insn_get_immediate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ insn_get_immediate ✨

okay bestie, welcome to the kernel API manual for insn_get_immediate πŸ’… this one lives in the insn(9) family of pages, and it's genuinely so useful β€” let's get into it 🫢


🌸 NAME 🌸

insn_get_immediate β€” get the immediate in an instruction πŸ’–

✨ SYNOPSIS ✨

int insn_get_immediate (struct insn *insn );

πŸŽ€ ARGUMENTS πŸŽ€

  • insn β€” the struct insn that's holding your instruction πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: if it's necessary, this bad boy first collects the instruction up to and including the displacement bytes ✨ lowkey an important detail, don't skip it.

Basically? Most of the immediates are sign-expanded β€” that's just how it is, no cap πŸ’…

And if you want the unsigned value, you can compute it by bit masking with this iconic little expression:

((1 << (nbytes * 8)) - 1)

that's literally it, she ate πŸ“

πŸ”₯ RETURN πŸ”₯

  • 0 β€” on success πŸŽ‰
  • < 0 β€” on error 😭

🌈 SEE ALSO 🌈

This one's part of a whole friend group, iykyk β€” go check out the Kernel file ./tools/arch/x86/lib/insn.c and also, like, all of these:


mwah πŸ’‹ this page is brought to you by ./tools/arch/x86/lib, dated October 2026, and it's the insn_get_immediate(9) kernel API manual β€” go read the whole squad, they're all iconic πŸ‘‘

πŸ“¦ where this page comes from