读书人

三星uboot1.1.6源码分析start.s(

发布时间: 2012-06-20 20:37:21 作者: rapoo

三星uboot1.1.6源码分析——start.s(5)——与MMU有关的源码(1)

现在接着回到start.s的代码中,进行分析。我省略了一些没用的代码,如与onenand有关的代码。这一篇主要关注MMU有关的代码。

-------------------------------------------------------------

after_copy:
#ifdef CONFIG_ENABLE_MMU ---我们定义了#define CONFIG_ENABLE_MMU

-------------------------------

下面这些很多都涉及到arm的协处理器的操作。

三星uboot1.1.6源码分析——start.s(五)——与MMU有关的源码(1)

-c0:ID号寄存器

-c0:缓存类型寄存器

-c1:控制寄存器

-c2:转换表基址寄存器(Translation Table Base --TTB)

-c3:域访问控制寄存器—omain access control )

-c4:保留

-c5:异常状态寄存器(fault status -FSR)

-c6:异常地址寄存器(fault address -FAR)

-c7:缓存操作寄存器

-c8:TLB操作寄存器

-c9:缓存锁定寄存器

-c10:TLB 锁定寄存器

-c11-12&14:保留

-c13:处理器ID

-c15:测试配置寄存器

---------------------------------------

主要和两个指令有关mcr和mrc。

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

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

MCR 指令将ARM 处理器的寄存器中的数据传送到协处理器的寄存器中.若协处理器不能成功地执行该操作,将产生未定义指令异常中断.指令格式如下;
MCR{cond} coproc,opcodel,Rd,CRn,CRm{,opcode2}
其中

coproc 指令操作的协处理器名.
cpcodel 协处理器的特定操作码.
CRD 作为目标寄存器的协处理器寄存器.
CRn 存放第1 个操作数的协处理器寄存器
CRm 存放第2 个操作数的协处理器寄存器.
Opcode2 可选的协处理器特定操作码.
MCR 指令举例如下:
MCR p6,2,R7,c1,c2,
MCR P7,0,R1,c3,c2,1,
MRC
协处理器寄存器到ARM 寄存器到的数据传送指令.MRC 指令将协处理器寄存器中的
数据传送到ARM 处理器的寄存器中.若协处理器不能成功地执行该操作.将产生未定义
异常中断.指令格式如下.
MRC {cond} coproc,opcodel,Rd,CRn,CRm{,opcode2}
其中coproc 指令操作的协处理器名.
opcodel 协处理器的特定操作码.
CRd 作为目标寄存器的协处理器寄存器.

CRn 存放第 1 个操作数的协处理器寄存器.
CRm 存放第2 个操作数的协处理器寄存器.
opcode2 可选的协处理器特定操作码.
MRC 指令举例如下
MRC p5,2,R2,c3,c2
MRC p7,0,R0,c1,c2,1

------------------------------

这个是在ARM7500FE手册上摘录的,我认为有利于理解这两个指令的使用,尤其是下面的例子。

<MCR|MRC>{cond} p#,<expression1>,Rd,cn,cm{,<expression2>}
where:
MRC move from coprocessor to ARM7500FE register (L=1)
MCR move from ARM7500FE register to coprocessor (L=0)
{cond} two character condition mnemonic
p# the unique number of the required coprocessor
<expression1> evaluated to a constant and placed in the CP Opc ?eld
Rd is an expression evaluating to a valid ARM processor register
number
cn and cm are expressions evaluating to the valid coprocessor register
numbers CRn and CRm respectively
<expression2> where present is evaluated to a constant and placed in
the CP ?eld

MRC 2,5,R3,c5,c6 ; request coproc 2 to perform operation 5
;on c5 and c6, and transfer the (single
;32-bit word) result back to R3
MCR 6,0,R4,c6 ;request coproc 6 to perform operation 0
;on R4 and place the result in c6
MRCEQ 3,9,R3,c5,c6,2 ;conditionally request coproc 2 to
;perform
;operation 9 (type 2) on c5 and c6, and
;transfer the result back to R3

-----------------------------------

enable_mmu:

-----------------------------------------------------------
/* enable domain access */
ldr r5, =0x0000ffff
mcr p15, 0, r5, c3, c0, 0@ load domain access register

-------------------------------------------------------------

上面这个主要与c3有关,如下所示:

c3, Domain Access Control Register

The purpose of the Domain Access Control Register is to hold the access permissions for a maximum of 16 domains.

Table 3.59 lists the purposes of the individual bits in the Domain Access Control Register.

The Domain Access Control Register is:

读书人网 >系统运维

热点推荐