|
楼主 |
发表于 2014-5-26 00:39:53
|
显示全部楼层
今天我拿板子进行硬件仿真了,发现thread+unprivilege模式下MRS指令访问ipsr和control寄存器竟然是有效,这是什么玩意这是
cm3权威指南 英文原版如是说
3.3 Opera TIOn M Ode
The Cortex-M3 processor supports two modes and two privilege levels (see Figure 3. 6).
When the processor is running in thread mode, it can be in either the privileged or user level, but
handlers can only be in the privileged level. When the processor exits reset, it is in thread mode, with
privileged access rights.
In the user access level (thread mode), access to the system control space (SCS)—a part of the
memory region for configuration registers and debugging components—is blocked. Furthermore,
instructions that access special registers (such as MSR, except when accessing APSR) cannot be used.
If a program running at the user access level tries to access SCS or special registers, a fault exception
will occur
access 应该是读写的意思没问题吧,此书中文版翻译成访问,禁止MSR/MRS访问特殊功能寄存器,也就是读和写。。。。
但是实际情况来看 读操作根本没有禁止嘛。。。。读取是成功的,中文翻译者在此文处有译著
译注:原文的意思是越权访问一律产生fault( If a program running at the user access level tries
to access SCS or special registers, a fault exception will occur)。但译者使用Keil MDK开发环境
的模拟器和STM32 单片机作实验时却发现,对特殊功能寄存器越权访问时,仅忽略访问操作,并不产生fault 。另
外,译者发现,当使用模拟器时,即使访问了SCS 中的地址(译者使用的地址是 0xE000E100),模拟器竟然也允许
读写!后来译者又使用STM32 单片机来实验,STM32 单片机则的确产生了总线fault 并上访成了硬fault 。因此,如
果使用指令模拟器,则要小心。附:译者使用的MDK 版本号是 3.20
他实际操作的结果是忽略操作,那应该就是读写都忽略吗???? |
|