get_eff_addr_modrm_16(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… get_eff_addr_modrm_16 β€” like, the kernel API manual, bestie

okay so real talk, this one lives in the get_eff_addr_modrm_16(9) corner of the Kernel API Manual and it's giving "niche x86 decoder lore that only the girlies in arch/x86/lib understand" ✨


🌸 NAME 🌸

get_eff_addr_modrm_16 β€” bestie, it obtains the referenced effective address via ModRM πŸŽ€ no cap, that's the whole vibe.


✨ SYNOPSIS ✨

int get_eff_addr_modrm_16 (struct insn *insn , struct pt_regs *regs ,
int *regoff , short *eff_addr );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • insn β€” the instruction, and it must be valid, like that's not optional, that's the whole assignment πŸ’…
  • regs β€” the register values exactly as seen when entering kernel mode
  • regoff β€” the obtained operand offset, in pt_regs, that's associated with the segment
  • eff_addr β€” the obtained effective address, the main character fr fr πŸ‘‘

πŸ”₯ DESCRIPTION πŸ”₯

okay so picture this: you want the 16-bit effective address referenced by the ModRM byte of insn, right? That's the mission. 🫢

So after identifying the registers involved in the register-indirect memory reference, its value gets obtained from the operands in regs. The computed address is stored in eff_addr. Also β€” and this part is cute β€” the register operand that indicates the associated segment is stored in regoff. You can use that parameter later to determine such segment. iykyk 😌

⭐ the returns, periodt

  • 0 on success. eff_addr will have the referenced effective address. 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. πŸ’€
ngl bestie, that's it β€” no secret extra returns hiding in the back of the group chat.

🌈 SEE ALSO 🌈

Kernel file ./arch/x86/lib/insn-eval.c β€” and honestly the whole friend group is here, so let's list every single one because we do not leave anyone on read πŸ™ˆ:

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(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)


okay that's the whole page and she ate, no crumbs πŸ“

source: ./arch/x86/lib Β· dated October 2026 Β· and that's the get_eff_addr_modrm_16(9) sign-off, mwah πŸ’‹πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from