ARM9协处理器CP15

article/2025/9/26 2:43:05

 

 

在基于ARM的嵌入式应用系统中,存储系统通常是通过系统控制协处理器CP15完成的。CP15包含1632位的寄存器,其编号为0~15

访问CP15寄存器的指令

MCR   ARM寄存器到协处理器寄存器的数据传送

MRC   协处理器寄存器到ARM寄存器的数据传送

MCR指令和MRC指令只能在处理器模式为系统模式时执行,在用户模式下执行MCR指令和MRC指令将会触发未定义指令的异常中断。

MCR指令

MCR指令将ARM处理器的寄存器中的数据传送到协处理器寄存器中。如果协处理器不能成功地执行该操作,将产生未定义的指令异常中断。

指令语法格式

MCR{<cond>} <p>< opcode_1><Rd>,<CRn>,<CRm>{,<opcode_2>}

MCR{<cond>} p150<Rd>,<CRn>,<CRm>{,<opcode_2>}

其中,<cond>为指令执行的条件码。当<cond>忽略时指令为无条件执行。

< opcode_1>为协处理器将执行的操作的操作码。对于CP15协处理器来说,< opcode_1>永远为0b000,当< opcode_1>不为0b000时,该指令操作结果不可预知。

<Rd>作为源寄存器的ARM寄存器,其值将被传送到协处理器寄存器中。

<CRn>作为目标寄存器的协处理器寄存器,其编号可能是C0C1C15

<CRm><opcode_2>两者组合决定对协处理器寄存器进行所需要的操作,如果没有指定,则将为<CRm>C0opcode_20,否则可能导致不可预知的结果。

The CRm field and opcode_2 field are used to specify a particular action when addressing registers.The opcode_1, opcode_2 and CRm fields should be zero, except when the values specified are used to select the desired operations, in all instructions which access CP15. Using other values will result in unpredictable behavior. Attempting to read from a non-readable register, or writing to a non-writable register will cause unpredictable results.

 

使用示例

下面的指令从ARM寄存器R4中中将数据传送到协处理器CP15的寄存器C1中。其中R4ARM寄存器,存放源操作数,C1C0为协处理器寄存器,为目标寄存器,opcode_10opcode_20

MCR  p15,  0,  R4,  C1,  C0,  0

 

MRC指令

MRC指令将协处理器的寄存器中的数值传送到ARM处理器的寄存器中、如果协处理器不能成功地执行该操作,将产生未定义的指令异常中断。

指令语法格式

MRC{<cond>} <p>< opcode_1><Rd>,<CRn>,<CRm>{,<opcode_2>}

MRC{<cond>} p150<Rd>,<CRn>,<CRm>{,<opcode_2>}

参数用法同MCR指令

 

 

CP15中的寄存器介绍

Register(寄存器)

Read

Write

 

C0

ID Code (1)

Unpredictable 

 

C0

Catch type(1)

Unpredictable

 

C1

Control

Control

 

C2

Translation table base

Translation table base

 

C3

Domain access control

Domain access control

 

C4

Unpredictable

Unpredictable

 

C5

Fault status(2)

Fault status (2)

 

C6

Fault address

Fault address

 

C7

Unpredictable

Cache operations

 

C8

Unpredictable

TLB operations

 

C9

Cache lockdown(2)

Cache lockdown (2)

 

C10

TLB lock down(2)

TLB lock down(2)

 

C11

Unpredictable

Unpredictable

 

C12

Unpredictable

Unpredictable

 

C13

Process ID

Process ID

 

C14

Unpredictable

Unpredictable

 

C15

Test configuration

Test configuration

 

Notes:

1.       Register location 0 provides access to more than one register. The register accessed depends upon values of the opcode_2 field. See the register description for details.

2.       Separate register for instruction and data .See the register description for details.

 

寄存器0ID Code Register

    This is a read-only register which returns a 32-bit device ID code

    这是一个只读寄存器,它存放微处理器的标识码。

The ID code register is accessed by reading CP15 register 0 with the opcode_2 field set to any value other than 1(the CRm field should be zero when reading). For example:

MRC  p15, 0, Rd, C0, C0, 0

ID Code内容如下:

Register bits

Function

Value

[31:24]

Implementor

0x41(‘A’,表示Arm公司)

[23:20]

Specification revision

0x1

[19:16]

Architecture version(4T)

0x2(ARM体系版本4T)

[15:4]

Part number

0x920

[3:0]

Layout revision

0x0

 

寄存器0Cache type register

