ARM - Domain Access Control Register

大憨熊 提交于 2019-12-22 11:12:03

问题


I wonder, why do we always have to disable all domains in Domain Access Control Register located in coprocessor register cp15 c3. This is usually done in startup code by something like below, using MCR instruction.

MVN   r1, #0
MCR   p15, 0, r1, c3, c0, 0

Why do we load all zeroes into c3 to disable all domains?


回答1:


You certainly do not have to disable domains in Domain Access Control Register. Actually, it is not even possible since domain access is always checked if MMU is enabled. What you really do by loading values to DACR is setting access permissions for domains. The page you posted a link to describes exactly meaning of bits in DACS. In general:

  • 00 - no access at all
  • 01 - access checked agains values in TLB entry
  • 11 - access always permitted

That means writting 0xFFFFFFFF to DACR turns memory protection off. That is exactly what the code you posted does. Notice instruction mvn, it is something different than mov. mvn <Rd>, <Rm> is "Move NOT" instruction, it writes complement of <Rm> to <Rd>. After mvn r1, #0 value of r1 equals 0xFFFFFFFF.

The startup code you came across probably does not need memory protection or switches it off temporarily only to enable it later. Nevertheless, it is not any kind of rule that you should always enable full access to all domains.



来源:https://stackoverflow.com/questions/9568513/arm-domain-access-control-register

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!