This commit is contained in:
Able 2022-04-19 02:15:45 -05:00
parent 8d70bb08ca
commit 9e836f8098
5 changed files with 71 additions and 32 deletions

View file

@ -54,7 +54,6 @@ watson = "0.4"
genfs = "0.1.0" genfs = "0.1.0"
rhai = "1.6.0" rhai = "1.6.0"
libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"} libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"}
acpi = "4.1.0"
axel = { git = "https://git.ablecorp.us/able/aos_userland" } axel = { git = "https://git.ablecorp.us/able/aos_userland" }
versioning = { 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 = "*" x86_64 = "*"
pc-beeper = {git = "https://github.com/AbleOS/pc-beeper"} pc-beeper = {git = "https://github.com/AbleOS/pc-beeper"}
vga = "*" vga = "*"
acpi = "4.1.0"

View file

@ -1,6 +1,49 @@
use crate::rhai_shell::shell; use core::alloc::Layout;
use acpi::AcpiTables;
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 // TODO: move to a better place
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct AcpiStruct {} pub struct AcpiStruct {}
@ -18,30 +61,3 @@ impl acpi::AcpiHandler for AcpiStruct {
todo!("unmap_physical_region"); 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);
}
}

View file

@ -39,6 +39,21 @@ impl StdIO {
} }
pub fn read(&mut self) { 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);
}
}
} }
} }

View file

@ -10,7 +10,7 @@ pub fn interp() {
trace!("Got filesystem"); trace!("Got filesystem");
let file = fs let file = fs
.open( .open(
b"/home/able/bins/aos_wasm_stress_test.wasm", b"/home/able/bins/aos_test.wasm",
OpenOptions::new().read(true), OpenOptions::new().read(true),
) )
.unwrap(); .unwrap();
@ -54,6 +54,14 @@ pub fn interp() {
None => debug!("No start function found"), 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) { match (has_driver_entry, has_driver_exit) {
(true, true) => { (true, true) => {
trace!("Valid driver entry and exit functions found"); trace!("Valid driver entry and exit functions found");

Binary file not shown.