|
18 | 18 | #include <asm/asm-offsets.h>
|
19 | 19 | #include <asm/msr.h>
|
20 | 20 | #include <asm/page_types.h>
|
| 21 | +#include <asm/pgtable_types.h> |
21 | 22 | #include <asm/processor-flags.h>
|
22 | 23 | #include <asm/segment.h>
|
23 | 24 | #include <asm/setup.h>
|
@@ -52,6 +53,9 @@ SYM_FUNC_START(startup_64_mixed_mode)
|
52 | 53 | mov 0(%rdx), %edi
|
53 | 54 | mov 4(%rdx), %esi
|
54 | 55 |
|
| 56 | + leaq (pte + 5 * PAGE_SIZE)(%rip), %rax |
| 57 | + movq %rax, %cr3 // reload after startup_32 |
| 58 | + |
55 | 59 | /* Switch to the firmware's stack */
|
56 | 60 | movl efi32_boot_sp(%rip), %esp
|
57 | 61 | andl $~7, %esp
|
@@ -267,11 +271,32 @@ SYM_FUNC_START_LOCAL(efi32_entry)
|
267 | 271 | movl $_end - 1b, BP_init_size(%esi)
|
268 | 272 | subl $startup_32 - 1b, BP_init_size(%esi)
|
269 | 273 |
|
| 274 | + call 1f |
| 275 | +1: pop %edi |
| 276 | + |
270 | 277 | /* Disable paging */
|
271 | 278 | movl %cr0, %eax
|
272 | 279 | btrl $X86_CR0_PG_BIT, %eax
|
273 | 280 | movl %eax, %cr0
|
274 | 281 |
|
| 282 | + /* Set up 1:1 mapping */ |
| 283 | + leal (pte - 1b)(%edi), %eax |
| 284 | + movl $_PAGE_PRESENT | _PAGE_RW | _PAGE_PSE, %ecx |
| 285 | + leal (_PAGE_PRESENT | _PAGE_RW)(%eax), %edx |
| 286 | +2: movl %ecx, (%eax) |
| 287 | + addl $8, %eax |
| 288 | + addl $PMD_SIZE, %ecx |
| 289 | + jnc 2b |
| 290 | + |
| 291 | + movl $PAGE_SIZE, %ecx |
| 292 | + .irpc l, 0123 |
| 293 | + movl %edx, \l * 8(%eax) |
| 294 | + addl %ecx, %edx |
| 295 | + .endr |
| 296 | + addl %ecx, %eax |
| 297 | + movl %edx, (%eax) |
| 298 | + movl %eax, %cr3 |
| 299 | + |
275 | 300 | jmp startup_32
|
276 | 301 | SYM_FUNC_END(efi32_entry)
|
277 | 302 |
|
@@ -322,3 +347,7 @@ SYM_DATA_LOCAL(efi32_boot_ds, .word 0)
|
322 | 347 | SYM_DATA_LOCAL(efi32_boot_sp, .long 0)
|
323 | 348 | SYM_DATA_LOCAL(efi32_boot_args, .long 0, 0, 0)
|
324 | 349 | SYM_DATA(efi_is64, .byte 1)
|
| 350 | + |
| 351 | + .bss |
| 352 | + .balign PAGE_SIZE |
| 353 | +SYM_DATA_LOCAL(pte, .fill 6 * PAGE_SIZE, 1, 0) |
0 commit comments