- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据ARM手册:
In the case of a 4kB granule, the hardware can use a 4-level look upprocess. The 48-bit address has nine address bits for each leveltranslated (that is, 512 entries each), with the final 12 bitsselecting a byte within the 4kB coming directly from the originaladdress.
Bits [47:39] of the virtual address index into the 512 entry L0 table.Each of these table entries spans a 512GB range and points to an L1table. Within that 512 entry L1 table, bits [38:30] are used as indexto select an entry and each entry points to either a 1GB block or anL2 table.
Bits [29:21] index into a 512 entry L2 table and each entry points toa 2MB block or next table level. At the last level, bits [20:12] indexinto a 512 entry L2 table and each entry points to a 4kB block
Because we choose 4k as page size, and one translation entry is 8bytes, that means we have 512 entries on each page. Therefore indeces0..511 belong to the first page, 512..1023 to the second and so forth. With other words, the address of paging[0] equals to _end (firstpage), and paging[512] equals to _end + PAGESIZE (second page).
paging[4*512+511]=(unsigned long)((unsigned char*)&_end+5*PAGESIZE) | // physical address
PT_PAGE | // we have area in it mapped by pages
PT_AF | // accessed flag
PT_KERNEL | // privileged
PT_ISH | // inner shareable
PT_MEM; // normal memory
指数
4*512+511 = 2559
远远超过了我想象的 L2 表。我想我误解了一些非常错误的东西!
paging[0]
和
paging[511]
跨越第一个表 (L0),然后
paging[512]
和
paging[2013]
跨越第二个表 (L1) 和
paging[1024]
和
paging[2559]
跨越最后一个表(L2)?
r<<21
和
r*PAGESIZE
,这些是什么意思?
最佳答案
有两个表,分别由 TTBR0 和 TTBR1 指向。
第一个,TTBR0,直接指向 &paging[0],形成 L0,L1,L2 页面层次结构:
Paging[0] points at &paging[512*2]
Paging[512*2] points at &paging[512*3]
Paging[512*3..512*3+511] contains page descriptors for physical memory at 0..200000.
另外
Paging[512*2+1..512*2+511] contains large descriptors for physical memory at 400000..40000000
第二个(内核)TTBR1 直接指向 &paging[512],形成类似的 L0,L1,L2 层次结构:
Paging[512+511] points at &paging[512*4]
Paging[512*4+511] points at &paging[512*5]
Paging[512*5] contains a descriptor for MMIO_BASE+0x201000.
第二组偏移到每个表的第 511 个描述符的原因是使其位于非常高的地址。
关于c - ARMv8a 中的这种简单分页是如何工作的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64843803/
我是一名优秀的程序员,十分优秀!