简体   繁体   English

完整的寄存器访问含义

[英]Full register access meaning

I am working on the MSP430 microcontroller and was going through its architecture. 我正在研究MSP430微控制器,并正在研究其体系结构。 In the user guide, under its features tab, there is a statement like this - " Full register access including program counter (PC), status register (SR), and stack pointer (SP) ". 在用户指南的“功能”选项卡下,有这样一条语句:“ 包括程序计数器(PC),状态寄存器(SR)和堆栈指针(SP)在内的完全寄存器访问 ”。 I was under the impression that the CPU always has access to all the registers irrespective of the architecture. 我给人的印象是,CPU始终可以访问所有寄存器,而与体系结构无关。

My understanding of the statement may be wrong. 我对声明的理解可能是错误的。 Can anyone explain me what it means exactly? 谁能解释我的确切含义?

As per the wikipedia page : 根据Wikipedia页面

The processor contains 16 16-bit registers, of which 4 are dedicated to special purposes: R0 is the program counter, R1 is the stack pointer, R2 is the status register, and R3 is a special register called the constant generator, providing access to 6 commonly used constant values without requiring an additional operand. 处理器包含16个16位寄存器,其中4个专用于特殊目的:R0是程序计数器,R1是堆栈指针,R2是状态寄存器,R3是称为常量发生器的特殊寄存器,可用于访问6个常用常数值,不需要其他操作数。 R3 always reads as 0 and writes to it are ignored. R3始终读为0,并忽略写入。 R4 through R15 are available for general use. R4至R15可供一般使用。

In other words, "full access" in this case means not just using jmp -type instructions to be able to jump to a new location, but also allowing something like xor r0, #1234 to directly (and probably fatally) modify the program counter. 换句话说,在这种情况下,“完全访问”意味着不仅使用jmp -type指令能够跳转到新位置,而且还允许诸如xor r0, #1234类的东西直接(并且可能致命地)修改程序计数器。 。

Ditto for the other special registers, except R3 , the constant generator and the only one of the four not mentioned in your quote. R3之外,其他特殊寄存器也同上,常量生成器以及报价中未提及的四个中的唯一一个。 While all the instructions could operate on that register, it ignores writes and generates various fixed values on read ( -1..2 , use of R2 can also give you 4 and 8 ) depending on the addressing mode used. 尽管所有指令都可以在该寄存器上操作 ,但它会忽略写入操作 ,并在读取时生成各种固定值( -1..2 ,使用R2还可以为您提供48 ),具体取决于所使用的寻址模式。


That may seem a little strange but it's not the strangest I've ever seen. 这似乎有些奇怪,但这并不是我见过的最奇怪的。 For that, you would have to investigate the RCA1802A CPU which, like the MPS430 had "general purpose" registers for specific functions but you could actually choose at run time which should be the program counter or stack pointer. 为此您必须研究RCA1802A CPU,它与MPS430一样具有用于特定功能的“通用”寄存器,但实际上您可以在运行时选择应该是程序计数器还是堆栈指针。 It actually had no call or ret instructions, instead it used a standard call and return technique (SCRT) to emulate it. 它实际上没有任何callret指令,而是使用标准调用和返回技术(SCRT)效仿。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在C ++中注册访问 - Register Access in C++ 寄存器STM32 CAN通信的访问 - Access of register STM32 CAN communication 为什么硬件寄存器访问是通过无符号数据类型 - Why hardware register access is through unsigned datatype 如何在msp430上分配一个变量指针来访问硬件寄存器? - How to assign a variable pointer to access hardware register on msp430? 使用偏移量获取微控制器中寄存器的完整地址的目的是什么? - what is the purpose of using offset to get register full address in micro-controller? 如何使用gdb在PPC上查看DAR(数据访问寄存器)的内容? - How can I see the contents of the DAR (data access register) on PPC using gdb? STM32F446xx 外设寄存器访问使用解引用指针和结构体的区别 - STM32F446xx Peripheral Register Access Difference Between Using Dereferenced Pointers and Structs 在没有编译器优化的情况下,特定于平台扩展的 volatile-specifier 替换为硬件寄存器访问? - Platform-extension-specific replacement for volatile-specifier as hardware-register access without compiler optimizations? 如何从C或C ++语言级别安全地访问内存映射硬件寄存器? - How to safely access memory mapped hardware register from C or C++ language level? 如何访问飞思卡尔P2020的交替时基寄存器的64位定时器寄存器中的VxWorks - how to access the Freescale P2020's Alternate Time Base Registers 64-bit timer register in VxWorks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM