Being a newbie in Assembly language I managed to tripped up over this hello-world-like program:
.global _start
_start:
ldr R0, =val
mov R7, #1
svc 0
.data
val: .word 0xffffffff
My intent is just to load the val word into R0, so its value would be used as the program's exit status (its the least significant byte, to be precise). However, instead of the expected value, ff_16 = 255, I get such an output from bash:
$ ./prog; echo $?
132
Output of disassemblying:
00000000 <_start>:
0: e59f0004 ldr r0, [pc, #4] ; c <_start+0xc>
4: e3a07001 mov r7, #1
8: ef000000 svc 0x00000000
c: 00000000 .word 0x00000000
It shows the presence of an offset from PC by 4 but the word marked as 4: is not the desired one, is it? On the other hand, even this word does not contain 84_16 = 132 value, so where it springs from?
Some clarification is needed, please.
Architecture: arm7l, OS: raspberrypi 5.4.72-v7+