get_eff_addr_sib(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… get_eff_addr_sib β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in the kernel, you've got an instruction, you've got registers, and you need the actual effective address that the SIB byte is pointing at. That's literally this function. It's giving "decode my vibe" but for memory operands. πŸŽ€


✨ NAME ✨

get_eff_addr_sib β€” obtains the referenced effective address via SIB. Yes, SIB as in Scale-Index-Base, the little byte that keeps x86 addressing feeling like a whole personality. πŸ’…


🌸 SYNOPSIS 🌸

int get_eff_addr_sib (struct insn *insn , struct pt_regs *regs , int
*base_offset , long *eff_addr );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • insn β€” the instruction. Must be valid, no cap. If it's not valid, this is not the moment. 🫢
  • regs β€” register values as seen when entering kernel mode. Like, the state of the world at the door.
  • base_offset β€” the obtained operand offset, in pt_regs, associated with the segment. It's the receipt that tells you which segment showed up to the party. 🧚
  • eff_addr β€” the obtained effective address. The main character, fr fr. πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

So what this does: it obtains the effective address referenced by the SIB byte of insn. ✨

Once it's identified the registers involved in the indexed, register-indirect memory reference, it gets that value from the operands in regs. The computed address gets stored in eff_addr. Also β€” and this part is iconic β€” the register operand that indicates the associated segment is stored in base_offset. You can literally use that parameter later to determine such segment. Teamwork, honestly. 🫢

  • 0 on success. eff_addr will have the referenced effective address. base_offset will have a register, as an offset from the base of pt_regs, that can be used to resolve the associated segment. Slay. πŸ’…
  • Negative value on error. 😭 Not every decode is a win, bestie.

🌈 SEE ALSO 🌈

Kernel file ./arch/x86/lib/insn-eval.c β€” plus the whole friend group, and I mean the whole friend group:


ngl, if you're reading all of these in a row, hydrate. πŸ’§ This is a lot of decoding and you deserve a little treat. πŸ“

mwah πŸ’œ this page came to you from ./arch/x86/lib, dated October 2026 β€” go forth and resolve those segments, bestie, you've got this fr fr πŸ¦‹βœ¨

πŸ“¦ where this page comes from