add: memory test

This commit is contained in:
Starnakin 2024-11-26 14:16:46 +01:00
parent 8203b36092
commit 773f55466e

View File

@ -69,11 +69,25 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
// PRINT_PTR(alloc_frame()); // PRINT_PTR(alloc_frame());
if (false) { if (false) {
void *ptr; void *start = alloc_pages(1);
while ((ptr = alloc_pages(PAGE_SIZE * 1))) { int *ptr;
if (ptr) uint32_t i;
memset(ptr, ~0, PAGE_SIZE * 1); for (i = 1; (ptr = alloc_pages(PAGE_SIZE)); i++) {
*ptr = i;
if (i == 4096)
break;
} }
uint16_t bozo = 0;
for (uint32_t j = 1; j < i - 1; j++) {
ptr = start + j * PAGE_SIZE;
if (*ptr != j) {
bozo++;
if (bozo == 12)
break;
}
kprintf("j=%d %p: %d\n", j, ptr, *ptr);
}
} else { } else {
while (vmalloc(10)) while (vmalloc(10))
; ;