Build HELLO page tables from unused memory instead of scratch buffer

This commit is contained in:
josh committed 2022-11-02 22:49:42 -04:00
1 parent 0b326e2e36
commit 8aa01ba122
4 files changed
+99 -75

No files matched your search

+1 -6
View File
@@ -33,6 +33,7 @@ struct BootInfo
enum Type
{
Reserved,
Bootloader,
Conventional,
Unusable,
ACPIReclaim,
@@ -68,12 +69,6 @@ struct BootInfo
/* Physical address of stack while jumping to HULK. */
ulong stack_phys;
/* Physical address of page tables while jumping to HULK. */
ulong pt_phys;
/* Size of page tables while jumping to HULK. */
ulong pt_size;
/* Physical address of ACPI XSDT table. */
ulong acpi_xsdt_phys;
}
+3 -3
View File
@@ -53,12 +53,11 @@ struct hippo
public static void initialize(HulkHeader * header)
{
size_t usable_memory;
ulong[2][5] reserved = [
ulong[2][4] reserved = [
[header.bootinfo.hulk_phys, cast(ulong)header.total_size - LinkerAddresses.hulk_bss_size],
[header.bootinfo.bss_phys, LinkerAddresses.hulk_bss_size],
[header.bootinfo.stack_phys, header.stack_size],
[cast(ulong)header.bootinfo.fb.buffer, header.bootinfo.fb.height * header.bootinfo.fb.stride * 4u],
[header.bootinfo.pt_phys, header.bootinfo.pt_size],
];
for (size_t ri = 0u; ri < reserved.length; ri++)
{
@@ -66,7 +65,8 @@ struct hippo
}
for (size_t bii = 0u; bii < header.bootinfo.memory_map_count; bii++)
{
if (header.bootinfo.memory_map[bii].type == BootInfo.MemoryRegion.Type.Conventional)
if ((header.bootinfo.memory_map[bii].type == BootInfo.MemoryRegion.Type.Bootloader) ||
(header.bootinfo.memory_map[bii].type == BootInfo.MemoryRegion.Type.Conventional))
{
ulong phys = header.bootinfo.memory_map[bii].base;
ulong phys_end = phys + header.bootinfo.memory_map[bii].size;