diff --git a/.gitignore b/.gitignore index e1f9a9e..32fa216 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,6 @@ -repbuild/target -ableos/target -aos_wasm_stress_test/target -facepalm/target -shadeable/target -userland/*/target -kernel/target -userland/root_fs/mnt/* +userland/root_fs/mnt/ target/ .gdb_history !*/.gitkeep +__pycache__/ +debug.log diff --git a/__pycache__/qmp.cpython-310.pyc b/__pycache__/qmp.cpython-310.pyc deleted file mode 100644 index 000975e..0000000 Binary files a/__pycache__/qmp.cpython-310.pyc and /dev/null differ diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index b646c9c..91c57bc 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -30,7 +30,7 @@ run-args = [ "-hdb", - "../img.ext2", + "../userland/root_fs/ext2.img", # "-qmp", diff --git a/ableos/debug.log b/ableos/debug.log deleted file mode 100644 index e69de29..0000000 diff --git a/ableos/disk.qcow2 b/ableos/disk.qcow2 deleted file mode 100644 index 2b9c37c..0000000 Binary files a/ableos/disk.qcow2 and /dev/null differ diff --git a/ableos/src/allocator/aalloc.rs b/ableos/src/allocator/aalloc.rs index 7534983..fcf0f3f 100644 --- a/ableos/src/allocator/aalloc.rs +++ b/ableos/src/allocator/aalloc.rs @@ -10,8 +10,8 @@ const BLOCK_SIZE: usize = 1024; const BLOCK_COUNT: usize = 512; #[derive(Debug, Clone, Copy)] pub struct MemoryRegion { - start: usize, - end: usize, + _start: usize, + _end: usize, } #[derive(Debug, Clone, Copy)] pub struct AAlloc { @@ -36,8 +36,8 @@ impl AAlloc { }; aalloc.add_region(MemoryRegion { - start: 0x00100000, - end: 0x00EFFFFF, + _start: 0x00100000, + _end: 0x00EFFFFF, }); debug!("{}", aalloc); } diff --git a/ableos/src/arch/x86_64/init.rs b/ableos/src/arch/x86_64/init.rs index 8ecb29b..88344bc 100644 --- a/ableos/src/arch/x86_64/init.rs +++ b/ableos/src/arch/x86_64/init.rs @@ -1,5 +1,5 @@ // #![allow(clippy::print_literal)] -use super::{drivers::serial, gdt, interrupts}; +use super::{gdt, interrupts}; use crate::{logger, serial_println, TERM}; /// x86_64 initialization diff --git a/ableos/src/arch/x86_64/interrupts.rs b/ableos/src/arch/x86_64/interrupts.rs index 68e9fda..fff43e2 100644 --- a/ableos/src/arch/x86_64/interrupts.rs +++ b/ableos/src/arch/x86_64/interrupts.rs @@ -1,17 +1,10 @@ use core::panic::PanicInfo; -use crate::{ - arch::gdt, image::mono_bitmap::bruh, kernel_state::KERNEL_STATE, print, println, - rhai_shell::KEYBUFF, VgaBuffer, SCREEN_BUFFER, -}; +use crate::{arch::gdt, rhai_shell::KEYBUFF, VgaBuffer, SCREEN_BUFFER}; use cpuio::outb; use pic8259::ChainedPics; -use qrcode::{ - render::{string, unicode}, - QrCode, -}; +use qrcode::QrCode; use spin::Lazy; -use vga::colors::Color16; use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; use super::sloop; @@ -156,8 +149,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac // warn!("ArrowKeys are unsupported currently"); } - kc => { - + _kc => { // trace!("Unprintable key: {kc:?}"), } }; diff --git a/ableos/src/channels.rs b/ableos/src/channels.rs index 7db1f60..ab0e73d 100644 --- a/ableos/src/channels.rs +++ b/ableos/src/channels.rs @@ -1,12 +1,6 @@ -use core::fmt::Display; - use alloc::collections::VecDeque; -use kernel::proccess::PID; - -use crate::{arch::generate_process_pass, handle::Handle}; #[derive(Debug)] - pub struct ChannelPermission { pub owner: bool, pub producer: bool, diff --git a/ableos/src/devices/pci/mod.rs b/ableos/src/devices/pci/mod.rs index 9ece944..6d087b0 100644 --- a/ableos/src/devices/pci/mod.rs +++ b/ableos/src/devices/pci/mod.rs @@ -2,8 +2,6 @@ // Copyright (c) 2021 trashbyte // See LICENSE.txt for full license -#![feature(asm)] - extern crate alloc; use alloc::{format, string::String, vec::Vec}; use core::fmt::{Display, Error, Formatter}; @@ -175,10 +173,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 - Port::::new(0xCF8).write(address); + Port::::new(0xCF8).write(address); // read data - Port::::new(0xCFC).read() + Port::::new(0xCFC).read() } #[allow(dead_code)] @@ -192,11 +190,10 @@ 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 - Port::::new(0xCF8).write(address); + Port::::new(0xCF8).write(address); // write data - Port::::new(0xCFC).write(value); - + Port::::new(0xCFC).write(value); } fn get_header_type(bus: u8, device: u8, function: u8) -> u8 { diff --git a/ableos/src/handle.rs b/ableos/src/handle.rs index 5d35bc5..dda6239 100644 --- a/ableos/src/handle.rs +++ b/ableos/src/handle.rs @@ -1,14 +1,13 @@ //! A handle is a u128 with a set of permissions //! and a resource connected to it -use crate::Path; -use crate::{arch::generate_process_pass, channels::Channel}; +use crate::arch::generate_process_pass; use core::fmt::Display; #[derive(Debug)] pub struct BinaryData { - name: String, - data: Vec, + _name: String, + _data: Vec, } #[derive(Debug, Eq, Hash, PartialEq, Clone, Copy)] diff --git a/ableos/src/hardware/mod.rs b/ableos/src/hardware/mod.rs index 9ef238d..dd39a86 100644 --- a/ableos/src/hardware/mod.rs +++ b/ableos/src/hardware/mod.rs @@ -1,12 +1,8 @@ use crate::arch::interrupts::InterruptIndex; use crate::arch::interrupts::PICS; use crate::ps2_mouse::{Mouse, MouseState}; -use crate::vga_e::VGAE; use lazy_static::lazy_static; -use log::info; use spin::Mutex; -use vga::colors::Color16; -use vga::writers::GraphicsWriter; use x86_64::instructions::port::PortReadOnly; use x86_64::structures::idt::InterruptStackFrame; diff --git a/ableos/src/ipc/channel.rs b/ableos/src/ipc/channel.rs index 852ed2a..d711d8e 100644 --- a/ableos/src/ipc/channel.rs +++ b/ableos/src/ipc/channel.rs @@ -16,7 +16,7 @@ pub struct ChannelPermission { #[derive(Debug)] pub struct Channel { pub public: bool, - name: String, + _name: String, inner: VecDeque, } @@ -26,7 +26,7 @@ impl Channel { Self { public, - name: name.into(), + _name: name.into(), inner: deq, } } diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index 83ee098..c6193a7 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -1,26 +1,14 @@ #![allow(clippy::empty_loop)] -use core::sync::atomic::{AtomicU64, Ordering}; +use core::sync::atomic::AtomicU64; -use crate::arch::drivers::sysinfo::master; -use crate::ipc::channel::ChannelMessage; -use crate::ipc::{self, IPC}; -use crate::scheduler::SCHEDULER; -use crate::time::fetch_time; +use crate::arch::{drivers::sysinfo::master, init, sloop}; +use crate::relib::network::socket::{SimpleSock, Socket}; use crate::{ - arch::{init, sloop}, - relib::network::socket::{SimpleSock, Socket}, - scratchpad, + boot_conf::KernelConfig, scheduler::SCHEDULER, scratchpad, systeminfo::RELEASE_TYPE, TERM, }; -use crate::{boot_conf::KernelConfig, systeminfo::RELEASE_TYPE}; -use crate::{hardware, wasm_jumploader, SectionType, TERM}; -use genfs::{Fs, OpenOptions}; use kernel::KERNEL_VERSION; -use libwasm::syscalls::time_calls::get_time; -use qrcode::render::unicode; -use qrcode::QrCode; use spin::Lazy; -use x86_64::instructions::interrupts::{disable, enable}; // TODO: Change this structure to allow for multiple cores loaded pub static KERNEL_CONF: Lazy = Lazy::new(KernelConfig::new); diff --git a/ableos/src/logger.rs b/ableos/src/logger.rs index 9b96df3..8bc0fd6 100644 --- a/ableos/src/logger.rs +++ b/ableos/src/logger.rs @@ -1,10 +1,6 @@ -use crate::kmain::KERNEL_CONF; -use crate::network::socket::{SimpleSock, Socket}; -use crate::time::fetch_time; -use alloc::borrow::ToOwned; -use lliw::{Fg, Reset}; -use log::{Level, Metadata, Record}; -use log::{LevelFilter, SetLoggerError}; +use crate::{kmain::KERNEL_CONF, time::fetch_time}; +use lliw::Fg; +use log::{Level, LevelFilter, Metadata, Record, SetLoggerError}; static LOGGER: SimpleLogger = SimpleLogger; // TODO: Rebuild this to take advantage of sockets @@ -19,7 +15,6 @@ impl log::Log for SimpleLogger { x86_64::instructions::interrupts::without_interrupts(|| { if self.enabled(record.metadata()) { let time_float = fetch_time(); - use log::Level::*; use Fg::*; let color = match record.level() { diff --git a/ableos/src/relib/image/mono_bitmap.rs b/ableos/src/relib/image/mono_bitmap.rs index 1276d5e..56c5a79 100644 --- a/ableos/src/relib/image/mono_bitmap.rs +++ b/ableos/src/relib/image/mono_bitmap.rs @@ -1,10 +1,6 @@ -use crate::{ - graphics::SCREEN_BUFFER, - relib::encoding::rle::{decode, encode}, - vga_e::VGAE, - VgaBuffer, -}; -use shadeable::pixel_format::new_rgba64; +use crate::relib::encoding::rle::{decode, encode}; +use crate::vga_e::VGAE; + use vga::writers::GraphicsWriter; pub fn bruh() { diff --git a/ableos/src/rhai_shell/mod.rs b/ableos/src/rhai_shell/mod.rs index 8c7c768..ab03642 100644 --- a/ableos/src/rhai_shell/mod.rs +++ b/ableos/src/rhai_shell/mod.rs @@ -1,12 +1,6 @@ -use crate::arch::drivers::sysinfo::master; -use crate::filesystem::FILE_SYSTEM; -use crate::time::fetch_time; -use crate::wasm_jumploader::interp; -use crate::{ - arch::{shutdown, sloop}, - systeminfo::{KERNEL_VERSION, RELEASE_TYPE}, - KERNEL_STATE, -}; +use crate::arch::{drivers::sysinfo::master, shutdown, sloop}; +use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}; +use crate::{filesystem::FILE_SYSTEM, time::fetch_time, KERNEL_STATE}; use genfs::{Fs, OpenOptions}; use kernel::allocator::ALLOCATOR; use rhai::Engine; diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index dd828f9..fd65024 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -1,34 +1,15 @@ -use core::fmt::Error; - -// use crate::aalloc::aalloc; use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2}; -use crate::arch::{generate_process_pass, shutdown}; -use crate::channels::{Channel, ChannelPermission}; -use crate::devices::pci; -use crate::filesystem::FILE_SYSTEM; -use crate::handle::Handle; -use crate::image::mono_bitmap::bruh; -use crate::ipc::IPC; -use crate::rhai_shell::shell; -use crate::rhai_shell::KEYBUFF; -use crate::unicode_utils::LAMBDA; -use crate::vterm::Term; -use crate::wasm_jumploader::run_program; -use crate::{vgai, SCREEN_BUFFER}; +use crate::{ + arch::shutdown, filesystem::FILE_SYSTEM, rhai_shell::KEYBUFF, vterm::Term, + wasm_jumploader::run_program, +}; + use acpi::{AcpiTables, PlatformInfo}; -use alloc::collections::{vec_deque, VecDeque}; -use cpuio::inb; -use cpuio::outb; +use cpuio::{inb, outb}; use ext2::fs::sync::{DirectoryEntry, Synced}; -use ext2::fs::Ext2; -use ext2::sector::Size1024; -use ext2::sys::inode; -use genfs::OpenOptions; -use genfs::{DirEntry, Fs}; -use kernel::proccess::PID; -use kernel::software_int; +use ext2::{fs::Ext2, sector::Size1024}; +use genfs::{Fs, OpenOptions}; use spin::Lazy; -use vga::writers::GraphicsWriter; // TODO: move to a better place #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -49,8 +30,8 @@ impl acpi::AcpiHandler for AcpiStruct { } pub static TERM: Lazy> = Lazy::new(|| spin::Mutex::new(Term::new())); -#[derive(Debug)] +#[derive(Debug)] pub struct Path { pub path: Vec, } @@ -156,10 +137,12 @@ pub fn command_parser(user: String, command: String) { let bin_name = iter.next().unwrap(); match bin_name { - "rhai" => { - drop(fs); - shell(); - } + // note: able asked for rhaish to stay in the repo but will be removed + // in the future so just comment it out for now + // "rhai" => { + // drop(fs); + // shell(); + // } "list" | "ls" => { for dir_entry in list_files_in_dir(fs, current_path) { println!("{}", dir_entry.file_name_string()); @@ -172,7 +155,7 @@ pub fn command_parser(user: String, command: String) { options.read(true); let file = { let path = format!("/home/{user}/bins/{bin_name}.wasm"); - if let Ok(file ) = fs.open(&path.as_bytes(), &options) { + if let Ok(file) = fs.open(&path.as_bytes(), &options) { file } else { let path = format!("/shared/bins/{bin_name}.wasm"); @@ -213,7 +196,7 @@ pub fn sound(n_frequency: u32) { set_pit_2(div); - //And play the sound using the PC speaker + // And play the sound using the PC speaker tmp = inb(0x61); if tmp != (tmp | 3) { outb(tmp | 3, 0x61); @@ -229,7 +212,7 @@ pub fn sound_off() { reset_pit_for_cpu(); } -pub fn list_files_in_dir(fs: &Synced>>, path: &[u8]) -> Vec { +pub fn list_files_in_dir(fs: &Synced>>, _path: &[u8]) -> Vec { let mut entry_list = vec![]; let dirr = fs.read_dir(b"/").unwrap(); diff --git a/ableos/src/unicode_utils.rs b/ableos/src/unicode_utils.rs index 11c95f0..45d1930 100644 --- a/ableos/src/unicode_utils.rs +++ b/ableos/src/unicode_utils.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + pub const CONSOLE: &str = "\u{E795}"; pub const POWER_SIGN: &str = "\u{23FB}"; pub const LAMBDA: &str = "λ"; diff --git a/ableos/src/vga_e.rs b/ableos/src/vga_e.rs index 0c6091f..72c0043 100644 --- a/ableos/src/vga_e.rs +++ b/ableos/src/vga_e.rs @@ -1,7 +1,4 @@ -use vga::{ - colors::Color16, - writers::{Graphics640x480x16, GraphicsWriter}, -}; +use vga::{colors::Color16, writers::Graphics640x480x16}; pub static VGAE_BUFF_OFFSET_X: spin::Mutex = spin::Mutex::new(0); pub static VGAE_BUFF_OFFSET_Y: spin::Mutex = spin::Mutex::new(0); diff --git a/ableos/src/vgai.rs b/ableos/src/vgai.rs index 8abc91a..18f45d3 100644 --- a/ableos/src/vgai.rs +++ b/ableos/src/vgai.rs @@ -1,5 +1,3 @@ -use vga::writers::{Graphics640x480x16, GraphicsWriter}; - pub enum Color { /// Represents the color `Black (0x0)`. Black = 0x0, diff --git a/ableos/src/virtio/mod.rs b/ableos/src/virtio/mod.rs index b75f160..cb22fa1 100644 --- a/ableos/src/virtio/mod.rs +++ b/ableos/src/virtio/mod.rs @@ -6,7 +6,7 @@ //! pub struct VirtioDevice { - status: VirtioDeviceStatus, + _status: VirtioDeviceStatus, } use crate::devices::pci::PciDeviceInfo; diff --git a/ableos/src/vterm.rs b/ableos/src/vterm.rs index 155ec72..cbaf110 100644 --- a/ableos/src/vterm.rs +++ b/ableos/src/vterm.rs @@ -1,11 +1,8 @@ +use crate::vga_e::VGAE; use vga::{colors::Color16, writers::GraphicsWriter}; -use crate::{ - hardware::{MOUSE, _MOUSE}, - vga_e::VGAE, -}; const TERM_MINUS_ONE_LINE: usize = 4720; -const CURSOR_COLOR: Color16 = Color16::Cyan; +// const CURSOR_COLOR: Color16 = Color16::Cyan; #[derive(Debug)] pub struct Term { diff --git a/ableos/src/wasm/mod.rs b/ableos/src/wasm/mod.rs index fbc9a86..7d55849 100644 --- a/ableos/src/wasm/mod.rs +++ b/ableos/src/wasm/mod.rs @@ -44,8 +44,8 @@ pub enum SectionType { pub struct Section { /// The section type - stype: SectionType, - section_size: u8, + _stype: SectionType, + _section_size: u8, } /// A wasm type diff --git a/ableos/src/wasm_jumploader/mod.rs b/ableos/src/wasm_jumploader/mod.rs index fc208e8..ab5a674 100644 --- a/ableos/src/wasm_jumploader/mod.rs +++ b/ableos/src/wasm_jumploader/mod.rs @@ -2,9 +2,7 @@ pub mod host_functions; use crate::{filesystem::FILE_SYSTEM, wasm_jumploader::host_functions::HostExternals}; use genfs::{Fs, OpenOptions}; -use wasmi::{ - ImportsBuilder, MemoryDescriptor, ModuleImportResolver, ModuleInstance, StackRecycler, -}; +use wasmi::{ImportsBuilder, ModuleInstance}; pub fn interp() { trace!("Interpreting..."); @@ -114,13 +112,9 @@ pub fn run_program(program: &[u8]) { // .expect("failed to instantiate wasm module") - use wasmi::GlobalRef; match instance { Ok(inst) => { - let mut instance = inst.assert_no_start(); - - let abc = instance.globals().capacity(); - + let instance = inst.assert_no_start(); let mut is_driver = false; let _is_program = false; let mut has_driver_entry = false; diff --git a/data.txt b/data.txt deleted file mode 100644 index e69de29..0000000 diff --git a/ext2-rs/ext2.img b/ext2-rs/ext2.img deleted file mode 100644 index 3af4aae..0000000 Binary files a/ext2-rs/ext2.img and /dev/null differ diff --git a/ext2-rs/src/lib.rs b/ext2-rs/src/lib.rs index 549af9c..dab5858 100644 --- a/ext2-rs/src/lib.rs +++ b/ext2-rs/src/lib.rs @@ -3,7 +3,6 @@ #![deny(missing_docs)] #![feature( min_specialization, - const_fn_trait_bound, step_trait, associated_type_defaults )] diff --git a/img.ext2 b/img.ext2 deleted file mode 100644 index 53837da..0000000 Binary files a/img.ext2 and /dev/null differ diff --git a/kernel/src/aalloc/aalloc.rs b/kernel/src/aalloc/aalloc.rs index 8499449..54d5598 100644 --- a/kernel/src/aalloc/aalloc.rs +++ b/kernel/src/aalloc/aalloc.rs @@ -5,11 +5,8 @@ #![allow(missing_docs)] use alloc::alloc::{GlobalAlloc, Layout}; -use core::{ - fmt::Display, - ptr::{self, null_mut}, -}; -use log::{debug, info, trace}; +use core::{fmt::Display, ptr::null_mut}; +use log::{debug, info}; // const HEAP_START: usize = 600_000_000; const HEAP_START: usize = 0x00100000; diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index b5e2840..9b89327 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -18,10 +18,7 @@ pub mod proccess; pub mod syscalls; pub mod time; -use core::{ - arch::asm, - sync::atomic::{AtomicU64, Ordering::Relaxed}, -}; +use core::arch::asm; use versioning::Version; /// The number of ticks since the first CPU was started diff --git a/numb.txt b/numb.txt deleted file mode 100644 index a44dd64..0000000 --- a/numb.txt +++ /dev/null @@ -1,11 +0,0 @@ - -331568558747636239054653976632901246101 -48288905519904217305554229999719318010 -277368580504891661412569302316981896415 -18566809782801922287076338139767918931 -23103957219706234160452062792550873334 -62880938080142049725728912049836558493 -282131992488267708548782739606642367699 -273527083064630779890783156924010103478 -95848032043557003344400482128815557376 -247727778155602114333610564115402907812 diff --git a/qrcode-rust/src/cast.rs b/qrcode-rust/src/cast.rs index 91634b8..a4b1954 100644 --- a/qrcode-rust/src/cast.rs +++ b/qrcode-rust/src/cast.rs @@ -36,6 +36,7 @@ impl ExpectOrOverflow for Option { macro_rules! impl_as { ($ty:ty) => { + #[allow(unconditional_recursion)] // idk why #[cfg(debug_assertions)] impl As for $ty { fn as_u16(self) -> u16 { diff --git a/qrcode-rust/src/render/image.rs b/qrcode-rust/src/render/image.rs index d42776b..5a3974c 100644 --- a/qrcode-rust/src/render/image.rs +++ b/qrcode-rust/src/render/image.rs @@ -1,4 +1,4 @@ -#![cfg(feature="image")] +#![cfg(feature = "image")] use crate::render::{Canvas, Pixel}; use crate::types::Color; diff --git a/qrcode-rust/src/render/svg.rs b/qrcode-rust/src/render/svg.rs index de4dedf..ba85fbd 100644 --- a/qrcode-rust/src/render/svg.rs +++ b/qrcode-rust/src/render/svg.rs @@ -10,7 +10,7 @@ //! let svg_xml = code.render::().build(); //! println!("{}", svg_xml); -#![cfg(feature="svg")] +#![cfg(feature = "svg")] use std::fmt::Write; use std::marker::PhantomData; diff --git a/qrcode-rust/src/render/unicode.rs b/qrcode-rust/src/render/unicode.rs index e7bd4bf..10d80e3 100644 --- a/qrcode-rust/src/render/unicode.rs +++ b/qrcode-rust/src/render/unicode.rs @@ -1,11 +1,7 @@ //! UTF-8 rendering, with 2 pixels per symbol. -use alloc::{ - string::String, - vec::{self, Vec}, -}; - use crate::render::{Canvas as RenderCanvas, Color, Pixel}; +use alloc::{string::String, vec::Vec}; const CODEPAGE: [&str; 4] = [" ", "\u{2584}", "\u{2580}", "\u{2588}"];