get_eff_addr_modrm(9)
π 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, inpt_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:
0on success π₯ βeff_addrwill have the referenced effective address, andregoffwill have a register, as an offset from the base ofpt_regs, that can be used to resolve the associated segment. slay.-EINVALon 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms