GNU >> Assembly (ARM)

hello, world! (swi, eabi)


參考資訊:
1. syscall
2. example
3. helloworld
4. ARM-assembly-hello-world
5. implementation-of-syscall-on-arm-oabi-what-is-svc-0x900071

main.s

    .global _start

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

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

    mov r0, #0
    swi 0x900001

NRsyscall namearg0(r0)arg1(r1)arg2(r2)
0x900001exitint error_code
0x900004writeunsigned int fdconst char *bufsize_t count

編譯、執行

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


返回上一頁