02.07.2013 Views

Uboot中start.S源码的指令级的详尽解析

Uboot中start.S源码的指令级的详尽解析

Uboot中start.S源码的指令级的详尽解析

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function Rd Instruction<br />

Invalidate TLB(s) SBZ MCR p15,0,Rd,c8,c7,0<br />

/*<br />

* disable MMU stuff and caches<br />

*/<br />

mrc p15, 0, r0, c1, c0, 0<br />

此处,对应的值为:<br />

rd为r0=0<br />

CRn为C1<br />

CRm为C0<br />

opcode_2为0,<br />

即,此行代码是将r0的值,即0,写入到CP15的寄存器1中。<br />

寄存器1的相关的定义为:<br />

http://www.heyrick.co.uk/assembler/coprocmnd.html<br />

“StrongARM SA110<br />

Register 1 - Control (read/write)<br />

All values set to 0 at power-up.<br />

o Bit 0 - On-chip MMU turned off (0) or on (1)<br />

o Bit 1 - Address alignment fault disabled (0) or enabled<br />

(1)<br />

o Bit 2 - Data cache turned off (0) or on (1)<br />

o Bit 3 - Write buffer turned off (0) or on (1)<br />

o Bit 7 - Little-endian operation if 0, big-endian if 1<br />

o Bit 8 - System bit - controls the MMU permission system<br />

o Bit 9 - ROM bit - controls the MMU permission system<br />

o Bit 12 - Instruction cache turned off (0) or on (1)”<br />

所以,对应内容就是,向bit[CRm]中写入opcode_2,即向bit[0]写入0,对应的作用为<br />

“On-chip MMU turned off”,即关闭MMU。<br />

bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)<br />

bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)<br />

orr r0, r0, #0x00000002 @ set bit 2 (A) Align<br />

orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache<br />

mcr p15, 0, r0, c1, c0, 0<br />

上面几行代码,注释中写的也很清楚了,就是去清楚对应的位和设置对应的位,具体位域的含义,<br />

见下:<br />

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0184b/<br />

Chdifbjc.html<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!