Fix page invalidation

So it turns out it was a bug there
This commit is contained in:
2024-04-03 22:33:11 +02:00
parent 3fd356138b
commit 5b857af041
2 changed files with 2 additions and 9 deletions

View File

@@ -47,13 +47,6 @@ static void extend_heap(size_t n_pages) {
void *p = get4k();
assert2(p != NULL, "Kernel out of memory!");
KERN_AddressSpace->map((void *) KERN_HeapEnd, (void *) HHDM_V2P(p), PAGE_RW);
volatile char *bugcheck2 = (volatile char *) KERN_HeapEnd;
for (size_t i = 0; i < PAGE_SIZE; i++) {
bugcheck2[i] = '\xff';
}
for (size_t i = 0; i < PAGE_SIZE; i++) {
assert2(bugcheck2[i] == '\xff', "I am insane");
}
KERN_HeapEnd += PAGE_SIZE;
}
allocated.fetch_add(n_pages * PAGE_SIZE);

View File

@@ -133,7 +133,7 @@ int AddressSpace::map(void *virt, void *real, uint32_t flags) {
uint64_t *ptsb = (uint64_t *) HHDM_P2V((*pdee & 0x000FFFFFFFFFF000ULL));
uint64_t *ptse = &ptsb[ptsi];
*ptse = ((uint64_t) real & 0x000FFFFFFFFFF000ULL) | (flags & 0xFFF) | PAGE_PRESENT;
invlpg((void *) ((uint64_t) virt & 0x000FFFFFFFFFF000ULL));
invlpg(virt);
return 1;
}
int AddressSpace::unmap(void *virt) {
@@ -167,7 +167,7 @@ int AddressSpace::unmap(void *virt) {
uint64_t *ptse = &ptsb[ptsi];
assert(*ptse & PAGE_PRESENT);
*ptse = (*ptse) & (~PAGE_PRESENT);
invlpg((void *) ((uint64_t) virt & 0x000FFFFFFFFFF000ULL));
invlpg(virt);
return 1;
}
FDT *AddressSpace::getFdt() {