panic handler

uefi
Able 2022-02-18 02:37:09 -06:00
parent 19d1066350
commit a159b71770
Signed by untrusted user: able
GPG Key ID: D164AF5F5700BE51
5 changed files with 5 additions and 36 deletions

12
ableos/Cargo.lock generated
View File

@ -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"

View File

@ -122,4 +122,3 @@ x86_64 = "*"
[target.'cfg(target_os = "uefi")'.dependencies]
uefi = { version="*",default-features = false, features = ["exts"] }
uefi-services = "0.11.0"

View File

@ -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)

View File

@ -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<Boot>) -> 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<Boot>) -> 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::<MpServices>() {
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]);

View File

@ -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);