arm linux 页表寻址,深入理解ARMV7页表映射机制及pagefault.docx

NSN SOC 公开▲PAGE

第PAGE 20页 All Rights reserved, No Spreading abroad without Permission of NSN

深入理解ARMV7的页表映射机制及pagefaultNSN soc shanghai李浩

【摘要】本文默认描述的对象为基于ARMV7 CortexA9的CycloneV SOC开发板,在描述过程中可能会穿插一些其它cpu体系的相关知识,从中我们可以详细了解ARMV7架构处理虚实地址转换的过程。并且分析了uboot和linux的具体实现过程和试验结果,使我们从理论到实现有更加清晰的认识。文档中尽可能的引用了厂家给出的第一手资料。【关键词】页表 TLB Pagefault MMU

第1节主要描述了异常的类型和异常向量的基地址;第2节和第3节主要描述了VA是如何转换成PA的,这只是MMU的一个功能,MMU另外一个主要功能是访问控制,即有没有权限去访问某个实际的PA;第4节关注MMU的访问控制功能。1 异常类型1.1 异常的描述An exception causes the processor to suspend program execution to handle an event, such as an externally generated interrupt or an attempt to execute an undefined instruction. Exceptions can be generated by internal and external sources.如何确定异常向量基地址:首先判断SCTLR[V],其次判断SCR[NS],最后确定VBAR。异常向量基地址见红色框:

1 SCTLR[V]=0,需要查看是否securtiy模式

2 SCR[NS]=0,确认是否secure state?

The Secure exception base address is controlled similarly, by the Secure SCTLR.V bit and the Secure VBAR.

3 VBAR寄存器

1.2 uboot实现过程1编译cyclone V的SPL过程中:cd /home/samba-share/lihao/project/altera-board/u-boot-altera-2012.10/spl/ && arm-linux-gnueabihf-ld.bfd -T /home/samba-share/lihao/project/altera-board/u-boot-altera-2012.10/spl/u-boot-spl.lds --gc-sections -Bstatic -Ttext 0xFFFF0000 。。。。 -lgcc -Map u-boot-spl.map -o u-boot-splman ld查看-Ttext的含义:

2查看SPL 的符号表u-boot-spl.map .text 0xffff0000 0x5734 arch/arm/cpu/armv7/start.o(.text) .text 0xffff0000 0x160 arch/arm/cpu/armv7/start.o 0xffff0000 _start 0xffff0040 _end_vect

3 阅读源代码,Uboot-socfpga/arch/arm/cpu/armv7/start.s

.globl _start

#if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))/* Set V=0 in CP15 SCTRL register - for VBAR to point to vector */mrcp15, 0, r0, c1, c0, 0@ Read CP15 SCTRL Registerbicr0, #CR_V@ V = 0mcrp15, 0, r0, c1, c0, 0@ Write CP15 SCTRL Register

/* Set vector address in CP15 VBAR register */ldr

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值