get_eff_addr_modrm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… get_eff_addr_modrm β€” like, the Kernel API Manual edition πŸŽ€

okay bestie, buckle up, because we're diving into get_eff_addr_modrm(9) and honestly? she's iconic. this is the little helper that ✨ obtains the referenced effective address via ModRM ✨ β€” iykyk.


✨ NAME ✨

get_eff_addr_modrm β€” obtain referenced effective address via ModRM πŸ¦‹


🌸 SYNOPSIS 🌸

int get_eff_addr_modrm (struct insn *insn , struct pt_regs *regs , int
*regoff , long *eff_addr );

like yes, that's the whole signature, no notes πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • insn β€” the instruction. it must be valid, no cap. invalid instruction? don't even try it πŸ™ˆ
  • regs β€” the register values exactly as they looked when you entered kernel mode πŸ‘‘
  • regoff β€” the obtained operand offset, in pt_regs, that's associated with the segment 🌈
  • eff_addr β€” the obtained effective address, coming right up ⭐

πŸ’– DESCRIPTION πŸ’–

okay so what she actually does: she obtains the effective address referenced by the ModRM byte of insn. after identifying the registers involved in the register-indirect memory reference, its value is obtained from the operands in regs. the computed address is stored in eff_addr. also β€” and this part is lowkey important β€” the register operand that indicates the associated segment is stored in regoff, and you can use that parameter later to determine such segment. main character energy, honestly 🫢

and the returns? here's the vibe check:

  • 0 on success πŸ”₯ β€” eff_addr will have the referenced effective address, and regoff will have a register, as an offset from the base of pt_regs, that can be used to resolve the associated segment. slay.
  • -EINVAL on error πŸ’€ β€” that's it, that's the error. periodt.
ngl bestie, remember: insn has to be valid. that's the one rule she will not bend on πŸ’…

🧚 SEE ALSO 🧚

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

is_string_insn(9), insn_has_rep_prefix(9), get_seg_reg_override_idx(9), check_seg_overrides(9), resolve_default_seg(9), resolve_seg_reg(9), get_segment_selector(9), get_reg_offset_16(9), get_desc(9), insn_get_seg_base(9), get_seg_limit(9), insn_get_code_seg_params(9), insn_get_modrm_rm_off(9), insn_get_modrm_reg_off(9), insn_get_modrm_reg_ptr(9), get_seg_base_limit(9), get_eff_addr_reg(9), get_eff_addr_modrm_16(9), get_eff_addr_sib(9), get_addr_ref_16(9), get_addr_ref_32(9), get_addr_ref_64(9), insn_get_addr_ref(9), insn_fetch_from_user(9), insn_fetch_from_user_inatomic(9), insn_decode_from_regs(9), insn_decode_mmio(9)

all of them. every single one. go read them, bestie, I believe in you 🌟


and that's the whole page, mwah πŸ’‹ β€” this little number lives in ./arch/x86/lib, dated October 2026, and she ate, fr fr πŸ“πŸ’œ

πŸ“¦ where this page comes from