1
0
Fork 0
forked from AbleOS/ableos
ableos_time/ableos/src/scratchpad.rs

64 lines
1.5 KiB
Rust
Raw Normal View History

2022-04-19 02:15:45 -05:00
use core::alloc::Layout;
2022-04-19 02:15:45 -05:00
use crate::rhai_shell::shell;
use acpi::{AcpiTables, PlatformInfo};
2022-02-08 03:01:29 -06:00
/// Experimental scratchpad for testing.
pub fn scratchpad() {
2022-04-09 17:26:43 -05:00
let axel_raw = "kernel{
2022-03-26 06:35:33 -05:00
vals=
time: 123
fn|
print: (None) -> (None);
foo: (None) -> (Num);
2022-04-09 17:26:43 -05:00
}";
2022-03-26 06:35:33 -05:00
let axel = axel::parse(axel_raw.to_string());
for node in axel {
info!("{:?}", node);
}
2022-04-19 02:15:45 -05:00
// acpi();
2022-03-11 17:13:41 -06:00
shell();
2022-02-08 04:13:53 -06:00
}
2022-02-12 03:25:02 -06:00
pub fn pci_fun() {}
2022-02-12 03:25:02 -06:00
pub fn acpi() {
let acpi_handler = AcpiStruct {};
let _table;
unsafe {
_table = AcpiTables::search_for_rsdp_bios(acpi_handler);
2022-02-12 03:25:02 -06:00
}
2022-04-19 02:15:45 -05:00
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 {}
impl acpi::AcpiHandler for AcpiStruct {
unsafe fn map_physical_region<T>(
&self,
physical_address: usize,
size: usize,
) -> acpi::PhysicalMapping<Self, T> {
info!("PHYS ADDR: {:?}", physical_address);
info!("Size: {:?}", size);
todo!("map_physical_region");
}
fn unmap_physical_region<T>(_region: &acpi::PhysicalMapping<Self, T>) {
todo!("unmap_physical_region");
}
2022-02-12 03:25:02 -06:00
}