- 论坛徽章:
- 0
|
回复 3# shuge_guet
arm-linux-gcc 发表于 2013-12-12 20:44 页表里需要做一份物理到虚拟的等值映射
贴一段uboot的代码
/*
* MMU Table for SMDK6400
*/
/* form a first-level section entry */
.macro FL_SECTION_ENTRY base,ap,d,c,b
.word (\base << 20) | (\ap << 10) | \
(\d << 5) | (1<<4) | (\c << 3) | (\b << 2) | (1<<1)
.endm
.section .mmudata, "a"
.align 14
/* the following alignment creates the mmu table at address 0x4000. */
.globl mmu_table
mmu_table:
.set __base, 0
/* 1:1 mapping for debugging */
.rept 0xA00
FL_SECTION_ENTRY __base, 3, 0, 0, 0
.set __base, __base + 1
.endr
/* access is not allowed. */
.rept 0xC00 - 0xA00
.word 0x00000000
.endr
/* 128MB for SDRAM 0xC0000000 -> 0x50000000 */
.set __base, 0x500
.rept 0xC80 - 0xC00
FL_SECTION_ENTRY __base, 3, 0, 1, 1
.set __base, __base + 1
.endr
/* access is not allowed. */
.rept 0x1000 - 0xc80
.word 0x00000000
.endr
#endif
/* 1:1 mapping for debugging */
这个是等值映射的意思吗?
我看uboot里就用mcr p15,0,r1,c2,c0,0 , r1 = 0xce700000
这个地址也就是自己想要映射的虚拟地址吧 ?
那我做点小实验的话也不用做那么长的计算了吧 , 直接给定一个常数 0xce700000就可以了吧
ldr r1,=0xce700000
mcr p15,0,r1,c2,c0,0
是这么做吗? 没出效果啊 , 还是会出现开MMU后读不了下一条指令 |
|