GNU >> Assembly (ARM 64)

hello, world! (svc)


參考資訊:
1. hello
2. syscall

main.s

    .global _start

    .data
msg: .asciz "hello, world!\n"
len = . - msg

    .text
_start:
    mov x8, #64
    mov x0, #1
    ldr x1, =msg
    ldr x2, =len
    svc #0

    mov x8, #93
    mov x0, #0
    svc #0

NRsyscall namex8arg0(x0)arg1(x1)arg2(x2)
64write4unsigned int fdconst char *bufsize_t count
93exit1int error_code

編譯、執行

$ aarch64-linux-gnu-gcc main.s -o main -nostdlib -static
$ qemu-aarch64 ./main
    hello, world!


返回上一頁