diff --git a/src/hello/hello.d b/src/hello/hello.d index cd389ac..566a0cf 100644 --- a/src/hello/hello.d +++ b/src/hello/hello.d @@ -9,6 +9,8 @@ import hos.memory; __gshared EFI_SYSTEM_TABLE * st; __gshared BootInfo bootinfo; __gshared UINTN memory_map_key; +extern extern(C) __gshared ubyte hulk_start; +extern extern(C) __gshared ubyte hulk_end; private void wait_key() { @@ -160,6 +162,18 @@ private void map(ulong source_page, ulong dest_page, PageTableEntry * pt_base) } } +private void map_hulk(PageTableEntry * pt_base) +{ + ulong virt = HULK_VIRTUAL_START; + ulong phys = cast(ulong)&hulk_start; + while (phys < cast(ulong)&hulk_end) + { + map(virt, phys, pt_base); + virt += 4096u; + phys += 4096u; + } +} + private void build_page_tables() { PageTableEntry * pt_base = new_page_table(); @@ -173,6 +187,7 @@ private void build_page_tables() map(page_addr, page_addr, pt_base); } } + map_hulk(pt_base); write_cr3(cast(ulong)pt_base); }