ARM 银行寄存器 [英] ARM Banked register

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

问题描述

在 ARM 中有一个 Banked Register 的概念.在阅读有关银行业务在这里的含义的许多问题及其答案以及各种其他资源时.然后我得到了这个定义:注册银行业务是指在同一地址提供多个注册副本.并非所有寄存器都可以同时看到.

In ARM there is a concept of Banked Register. While reading many questions and their answer and various other resources about what is Banked mean here. Then I got this definition: Register banking refers to providing multiple copies of a register at the same address. Not all registers can be seen at once.

但我在这里的查询是如何创建多个寄存器副本.因为我们的核心中有单个寄存器文件.如果有另一种模式,那么它将获得不包含任何数据的存储寄存器的新副本,并且不会访问另一个模式寄存器的数据.那么这个寄存器副本是如何创建的呢?

But my query here is that How multiple copies of registers are created. Because we have single register file in our core. And if there is another mode then it will get the new copy of the banked register that will not contain any data and not going to access the data of another mode register. Then how this copy of register is created?

推荐答案

注册银行业务是指在同一地址提供多个注册副本.并非所有寄存器都可以同时看到.

Register banking refers to providing multiple copies of a register at the same address. Not all registers can be seen at once.

这是正确的.但是,该寄存器没有传统地址".大多数 arm 指令或二进制编码"都将寄存器作为源或目标参数.有 16 个基址寄存器,因此二进制指令中的每个寄存器需要 4 位.一条典型的指令需要 12 位(共 32 位)来描述三个寄存器(两个源和一个目标).指令中的这些位就是上面定义中的地址".

This is some what correct. However, the register does not have a 'traditional address'. The majority of the arm instructions or 'binary encodings' have register as source or destination arguments. There are sixteen base register so four bits are needed for each register in a binary instruction. A typical instruction takes 12 bits (out of 32bits) to describe the three registers (two source and one destination). These bits in the instruction are the 'address' in the definition above.

但我在这里的查询是如何创建多个寄存器副本.因为我们的核心中有单个寄存器文件.如果有另一种模式,那么它将获得不包含任何数据的存储寄存器的新副本,并且不会访问另一个模式寄存器的数据.那么这个寄存器副本是如何创建的呢?

But my query here is that How multiple copies of registers are created. Because we have single register file in our core. And if there is another mode then it will get the new copy of the banked register that will not contain any data and not going to access the data of another mode register. Then how this copy of register is created?

它们不是动态创建"的.存储的寄存器是核心的寄存器文件"的一部分,并且始终存在.问题是,除非发生模式切换",否则典型指令无法访问某些存储区寄存器.这可能是从用户到 IRQ 模式,或者从正常到安全世界与 trustzone.

They are not 'created' dynamically. The banked registers are part of the 'register file' of the core and always exist. The issue is that the typical instructions can not access some banked registers unless a 'mode switch' occurs. This maybe from user to IRQ mode or from normal to secure world with trustzone.

因此,在不同模式下运行相同的代码可能最终会访问不同的(存储的)寄存器.这样,用户代码永远不会影响 IRQ 堆栈,反之亦然.或许更重要的是,如果在 IRQ 的开始和结束时没有执行仔细的上下文保存,IRQ 代码可能会损坏非银行用户寄存器.

So running the same code in different modes may end up accessing different (banked) registers. In this way, user code never affects the IRQ stack and vice-versa. Perhaps more importantly, the IRQ code could corrupt non-banked user registers if careful context saving is not performed at the start and end of an IRQ.

请参阅:访问 ARM 上的存储寄存器,了解如何访问这些不同的寄存器.

See: Accessing banked registers on ARM for information on how you might access these different registers.

较新的 ARMv7 指令 mrs r2,sp_svc 打破了这种分组寄存器规则,允许直接访问分组寄存器而无需切换模式.目的是允许上下文切换代码轻松访问存储寄存器,以便在不进行模式切换的情况下进行保存和恢复.

The newer ARMv7 instruction mrs r2,sp_svc breaks this banked register rule and allows access to the banked registers directly without switching a mode. the intent is to allow context switching code to easily access the banked registers for saving and restoring without a mode switch.

传统指令ldm rN, {sp,lr}^允许在不切换模式的情况下保存用户堆栈指针和链接寄存器.同样,这有一个特殊的编码(或根据您的定义寻址).

The traditional instruction ldm rN, {sp,lr}^ allows saving of user stack pointer and link register without switching modes. Again, this has a special encoding (or addressing as per your definition).

银行业务也是通过 trustzone 中的 CP15 系统寄存器完成的.TrustZone 监控模式和银行 IFSR...任何人都会看到 ARM银行业务",它在概念上与注册银行业务相同.

Banking is also done with CP15 system registers in trustzone. TrustZone monitor mode and banked IFSR... maybe interesting for anyone looking at that ARM 'banking' which is conceptually the same as the register banking.

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

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