Rework scratch module and use qualified names for function calls

This commit is contained in:
josh committed 2022-03-20 22:21:10 -04:00
1 parent 1e00d7a9e9
commit b40151055c
2 files changed
+26 -12

No files matched your search

+6 -7
View File
@@ -2,7 +2,7 @@ module hello.hello;
import uefi;
import console = hello.console;
import hello.scratch;
import scratch = hello.scratch;
import hulk.bootinfo;
import hos.page_table;
import hos.cpu;
@@ -28,9 +28,9 @@ private bool in_qemu()
private bool set_graphics_mode()
{
uint max_horizontal_resolution = in_qemu() ? 1920u : 0xFFFFFFFFu;
UINTN buffer_size = scratch_free();
UINTN buffer_size = scratch.free();
EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
EFI_HANDLE * handles = cast(EFI_HANDLE *)scratch_current();
EFI_HANDLE * handles = cast(EFI_HANDLE *)scratch.current();
EFI_STATUS status = st.BootServices.LocateHandle(ByProtocol,
&gop_guid, null, &buffer_size, handles);
if (status != EFI_SUCCESS)
@@ -84,10 +84,10 @@ private bool set_graphics_mode()
private ulong get_memory_map()
{
UINTN memory_map_size = scratch_free();
UINTN memory_map_size = scratch.free();
UINTN descriptor_size;
UINT32 descriptor_version;
ubyte * scratch_base = scratch_current();
ubyte * scratch_base = scratch.current();
UINTN status = st.BootServices.GetMemoryMap(
&memory_map_size,
cast(EFI_MEMORY_DESCRIPTOR *)scratch_base,
@@ -134,7 +134,7 @@ private ulong get_memory_map()
private PageTableEntry * new_page_table()
{
PageTableEntry * pt = cast(PageTableEntry *)scratch_alloc(1u);
PageTableEntry * pt = cast(PageTableEntry *)scratch.alloc(1u);
memset64(pt, 0u, 512);
return pt;
}
@@ -257,7 +257,6 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
console.writeln("HELLO, HOS EFI Lightweight LOader, v0.1.0");
console.writeln("Firmware vendor: '%S', version: 0x%x", st.FirmwareVendor, st.FirmwareVendor);
wait_key();
if (!set_graphics_mode())
{