1.5.6. clear bits

	1bic	r0, r0, #0x00002300	@ clear bits 13, 9:8 (--V- --RS)2
	bic	r0, r0, #0x00000087	@ clear bits 7, 2:0 (B--- -CAM)3
	orr	r0, r0, #0x00000002	@ set bit 2 (A) Align4
	orr	r0, r0, #0x00001000	@ set bit 12 (I) I-Cache5
	mcr	p15, 0, r0, c1, c0, 06
        

1

此处几行代码,注释中写的也很清楚了,就是去清楚对应的位和设置对应的位,具体位域的含义见下:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0184b/Chdifbjc.html

表 1.6. 控制寄存器1的位域含义

Register bitsNameFunctionValue
31iA bitAsynchronous clock selectSee Table 2.11
30nF bitnotFastBus selectSee Table 2.11
29:15-Reserved

Read = Unpredictable

Write = Should be zero

14RR bitRound robin replacement

0 = Random replacement

1 = Round-robin replacement

13V bitBase location of exception registers

0 = Low addresses = 0x00000000

1 = High addresses = 0xFFFF0000

12I bitICache enable

0 = ICache disabled

1 = ICache enabled

11:10-Reserved

Read = 00

Write = 00

9R bitROM protectionThis bit modifies the MMU protection system. See Domain access control
8S bitSystem protectionThis bit modifies the MMU protection system. See Domain access control
7B bitEndianness

0 = Little-endian operation

1 = Big-endian operation

6:3-Reserved

Read = 1111

Write = 1111

2C bitDCache enable

0 = DCache disabled

1 = DCache enabled

1A bitAlignment fault enableData address alignment fault checking

0 = Fault checking disabled

1 = Fault checking enabled

0M bitMMU enable

0 = MMU disabled

1 = MMU enabled



表 1.7. 时钟模式

Clocking modeiAnF
FastBus mode00
Synchronous01
Reserved10
Asynchronous11


http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0151c/I273867.html

Domain access control

表 1.8. 关于访问控制位在域访问控制寄存器中的含义

ValueMeaningDescription
00No accessAny access generates a domain fault
01Client Accesses are checked against the access permission bits in the section or page descriptor
10ReservedReserved. Currently behaves like the no access mode
11ManagerAccesses are not checked against the access permission bits so a permission fault cannot be generated


表 1.9 “关于访问允许(AP)位的含义”shows how to interpret the Access Permission (AP) bits and how their interpretation is dependent on the S and R bits (control register bits 8 and 9)

表 1.9. 关于访问允许(AP)位的含义

APSRSupervisor permissionsUser permissionsDescription
0000No accessNo access Any access generates a permission fault
0010Read-onlyNo accessOnly Supervisor read permitted
0001Read-onlyRead-onlyAny write generates a permission fault
0011Reserved--
01xxRead/writeNo access Access allowed only in Supervisor mode
10xxRead/writeRead-only Writes in User mode cause permission fault
11xxRead/writeRead/writeAll access types permitted in both modes
xx11Reserved- 


2

此行作用是:

  1. 清除bit[13]

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

    0 = Low address = 0x0000 0000

  2. 清除bit[9]和bit[8]

    此处不是很懂,待后续深入了解。

    目前的理解是:

    不论是Supervisor还是user,谁都不能访问,否则就出现权限错误“Any access generates a permission fault”

3

此行作用是:

  1. 清除bit[7]

    使用little endian

  2. 清除bit[2-0]

    DCache disabled,关闭Dcache;

    Alignment Fault checking disabled,关闭地址对齐的错误检查;

    MMU disabled,关闭MMU。

4

此行作用是:

  1. 设置bit[1]

    “Enable Data address alignment fault checking”打开数据地址对齐的错误检查,即如果数据地址为非法(奇数?)地址,就报错。

5

此行作用是:

  1. 设置bit[12]

    开启指令缓存I cache。

6

mcr指令,将刚才设置的r0的值,再写入到寄存器1中。