this doesn't work:
.global main
.type main%function
main:
ldr r4,[r1]
mov r1,r4
add r1,r1,#4 // I go to the next argv
ldr r0,=message
b printf
message:
.asciz "%s\n"
but output is:
$ ./a.out a b c
out
this works though:
.global main
.type main%function
main:
ldr r4,[r1,#4] // this works, if I write #4 HERE
mov r1,r4
//add r1,r1,#4 // commented
ldr r0,=message
b printf
message:
.asciz "%s\n"
output:
$ ./a.out a b c
a
Also, I don't get how can it be possible that MOV can move memory addresses (32 bit) in another register (in the line mov r1,r4
) if MOV can only move 8 bit of immediates/data...