GNU >> Assembly (ARM)

hello, world! (swi, eabi)


參考資訊:
1. syscall
2. helloworld
3. ARM-assembly-hello-world

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!


返回上一頁