From df86c272f39038c4dae53d570552920eecfde9d7 Mon Sep 17 00:00:00 2001 From: Able Date: Mon, 7 Feb 2022 03:42:57 -0600 Subject: [PATCH] qprofiler integration --- .gitignore | 3 ++- ableos/Cargo.lock | 21 +++++++++++++++++++++ ableos/Cargo.toml | 8 ++++++++ ableos/src/kmain.rs | 30 ++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 284a6a6..f58b9cb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ repbuild/target ableos/target aos_wasm_stress_test/target facepalm/target -shadeable/target \ No newline at end of file +shadeable/target +qprofiler \ No newline at end of file diff --git a/ableos/Cargo.lock b/ableos/Cargo.lock index feb5fc6..4210efd 100644 --- a/ableos/Cargo.lock +++ b/ableos/Cargo.lock @@ -27,6 +27,7 @@ name = "ableos" version = "0.1.0" dependencies = [ "ab_glyph", + "acpi", "bootloader", "cpuio", "externc-libm", @@ -55,6 +56,17 @@ dependencies = [ "y-compositor-protocol", ] +[[package]] +name = "acpi" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55237649c6e747ea67e5ed45125af5e6a35ea1250c5e44995eb6049a955bd004" +dependencies = [ + "bit_field", + "log", + "rsdp", +] + [[package]] name = "ahash" version = "0.7.6" @@ -477,6 +489,15 @@ dependencies = [ "syn", ] +[[package]] +name = "rsdp" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d3add2fc55ef37511bcf81a08ee7a09eff07b23aae38b06a29024a38c604b1" +dependencies = [ + "log", +] + [[package]] name = "ryu" version = "1.0.9" diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index ec23671..eb4db11 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -32,6 +32,11 @@ run-args = [ # A simple example of a boot image "-drive", "file=disk.qcow2,if=none,id=drive0", + +# "-qmp", +# "unix:../qmp-sock,server,nowait" + + ] test-args = [ "-device", @@ -53,6 +58,9 @@ picorand = "*" # watson = "0.4" +acpi = "4.1.0" + + [dependencies.rdrand] version = "0.8.1" default-features = false diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index 8cae943..9b741bc 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -1,5 +1,7 @@ #![allow(clippy::empty_loop)] +use acpi::AcpiTables; + use { crate::{ arch::{init, sloop}, @@ -72,6 +74,13 @@ pub fn kernel_main() -> ! { mode.copy_to_buffer(); } } + if false { + // Currently not implemented + let acpi_handler = ACPI_struct {}; + unsafe { + let table = AcpiTables::search_for_rsdp_bios(acpi_handler); + } + } start_facepalm(); @@ -112,3 +121,24 @@ pub fn generate_process_pass() -> u128 { let ret = (gen.try_next_u64().unwrap() as u128) << 64 | (gen.try_next_u64().unwrap() as u128); ret } + +// TODO: move to a better place +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct ACPI_struct {} + +impl acpi::AcpiHandler for ACPI_struct { + unsafe fn map_physical_region( + &self, + physical_address: usize, + size: usize, + ) -> acpi::PhysicalMapping { + info!("PHYS ADDR: {:?}", physical_address); + info!("Size: {:?}", size); + + todo!("map_physical_region"); + } + + fn unmap_physical_region(region: &acpi::PhysicalMapping) { + todo!("unmap_physical_region"); + } +}