This commit is contained in:
able 2022-06-02 06:51:23 -05:00
parent 208cbfbad0
commit feccc3ab41
7 changed files with 41 additions and 149 deletions

View file

@ -6,5 +6,4 @@ members = [
"facepalm", "facepalm",
"shadeable", "shadeable",
"repbuild", "repbuild",
] ]

41
TODO.md
View file

@ -1,19 +1,50 @@
# AbleOS # AbleOS
## General ## General
- [ ] Improve EXT2 - [ ] 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 ## ARM
- [ ] Get arm-version booting on real hardware - [ ] Get arm-version booting on real hardware
## Drivers
# Drivers
- [ ] Slim down driver specific program code - [ ] Slim down driver specific program code
- [ ] Remove entry/exit functions for drivers - [ ] 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 # Tooling
## Repbuild ## Repbuild

View file

@ -5,7 +5,7 @@ user_processes = ["shell"]
[logging] [logging]
enabled = true enabled = true
level = "Trace" level = "Trace"
log_to_serial = true log_to_serial = false
[tests] [tests]
run_tests = false run_tests = false

View file

@ -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;
}
*/

View file

@ -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; ((bus << 16) | (device << 11) | (func << 8) | (offset & 0xfc) | 0x80000000) as u32;
// write address // write address
unsafe {
Port::<u32>::new(0xCF8).write(address); Port::<u32>::new(0xCF8).write(address);
}
// read data // read data
unsafe { Port::<u32>::new(0xCFC).read() } Port::<u32>::new(0xCFC).read()
} }
#[allow(dead_code)] #[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; ((bus << 16) | (device << 11) | (func << 8) | (offset & 0xfc) | 0x80000000) as u32;
// write address // write address
unsafe {
Port::<u32>::new(0xCF8).write(address); Port::<u32>::new(0xCF8).write(address);
}
// write data // write data
unsafe {
Port::<u32>::new(0xCFC).write(value); Port::<u32>::new(0xCFC).write(value);
}
} }
fn get_header_type(bus: u8, device: u8, function: u8) -> u8 { fn get_header_type(bus: u8, device: u8, function: u8) -> u8 {

View file

@ -60,7 +60,6 @@ pub mod time;
pub mod utils; pub mod utils;
pub mod virtio; pub mod virtio;
pub mod wasm; pub mod wasm;
pub mod bogomips;
pub mod wasm_jumploader; pub mod wasm_jumploader;
mod unicode_utils; mod unicode_utils;

View file

@ -5,7 +5,7 @@ use crate::filesystem::FILE_SYSTEM;
use crate::rhai_shell::shell; use crate::rhai_shell::shell;
use crate::rhai_shell::KEYBUFF; use crate::rhai_shell::KEYBUFF;
use crate::wasm_jumploader::run_program; use crate::wasm_jumploader::run_program;
use crate::{SCREEN_BUFFER, bogomips}; use crate::{SCREEN_BUFFER};
use acpi::{AcpiTables, PlatformInfo}; use acpi::{AcpiTables, PlatformInfo};
use cpuio::inb; use cpuio::inb;
use cpuio::outb; 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 { for _ in 0..10 {
debug!("{}", generate_process_pass()); debug!("{}", generate_process_pass());
@ -111,8 +111,6 @@ pub fn scratchpad() {
debug!("end the graphics"); debug!("end the graphics");
// */ // */
use crate::bogomips::bogomips;
// bogomips();
real_shell(); real_shell();