get_addr_ref_32(9)
π get_addr_ref_32(9) β the Kernel API Manual, but make it cute
okay so bestie, welcome to get_addr_ref_32(9) from the Kernel API Manual β¨ this one is short and sweet and honestly kinda iconic β it's the 32-bit address resolver of your dreams π
πΈ NAME πΈ
get_addr_ref_32 β Obtain a 32-bit linear address
like, that's the whole vibe. it gets you a 32-bit linear address. slay.
β¨ SYNOPSIS β¨
void __user * get_addr_ref_32 (struct insn *insn , struct pt_regs *regs
);
no cap, that's the whole signature π«Ά
π¦ ARGUMENTS π¦
insnβ the instruction you're looking at, and it's bringing its ModRM, SIB bytes and displacement with it. it's giving "I came prepared" πregsβ the register values exactly as they looked when you entered kernel mode. like a little snapshot of the moment, preserved for you π
π DESCRIPTION π
so here's the tea β β this function is only for 32-bit address encodings. its whole job is to obtain the linear memory address referred to by the instruction's ModRM, SIB, displacement bytes and segment base address, as applicable. yes, the "as applicable" is doing heavy lifting there, it's that girl β¨
and if you're in protected mode? segment limits are enforced β no sneaking past them, periodt. π¨
on success you get back the linear address referenced by the instruction and the registers π
and on error? you get -1L. yeah. negative one long. it happens to the best of us π
π SEE ALSO π
the kernel file ./arch/x86/lib/insn-eval.c is the main character here, and it also wants you to know about all these besties:
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_modrm_16(9)get_eff_addr_sib(9)get_addr_ref_16(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)
iykyk π
aaaand that's the page, bestie π big love to ./arch/x86/lib for housing all this, dated October 2026 β go read the source, it ate π
β¨
π¦ 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