Aarch64 上同时存在不同大小的页面 [英] Simultaneous existence of different-sized pages on Aarch64
问题描述
根据架构概览文档 Aarch64 支持 4k 和 64k 页面.一些 CPU 还支持 16k 页.查看地址转换方案的详细信息,我得出的结论是,此类 CPU 不支持同时存在不同大小的页面(与 x86_64 不同,它允许这样做).我说得对吗?
According to the architecture overview document Aarch64 supports 4k and 64k pages. Some CPUs also support 16k pages. Looking into address translation scheme details I come to the conclusion that such CPUs don't support the simultaneous existence of different-sized pages (unlike x86_64 which allows that). Am I right?
推荐答案
您将两种不同但相关的事物混为一谈 - 页面大小与粒度.
You're conflating two different, albeit related, things here - page size vs. granularity.
在 AArch64 中,您有 3 种可能的翻译粒度可供选择,每一种都会产生一组不同的页面大小:
In AArch64, you have 3 possible translation granules to choose from, each of which results in a different set of page sizes:
- 4KB 粒度:4KB、2MB 和 1GB 页面.
- 16KB 粒度:16KB 和 32MB 页面.
- 64KB 粒度:64KB 和 512MB 页面.
翻译粒度通常定义了翻译机制的各种属性,因此它适用于一整套表,并且您不能在表中混合和匹配粒度是正确的,尽管它完全可以同时对不同表使用不同的粒度(例如在不同的异常级别).
The translation granule defines various properties of the translation regime in general, so it applies to a whole set of tables and you are correct in the sense that you can't mix and match granules within a table, although it's perfectly fine to use different granules for different tables at the same time (e.g. at different exception levels).
相比之下,x86 始终具有 4KB 粒度,但提供的页面大小范围因模式而异:
Comparatively, x86 always has 4KB granularity, but the range of page sizes on offer varies depending on the mode:
- 32 位:4KB 和 4MB 页面.
- PAE:4KB 和 2MB 页面.
- 64 位:4KB、2MB 和(如果支持)1GB 页面.
在这两种情况下,大于基本粒度的页面大小表示中间表级别的块条目.换句话说,使用常见的4KB粒度,3级*,例如:
In both cases, the page sizes larger than the basic granule represent block entries at intermediate table levels. In other words, using the common 4KB granule, 3-level*, example:
- 一级表中的每个有效条目都指向一个自然对齐的 1GB 内存区域,或一个描述该 1GB 地址空间的二级表.
- 二级表中的每个有效条目都指向一个自然对齐的 2MB 内存区域,或一个描述这 2MB 地址空间的三级表.
- 三级表中的每个有效条目都指向一个自然对齐的 4KB 内存区域.
* 根据实际的地址空间大小,可能在这之上有一个第零级表,但两种架构都不允许该级别的块条目(无论如何它们都会变得不切实际).对于 AArch64,较大的颗粒仅支持级别 2 和 3 的块/页面条目,而 64KB 颗粒根本没有级别 0.
这篇关于Aarch64 上同时存在不同大小的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!