明确访问存入银行ARM寄存器 [英] Explicitly accessing banked registers on ARM
问题描述
据中ARM说明书,应该可以访问编组寄存器为一个特定的CPU模式,例如,R13_SVC。当我尝试这样做GCC骂我,出现以下错误:
立即EX pression要求#preFIX - `MOV R2,sp_svc
怎么了?
更新。从ARM体系结构参考手册ARMv5及更高版本的ARMv6下面的文字使我相信这是可能的,部分A2.4.2:
寄存器R13和R14有六个编组
每个物理寄存器。一个用于
在用户和系统模式,并且每个
剩余的五个中的一个用于
五例外模式。在哪儿
必要为特定哪些
版本被称为,您使用
其命名格式为:R13_mode
R14_mode,其中模式是
USR的合适的一个,SVC(对于
监控模式),ABT,UND,IRQ和
FIQ。
块引用>解决方案我不认为这是可能的
MOV
指令;至少根据ARM体系结构参考手册我在读。你有什么文件?还有就是LDM
的变体,可以在特权模式下加载用户模式寄存器(使用^
)。你唯一的选择是切换到SVC模式,做MOV R2,SP
,然后再切换回任何其他的模式,你正在使用。你得到这个错误是因为它不理解
sp_svc
,所以它认为你正在试图做的直接MOV
,这将是这样的:MOV R2,#0x14的
所以这就是为什么它说:需要一个#preFIX。
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
mov
instruction; at least according to the ARM Architecture Reference Manual I'm reading. What document do you have? There are is a variant ofldm
that 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:mov r2, #0x14
So that's why it says "requires a # prefix".
这篇关于明确访问存入银行ARM寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!