I recently started to learn programming in ARM assembly,
today I encountered annoying problem where my program started to crash when I used the r4 register.
With this simple code the program works fine
.text
.align 2
.global arr
.type arr, %function
arr:
mov r3, #8
mov r0, r3
bx lr
.size arr, .-arr
But changing to r4 it crashes
.text
.align 2
.global arr
.type arr, %function
arr:
mov r4, #8
mov r0, r4
bx lr
.size arr, .-arr
What the hell am I doing wrong??? It clearly states in ARM docs this:
In all ARM processors, the following registers are available and accessible in any processor mode: 13 general-purpose registers R0-R12 Source
The supposed 'duplicate' question regarding 'answer' does not help at all, since everyone there has categorized r4 (THE ONE THAT I HAVE PROBLEMS) with others (r5, r6, ... that I dont have problems).
I am looking for explanation why using specifically r4 causes this problem, I do not have problems using instead of r4 registers that are supposed to be the same type as r4 (r5, r6, r7, r8).