# Linux Kernel Module Cheat
The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>.

#### 28.8.2. ARM calling convention

Call C standard library functions from assembly and vice versa.

- arm

  - lkmc/arm.h `ENTRY` and `EXIT`

  - userland/arch/arm/linux/c_from_asm.S

- aarch64

  - lkmc/aarch64.h `ENTRY` and `EXIT`

  - userland/arch/aarch64/inline_asm/linux/asm_from_c.c

ARM Architecture Procedure Call Standard (AAPCS) is the name that ARM Holdings gives to the calling convention.

Official specification: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf

Bibliography:

- https://en.wikipedia.org/wiki/Calling_convention#ARM_(A32) Wiki contains the master list as usual.

- https://stackoverflow.com/questions/8422287/calling-c-functions-from-arm-assembly

- https://stackoverflow.com/questions/261419/arm-to-c-calling-convention-registers-to-save

- https://stackoverflow.com/questions/10494848/arm-whats-the-difference-between-apcs-and-aapcs-abi