mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
inline_asm: remember register variables :-)
This commit is contained in:
@@ -19741,11 +19741,11 @@ The following <<userland-setup>> programs illustrate how to make system calls:
|
||||
* x86_64
|
||||
** link:userland/arch/x86_64/freestanding/linux/hello.S[]
|
||||
** link:userland/arch/x86_64/freestanding/linux/int_system_call.S[]
|
||||
** link:userland/arch/x86_64/inline_asm/freestanding/linux/hello.c[]
|
||||
** link:userland/arch/x86_64/inline_asm/freestanding/linux/hello_regvar.c[]
|
||||
** link:userland/arch/x86_64/inline_asm/freestanding/linux/hello.c[]: this shows how to do system calls from inline assembly without any C standard library helpers like `syscall`
|
||||
** link:userland/arch/x86_64/inline_asm/freestanding/linux/hello_regvar.c[]: same as link:userland/arch/x86_64/inline_asm/freestanding/linux/hello.c[] but using register variables instead of register constraints
|
||||
* arm
|
||||
** link:userland/arch/arm/freestanding/linux/hello.S[]
|
||||
** link:userland/arch/arm/inline_asm/freestanding/linux/hello.c[]
|
||||
** link:userland/arch/arm/inline_asm/freestanding/linux/hello.c[]: there are no register constraints in ARM, so register variables are the most efficient way of storing variables in specific general purpose registers: https://stackoverflow.com/questions/3929442/how-to-specify-an-individual-register-as-constraint-in-arm-gcc-inline-assembly/54845046#54845046
|
||||
* aarch64
|
||||
** link:userland/arch/aarch64/freestanding/linux/hello.S[]
|
||||
** link:userland/arch/aarch64/inline_asm/freestanding/linux/hello.c[]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* aarch64 freestanding C inline assemby Linux hello world
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#linux-system-calls
|
||||
*/
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#linux-system-calls */
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* x86_64 freestanding C inline assemby Linux hello world
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#linux-system-calls
|
||||
*/
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#linux-system-calls */
|
||||
|
||||
#define _XOPEN_SOURCE 700
|
||||
#include <inttypes.h>
|
||||
|
||||
Reference in New Issue
Block a user