Truly enable virtual memory.

Map is still identity-mapped. I think we need to sort and/or clean up
the map before using a higher half address. In-kernel vga output not
working yet, but do_the_set_registers() is getting called.
This commit is contained in:
Justin C. Miller
2018-03-25 13:51:32 -07:00
parent 417f080993
commit 64a6d88e5c
5 changed files with 52 additions and 35 deletions

View File

@@ -38,16 +38,6 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
// From here on out, use CHECK_EFI_STATUS_OR_FAIL instead
// because the console is now set up
// Get info about the image
/*
con_status_begin(L"Gathering image information...");
EFI_LOADED_IMAGE *info = 0;
EFI_GUID image_proto = EFI_LOADED_IMAGE_PROTOCOL_GUID;
status = ST->BootServices->HandleProtocol(ImageHandle, &image_proto, (void **)&info);
CHECK_EFI_STATUS_OR_FAIL(status);
con_status_ok();
*/
con_status_begin(L"Loading kernel into memory...");
void *kernel_image = NULL;
uint64_t kernel_length = 0;
@@ -68,13 +58,12 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
version->gitsha & 0x0fffffff,
version->gitsha & 0xf0000000 ? "*" : ""
);
Print(L"\n Entrypoint %d", version->entrypoint);
void (*kernel_main)() = version->entrypoint;
con_status_ok();
//memory_dump_map();
// memory_dump_map();
con_status_begin(L"Exiting boot services...");
UINTN memmap_size = 0, memmap_key = 0;
@@ -97,14 +86,12 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
CHECK_EFI_STATUS_OR_FAIL(status);
status = ST->BootServices->ExitBootServices(ImageHandle, memmap_key);
CHECK_EFI_STATUS_OR_FAIL(status);
CHECK_EFI_STATUS_OR_ASSERT(status, 0);
status = memory_virtualize(
&kernel_image,
memory_map, memmap_size,
desc_size, desc_version);
CHECK_EFI_STATUS_OR_FAIL(status);
CHECK_EFI_STATUS_OR_ASSERT(status, 0);
kernel_main();
return EFI_LOAD_ERROR;