summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/32/paging.c
diff options
context:
space:
mode:
authordzwdz2022-08-01 16:33:44 +0200
committerdzwdz2022-08-01 20:35:49 +0200
commit6a85c6ede66f723e1415552482e1c6640653efa2 (patch)
treebb3790a2d1f42d9cf3c69654f20cbd53cc929038 /src/kernel/arch/amd64/32/paging.c
parent24a5f2bf46432aef70fd8d2ebf6c7ba94a6ce5a2 (diff)
amd64: /video/b device, provided by grub
Diffstat (limited to 'src/kernel/arch/amd64/32/paging.c')
-rw-r--r--src/kernel/arch/amd64/32/paging.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/kernel/arch/amd64/32/paging.c b/src/kernel/arch/amd64/32/paging.c
index f33168d..16c3526 100644
--- a/src/kernel/arch/amd64/32/paging.c
+++ b/src/kernel/arch/amd64/32/paging.c
@@ -8,7 +8,7 @@ __attribute__((aligned(4096)))
static pe_generic_t pdpte_low[512]; // 0-512gb
__attribute__((aligned(4096)))
-static pe_generic_t pde_low[512]; // 0-1gb
+static pe_generic_t pde_low[4][512]; // 4 * 0-1gb
void pml4_identity_init(void) {
memset32(pml4_identity, 0, sizeof pml4_identity);
@@ -21,18 +21,20 @@ void pml4_identity_init(void) {
.address = ((uintptr_t)pdpte_low) >> 12,
};
- pdpte_low[0] = (pe_generic_t) {
- .present = 1,
- .writeable = 1,
- .address = ((uintptr_t)pde_low) >> 12,
- };
-
- for (int i = 0; i < 512; i++) {
- pde_low[i] = (pe_generic_t) {
+ for (int i = 0; i < 4; i++) {
+ pdpte_low[i] = (pe_generic_t) {
.present = 1,
.writeable = 1,
- .large = 1,
- .address = (i * 2 * 1024 * 1024) >> 12,
+ .address = ((uintptr_t)&pde_low[i]) >> 12,
};
+
+ for (int j = 0; j < 512; j++) {
+ pde_low[i][j] = (pe_generic_t) {
+ .present = 1,
+ .writeable = 1,
+ .large = 1,
+ .address = (i * 512 + j) << 9,
+ };
+ }
}
}