regs_get_kernel_argument(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… regs_get_kernel_argument(9) πŸ’…

okay bestie, this is a page straight outta the Kernel API Manual, and it’s serving kernel-argument realness. The function is regs_get_kernel_argument, and yes, it gets the Nth function argument in the kernel. iconic behavior, honestly.


πŸŽ€ NAME πŸŽ€

regs_get_kernel_argument β€” get Nth function argument in kernel

✨ SYNOPSIS ✨

unsigned long regs_get_kernel_argument (struct pt_regs *regs , unsigned
int n );

🫢 ARGUMENTS 🫢

  • regs β€” pt_regs of that context
  • n β€” function argument number (start from 0)

🌸 DESCRIPTION 🌸

So the doc says regs_get_argument returns the nth argument of the function call. That’s the whole vibe.

Heads up though: this chooses the most probable assignment, and in some cases it can be incorrect. not me warning you twice, but like… bestie, pls know this is a best-effort situation πŸ’€

This is expected to be called from kprobes or ftrace with regs where the top of stack is the return address. that’s the setup, that’s the assignment, no cap.

πŸ‘‘ SEE ALSO πŸ‘‘


Source/version: ./arch/x86/include/asm Β· Date: October 2026 Β· later bestie, go read the kernel source and slay πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from