linux arm uboot开启mmu,uboot中MMU地址映射

1.uboot的页表位置:lowlevel_init.S文件的最后:、

/* 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=2^14 16K对齐.

.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 or 256MB for SDRAM 0xC0000000 -> 0x50000000

.set __base, 0x500 //地址映射

#ifdef FORLINX_BOOT_RAM128

.rept 0xC80 - 0xC00

#else

.rept 0xD00 - 0xC00

#endif

FL_SECTION_ENTRY __base,3,0,1,1

.set __base,__base+1

.endr

/ /access is not allowed.

#ifdef FORLINX_BOOT_RAM128

.rept 0x1000 - 0xC80

#else

.rept 0x1000 - 0xD00

#endif

.word 0x00000000

.endr

2. 如何查找也基地址?

在uboot的第二阶段启动MMU。在start.S文件中:

1)定义页表地址:

#ifdef CONFIG_ENABLE_MMU

_mmu_table_base:

.word mmu_table

#endif

2)讲页表地址送入P15的C2寄存器:

#ifdef CONFIG_ENABLE_MMU

enable_mmu:

/* enable domain access */

ldrr5, =0x0000ffff

mcrp15, 0, r5, c3, c0, 0@ load domain access register

/* Set the TTB register */

ldrr0, _mmu_table_base

ldrr1, =CFG_PHY_UBOOT_BASE

ldrr2, =0xfff00000

bicr0, r0, r2

orrr1, r0, r1

mcrp15, 0, r1, c2, c0, 0

/* Enable the MMU */

mmu_on:

mrcp15, 0, r0, c1, c0, 0

orrr0, r0, #1/* Set CR_M to enable MMU */

mcrp15, 0, r0, c1, c0, 0

nop

nop

nop

nop

#endif

阅读(3599) | 评论(0) | 转发(2) |

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值