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

               

作者: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.csdn.net/u/20081231/10/bbde79c2-2884-48e3-9718-90d7fcc1afa8.html?seed=1947589160

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

           

猜你喜欢

转载自blog.csdn.net/qq_44884287/article/details/89448473