From fde952a383e76190b59cd8a7ba1430e4f026e638 Mon Sep 17 00:00:00 2001 From: Able Date: Mon, 7 Feb 2022 09:59:58 -0600 Subject: [PATCH] uefi stuff --- ableos/Cargo.lock | 21 +++++++++++++++++++++ ableos/Cargo.toml | 1 + ableos/src/arch/uefi_86/mod.rs | 12 ++++++++++++ ableos/src/kmain.rs | 4 +++- repbuild/src/main.rs | 5 ++++- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ableos/Cargo.lock b/ableos/Cargo.lock index c0fbc11..dc4d1a1 100644 --- a/ableos/Cargo.lock +++ b/ableos/Cargo.lock @@ -53,6 +53,7 @@ dependencies = [ "vga", "volatile 0.2.7", "wasmi", + "x86", "x86_64", "y-compositor-protocol", ] @@ -419,6 +420,15 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +[[package]] +name = "raw-cpuid" +version = "10.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "929f54e29691d4e6a9cc558479de70db7aa3d98cd6fe7ab86d7507aa2886b9d2" +dependencies = [ + "bitflags", +] + [[package]] name = "rdrand" version = "0.8.1" @@ -739,6 +749,17 @@ dependencies = [ "parity-wasm", ] +[[package]] +name = "x86" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6297379090b1be212a2d59dd57708c99b42b4bcbeee2ce6fb80babbe7b63e89a" +dependencies = [ + "bit_field", + "bitflags", + "raw-cpuid", +] + [[package]] name = "x86_64" version = "0.14.7" diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index ccde7c4..48ee51f 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -50,6 +50,7 @@ log = "*" pretty-hex = "0.2.1" unicode-width = "0.1.7" picorand = "*" +x86 = "*" # watson = "0.4" [dependencies.rdrand] diff --git a/ableos/src/arch/uefi_86/mod.rs b/ableos/src/arch/uefi_86/mod.rs index 44c7743..5d0fdfd 100644 --- a/ableos/src/arch/uefi_86/mod.rs +++ b/ableos/src/arch/uefi_86/mod.rs @@ -73,6 +73,16 @@ 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) = system_table.boot_services().locate_protocol::() { + let mp = mp.expect("Warnings encountered while opening GOP"); + let mp = unsafe { &mut *mp.get() }; + + info!("Found MP Services"); + // info!("{:?}", mp.get_number_of_processors().unwrap_success()); + // info!("{:?}", mp.get_processor_info(0).unwrap_success()); + } + // */ // exit boot services kernel_main(); @@ -166,3 +176,5 @@ pub fn file_system() -> Result { */ + +pub fn mp_handle() {} diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index a4ea1ad..9f390f0 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -51,7 +51,9 @@ pub fn kernel_main() -> ! { vterm0.set_cursor_position(60, 40); vterm0.characters[0][0].character = 'a'; - // start_facepalm(); + // + + start_facepalm(); sloop() } diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 3b97ab1..efe131f 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -72,7 +72,10 @@ fn main() -> anyhow::Result<()> { MachineType::Uefi86 => { xshell::cmd!("cargo build --release --target=x86_64-unknown-uefi").run()?; - xshell::cmd!("uefi-run -b src/arch/uefi_86/firmware/OVMF-pure-efi.fd target/x86_64-unknown-uefi/release/ableos.efi").run()?; + xshell::cmd!( + "uefi-run -b src/arch/uefi_86/firmware/OVMF-pure-efi.fd target/x86_64-unknown-uefi/release/ableos.efi" + ) + .run()?; } } }