Check for a funny bug

Sometimes first and last pages in extend_heap don't get properly mapped...
They're there according to qemu's info tlb... But are they really? After reloading CR3 they seem to appear properly.
Debugging with qemu reply produced one replay in which the bug disappeared when trying to debug it... So it cannot be excluded that it's a qemu bug...
This commit is contained in:
2024-03-31 17:39:57 +02:00
parent b233a92f0f
commit da050e7b04
2 changed files with 11 additions and 4 deletions

View File

@@ -47,6 +47,13 @@ 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

@@ -62,8 +62,8 @@ SECTIONS
} :data
/* Discard .note.* and .eh_frame since they may cause issues on some hosts. */
/DISCARD/ : {
*(.eh_frame)
*(.note .note.*)
}
/* /DISCARD/ : {*/
/* *(.eh_frame)*/
/* *(.note .note.*)*/
/* }*/
}