ARM - 域访问控制寄存器 [英] ARM - Domain Access Control Register

查看:36
本文介绍了ARM - 域访问控制寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,为什么我们总是要禁用位于协处理器寄存器 cp15 c3 中的域访问控制寄存器中的所有域.这通常在启动代码中通过如下方式完成,使用 MCR 指令.

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

为什么我们将所有零加载到 c3 中以禁用所有 ?

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

推荐答案

您当然不必在域访问控制寄存器中禁用域.实际上,这甚至是不可能的,因为如果启用 MMU,总是会检查域访问.通过将值加载到 DACR,您真正要做的是设置域的访问权限.您发布的页面一个链接来描述 DACS 中位的确切含义.一般来说:

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 - 根本无法访问
  • 01 - 再次检查 TLB 条目中的访问权限
  • 11 - 始终允许访问
  • 00 - no access at all
  • 01 - access checked agains values in TLB entry
  • 11 - access always permitted

这意味着将 0xFFFFFFFF 写入 DACR 会关闭内存保护.这正是您发布的代码所做的.注意指令mvn,它与mov 有所不同.mvn , 是M​​ove NOT"指令,它将的补码写成.mvn r1之后,r1的#0值等于0xFFFFFFFF.

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.

这篇关于ARM - 域访问控制寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