arm - How to use "printf" in raspberry pi assembly language -
does printf
has limit number of values can print?
here code.
.data .balign 4 string: .asciz "\n%d %d %d %d\n" .text .global main .extern printf main: push {ip, lr} @ push return address + dummy register @ alignment ldr r0, =string @ address of string r0 mov r1, #11 mov r2, #22 mov r3, #33 mov r4, #444 bl printf @ print string , pass params @ r1, r2, , r3 pop {ip, pc} @ pop return address pc
when compile , execute code prints this:
11 22 33 1995276288
as can see, value in r4 not print right value.
i don't know why?
only first 4 arguments passed in registers (r0-r3) on arm -- additional args passed on stack. check out procedure call abi details.
Comments
Post a Comment