insn_get_modrm_reg_ptr(9)
π insn_get_modrm_reg_ptr(9) β Kernel API Manual π
okay so bestie, this is a page from the Kernel API Manual, and it's genuinely one of the shorter ones β a little baby function that nonetheless does something very specific and slays at it. Let's get into it β¨
πΈ NAME πΈ
insn_get_modrm_reg_ptr β obtain a register pointer based on the ModRM byte. that's it, that's the whole vibe π«Ά
π SYNOPSIS π
unsigned long * insn_get_modrm_reg_ptr (struct insn *insn , struct pt_regs *regs );
like, look at that signature. beautiful. no notes. π
π¦ ARGUMENTS π¦
insnβ the instruction that's carrying the ModRM byte. it's literally the whole reason we're here π«regsβ the register values, exactly as they looked when you entered kernel mode. think of it as a little snapshot of the moment you walked in the door πΈ
β DESCRIPTION β
so here's the tea β β this function hands you back the register indicated by the reg part of the ModRM byte. and it gives it to you as a pointer within pt_regs, which is lowkey the whole point. no copy, no drama, just a pointer straight into your saved register state. iconic behavior, honestly π
π₯ SEE ALSO π₯
bestie there are SO many siblings. this function does not exist in a vacuum, bestie, it's part of a whole friend group over in the kernel file ./arch/x86/lib/insn-eval.c β and here's the entire group chat, everybody's invited π:
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)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_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)
no cap, that's the whole list. go read them all, i'll wait π§π
π reminder: this page comes from ./arch/x86/lib, dated October 2026. so if you're quoting it in the group chat, cite your source, bestie πβ¨
π¦ 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