diff --git a/src/common/hos/page_table.d b/src/common/hos/page_table.d new file mode 100644 index 0000000..17f9346 --- /dev/null +++ b/src/common/hos/page_table.d @@ -0,0 +1,23 @@ +struct PageTableEntry +{ + ulong entry; + + this(ulong address, ulong no_execute, ulong global, + ulong huge, ulong disable_cache, ulong write_through, ulong user, + ulong writable, ulong present) + { + entry = (present | + (writable << 1) | + (user << 2) | + (write_through << 3) | + (disable_cache << 4) | + (huge << 7) | + (global << 8) | + (no_execute << 63)) | address; + } + + bool present() + { + return (entry & 0x1u) != 0u; + } +} diff --git a/src/hello/hello.d b/src/hello/hello.d index 5d8f617..3cd2ecb 100644 --- a/src/hello/hello.d +++ b/src/hello/hello.d @@ -2,6 +2,7 @@ import uefi; import output; import scratch; import hulk.bootinfo; +import hos.page_table; __gshared EFI_SYSTEM_TABLE * st; __gshared BootInfo bootinfo; @@ -129,6 +130,9 @@ extern (C) EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * st) writeln("HELLO, HOS EFI Lightweight LOader, v0.1.0"); writeln("Firmware vendor: '%S', version: 0x%x", st.FirmwareVendor, st.FirmwareVendor); + PageTableEntry * pte = cast(PageTableEntry *)scratch_alloc(1u); + wait_key(); + if (!set_graphics_mode()) { wait_key();