新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 關(guān)于ARM9協(xié)處理器CP15及MCR和MRC指令

關(guān)于ARM9協(xié)處理器CP15及MCR和MRC指令

作者: 時間:2016-11-24 來源:網(wǎng)絡(luò) 收藏
在ARM芯片資料中,針對協(xié)處理器CP15的介紹非常少,但是CP15又十分重要,例如在使用MMU編寫虛擬地址映射表時,最后的一步重要工作就是要將映射表的基地址存儲到CP15的寄存器C2中,還有一些控制的TLB,Cache等訪問控制權(quán)限等等。。。

在基于ARM的嵌入式應(yīng)用系統(tǒng)中,存儲系統(tǒng)通常是通過系統(tǒng)控制協(xié)處理器CP15完成的。CP15包含16個32位的寄存器,其編號為0~15。

本文引用地址:http://www.butianyuan.cn/article/201611/320982.htm

訪問CP15寄存器的指令

MCRARM寄存器到協(xié)處理器寄存器的數(shù)據(jù)傳送

MRC協(xié)處理器寄存器到ARM寄存器的數(shù)據(jù)傳送

MCR指令和MRC指令只能在處理器模式為系統(tǒng)模式時執(zhí)行,在用戶模式下執(zhí)行MCR指令和MRC指令將會觸發(fā)未定義指令的異常中斷。

MCR指令

MCR指令將ARM處理器的寄存器中的數(shù)據(jù)傳送到協(xié)處理器寄存器中。如果協(xié)處理器不能成功地執(zhí)行該操作,將產(chǎn)生未定義的指令異常中斷。

指令語法格式

MCR{}

,< opcode_1>,,,{,}

MCR{} p15,0,,,{,}

其中,為指令執(zhí)行的條件碼。當忽略時指令為無條件執(zhí)行。

< opcode_1>為協(xié)處理器將執(zhí)行的操作的操作碼。對于CP15協(xié)處理器來說,< opcode_1>永遠為0b000,當< opcode_1>不為0b000時,該指令操作結(jié)果不可預(yù)知。

作為源寄存器的ARM寄存器,其值將被傳送到協(xié)處理器寄存器中。

作為目標寄存器的協(xié)處理器寄存器,其編號可能是C0,C1,…,C15。

和兩者組合決定對協(xié)處理器寄存器進行所需要的操作,如果沒有指定,則將為為C0,opcode_2為0,否則可能導致不可預(yù)知的結(jié)果。

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中中將數(shù)據(jù)傳送到協(xié)處理器CP15的寄存器C1中。其中R4為ARM寄存器,存放源操作數(shù),C1、C0為協(xié)處理器寄存器,為目標寄存器,opcode_1為0,opcode_2為0。

MCRp15,0,R4,C1,C0,0

MRC指令

MRC指令將協(xié)處理器的寄存器中的數(shù)值傳送到ARM處理器的寄存器中、如果協(xié)處理器不能成功地執(zhí)行該操作,將產(chǎn)生未定義的指令異常中斷。

指令語法格式

MRC{}

,< opcode_1>,,,{,}

MRC{} p15,0,,,{,}

參數(shù)用法同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.

寄存器0:ID 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:

MRCp15, 0, Rd, C0, C0,0

ID Code內(nèi)容如下:

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

寄存器0:Cache 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:

MRCp15, 0, Rd, C0, C0,1; returns cache details

The format of cache type register (寄存器的數(shù)據(jù)格式如下)

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(數(shù)據(jù)緩存大小)

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)


上一頁 1 2 下一頁

評論


技術(shù)專區(qū)

關(guān)閉