From 174b621acd36fb0643d3f6ccc883f6538ae79818 Mon Sep 17 00:00:00 2001 From: Able Date: Wed, 26 Apr 2023 14:33:40 -0500 Subject: [PATCH] add an example system.toml --- README.md | 28 ++-------------------------- kernel/src/arch/x86_64/gdt.rs | 24 ++++++++++++++---------- kernel/src/handle.rs | 16 +++++++++------- kernel/src/interp/objects.rs | 9 ++++++--- repbuild/limine.cfg | 2 +- rustfmt.toml | 1 + system.toml | 31 +++++++++++++++++++++++++++++++ test.wasm | Bin 198 -> 0 bytes 8 files changed, 64 insertions(+), 47 deletions(-) create mode 100644 system.toml delete mode 100644 test.wasm diff --git a/README.md b/README.md index e8e8306..bd105cf 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,2 @@ -# ableOS -![Discord](https://img.shields.io/discord/831368967385120810) ![Code Size](https://img.shields.io/github/languages/code-size/abletheabove/ableos) -## Set up -Install [Qemu](https://www.qemu.org/) - -> On Windows be sure to add `C:\Program Files\qemu` to your `PATH` variable - -`rustup component add rust-src` - -`rustup component add llvm-tools-preview` - -`cargo install bootimage` - - -## Running -repbuild can be used to run and build docs for able os - -`cargo repbuild doc` -`cargo repbuild run` - -## Testing on real hardware -I recommend using an old x86_64 computer -* `cargo run --release` to generate a binary image that is bootable -* flash it to a USB device via `dd` or balenaEtcher -* Remove said USB device and plug into test machine -* assure test machine boots from USB devices +TODO: + Support cache drives \ No newline at end of file diff --git a/kernel/src/arch/x86_64/gdt.rs b/kernel/src/arch/x86_64/gdt.rs index 83c3779..4a86072 100644 --- a/kernel/src/arch/x86_64/gdt.rs +++ b/kernel/src/arch/x86_64/gdt.rs @@ -1,17 +1,21 @@ -use spin::Lazy; -use x86_64::{ - structures::{ - gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector}, - tss::TaskStateSegment, +use { + spin::Lazy, + x86_64::{ + structures::{ + gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector}, + tss::TaskStateSegment, + }, + VirtAddr, }, - VirtAddr, }; pub const DOUBLE_FAULT_IX: u16 = 0; pub unsafe fn init() { - use x86_64::instructions::segmentation::{Segment, CS, SS}; - use x86_64::instructions::tables::load_tss; + use x86_64::instructions::{ + segmentation::{Segment, CS, SS}, + tables::load_tss, + }; log::info!("Initialising GDT"); GDT.0.load(); @@ -23,7 +27,7 @@ pub unsafe fn init() { struct Selectors { kcode: SegmentSelector, kdata: SegmentSelector, - tss: SegmentSelector, + tss: SegmentSelector, } static TSS: Lazy = Lazy::new(|| { @@ -45,7 +49,7 @@ static GDT: Lazy<(GlobalDescriptorTable, Selectors)> = Lazy::new(|| { let sels = Selectors { kcode: gdt.add_entry(Descriptor::kernel_code_segment()), kdata: gdt.add_entry(Descriptor::kernel_data_segment()), - tss: gdt.add_entry(Descriptor::tss_segment(&TSS)), + tss: gdt.add_entry(Descriptor::tss_segment(&TSS)), }; (gdt, sels) }); diff --git a/kernel/src/handle.rs b/kernel/src/handle.rs index 6d1b748..6f1f67d 100644 --- a/kernel/src/handle.rs +++ b/kernel/src/handle.rs @@ -1,6 +1,8 @@ -use crate::arch::hardware_random_u64; -use alloc::vec::Vec; -use core::fmt::{self, Formatter}; +use { + crate::arch::hardware_random_u64, + alloc::vec::Vec, + core::fmt::{self, Formatter}, +}; #[derive(Debug, Eq, Hash, PartialEq, Clone, Copy)] pub struct OSHandle { pub id: u64, @@ -19,14 +21,14 @@ impl OSHandle { #[derive(Debug, Eq, Hash, PartialEq, Clone, Copy)] pub struct Handle { - id: OSHandle, + id: OSHandle, perms: Permissions, } impl Handle { pub fn new() -> Handle { Handle { - id: OSHandle::random_new(), + id: OSHandle::random_new(), perms: Permissions::new(), } } @@ -46,13 +48,13 @@ impl fmt::Display for Handle { #[derive(PartialEq, Hash, Eq, Debug, Clone, Copy)] pub struct Permissions { - edit_children: bool, + edit_children: bool, edit_attributes: bool, } impl Permissions { pub fn new() -> Self { Self { - edit_children: true, + edit_children: true, edit_attributes: true, } } diff --git a/kernel/src/interp/objects.rs b/kernel/src/interp/objects.rs index acaf3a2..810f145 100644 --- a/kernel/src/interp/objects.rs +++ b/kernel/src/interp/objects.rs @@ -1,7 +1,10 @@ -use alloc::vec; -use alloc::vec::Vec; +use { + alloc::vec::Vec, + spin::{Lazy, Mutex}, +}; -use spin::{Lazy, Mutex}; +// Seperate use statement +use alloc::vec; pub type HostObjects = Vec>; diff --git a/repbuild/limine.cfg b/repbuild/limine.cfg index 149bd06..8afc3c6 100644 --- a/repbuild/limine.cfg +++ b/repbuild/limine.cfg @@ -2,7 +2,7 @@ ${ABLEOS_KERNEL}=boot:///kernel # TODO: Make a boot background image for ableOS DEFAULT_ENTRY=1 -TIMEOUT=0 +TIMEOUT=50 VERBOSE=yes INTERFACE_RESOLUTION=1024x768 # Terminal related settings diff --git a/rustfmt.toml b/rustfmt.toml index 547b7dc..3807d4c 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,2 +1,3 @@ hex_literal_case = "Upper" imports_granularity = "One" +struct_field_align_threshold = 5 diff --git a/system.toml b/system.toml new file mode 100644 index 0000000..54e67cd --- /dev/null +++ b/system.toml @@ -0,0 +1,31 @@ +[boot] +[boot.limine] +default_entry = 1 +timeout = 0 +verbose = true +interface_resolution = "1024x768x24" +# Terminal related settings +term_wallpaper = "boot:///background.bmp" +term_background = "008080" + +[boot.limine.ableos] +comment = "Default AbleOS boot entry." +protocol = "limine" +kernel_path = "boot:///kernel" +kernel_cmdline = "baka=false foobles=true" +resolution = "1024x768x24" + +[repositories] +core = "https://git.ablecorp.us/AbleOS/core" +userspace = "https://git.ablecorp.us/AbleOS/ableos_userland" +nya = "https://git.ablecorp.us/AbleOS/nya" + + +[packages] +[packages.list_files] +version = "0.1.1" +hash = "" +repo = "userspace" +authors = [] + +[packages.list_files.configuration] diff --git a/test.wasm b/test.wasm deleted file mode 100644 index da05794df633a154cf69362ca3273f286f0b4344..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmXAhK?=e!6h!|djV)G11i=%C*XYh$G-(@9Aq0|Nu$$)MT^L(t^LR51ndm@7xD^@+ zNsE*)YdNQsNfT!Al*P+OJ_c)s)>+q@VF*NpB6j)6he?o%Yyy)!K<*#7Q}d5nDxzkW2}=cP%8kU@ol(~(3FZ74E${`VACh1& A0ssI2