From cb27c1349acf69d5520da0553191b57d3b046429 Mon Sep 17 00:00:00 2001 From: Able Date: Thu, 12 May 2022 21:07:06 -0500 Subject: [PATCH] changes --- Cargo.lock | 51 ++++++++++++++++++++++++++++++++++++ ableos/Cargo.toml | 3 +++ ableos/src/arch/riscv/mod.rs | 2 +- ableos/src/scratchpad.rs | 42 +++++++++++++++++++++++++---- ableos/src/utils.rs | 12 +++++++++ numb.txt | 11 ++++++++ 6 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 numb.txt diff --git a/Cargo.lock b/Cargo.lock index 850b6b4..71c1704 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,6 +31,7 @@ dependencies = [ "axel", "bootloader", "cpuio", + "embedded-graphics", "ext2", "externc-libm", "facepalm", @@ -137,6 +138,12 @@ dependencies = [ "versioning", ] +[[package]] +name = "az" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f771a5d1f5503f7f4279a30f3643d3421ba149848b89ecaaec0ea2acf04a5ac4" + [[package]] name = "bare-metal" version = "1.0.0" @@ -167,6 +174,12 @@ version = "0.9.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de78decc37247c7cfac5dbf3495c7298c6ac97cb355161caa7e15969c6648e6c" +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "cfg-if" version = "1.0.0" @@ -266,6 +279,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "embedded-graphics" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "750082c65094fbcc4baf9ba31583ce9a8bb7f52cadfb96f6164b1bc7f922f32b" +dependencies = [ + "az", + "byteorder", + "embedded-graphics-core", + "float-cmp", + "micromath", +] + +[[package]] +name = "embedded-graphics-core" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8b1239db5f3eeb7e33e35bd10bd014e7b2537b17e071f726a09351431337cfa" +dependencies = [ + "az", + "byteorder", +] + [[package]] name = "ext2" version = "0.1.1" @@ -292,6 +328,15 @@ dependencies = [ "log", ] +[[package]] +name = "float-cmp" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -481,6 +526,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +[[package]] +name = "micromath" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc4010833aea396656c2f91ee704d51a6f1329ec2ab56ffd00bfd56f7481ea94" + [[package]] name = "no-std-compat" version = "0.4.1" diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index 68c8e41..19951fe 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -53,6 +53,9 @@ rhai = "1.6.0" libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"} axel = { git = "https://git.ablecorp.us/able/aos_userland" } versioning = { git = "https://git.ablecorp.us/able/aos_userland" } +embedded-graphics="*" + + [dependencies.logos] version = "0.12" diff --git a/ableos/src/arch/riscv/mod.rs b/ableos/src/arch/riscv/mod.rs index b49e057..a201dd2 100644 --- a/ableos/src/arch/riscv/mod.rs +++ b/ableos/src/arch/riscv/mod.rs @@ -40,7 +40,7 @@ extern "C" fn _start() -> ! { let uart = crate::arch::drivers::uart::Uart::new(0x1000_0000); uart.init(); - serial_println!("Hello, world!\r"); + log!("Hello, world!\r"); loop { if let Some(c) = uart.get() { diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index 6c36f28..529f4de 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -1,7 +1,8 @@ use core::alloc::Layout; +use crate::arch::generate_process_pass; use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2}; -use crate::devices::{pci, pci_inner}; +use crate::devices::{self, pci, pci_inner}; use crate::encoding::bin; use crate::port_io::{read32, read8, write8}; use crate::rhai_shell::shell; @@ -21,6 +22,14 @@ pub fn scratchpad() { }"; let axel = axel::parse(axel_raw.to_string()); + let xyz = devices::pci::brute_force_scan(); + for dev in xyz { + trace!("{:?}", dev); + dev.bars.iter().for_each(|bar| { + trace!("{:?}", bar); + }); + } + for node in axel { info!("{:?}", node); } @@ -41,12 +50,12 @@ pub fn scratchpad() { } */ - // sound(1000); - // sound_off(); - // acpi(); + let abc = Path::new("/home/able".to_string()); - Path::new("/".to_string()); + for _ in 0..10 { + debug!("{}", generate_process_pass()); + } real_shell(); } @@ -247,4 +256,27 @@ impl Path { path: path_vec_string, } } + + pub fn get_path(&self) -> String { + let mut path = String::new(); + for part in &self.path { + path.push_str(part); + path.push('/'); + } + path + } +} + +#[derive(Debug, Copy, Clone)] +pub enum GpuFormats { + BGRA8Unorm = 1, + BGRX8Unorm = 2, + ARGB8Unorm = 3, + XRGB8Unorm = 4, + + RGBA8Unorm = 67, + XBGR8Unorm = 68, + + ABGR8Unorm = 121, + RGBX8Unorm = 134, } diff --git a/ableos/src/utils.rs b/ableos/src/utils.rs index b3e9e26..183d6db 100644 --- a/ableos/src/utils.rs +++ b/ableos/src/utils.rs @@ -22,3 +22,15 @@ mod tests { assert_eq!(type_of(&1), "i32"); } } + +pub const fn kb(x: usize) -> usize { + x * 1024 +} + +pub const fn mb(x: usize) -> usize { + x * 1024 * 1024 +} + +pub const fn gb(x: usize) -> usize { + x * 1024 * 1024 * 1024 +} diff --git a/numb.txt b/numb.txt new file mode 100644 index 0000000..a44dd64 --- /dev/null +++ b/numb.txt @@ -0,0 +1,11 @@ + +331568558747636239054653976632901246101 +48288905519904217305554229999719318010 +277368580504891661412569302316981896415 +18566809782801922287076338139767918931 +23103957219706234160452062792550873334 +62880938080142049725728912049836558493 +282131992488267708548782739606642367699 +273527083064630779890783156924010103478 +95848032043557003344400482128815557376 +247727778155602114333610564115402907812