Rename hello.output to hello.console

This commit is contained in:
josh committed 2022-03-20 22:12:46 -04:00
1 parent 79b34477ed
commit 1e00d7a9e9
2 files changed
+69 -24

No files matched your search

+14 -23
View File
@@ -1,7 +1,7 @@
module hello.hello;
import uefi;
import hello.output;
import console = hello.console;
import hello.scratch;
import hulk.bootinfo;
import hos.page_table;
@@ -14,16 +14,6 @@ __gshared UINTN memory_map_key;
extern extern(C) __gshared ubyte hulk_start;
extern extern(C) __gshared ubyte hulk_end;
private void wait_key()
{
writeln("Press any key...");
st.ConIn.Reset(st.ConIn, FALSE);
EFI_INPUT_KEY key;
while (st.ConIn.ReadKeyStroke(st.ConIn, &key) == EFI_NOT_READY)
{
}
}
private bool in_qemu()
{
ulong * firmware_vendor = cast(ulong *) st.FirmwareVendor;
@@ -45,7 +35,7 @@ private bool set_graphics_mode()
&gop_guid, null, &buffer_size, handles);
if (status != EFI_SUCCESS)
{
writeln("LocateHandle: error %x", status);
console.writeln("LocateHandle: error %x", status);
return false;
}
EFI_HANDLE gop_handle = handles[0];
@@ -54,12 +44,12 @@ private bool set_graphics_mode()
&gop_guid, &gop_interface);
if (status != EFI_SUCCESS)
{
writeln("HandleProtocol: error %x", status);
console.writeln("HandleProtocol: error %x", status);
return false;
}
if (gop_interface == null)
{
writeln("null interface from HandleProtocol");
console.writeln("null interface from HandleProtocol");
return false;
}
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop = cast(EFI_GRAPHICS_OUTPUT_PROTOCOL *)gop_interface;
@@ -81,7 +71,7 @@ private bool set_graphics_mode()
}
if ((status = gop.SetMode(gop, best_mode_number)) != EFI_SUCCESS)
{
writeln("SetMode: Error %x\n", status);
console.writeln("SetMode: Error %x\n", status);
return false;
}
bootinfo.fb.buffer = cast(uint *)gop.Mode.FrameBufferBase;
@@ -106,7 +96,7 @@ private ulong get_memory_map()
&descriptor_version);
if (status != EFI_SUCCESS)
{
writeln("GetMemoryMap: Error %x", status);
console.writeln("GetMemoryMap: Error %x", status);
return 0u;
}
ulong max_physical_address;
@@ -116,7 +106,7 @@ private ulong get_memory_map()
{
if (count > bootinfo.memory_map.length)
{
writeln("Memory map too large");
console.writeln("Memory map too large");
for (;;)
{
}
@@ -263,14 +253,15 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
{
.st = st;
st.ConOut.ClearScreen(st.ConOut);
console.clear();
writeln("HELLO, HOS EFI Lightweight LOader, v0.1.0");
writeln("Firmware vendor: '%S', version: 0x%x", st.FirmwareVendor, st.FirmwareVendor);
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())
{
wait_key();
console.wait_key();
return EFI_SUCCESS;
}
@@ -288,8 +279,8 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st)
{
break;
}
writeln("ExitBootServices: Error %x", status);
wait_key();
console.writeln("ExitBootServices: Error %x", status);
console.wait_key();
return EFI_SUCCESS;
}