From feccc3ab41d614f7dd54624a89375987a864cc5c Mon Sep 17 00:00:00 2001 From: able Date: Thu, 2 Jun 2022 06:51:23 -0500 Subject: [PATCH] planning --- Cargo.toml | 1 - TODO.md | 41 +++++++++-- ableos/assets/kernel.toml | 2 +- ableos/src/bogomips.rs | 130 ---------------------------------- ableos/src/devices/pci/mod.rs | 9 +-- ableos/src/lib.rs | 1 - ableos/src/scratchpad.rs | 6 +- 7 files changed, 41 insertions(+), 149 deletions(-) delete mode 100644 ableos/src/bogomips.rs diff --git a/Cargo.toml b/Cargo.toml index 7186043..7053fe6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,5 +6,4 @@ members = [ "facepalm", "shadeable", "repbuild", - ] \ No newline at end of file diff --git a/TODO.md b/TODO.md index a9a8d83..6f47939 100644 --- a/TODO.md +++ b/TODO.md @@ -1,19 +1,50 @@ # AbleOS ## General - [ ] Improve EXT2 +- [ ] Remove x86 specific code and refine the boot process +## Capabilities +A new process should not have any capabilities at all until it is given them or requests them and is approved. +- [ ] Filesystem cap + - [ ] Create a new filesystem + - [ ] Unmount/Mount a filesystem + - [ ] read a file + - [ ] write a file + - [ ] delete a file + + +- [ ] Network cap + - [ ] open/close socket + - [ ] bind/unbind socket + +- [ ] Manage Process cap + - [ ] spawn Process cap + - [ ] kill Process cap + + + + + + +## Riscv ## ARM - [ ] Get arm-version booting on real hardware - - - - -# Drivers +## Drivers - [ ] Slim down driver specific program code - [ ] Remove entry/exit functions for drivers +## Filesystem +- [ ] Create a vfs that ties into the capability system +- [ ] Remote home directory + - [ ] local file caching + - [ ] remote file changes + - [ ] Update file if the remote file changes + + + + # Tooling ## Repbuild diff --git a/ableos/assets/kernel.toml b/ableos/assets/kernel.toml index f12e603..0e3dbe6 100644 --- a/ableos/assets/kernel.toml +++ b/ableos/assets/kernel.toml @@ -5,7 +5,7 @@ user_processes = ["shell"] [logging] enabled = true level = "Trace" -log_to_serial = true +log_to_serial = false [tests] run_tests = false diff --git a/ableos/src/bogomips.rs b/ableos/src/bogomips.rs deleted file mode 100644 index 1d49991..0000000 --- a/ableos/src/bogomips.rs +++ /dev/null @@ -1,130 +0,0 @@ -use crate::time::fetch_time; - - - - - - - -fn delay(ms: u64) { - let mut i = 0; - while i < ms { - i += 1; - } -} - -pub const CLOCKS_PER_SEC: u64 = 1000; - - - - -pub fn bogomips() -> u32 { - - let mut loops_per_sec:u64 = 1; - let mut ticks: u64 = 0; - info!("bogomips: starting"); - - while (loops_per_sec << 1) != 0 { - ticks = fetch_time() as u64; - delay(loops_per_sec); - ticks = fetch_time() as u64 - ticks; - if ticks >= CLOCKS_PER_SEC { - loops_per_sec = (loops_per_sec / ticks) * CLOCKS_PER_SEC; - println!("ok - {}.{} BogoMips\n", - loops_per_sec/500000, - (loops_per_sec/5000) % 100 - ); - return 0; - } - } - - - - - - - - println!("bogomips: failed to get a result"); - return 61; - - - -} - - - - - - - - - - - - -/* - -asm!{ - -} - - - - - - -#ifdef CLASSIC_BOGOMIPS -/* the original code from the Linux kernel */ -static __inline__ void delay(int loops) -{ - __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax"); -} -#endif - -#ifdef QNX_BOGOMIPS -/* version for QNX C compiler */ -void delay(int loops); -#pragma aux delay = \ - "l1:" \ - "dec eax" \ - "jns l1" \ - parm nomemory [eax] modify exact nomemory [eax]; -#endif - -#ifdef PORTABLE_BOGOMIPS -/* portable version */ -static void delay(int loops) -{ - long i; - for (i = loops; i >= 0 ; i--) - ; -} -#endif - -int -main(void) -{ - unsigned long loops_per_sec = 1; - unsigned long ticks; - - printf("Calibrating delay loop.. "); - fflush(stdout); - - while ((loops_per_sec <<= 1)) { - ticks = clock(); - delay(loops_per_sec); - ticks = clock() - ticks; - if (ticks >= CLOCKS_PER_SEC) { - loops_per_sec = (loops_per_sec / ticks) * CLOCKS_PER_SEC; - printf("ok - %lu.%02lu BogoMips\n", - loops_per_sec/500000, - (loops_per_sec/5000) % 100 - ); - return 0; - } - } - printf("failed\n"); - return -1; -} - -*/ \ No newline at end of file diff --git a/ableos/src/devices/pci/mod.rs b/ableos/src/devices/pci/mod.rs index 9a383bb..9ece944 100644 --- a/ableos/src/devices/pci/mod.rs +++ b/ableos/src/devices/pci/mod.rs @@ -175,12 +175,10 @@ unsafe fn pci_config_read(bus: u8, device: u8, func: u8, offset: u8) -> u32 { ((bus << 16) | (device << 11) | (func << 8) | (offset & 0xfc) | 0x80000000) as u32; // write address - unsafe { Port::::new(0xCF8).write(address); - } // read data - unsafe { Port::::new(0xCFC).read() } + Port::::new(0xCFC).read() } #[allow(dead_code)] @@ -194,14 +192,11 @@ unsafe fn pci_config_write(bus: u8, device: u8, func: u8, offset: u8, value: u32 ((bus << 16) | (device << 11) | (func << 8) | (offset & 0xfc) | 0x80000000) as u32; // write address - unsafe { Port::::new(0xCF8).write(address); - } // write data - unsafe { Port::::new(0xCFC).write(value); - } + } fn get_header_type(bus: u8, device: u8, function: u8) -> u8 { diff --git a/ableos/src/lib.rs b/ableos/src/lib.rs index 864a024..8460eba 100644 --- a/ableos/src/lib.rs +++ b/ableos/src/lib.rs @@ -60,7 +60,6 @@ pub mod time; pub mod utils; pub mod virtio; pub mod wasm; -pub mod bogomips; pub mod wasm_jumploader; mod unicode_utils; diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index e34b5ab..bf6a5dc 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -5,7 +5,7 @@ use crate::filesystem::FILE_SYSTEM; use crate::rhai_shell::shell; use crate::rhai_shell::KEYBUFF; use crate::wasm_jumploader::run_program; -use crate::{SCREEN_BUFFER, bogomips}; +use crate::{SCREEN_BUFFER}; use acpi::{AcpiTables, PlatformInfo}; use cpuio::inb; use cpuio::outb; @@ -89,7 +89,7 @@ pub fn scratchpad() { */ - let abc = Path::new("/home/able".to_string()); + let _abc = Path::new("/home/able".to_string()); for _ in 0..10 { debug!("{}", generate_process_pass()); @@ -111,8 +111,6 @@ pub fn scratchpad() { debug!("end the graphics"); // */ -use crate::bogomips::bogomips; -// bogomips(); real_shell();