Linux kernel module ABI (x86)
Question
I'm looking for an official definition of the ABI used for calls in kernel modules on x86. I recently looked into a compiled module and was surprised to discover that:
it uses registers to pass the first three arguments (
eax
,edx
andecx
).it's not
fastcall
as described in GCC docs. The docs say thatfastcall
uses ecx and edx (Microsoft style).
The only somewhat relevant info I could find was this, but it's not saying much at all.
So:
1) Is there any official documentation on the ABI used in kernel modules (not the syscall ABI and not just the function list - those I did find).
2) How is this weird fastcall produced by the compiler? Is there a switch I missed?
Solution
-mregparm=3
is responsible for this.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow