Xen: ARM: Zero reserved fields of xatp before making hypervisor call
[sfrench/cifs-2.6.git] / Documentation / zh_CN / arm64 / memory.txt
1 Chinese translated version of Documentation/arm64/memory.txt
2
3 If you have any comment or update to the content, please contact the
4 original document maintainer directly.  However, if you have a problem
5 communicating in English you can also ask the Chinese maintainer for
6 help.  Contact the Chinese maintainer if this translation is outdated
7 or if there is a problem with the translation.
8
9 Maintainer: Catalin Marinas <catalin.marinas@arm.com>
10 Chinese maintainer: Fu Wei <wefu@redhat.com>
11 ---------------------------------------------------------------------
12 Documentation/arm64/memory.txt 的中文翻译
13
14 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
15 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
16 译存在问题,请联系中文版维护者。
17
18 本文翻译提交时的 Git 检出点为: bc465aa9d045feb0e13b4a8f32cc33c1943f62d6
19
20 英文版维护者: Catalin Marinas <catalin.marinas@arm.com>
21 中文版维护者: 傅炜  Fu Wei <wefu@redhat.com>
22 中文版翻译者: 傅炜  Fu Wei <wefu@redhat.com>
23 中文版校译者: 傅炜  Fu Wei <wefu@redhat.com>
24
25 以下为正文
26 ---------------------------------------------------------------------
27                      Linux 在 AArch64 中的内存布局
28                      ===========================
29
30 作者: Catalin Marinas <catalin.marinas@arm.com>
31
32 本文档描述 AArch64 Linux 内核所使用的虚拟内存布局。此构架可以实现
33 页大小为 4KB 的 4 级转换表和页大小为 64KB 的 3 级转换表。
34
35 AArch64 Linux 使用 3 级或 4 级转换表,其页大小配置为 4KB,对于用户和内核
36 分别都有 39-bit (512GB) 或 48-bit (256TB) 的虚拟地址空间。
37 对于页大小为 64KB的配置,仅使用 2 级转换表,有 42-bit (4TB) 的虚拟地址空间,但内存布局相同。
38
39 用户地址空间的 63:48 位为 0,而内核地址空间的相应位为 1。TTBRx 的
40 选择由虚拟地址的 63 位给出。swapper_pg_dir 仅包含内核(全局)映射,
41 而用户 pgd 仅包含用户(非全局)映射。swapper_pg_dir 地址被写入
42 TTBR1 中,且从不写入 TTBR0。
43
44
45 AArch64 Linux 在页大小为 4KB,并使用 3 级转换表时的内存布局:
46
47 起始地址                    结束地址                    大小          用途
48 -----------------------------------------------------------------------
49 0000000000000000        0000007fffffffff         512GB          用户空间
50 ffffff8000000000        ffffffffffffffff         512GB          内核空间
51
52
53 AArch64 Linux 在页大小为 4KB,并使用 4 级转换表时的内存布局:
54
55 起始地址                    结束地址                    大小          用途
56 -----------------------------------------------------------------------
57 0000000000000000        0000ffffffffffff         256TB          用户空间
58 ffff000000000000        ffffffffffffffff         256TB          内核空间
59
60
61 AArch64 Linux 在页大小为 64KB,并使用 2 级转换表时的内存布局:
62
63 起始地址                    结束地址                    大小          用途
64 -----------------------------------------------------------------------
65 0000000000000000        000003ffffffffff           4TB          用户空间
66 fffffc0000000000        ffffffffffffffff           4TB          内核空间
67
68
69 AArch64 Linux 在页大小为 64KB,并使用 3 级转换表时的内存布局:
70
71 起始地址                    结束地址                    大小          用途
72 -----------------------------------------------------------------------
73 0000000000000000        0000ffffffffffff         256TB          用户空间
74 ffff000000000000        ffffffffffffffff         256TB          内核空间
75
76
77 更详细的内核虚拟内存布局,请参阅内核启动信息。
78
79
80 4KB 页大小的转换表查找:
81
82 +--------+--------+--------+--------+--------+--------+--------+--------+
83 |63    56|55    48|47    40|39    32|31    24|23    16|15     8|7      0|
84 +--------+--------+--------+--------+--------+--------+--------+--------+
85  |                 |         |         |         |         |
86  |                 |         |         |         |         v
87  |                 |         |         |         |   [11:0]  页内偏移
88  |                 |         |         |         +-> [20:12] L3 索引
89  |                 |         |         +-----------> [29:21] L2 索引
90  |                 |         +---------------------> [38:30] L1 索引
91  |                 +-------------------------------> [47:39] L0 索引
92  +-------------------------------------------------> [63] TTBR0/1
93
94
95 64KB 页大小的转换表查找:
96
97 +--------+--------+--------+--------+--------+--------+--------+--------+
98 |63    56|55    48|47    40|39    32|31    24|23    16|15     8|7      0|
99 +--------+--------+--------+--------+--------+--------+--------+--------+
100  |                 |    |               |              |
101  |                 |    |               |              v
102  |                 |    |               |            [15:0]  页内偏移
103  |                 |    |               +----------> [28:16] L3 索引
104  |                 |    +--------------------------> [41:29] L2 索引
105  |                 +-------------------------------> [47:42] L1 索引
106  +-------------------------------------------------> [63] TTBR0/1
107
108
109 当使用 KVM 时, 管理程序(hypervisor)在 EL2 中通过相对内核虚拟地址的
110 一个固定偏移来映射内核页(内核虚拟地址的高 24 位设为零):
111
112 起始地址                    结束地址                    大小          用途
113 -----------------------------------------------------------------------
114 0000004000000000        0000007fffffffff         256GB          在 HYP 中映射的内核对象