mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-12 14:56:48 +00:00
Fallback to regular paging for the boot pagetable
This commit is contained in:
parent
503252e8e8
commit
fb884cd038
@ -177,26 +177,48 @@ PTE_GLOBAL = (1 << 8)
|
|||||||
|
|
||||||
// Page Directory: map to low 1 GiB * 4 space
|
// Page Directory: map to low 1 GiB * 4 space
|
||||||
lea edi, [boot_pd]
|
lea edi, [boot_pd]
|
||||||
mov eax, (PTE_PRESENT | PTE_WRITE | PTE_GLOBAL | PTE_HUGE) // Map offset 0.
|
lea eax, [boot_pt + (PTE_PRESENT | PTE_WRITE | PTE_GLOBAL)]
|
||||||
mov ecx, 512 * 4 // (of entries in PD) * (number of PD)
|
mov ecx, 512 * 4 // (of entries in PD) * (number of PD)
|
||||||
write_pd_entry:
|
write_pd_entry:
|
||||||
mov dword ptr [edi], eax
|
mov dword ptr [edi], eax
|
||||||
mov dword ptr [edi + 4], 0
|
mov dword ptr [edi + 4], 0
|
||||||
add eax, 0x200000 // +2MiB
|
add eax, 0x1000 // +4KiB to next table
|
||||||
add edi, 8
|
add edi, 8
|
||||||
loop write_pd_entry
|
loop write_pd_entry
|
||||||
|
|
||||||
// Page Directory: map to 1 GiB space offset 32GiB
|
// Page Directory: map to 1 GiB space offset 32GiB
|
||||||
lea edi, [boot_pd_32g]
|
lea edi, [boot_pd_32g]
|
||||||
mov eax, (PTE_PRESENT | PTE_WRITE | PTE_GLOBAL | PTE_HUGE) // Should +0x800000000 but this is 32-bit.
|
lea eax, [boot_pt_32g + (PTE_PRESENT | PTE_WRITE | PTE_GLOBAL)]
|
||||||
mov ecx, 512 // (of entries in PD)
|
mov ecx, 512 // (of entries in PD)
|
||||||
write_pd_32g_entry:
|
write_pd_32g_entry:
|
||||||
mov dword ptr [edi], eax
|
mov dword ptr [edi], eax
|
||||||
mov dword ptr [edi + 4], 0x8 // Map offset 32GiB.
|
mov dword ptr [edi + 4], 0x0
|
||||||
add eax, 0x200000 // +2MiB
|
add eax, 0x1000 // +4KiB to next table
|
||||||
add edi, 8
|
add edi, 8
|
||||||
loop write_pd_32g_entry
|
loop write_pd_32g_entry
|
||||||
|
|
||||||
|
// Page Table: map to low 1 GiB * 4 space
|
||||||
|
lea edi, [boot_pt]
|
||||||
|
mov eax, (PTE_PRESENT | PTE_WRITE | PTE_GLOBAL) // Offset 0
|
||||||
|
mov ecx, 512 * 512 * 4 // (of entries in PT) * (number of PT) * (number of PD)
|
||||||
|
write_pt_entry:
|
||||||
|
mov dword ptr [edi], eax
|
||||||
|
mov dword ptr [edi + 4], 0
|
||||||
|
add eax, 0x1000 // +4KiB
|
||||||
|
add edi, 8
|
||||||
|
loop write_pt_entry
|
||||||
|
|
||||||
|
// Page Table: map to 1 GiB space offset 32GiB
|
||||||
|
lea edi, [boot_pt_32g]
|
||||||
|
mov eax, (PTE_PRESENT | PTE_WRITE | PTE_GLOBAL) // Offset 0x8_00000000 but should write to high 32bits
|
||||||
|
mov ecx, 512 * 512 // (of entries in PT) * (number of PT)
|
||||||
|
write_pt_32g_entry:
|
||||||
|
mov dword ptr [edi], eax
|
||||||
|
mov dword ptr [edi + 4], 0x8 // Offset 0x8_00000000
|
||||||
|
add eax, 0x1000 // +4KiB
|
||||||
|
add edi, 8
|
||||||
|
loop write_pt_32g_entry
|
||||||
|
|
||||||
jmp enable_long_mode
|
jmp enable_long_mode
|
||||||
|
|
||||||
enable_long_mode:
|
enable_long_mode:
|
||||||
@ -261,8 +283,12 @@ boot_pd_2g_3g:
|
|||||||
.skip 4096
|
.skip 4096
|
||||||
boot_pd_3g_4g:
|
boot_pd_3g_4g:
|
||||||
.skip 4096
|
.skip 4096
|
||||||
|
boot_pt:
|
||||||
|
.skip 4096 * 512 * 4
|
||||||
boot_pd_32g:
|
boot_pd_32g:
|
||||||
.skip 4096
|
.skip 4096
|
||||||
|
boot_pt_32g:
|
||||||
|
.skip 4096 * 512
|
||||||
boot_page_table_end:
|
boot_page_table_end:
|
||||||
|
|
||||||
boot_stack_bottom:
|
boot_stack_bottom:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user