Commit d6a41f1
x86/startup_64: Simplify calculation of initial page table address
Determining the address of the initial page table to program into CR3
involves:
- taking the physical address
- adding the SME encryption mask
On the primary entry path, the code is mapped using a 1:1 virtual to
physical translation, so the physical address can be taken directly
using a RIP-relative LEA instruction.
On the secondary entry path, the address can be obtained by taking the
offset from the virtual kernel base (__START_kernel_map) and adding the
physical kernel base.
This is implemented in a slightly confusing way, so clean this up.
Signed-off-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Tested-by: Tom Lendacky <[email protected]>
Link: https://lore.kernel.org/r/[email protected]1 parent 63bed96 commit d6a41f1
1 file changed
+7
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| |||
126 | 124 | | |
127 | 125 | | |
128 | 126 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 127 | | |
136 | 128 | | |
137 | 129 | | |
| |||
171 | 163 | | |
172 | 164 | | |
173 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
174 | 170 | | |
175 | 171 | | |
176 | 172 | | |
177 | 173 | | |
178 | 174 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 175 | + | |
182 | 176 | | |
183 | 177 | | |
184 | | - | |
185 | | - | |
186 | 178 | | |
187 | 179 | | |
188 | 180 | | |
| |||
212 | 204 | | |
213 | 205 | | |
214 | 206 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | 207 | | |
219 | 208 | | |
220 | 209 | | |
| |||
0 commit comments