程式語言 - GNU - Assembly (ARM) - Hello, world!(swi, eabi)



參考資訊:
http://kerseykyle.com/articles/ARM-assembly-hello-world
https://github.com/kevinhooke/learning-arm-asm/blob/master/helloworld.s
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/constants/syscalls.md

main.s

    .global _start

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

    .text
_start:
    mov r7, #4
    mov r0, #1
    ldr r1, =msg
    ldr r2, =len
    swi 0

    mov r7, #1
    mov r0, #0
    swi 0

NRsyscall namer7arg0(r0)arg1(r1)arg2(r2)
1exit1int error_code
4write4unsigned int fdconst char *bufsize_t count

編譯、執行

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