diff --git a/Bootloaders/libuefi/src/con.rs b/Bootloaders/libuefi/src/con.rs index 84d308e9eb1623ab2635242b4ed6840ebad29286..8aeec0150242972751f50aa02ce4b69137ce9dc9 100644 --- a/Bootloaders/libuefi/src/con.rs +++ b/Bootloaders/libuefi/src/con.rs @@ -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)] diff --git a/Bootloaders/libuefi/src/lib.rs b/Bootloaders/libuefi/src/lib.rs index 0f599c55249fa60327f5a9aa75e604a0bf9eb4dc..03a5a9b1d6f250c46036c90a45a8b9cb2e6a5e34 100644 --- a/Bootloaders/libuefi/src/lib.rs +++ b/Bootloaders/libuefi/src/lib.rs @@ -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) /// diff --git a/Bootloaders/uefi/Makefile b/Bootloaders/uefi/Makefile index d47bdd09547cde08d8eafd8f3bfcea975e2ebb4c..268cd4c5d85f76f6c9b7bacc147f1e40d6bbf6cd 100644 --- a/Bootloaders/uefi/Makefile +++ b/Bootloaders/uefi/Makefile @@ -21,7 +21,7 @@ clean: @echo [LD] -o $@ $Vx86_64-efi-pe-ld -g -r -o $@ -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 diff --git a/Bootloaders/uefi/main.rs b/Bootloaders/uefi/main.rs index 37ef600cfb1abc4334c187b4e13b7ea38ca58aa0..147509dc5270d67c61c1e718e20d6e9d28b95465 100644 --- a/Bootloaders/uefi/main.rs +++ b/Bootloaders/uefi/main.rs @@ -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 { diff --git a/Bootloaders/uefi/target-uefi.json b/Bootloaders/uefi/target-uefi.json index 4450d425483348061358f32fca8e41820795605e..046c8c608af1d0935eba513e6fea6a5613428bb0 100644 --- a/Bootloaders/uefi/target-uefi.json +++ b/Bootloaders/uefi/target-uefi.json @@ -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,