diff options
Diffstat (limited to 'rsdos')
| -rw-r--r-- | rsdos/src/main.rs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs index 13923ea..6dbad5f 100644 --- a/rsdos/src/main.rs +++ b/rsdos/src/main.rs | |||
| @@ -87,16 +87,10 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut | |||
| 87 | rsnix::serial::init(); | 87 | rsnix::serial::init(); |
| 88 | rsnix::serial_println!("=== rsnix boot ==="); | 88 | rsnix::serial_println!("=== rsnix boot ==="); |
| 89 | 89 | ||
| 90 | // Stash the memory map | 90 | // Locate GOP (Graphics Output Protocol) *before* the memory map is |
| 91 | let map_key = match rsnix::memory::capture_memory_map(bs) { | 91 | // captured: the heap/page allocators need to know the framebuffer |
| 92 | Ok(k) => k, | 92 | // region so they never hand out its pages (some real firmware lists |
| 93 | Err(e) => { | 93 | // it as conventional memory). |
| 94 | rsnix::serial_println!("mem: capture_memory_map failed 0x{:x}", e); | ||
| 95 | 0 | ||
| 96 | } | ||
| 97 | }; | ||
| 98 | |||
| 99 | // Locate GOP (Graphics Output Protocol) | ||
| 100 | let mut gop_interface: *mut core::ffi::c_void = core::ptr::null_mut(); | 94 | let mut gop_interface: *mut core::ffi::c_void = core::ptr::null_mut(); |
| 101 | let gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; | 95 | let gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; |
| 102 | let gop_result = unsafe { | 96 | let gop_result = unsafe { |
| @@ -108,6 +102,20 @@ pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut | |||
| 108 | }; | 102 | }; |
| 109 | if gop_result == EFI_SUCCESS { | 103 | if gop_result == EFI_SUCCESS { |
| 110 | let gop = unsafe { &mut *(gop_interface as *mut GraphicsOutputProtocol) }; | 104 | let gop = unsafe { &mut *(gop_interface as *mut GraphicsOutputProtocol) }; |
| 105 | rsnix::gop::peek_fb_region(gop); | ||
| 106 | } | ||
| 107 | |||
| 108 | // Stash the memory map | ||
| 109 | let map_key = match rsnix::memory::capture_memory_map(bs) { | ||
| 110 | Ok(k) => k, | ||
| 111 | Err(e) => { | ||
| 112 | rsnix::serial_println!("mem: capture_memory_map failed 0x{:x}", e); | ||
| 113 | 0 | ||
| 114 | } | ||
| 115 | }; | ||
| 116 | |||
| 117 | if gop_result == EFI_SUCCESS { | ||
| 118 | let gop = unsafe { &mut *(gop_interface as *mut GraphicsOutputProtocol) }; | ||
| 111 | rsnix::serial_println!("gop: framebuffer found"); | 119 | rsnix::serial_println!("gop: framebuffer found"); |
| 112 | rsnix::gop::init(gop); | 120 | rsnix::gop::init(gop); |
| 113 | } else { | 121 | } else { |