This is a read-only register which contains information about the size and architecture of the caches, allowing operating systems to establish how to perform such operations as cache cleaning and lockdown.

这个只读寄存器包含了高速缓存的大小和类型。

The cache type register is accessed by reading CP15 register 0 with the opcode_2 field set to 1.for example: 

MRC  p15, 0, Rd, C0, C0, 1; returns cache details

 

The format of cache type register (寄存器的数据格式如下)

Register bits

Function

Value

[31:29]

Reserved

000

[28:25]

Cache type (缓存类型)

0110

[24]

Harvard/Unified

1(defines Harvard cache)

[23:21]

Reserved

000

[20:18]

Data Cache size(数据缓存大小)

101(defines 16KB)

[17:15]

Data Cache associativity

110(defines 64 way)

[14]

Reserved

0

[13:12]

Data Cache words per line

10(defines 8 words per line)

[11:9]

Reserved

000

[ 8:6]

Instruction Cache size(指令缓存大小)

101(defines 16KB)

[5:3]

Instruction Cache Associativity

110(defines 64 way)

[2]

Reserved

0

[1:0]

Instruction Cache per line

10(defines 8 words per line)

 

寄存器1Control register

对该寄存器读写指令如下:

MRC   p15, 0, Rd, c1, c0, 0   ; read control register

MCR   p15, 0, Rd, c1, c0, 0   ; write control register

该寄存器功能如下表

Registe bits

Name

Function

Value

31

iA bit

Asynchronous clock select

  见时钟模式表

30

nF bit

notFastBus select

  见 时钟模式表

29:15

  -

 Reserved

Read = Unpredictable

Write = should be zero

14

RR bit

Round robin replacement

0 = Random replacement

1 = Round robin replacement

13

V bit

Base location of exception register(异常寄存器基地址)

0 = Low address = 0x0000 0000

1 = High address = 0xFFFF 0000

12

I bit

Instruction cache enable

0 = Instruction cache disable

1 = Instruction cache enable

11:10

 -

Reserved

Read = 00

Write = 00

9

R  bit

ROM protection

 见图1

8

S  bit

System protection

 见图1

7

B  bit

Big-endian/little-endian

0 = Little-endian operation

1 = Big-endian operation

6:3

    -  

 Reserved

Read = 1111

Write = 1111

2

C bit

Data cache enable

0 = data cache disable

1 = data cache enable

1

A bit

Alignment fault enable

Data address alignment fault checking

(地址对齐检查)

0 = 禁用地址对齐检查功能

1 = 使能地址对齐检查功能

0

M bit

MMU enable

0 = MMU disable

1 = MMU enable

 

 时钟模式表

Clocking mode(时钟模式)

iA

      nF

Fastbus mode (快速总线模式)

      0

      0

Reserved

      1

      0

Synchronous (同步模式)

      0

      1

Asynchronous (异步模式)

      1

      1

 引用 关于ARM9协处理器CP15及MCR和MRC指令 - 心诚至上 - 心诚至上

                                                         图1

 

寄存器2:Translation Table Base(TTB) Register

 

Register bits

Function

31:14

Pointer to first level translation table base .  Read /write

13:0

Reserved

Read = Unpredictable

Write = Should be zero

访问C2寄存器指令如下:

MRC   p15, 0, Rd, C2, C0, 0   ;  Read TTB register

MCR   p15, 0, Rd, C2, C0, 0   ;  Write TTB register

该寄存器存放第一级转换表基地址。写入时,位[13:0]必须为0,读出时,位[13:0]的值不可预知。

寄存器3:Domain Access Control Register

寄存器3是可读写的域访问控制寄存器,分为16组,每组占用2个位

引用 关于ARM9协处理器CP15及MCR和MRC指令 - 心诚至上 - 心诚至上

访问该寄存器的指令如下:

MRC   p15, 0, Rd, C3, C0, 0   ;  Read domain 15:0 access permissions

MCR   p15, 0, Rd, C3, C0, 0   ;  Read domain 15:0 access permissions

Interpreting Access Control Bits in Domain Access Control Register

引用 关于ARM9协处理器CP15及MCR和MRC指令 - 心诚至上 - 心诚至上

 

 

寄存器4:保留

对该寄存器的读写会产生不可预料的结果。

 

寄存器5Fault Status Register

寄存器6Fault Address Register

寄存器7Cache Operations

该寄存器是只写寄存器,用于管理指令缓存和数据缓存。

对该寄存器的写操作所实现的功能,是通过MCR指令中的opcode_2CRm两者的组合来选择的,具体组合如下。

 

