mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-29 00:27:52 +01:00
Fix page invalidation
So it turns out it was a bug there
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user