# Linux Kernel Module Cheat

### 28.6. GCC inline assembly

Examples under `arch/<arch>/c/` directories show to how use inline assembly from higher level languages such as C:

- x86_64

  - userland/arch/x86_64/inline_asm/inc.c

  - userland/arch/x86_64/inline_asm/add.c

  - userland/arch/x86_64/inline_asm/sqrt_x87.c Shows how to use the x86 x87 FPU instructions from inline assembly. Bibliography: https://stackoverflow.com/questions/6514537/how-do-i-specify-immediate-floating-point-numbers-with-inline-assembly/52906126#52906126

- arm

  - userland/arch/arm/inline_asm/inc.c

  - userland/arch/arm/inline_asm/inc_memory.c

  - userland/arch/arm/inline_asm/inc_memory_global.c

  - userland/arch/arm/inline_asm/add.c

- aarch64

  - userland/arch/aarch64/inline_asm/earlyclobber.c

  - userland/arch/aarch64/inline_asm/inc.c

  - userland/arch/aarch64/inline_asm/inc_32.c: how to use 32-bit `w` registers in aarch64. We have to add `w` to the `%` as in `%w[io]` instead of `%[io]`

  - userland/arch/aarch64/inline_asm/multiline.cpp

- GCC inline assembly register variables

- GCC inline assembly scratch registers

- GCC inline assembly early-clobbers

- GCC inline assembly floating point ARM

- GCC intrinsics