Add HULK header; map virtual memory for HULK bss section
This commit is contained in:
1 parent
c58284761a
commit
15559b0a56
5 files changed
+59
-20
No files matched your search
+10
-7
@@ -7,6 +7,7 @@ import uefi;
|
||||
import console = hello.console;
|
||||
import scratch = hello.scratch;
|
||||
import hulk.bootinfo;
|
||||
import hulk.header : HulkHeader = Header;
|
||||
import hos.page_table;
|
||||
import hos.cpu;
|
||||
import hos.memory;
|
||||
@@ -14,8 +15,7 @@ import hos.memory;
|
||||
__gshared EFI_SYSTEM_TABLE * st;
|
||||
private __gshared BootInfo bootinfo;
|
||||
private __gshared UINTN memory_map_key;
|
||||
extern extern(C) __gshared ubyte hulk_start;
|
||||
extern extern(C) __gshared ubyte hulk_end;
|
||||
extern extern(C) __gshared ubyte hulk_bin_start;
|
||||
|
||||
/**
|
||||
* Detect if we're running in QEMU.
|
||||
@@ -237,8 +237,10 @@ private void map2m(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)
|
||||
ulong phys = cast(ulong)&hulk_bin_start;
|
||||
HulkHeader * hulk_header = cast(HulkHeader *)&hulk_bin_start;
|
||||
size_t end_phys = phys + cast(size_t)hulk_header.total_size;
|
||||
while (phys < end_phys)
|
||||
{
|
||||
map4k(virt, phys, pt_base);
|
||||
virt += 4096u;
|
||||
@@ -272,8 +274,8 @@ private void build_page_tables(ulong max_physical_address)
|
||||
}
|
||||
}
|
||||
/* Map graphics framebuffer. */
|
||||
ulong framebuffer_size = bootinfo.fb.height * bootinfo.fb.stride;
|
||||
for (size_t offset = 0u; offset < framebuffer_size; offset++)
|
||||
ulong framebuffer_size = bootinfo.fb.height * bootinfo.fb.stride * 4u;
|
||||
for (size_t offset = 0u; offset < framebuffer_size; offset += 4096u)
|
||||
{
|
||||
ulong addr = cast(ulong)bootinfo.fb.buffer + offset;
|
||||
map4k(addr, addr, pt_base);
|
||||
@@ -289,7 +291,8 @@ private void build_page_tables(ulong max_physical_address)
|
||||
*/
|
||||
private void jump_to_hulk()
|
||||
{
|
||||
void function(BootInfo *) hulk_start = cast(void function(BootInfo *))HULK_VIRTUAL_START;
|
||||
HulkHeader * hulk_header = cast(HulkHeader *)&hulk_bin_start;
|
||||
void function(BootInfo *) hulk_start = cast(void function(BootInfo *))hulk_header.entry;
|
||||
hulk_start(&bootinfo);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user