From d609e6d78c1e2731b7e5512fee403607589236e8 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 18 Feb 2022 02:37:09 -0600 Subject: [PATCH] panic handler --- ableos/Cargo.lock | 12 ------------ ableos/Cargo.toml | 1 - ableos/src/allocator/mod.rs | 4 ++-- ableos/src/arch/uefi_86/mod.rs | 22 ++-------------------- ableos/src/panic.rs | 2 +- 5 files changed, 5 insertions(+), 36 deletions(-) diff --git a/ableos/Cargo.lock b/ableos/Cargo.lock index dc4d1a1..6948e42 100644 --- a/ableos/Cargo.lock +++ b/ableos/Cargo.lock @@ -48,7 +48,6 @@ dependencies = [ "spin", "uart_16550", "uefi", - "uefi-services", "unicode-width", "vga", "volatile 0.2.7", @@ -664,17 +663,6 @@ dependencies = [ "syn", ] -[[package]] -name = "uefi-services" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7840bddc6477dc443cc5652ca9683de9f10bd173691151c3160d734521bef3bd" -dependencies = [ - "cfg-if", - "log", - "uefi", -] - [[package]] name = "unicode-width" version = "0.1.9" diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index 48ee51f..ec21c27 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -122,4 +122,3 @@ x86_64 = "*" [target.'cfg(target_os = "uefi")'.dependencies] uefi = { version="*",default-features = false, features = ["exts"] } -uefi-services = "0.11.0" diff --git a/ableos/src/allocator/mod.rs b/ableos/src/allocator/mod.rs index 59dd3e8..1f164a1 100644 --- a/ableos/src/allocator/mod.rs +++ b/ableos/src/allocator/mod.rs @@ -17,11 +17,11 @@ static ALLOCATOR: Dummy = Dummy; */ use linked_list_allocator::LockedHeap; -#[cfg(not(target_os = "uefi"))] +// #[cfg(not(target_os = "uefi"))] #[global_allocator] pub static ALLOCATOR: LockedHeap = LockedHeap::empty(); -#[cfg(not(target_os = "uefi"))] +// #[cfg(not(target_os = "uefi"))] #[alloc_error_handler] fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! { panic!("allocation error: {:?}", layout) diff --git a/ableos/src/arch/uefi_86/mod.rs b/ableos/src/arch/uefi_86/mod.rs index 138bcec..6c4da4e 100644 --- a/ableos/src/arch/uefi_86/mod.rs +++ b/ableos/src/arch/uefi_86/mod.rs @@ -7,16 +7,12 @@ pub fn shutdown() { pub fn sloop() -> ! { loop {} } -use core::{ffi::c_void, sync::atomic::AtomicUsize, time::Duration}; use crate::kmain::kernel_main; use uefi::{ prelude::*, - proto::{ - console::gop::{GraphicsOutput, PixelFormat}, - pi::mp::MpServices, - }, + proto::console::gop::{GraphicsOutput, PixelFormat}, }; use uefi::{proto::console::gop::FrameBuffer, ResultExt}; @@ -26,7 +22,7 @@ fn main(_handle: Handle, mut system_table: SystemTable) -> Status { .stdout() .reset(false) .expect_success("Failed to reset output buffer"); - uefi_services::init(&mut system_table).unwrap_success(); + // uefi_services::init(&mut system_table).unwrap_success(); { // Print out UEFI revision number @@ -71,24 +67,10 @@ fn main(_handle: Handle, mut system_table: SystemTable) -> Status { warn!("UEFI Graphics Output Protocol is not supported"); } - use uefi::proto::pi::mp::MpServices; - - if let Ok(mp_support) = system_table.boot_services().locate_protocol::() { - let mp_support = mp_support - .expect("Warnings encountered while opening multi-processor services protocol"); - let mp = unsafe { &mut *mp_support.get() }; - let proc_count = mp.get_number_of_processors().unwrap().unwrap(); - info!("Number of processors: {:?}", proc_count); - } - // exit boot services kernel_main(); } -extern "efiapi" fn hi(_: *mut c_void) { - info!("Hello, world!"); -} - use uefi::proto::console::gop::ModeInfo; pub type PixelWriter = unsafe fn(&mut FrameBuffer, usize, [u8; 3]); diff --git a/ableos/src/panic.rs b/ableos/src/panic.rs index ccc619a..cba3d33 100644 --- a/ableos/src/panic.rs +++ b/ableos/src/panic.rs @@ -10,7 +10,7 @@ use {crate::arch::sloop, core::panic::PanicInfo}; /// # Safety /// This function is unsafe because it does not guarantee that the panic is handled. -#[cfg(not(target_os = "uefi"))] +// #[cfg(not(target_os = "uefi"))] #[panic_handler] fn panic(info: &PanicInfo) -> ! { error!("{}", info);