diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index 54805f9..8984597 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -54,7 +54,6 @@ watson = "0.4" genfs = "0.1.0" rhai = "1.6.0" libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"} -acpi = "4.1.0" axel = { git = "https://git.ablecorp.us/able/aos_userland" } versioning = { git = "https://git.ablecorp.us/able/aos_userland" } @@ -134,3 +133,4 @@ volatile = "0.2.6" x86_64 = "*" pc-beeper = {git = "https://github.com/AbleOS/pc-beeper"} vga = "*" +acpi = "4.1.0" \ No newline at end of file diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index 698f6b5..aa1dd42 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -1,6 +1,49 @@ -use crate::rhai_shell::shell; -use acpi::AcpiTables; +use core::alloc::Layout; +use crate::rhai_shell::shell; +use acpi::{AcpiTables, PlatformInfo}; + +/// Experimental scratchpad for testing. +pub fn scratchpad() { + let axel_raw = "kernel{ + vals= + time: 123 + fn| + print: (None) -> (None); + foo: (None) -> (Num); +}"; + let axel = axel::parse(axel_raw.to_string()); + for node in axel { + info!("{:?}", node); + } + // acpi(); + shell(); +} + +pub fn pci_fun() {} + +pub fn acpi() { + let acpi_handler = AcpiStruct {}; + let _table; + unsafe { + _table = AcpiTables::search_for_rsdp_bios(acpi_handler); + } + match _table.unwrap().platform_info().unwrap() { + PlatformInfo { + power_profile, + interrupt_model, + processor_info, + pm_timer, + } => { + info!("{:?}", power_profile); + info!("{:?}", interrupt_model); + // info!("{:?}", processor_info.unwrap()); + // info!("{:?}", pm_timer.unwrap()); + } + + _ => todo!(), + } +} // TODO: move to a better place #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct AcpiStruct {} @@ -18,30 +61,3 @@ impl acpi::AcpiHandler for AcpiStruct { todo!("unmap_physical_region"); } } - -/// Experimental scratchpad for testing. -pub fn scratchpad() { - let axel_raw = "kernel{ - vals= - time: 123 - fn| - print: (None) -> (None); - foo: (None) -> (Num); -}"; - let axel = axel::parse(axel_raw.to_string()); - for node in axel { - info!("{:?}", node); - } - - shell(); -} - -pub fn pci_fun() {} - -pub fn acpi() { - let acpi_handler = AcpiStruct {}; - let _table; - unsafe { - _table = AcpiTables::search_for_rsdp_bios(acpi_handler); - } -} diff --git a/ableos/src/stdio.rs b/ableos/src/stdio.rs index 7d243c2..f69a2e3 100644 --- a/ableos/src/stdio.rs +++ b/ableos/src/stdio.rs @@ -39,6 +39,21 @@ impl StdIO { } pub fn read(&mut self) { - todo!(); + use crate::devices::DEVICE_TABLE; + let mut dt = DEVICE_TABLE.lock(); + let key_device = dt.devices.get_mut(&self.device).unwrap(); + + match key_device { + Character(dev) => { + let mut buf = String::new(); + dev.read_char().map(|c| buf.push(c)); + println!("{}", buf); + } + Vterm(vterm) => { + let mut buf = String::new(); + vterm.read_char().map(|c| buf.push(c)); + println!("{}", buf); + } + } } } diff --git a/ableos/src/wasm_jumploader/mod.rs b/ableos/src/wasm_jumploader/mod.rs index 12d740f..50b1fd8 100644 --- a/ableos/src/wasm_jumploader/mod.rs +++ b/ableos/src/wasm_jumploader/mod.rs @@ -10,7 +10,7 @@ pub fn interp() { trace!("Got filesystem"); let file = fs .open( - b"/home/able/bins/aos_wasm_stress_test.wasm", + b"/home/able/bins/aos_test.wasm", OpenOptions::new().read(true), ) .unwrap(); @@ -54,6 +54,14 @@ pub fn interp() { None => debug!("No start function found"), } + match instance.export_by_name("main") { + Some(_val) => { + trace!("Program main function found"); + has_start = true; + } + None => debug!("No main function found"), + } + match (has_driver_entry, has_driver_exit) { (true, true) => { trace!("Valid driver entry and exit functions found"); diff --git a/userland/root_fs/ext2.img b/userland/root_fs/ext2.img index 385e50c..87b45ad 100644 Binary files a/userland/root_fs/ext2.img and b/userland/root_fs/ext2.img differ