Commit 6b21624a authored by John Hodge's avatar John Hodge
Browse files

UEFI Bootloader - Upgrade

parent ed649dec
......@@ -85,8 +85,8 @@ impl SimpleTextOutputInterface
#[derive(Default)]
pub struct InputKey
{
scan_code: u16,
unicode_char: u16,
pub scan_code: u16,
pub unicode_char: u16,
}
#[repr(C)]
......
......@@ -13,7 +13,6 @@
#![no_std]
#![crate_name="uefi"]
#![crate_type="lib"]
#![feature(unique)]
#![feature(try_trait)] // Makes Status a little easier to use
#![feature(ptr_internals)] // rawptr as_ref
......@@ -94,6 +93,9 @@ impl<T> ::core::ops::Deref for SizePtr<T>
}
}
// TODO: Have a SystemTablePtr structure that exposes the various boot services as borrows only
// - BUT: The only way to call ExitBootServices is to consume it
#[repr(C)]
/// System Table (top-level EFI structure)
///
......
......@@ -21,7 +21,7 @@ clean:
@echo [LD] -o [email protected]
$Vx86_64-efi-pe-ld -g -r -o [email protected] -e efi_main $(OBJS) --strip-discarded --gc-sections --allow-multiple-definition
$(TARGET_DIR)libbootloader_uefi.a: .obj/libstubs.a $(TARGET_FILE)
$(TARGET_DIR)libbootloader_uefi.a: .obj/libstubs.a $(TARGET_FILE) .PHONY
@echo [XARGO] build
$VRUSTFLAGS="$(RUSTFLAGS)" RUST_TARGET_PATH=$(abspath .) $(XARGO) build --target=$(TARGET_NAME) --release
......
......@@ -2,8 +2,8 @@
//
//
#![feature(asm)]
#![feature(proc_macro, proc_macro_non_items)] // utf16_literal
#![feature(panic_implementation,panic_info_message)]
#![feature(proc_macro_hygiene)] // utf16_literal
#![feature(panic_info_message)]
#![no_std]
use uefi::boot_services::protocols;
......@@ -91,6 +91,7 @@ pub extern "win64" fn efi_main(image_handle: ::uefi::Handle, system_table: &::ue
let system_volume_fs: &protocols::SimpleFileSystem = boot_services.handle_protocol(&image_proto.device_handle).expect("image_proto - FileProtocol");
// - Get the root of this volume and load the bootloader configuration file from it
let system_volume_root = system_volume_fs.open_volume().expect("system_volume_fs - File");
// NOTE: This function will return Ok(Default::default()) if the file can't be found
let config = match Configuration::from_file(boot_services, &system_volume_root, PATH_CONFIG.into())
{
Ok(c) => c,
......@@ -133,6 +134,7 @@ pub extern "win64" fn efi_main(image_handle: ::uefi::Handle, system_table: &::ue
(map_key, map)
};
loge!(conout, "- Exiting boot services");
//let runtime_services = system_table_ptr.exit_boot_services().ok().expect("exit_boot_services");
// SAFE: Weeelll...
unsafe {
(boot_services.exit_boot_services)(image_handle, map_key).expect("exit_boot_services");
......@@ -211,10 +213,8 @@ fn load_kernel_file(boot_services: &::uefi::boot_services::BootServices, sys_vol
}
#[panic_implementation]
// NOTE: Needs to be public and no_mangle (rust#51342)
#[no_mangle]
pub fn handle_panic(info: &::core::panic::PanicInfo) -> ! {
#[panic_handler]
fn handle_panic(info: &::core::panic::PanicInfo) -> ! {
static mut NESTED: bool = false;
unsafe {
if NESTED {
......
......@@ -8,7 +8,7 @@
"target-c-int-width": "32",
"os": "tifflin",
"arch": "x86_64",
"pre-link-args": [],
"pre-link-args": {},
"no-compiler-rt": true,
"disable-redzone": true,
"eliminate-frame-pointer": false,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment