inline_asm: remember register variables :-)

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-06-25 10:00:09 +00:00
parent 3eca3b8124
commit 15ffa40b6e
3 changed files with 5 additions and 7 deletions

View File

@@ -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[]

View File

@@ -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>

View File

@@ -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>