mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
23 lines
498 B
ArmAsm
23 lines
498 B
ArmAsm
/* x86_64 freestanding Linux hello world
|
|
* https://github.com/cirosantilli/linux-kernel-module-cheat#linux-system-calls
|
|
*/
|
|
|
|
.text
|
|
.global _start
|
|
_start:
|
|
asm_main_after_prologue:
|
|
/* write */
|
|
mov $1, %rax /* syscall number */
|
|
mov $1, %rdi /* stdout */
|
|
lea msg(%rip), %rsi /* buffer */
|
|
mov $len, %rdx /* len */
|
|
syscall
|
|
|
|
/* exit */
|
|
mov $60, %rax /* syscall number */
|
|
mov $0, %rdi /* exit status */
|
|
syscall
|
|
msg:
|
|
.ascii "hello\n"
|
|
len = . - msg
|