aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/translations/zh_TW/arch/arm64/memory.txt
blob: 6ee2239c293fa6885491b231c41cb5141c07357a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
SPDX-License-Identifier: GPL-2.0

Chinese translated version of Documentation/arch/arm64/memory.rst

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.

Maintainer: Catalin Marinas <catalin.marinas@arm.com>
Chinese maintainer: Fu Wei <wefu@redhat.com>
Traditional Chinese maintainer: Hu Haowen <2023002089@link.tyut.edu.cn>
---------------------------------------------------------------------
Documentation/arch/arm64/memory.rst 的中文翻譯

如果想評論或更新本文的內容,請直接聯繫原文檔的維護者。如果你使用英文
交流有困難的話,也可以向中文版維護者求助。如果本翻譯更新不及時或者翻
譯存在問題,請聯繫中文版維護者。

本文翻譯提交時的 Git 檢出點爲: bc465aa9d045feb0e13b4a8f32cc33c1943f62d6

英文版維護者: Catalin Marinas <catalin.marinas@arm.com>
中文版維護者: 傅煒  Fu Wei <wefu@redhat.com>
中文版翻譯者: 傅煒  Fu Wei <wefu@redhat.com>
中文版校譯者: 傅煒  Fu Wei <wefu@redhat.com>
繁體中文版校譯者: 胡皓文  Hu Haowen <2023002089@link.tyut.edu.cn>

以下爲正文
---------------------------------------------------------------------
		     Linux 在 AArch64 中的內存佈局
		     ===========================

作者: Catalin Marinas <catalin.marinas@arm.com>

本文檔描述 AArch64 Linux 內核所使用的虛擬內存佈局。此構架可以實現
頁大小爲 4KB 的 4 級轉換表和頁大小爲 64KB 的 3 級轉換表。

AArch64 Linux 使用 3 級或 4 級轉換表,其頁大小配置爲 4KB,對於用戶和內核
分別都有 39-bit (512GB) 或 48-bit (256TB) 的虛擬地址空間。
對於頁大小爲 64KB的配置,僅使用 2 級轉換表,有 42-bit (4TB) 的虛擬地址空間,但內存佈局相同。

用戶地址空間的 63:48 位爲 0,而內核地址空間的相應位爲 1。TTBRx 的
選擇由虛擬地址的 63 位給出。swapper_pg_dir 僅包含內核(全局)映射,
而用戶 pgd 僅包含用戶(非全局)映射。swapper_pg_dir 地址被寫入
TTBR1 中,且從不寫入 TTBR0。


AArch64 Linux 在頁大小爲 4KB,並使用 3 級轉換表時的內存佈局:

起始地址			結束地址			大小		用途
-----------------------------------------------------------------------
0000000000000000	0000007fffffffff	 512GB		用戶空間
ffffff8000000000	ffffffffffffffff	 512GB		內核空間


AArch64 Linux 在頁大小爲 4KB,並使用 4 級轉換表時的內存佈局:

起始地址			結束地址			大小		用途
-----------------------------------------------------------------------
0000000000000000	0000ffffffffffff	 256TB		用戶空間
ffff000000000000	ffffffffffffffff	 256TB		內核空間


AArch64 Linux 在頁大小爲 64KB,並使用 2 級轉換表時的內存佈局:

起始地址			結束地址			大小		用途
-----------------------------------------------------------------------
0000000000000000	000003ffffffffff	   4TB		用戶空間
fffffc0000000000	ffffffffffffffff	   4TB		內核空間


AArch64 Linux 在頁大小爲 64KB,並使用 3 級轉換表時的內存佈局:

起始地址			結束地址			大小		用途
-----------------------------------------------------------------------
0000000000000000	0000ffffffffffff	 256TB		用戶空間
ffff000000000000	ffffffffffffffff	 256TB		內核空間


更詳細的內核虛擬內存佈局,請參閱內核啓動信息。


4KB 頁大小的轉換表查找:

+--------+--------+--------+--------+--------+--------+--------+--------+
|63    56|55    48|47    40|39    32|31    24|23    16|15     8|7      0|
+--------+--------+--------+--------+--------+--------+--------+--------+
 |                 |         |         |         |         |
 |                 |         |         |         |         v
 |                 |         |         |         |   [11:0]  頁內偏移
 |                 |         |         |         +-> [20:12] L3 索引
 |                 |         |         +-----------> [29:21] L2 索引
 |                 |         +---------------------> [38:30] L1 索引
 |                 +-------------------------------> [47:39] L0 索引
 +-------------------------------------------------> [63] TTBR0/1


64KB 頁大小的轉換表查找:

+--------+--------+--------+--------+--------+--------+--------+--------+
|63    56|55    48|47    40|39    32|31    24|23    16|15     8|7      0|
+--------+--------+--------+--------+--------+--------+--------+--------+
 |                 |    |               |              |
 |                 |    |               |              v
 |                 |    |               |            [15:0]  頁內偏移
 |                 |    |               +----------> [28:16] L3 索引
 |                 |    +--------------------------> [41:29] L2 索引
 |                 +-------------------------------> [47:42] L1 索引
 +-------------------------------------------------> [63] TTBR0/1


當使用 KVM 時, 管理程序(hypervisor)在 EL2 中通過相對內核虛擬地址的
一個固定偏移來映射內核頁(內核虛擬地址的高 24 位設爲零):

起始地址			結束地址			大小		用途
-----------------------------------------------------------------------
0000004000000000	0000007fffffffff	 256GB		在 HYP 中映射的內核對象