MMU相关指令学习(一)(主要是页表设置指令)

本文深入探讨了MMU(内存管理单元)的作用及其在虚拟地址与物理地址转换过程中的关键角色。详细解析了ARM MMU的多层页表结构,包括L1和L2页表的工作原理,以及不同页表项的设置与功能。此外,文章对比了单步搜索与两步搜索在页表搜索中的应用,为理解复杂内存管理提供了清晰的视角。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow

               

作者:wogoyixikexie@gliet

————————————————————————————————————————————

下面看看这张图,结合指令看看,不过我始终觉得这个图和程序描述的设置有很大差别。

————————————————————————————————————————————————

这里再来补充一下MMU的作用以及不使用MMU会造成什么后果。

————————————————————————————————————————————————————

MMU把虚拟地址转换成物理地址;控制内存访问权限;决定内存页的写缓冲和cache。如果禁用MMU,虚拟地址会一一对应物理地址(相等)

 

—————

页表的结构

—————

————————————————————

ARM MMU是具有多层页表结构,分为两级页表:L1和L2。L1成为主页表,可以包含两种也表项:可以指向L2页表的起始地址和转换成1MB页的页表项。L1主页表也可以称为段页表。

————————————————————————————————————————————————————

 

——————

L1页表项设置

——————

——————————————————————————————————————————————————

————————————————————————————————————————————————————

A section page table entry points toa1MB section of memory. The upper 12 bits of
the page table entry replace the upper 12 bits of the virtual address to generate the physical
address. A section entry also contains the domain, cached, buffered, and access permission
attributes, which we discuss in Section 14.6.
A coarse page entry contains a pointer to the base address of a second-level coarse page
table. The coarse page table entry also contains domain information for the 1 MB section
of virtual memory represented by the L1 table entry. For coarse pages, the tables must be
aligned on an address multiple of 1 KB.
A fine page table entry contains a pointer to the base address of a second-level fine page
table. The fine page table entry also contains domain information for the 1 MB section of
virtual memory represented by the L1 table entry. Fine page tables must be aligned on an
address multiple of 4 KB.
A fault page table entry generates a memory page fault. The fault condition results in
either a prefetch or data abort, depending on the type of memory access attempted.
The location of the L1 master page table in memory is set by writing to the CP15:c2
register.

————————————————————————————————————

———————

L1转换表基地址

———————

The CP15:c2 register holds the translation table base address (TTB)—an address pointing to the location of the master L1 table in virtual memory(指出L1页表在虚拟内存中的地址). Figure 14.7 shows the format of CP15:c2 register.

 

——————————————————————————————————————————————————

————

L2页表项

————

L2页表项包含的种类

 

——————————————————————————————————————————————————

具体设置如下。

———————————————————————————————————————————————

从上面可以看出,这些东西都是相通的,继续看,估计今天就可以找到答案。

 

————

页表搜索

————

1.单步搜索(其实是只使用了一级页表:在裸奔的情况下使用)

———————————————————————————————————————————————————————

2.两步搜索(其实是使用二级页表:在使用linux/wince操作系统的时候使用)

———————————————————————————————————————————————————————

从上面可以看出,使用两级页表的时候,一级页表存放的是二级页表的目录,二级页表才是存放转换表的。

———————————————————————————————————————————————————————

关于更加详细的分析,请看《MMU相关指令学习(二)(主要是页表设置指令)》一文。或者我发的论坛帖子

http://topic.youkuaiyun.com/u/20081231/10/bbde79c2-2884-48e3-9718-90d7fcc1afa8.html?seed=1947589160

转载请标明:作者wogoyixikexie@gliet.桂林电子科技大学一系科协,原文地址:http://blog.youkuaiyun.com/gooogleman——如有错误,希望能够留言指出;如果你有更加好的方法,也请在博客后面留言,我会感激你的批评和分享。

           

分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值