According to the ARM manual, it should be possible to access the banked registers for a specific CPU mode as, for instance, “r13_svc”. When I try to do this gcc yells at me with the following error:
immediate expression requires a # prefix — `mov r2,sp_svc’
What’s wrong?
Update. The following text from the ARM Architecture Reference Manual for ARMv5 and ARMv6 led me to believe that it is possible, section A2.4.2:
Registers R13 and R14 have six banked
physical registers each. One is used
in User and System modes, and each of
the remaining five is used in one of
the five exception modes. Where it is
necessary to be specific about which
version is being referred to, you use
names of the form: R13_mode
R14_mode where mode is the
appropriate one of usr, svc (for
Supervisor mode), abt, und, irq and
fiq.
I don’t think that’s possible with the
movinstruction; at least according to the ARM Architecture Reference Manual I’m reading. What document do you have? There are is a variant ofldmthat can load user mode registers from a privileged mode (using^). Your only other option is to switch to SVC mode, domov r2, sp, and then switch back to whatever other mode you were using.The error you’re getting is because it doesn’t understand
sp_svc, so it thinks you’re trying to do an immediatemov, which would look like:So that’s why it says “requires a # prefix”.