HELLO: Zero out page tables after allocating, before using

This commit is contained in:
Josh Holtrop 2022-03-18 21:21:00 -04:00
parent 05cc2da2e3
commit 3e25ab6ae4

View File

@ -4,6 +4,7 @@ import scratch;
import hulk.bootinfo; import hulk.bootinfo;
import hos.page_table; import hos.page_table;
import hos.cpu; import hos.cpu;
import hos.memory;
__gshared EFI_SYSTEM_TABLE * st; __gshared EFI_SYSTEM_TABLE * st;
__gshared BootInfo bootinfo; __gshared BootInfo bootinfo;
@ -124,7 +125,9 @@ private bool get_memory_map()
private PageTableEntry * new_page_table() private PageTableEntry * new_page_table()
{ {
return cast(PageTableEntry *)scratch_alloc(1u); PageTableEntry * pt = cast(PageTableEntry *)scratch_alloc(1u);
memset64(pt, 0u, 512);
return pt;
} }
private void map(ulong source_page, ulong dest_page, PageTableEntry * pt_base) private void map(ulong source_page, ulong dest_page, PageTableEntry * pt_base)