nasm demo
使用sys_write的hello.asm
section .data
msg db "Hello world!",10 ; 10 is the ASCII code for a new line (LF)
section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 13
syscall
mov rax, 60
mov rdi, 0
syscall
syscall | rax | rdi | rsi | rdx | r10 | r9 | r8 |
---|---|---|---|---|---|---|---|
sys_call | 1 | 1 | ADDR | 13 |
编译运行
nasm -felf64 hello.asm
ld hello.o -o hello
./hello