引用 关于ARM9协处理器CP15及MCR和MRC指令 - 心诚至上 - 心诚至上

寄存器8TLB Operations

Register 8 is a write-only register used to manage the translation lookaside buffer(TLBs),the instruction TLB and the data TLB.

Five TLB operations are defined and the function to be performed is selected by the opcode_2 and CRm fields in the MCR instruction used to write CP15 register 8.Writing other opcode_2 or CRm values id unpredictable. Reading from CP15 register 8 is unpredictable.

 Function                Data                                        instruction                     
 Invalidate TLB(s)                     SBZ MCR p15,0,Rd,c8,c7,0
 Invalidate I TLB SBZ MCR p15,0,Rd,c8,c5,0
 Invalidate I TLB single entry (using MVA) MVA format MCR p15,0,Rd,c8,c5,1
 Invalidate D TLB SBZ MCR p15,0,Rd,c8,c6,0
 Invalidate D TLB single entry (using MVA) MVA format MCR p15,0,Rd,c8,c6,1


http://chatgpt.dhexx.cn/article/PxTamZQU.shtml

相关文章

CP15协处理器访问指令MCR/MRC解析

ARM11协处理器从CP0到CP15, 其中CP15位系统控制协处理器。功能如下&#xff1a; • overall system control and configuration • cache configuration and management • Tightly-Coupled Memory (TCM) configuration and management • Memory Management Unit (MMU) con…

ARM协处理器CP15(设置MMU,cache等)学习

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴! 作者:wogoyixikexie@gliet 一直对协处理器CP15很恐惧,因为在网上基本上找不到中文的…

ARM存储器之:协处理器CP15

链接&#xff1a;http://www.eefocus.com/embedded/323216/r0 ARM存储器之&#xff1a;协处理器CP15 ARM存储系统有非常灵活的体系结构&#xff0c;可以适应不同的嵌入式应用系统的需要。ARM存储器系统可以使用简单的平板式地址映射机制&#xff08;就像一些简单的单片机一样…

协处理器CP15

在基于ARM的嵌入式应用系统中&#xff0c;存储系统通常是通过系统控制协处理器CP15完成的。ARM处理器使用协处理器15(CP15)的寄存器来控制cache、TCM和存储器管理。CP15包含16个32位的寄存器&#xff0c;其编号为0~15。 CP15访问CP15寄存器的指令 MCR ARM寄存器到协处理器寄存…

ARM协处理器(CP15)指令介绍

什么是协处理器 协处理器是一种芯片&#xff0c;用于减轻系统微处理器的特定处理任务。例如&#xff0c;数学协处理器可以控制数字处理&#xff1b;图形协处理器可以处理视频绘制。例如&#xff0c;intel pentium微处理器就包括内置的数学协处理器。   协处理器可以附属于AR…

(转)ARM协处理器CP15寄存器详解

用于系统存储管理的协处理器CP15 MCR{cond} coproc&#xff0c;opcode1&#xff0c;Rd&#xff0c;CRn&#xff0c;CRm&#xff0c;opcode2 MRC {cond} coproc&#xff0c;opcode1&#xff0c;Rd&#xff0c;CRn&#xff0c;CRm&#xff0c;opcode2 coproc 指…

浅谈ARMv7-A协处理器CP15

协处理器&#xff0c;顾名思义就是协助型处理器&#xff0c;主要协助做一些主处理器无法执行或者执行效率不佳的事情&#xff0c;比如浮点、图像、音频处理这一类&#xff0c;随着硬件的发展&#xff0c;大多协处理器的功能都慢慢集成到主处理器中&#xff0c;但是某些特定的工…

i.MX6ULL(三) CP15协处理器

CP15 CP15协处理器是ARM处理器中一门重要的协处理器&#xff0c;主要用来控制 cache、TCM&#xff08; tiny code memory&#xff09;和存储器管理。 CP15协处理器包含16个32位的寄存器&#xff0c;其编号为0~15&#xff0c;其中CP15寄存器0是预留的&#xff0c;所以CP15实际有…

ARM汇编指令3 - CP15协处理器介绍和操作方法

一. ARM CP15协处理器寄存器简介 CP15协处理器寄存器是ARM处理器里面的一些有特殊功能的寄存器&#xff0c;CP15协处理器一般包括C0 - C15寄存器&#xff0c;它们分别控制高速缓存cache&#xff0c;MMU&#xff0c;TLB等功能&#xff0c;下面分别介绍 二. CP15寄存器访问 1. C…

