get_eff_addr_sib(9)
π get_eff_addr_sib β from the Kernel API Manual, bestie
okay so picture this: you're deep in the kernel, you've got an instruction, you've got registers, and you need the actual effective address that the SIB byte is pointing at. That's literally this function. It's giving "decode my vibe" but for memory operands. π
β¨ NAME β¨
get_eff_addr_sib β obtains the referenced effective address via SIB. Yes, SIB as in Scale-Index-Base, the little byte that keeps x86 addressing feeling like a whole personality. π
πΈ SYNOPSIS πΈ
int get_eff_addr_sib (struct insn *insn , struct pt_regs *regs , int
*base_offset , long *eff_addr );
π¦ ARGUMENTS π¦
insnβ the instruction. Must be valid, no cap. If it's not valid, this is not the moment. π«Άregsβ register values as seen when entering kernel mode. Like, the state of the world at the door.base_offsetβ the obtained operand offset, inpt_regs, associated with the segment. It's the receipt that tells you which segment showed up to the party. π§eff_addrβ the obtained effective address. The main character, fr fr. π
π DESCRIPTION π
So what this does: it obtains the effective address referenced by the SIB byte of insn. β¨
Once it's identified the registers involved in the indexed, register-indirect memory reference, it gets that value from the operands in regs. The computed address gets stored in eff_addr. Also β and this part is iconic β the register operand that indicates the associated segment is stored in base_offset. You can literally use that parameter later to determine such segment. Teamwork, honestly. π«Ά
0on success.eff_addrwill have the referenced effective address.base_offsetwill have a register, as an offset from the base ofpt_regs, that can be used to resolve the associated segment. Slay. π- Negative value on error. π Not every decode is a win, bestie.
π SEE ALSO π
Kernel file ./arch/x86/lib/insn-eval.c β plus the whole friend group, and I mean 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(9)get_eff_addr_modrm_16(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)
ngl, if you're reading all of these in a row, hydrate. π§ This is a lot of decoding and you deserve a little treat. π
mwah π this page came to you from ./arch/x86/lib, dated October 2026 β go forth and resolve those segments, bestie, you've got this 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