1
0
Fork 0
forked from koniifer/ableos
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"
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"

View file

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

View file

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

View file

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

Binary file not shown.