【文献翻译】用于5G蜂窝的毫米波移动通信:我看行!

【标题】&#xff1a;Millimeter Wave Mobile Communications for 5G Cellular: It Will Work! 【作者】&#xff1a;T. S. Rappaport, S. Sun, R. Mayzus, H. Zhao, Y. Azar, K. Wang, G. N. Wong, J. K. Schulz, M. Samimi, and F. Gutierrez 【来源】&#xff1a;IEEE Acces…

STM32之单DAC数模转换输出(2021-07-30)

STM32之单DAC数模转换输出 1.DAC简介及框图&#xff1a; DAC功能只有STM32大容量的芯片才具有&#xff1b;中低容量的芯片没有&#xff1b; DAC有两个 8位*&#xff08;右对齐&#xff09;或者是12位&#xff08;左或右对齐&#xff09;*的转换器&#xff0c;每个转换器只有一…

pycinrad学习入门笔记,数据为雷达新旧格式基数据、pup产品数据

安装步骤 1.更改pip源为清华径向 2.pip install cinrad 3.运行上传的代码&#xff0c;在我的资料上传里 4、可以解码的基数据有&#xff1a;old 、new&#xff0c;格式可以是bz2和bin格式&#xff0c;分别使用不同的函数 file1 "Z_RADR_I_Z9552_20200711161600_O_DO…

Linux 初级 文件与目录管理(3)

文件和目录管理 在开始目录的切换之前&#xff0c;先了解一下路径&#xff0c;什么是相对路径&#xff0c;什么是绝对路径。 绝对目录 &#xff1a; 路径的写法&#xff0c;一定是由根目录写起/ 写起。例如如&#xff1a; /usr/share/dor这个目录 相对路径&#xff1a; 路径的…

bwapp通关教程

** HTML Injection - Reflected (GET) ** low: 低级漏洞中&#xff0c;输入数据没有做校验 First name: <script>alert( xss )</script> Last name: <script>alert( xss )</script> 出现xss即为成功。 medium 和low一样&#xff0c;但发现被全…

新一代天气雷达文件三维可视化

链接&#xff1a;从最新文章获取百度盘地址 支持新一代天气雷达SA SB CA&#xff0c;支持FMT&#xff0c;支持SWAN格式直接将文件拖进程序即可 支持列表样例Z_RADR_I_Z***_20200803100000_O_DOR_SA_CAP.bin.bz2Z_RADR_I_Z***_20210514000000_O_DOR_SA_CAP_FMT.bin.bz2Z_OTHE_…

激光雷达动态障碍物滤除-调研与展望

0. 简介 激光雷达作为自动驾驶中最常用的传感器之一&#xff0c;由于其深度感知特性优良&#xff0c;这也让以激光SLAM为主的SLAM方法被广泛应用。但是我们发现在人员密集&#xff0c;车辆密集的场景经常会造成点云定位效果不佳&#xff0c;而这些情况传统滤波方法是没有办法解…

DAC的简单应用

1.简介 DAC指数字/模拟转换。STM32F103RCT6具有2个12位数字输入&#xff0c;模拟输出的DAC&#xff1b;支持数字输入配置成8位右对齐、12位左对齐或12位右对齐格式&#xff1b;在双DAC通道模式下支持单通道独立转换或双通道同步转换。 2.框图 根据框图&#xff0c;将数据写入…

STM32学习笔记--DAC

目录&#xff1a; 一、DAC原理1.DAC定义2.STM32DAC简介3.STM32DAC工作原理 二、STM32DAC库函数配置参考资料 一、DAC原理 1.DAC定义 DAC是Digital-to- Analog Converter的缩写&#xff0c;数字/模拟转换模块的简称&#xff0c;它的作用就是把输入的数字编码&#xff0c;转换成…

Bwapp 04 05

文章目录 Insecure DOR (Change Secret)Insecure DOR (Reset Secret)Insecure DOR (Order Tickets)安全配置 Insecure DOR (Change Secret) 抓包的话&#xff0c;就可以实行篡位修改 Insecure DOR (Reset Secret) 同上&#xff0c;换成了xml的形式 Insecure DOR (Order Ticke…

水处理相关工艺控制程序汇总(RXXW_Dor)

水处理和化工行业流程控制类程序工艺有很多相似之处,属于过程控制,并不太关心控制实时性和控制速度,这篇博客汇总项目各种工艺写法,陆续会更新。流程控制类程序很多可以利用状态机思想进行编程,有关状态机编程的详细方法可以参看下面的文章链接: PLC面向对象编程系列之有…