get_eff_addr_reg(9)
π get_eff_addr_reg(9) β Kernel API Manual
πΈ NAME
get_eff_addr_reg β Obtain effective address from register operand. Thatβs the whole quest, bestie: pull the effective address out of a register operand. We are literally doing address extraction. β¨
β¨ SYNOPSIS
int get_eff_addr_reg (struct insn *insn , struct pt_regs *regs , int
*regoff , long *eff_addr );
π ARGUMENTS
insnβ Instruction. Must be valid. Like, actually valid, please. πregsβ Register values as seen when entering kernel mode. This is the kernel-entry vibe check. π«Άregoffβ Obtained operand offset, inpt_regs, with the effective address. Itβs giving βwhere inpt_regsdid this operand live?β energy. πΈeff_addrβ Obtained effective address. The effective address itself lands here. π
π¦ DESCRIPTION
Okay so get_eff_addr_reg obtains the effective address stored in the register operand as indicated by the ModRM byte. It is to be used only with register addressing β i.e., ModRM.mod is 3. That is the rule, bestie, and we are not testing it. π
The effective address is saved in eff_addr. The register operand, as an offset from the base of pt_regs, is saved in regoff; such offset can then be used to resolve the segment associated with the operand. This function can be used with any of the supported address sizes in x86. Iconic x86 behavior, tbh. π
β οΈ Register addressing only:ModRM.modis3. No memory-addressing detours, no βbut what ifβ β the manual says use it only with register addressing. Periodt. π
Return tea: 0 on success. eff_addr will have the effective address stored in the operand indicated by ModRM. regoff will have such operand as an offset from the base of pt_regs. -EINVAL on error. π
π SEE ALSO
Kernel file ./arch/x86/lib/insn-eval.c β and the whole friend group is here, iykyk:
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_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)
xoxo, your local kernel bestie π β source/version: ./arch/x86/lib, date: October 2026, page: get_eff_addr_reg(9). Slay and decode responsibly. π
β¨
π¦ 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