From b9b798efffcd14427493df7b113cde8abafeef24 Mon Sep 17 00:00:00 2001 From: able Date: Sun, 28 May 2023 04:51:51 -0500 Subject: [PATCH] DOCS: adding in some docs in various spots and added a contrib guide --- CONTRIBUTING.md | 4 ++++ README.md | 2 ++ kernel/src/arch/x86_64/interrupts.rs | 6 ++++-- kernel/src/ipc/buffer.rs | 24 +++++++++++++++++++++++- kernel/src/ipc/message.rs | 4 ++++ kernel/src/kmain.rs | 11 +++++++++++ kernel/src/lib.rs | 3 ++- kernel/src/utils.rs | 4 ++++ 8 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..7004714f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,4 @@ +# Commit style +`[SCOPE]: [COMMENT]` +SCOPE is what you changed +COMMENT is why you changed that \ No newline at end of file diff --git a/README.md b/README.md index 03033416..fb7cc9e0 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ TODO - HBVM assembler (with IDL support) - HBVM Lisp/s-expr Compiler (Also (with (IDL (support)))) - Documentation +# Community +[Discord](https://discord.gg/5TnJ8sa7) # Compiling 1. `git submodule update --init` diff --git a/kernel/src/arch/x86_64/interrupts.rs b/kernel/src/arch/x86_64/interrupts.rs index 63042d94..73ee727f 100644 --- a/kernel/src/arch/x86_64/interrupts.rs +++ b/kernel/src/arch/x86_64/interrupts.rs @@ -1,3 +1,4 @@ +// TODO: Turn apic keyboard interrupt into a standard ipc message use { log::trace, spin::{Lazy, Mutex}, @@ -15,7 +16,7 @@ pub unsafe fn init() { #[repr(u8)] enum Interrupt { Timer = 32, - Keyboard = 33, + ApicErr = u8::MAX - 1, Spurious = u8::MAX, } @@ -46,7 +47,6 @@ static IDT: Lazy = Lazy::new(|| { idt[Interrupt::ApicErr as usize].set_handler_fn(apic_err); idt[Interrupt::Spurious as usize].set_handler_fn(spurious); - idt[Interrupt::Timer as usize].set_handler_fn(timer); idt @@ -64,6 +64,8 @@ extern "x86-interrupt" fn page_fault( } extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) { + // TODO: Pause the running program then schedule the next program + unsafe { LAPIC.lock().end_of_interrupt() }; } diff --git a/kernel/src/ipc/buffer.rs b/kernel/src/ipc/buffer.rs index a2b39db8..d80a7cd6 100644 --- a/kernel/src/ipc/buffer.rs +++ b/kernel/src/ipc/buffer.rs @@ -12,4 +12,26 @@ pub struct IpcBuffer { buffer: BufferTypes, } -pub struct Protocol {} +impl IpcBuffer { + pub fn validate_messages(&mut self) -> Result<(), IpcError> { + Ok(()) + } +} + +pub enum IpcError { + InvalidMessage, +} + +/// TODO: define this, possibly as the binary form of the IDL +/// DEPEND: This depends on an IDL +pub struct Protocol { + // TODO: add in settings + // like `invalid_message_handler` with some options similar to + // `Deny` Drops the message + // `Allow` Allows invalid messages (This disables validators IPC side and relies on programs to handle invalid messages) + // `CustomFunct` a callback + // and `report_invalid_messages_to_sender` + // `True` + // `False` + // settings: PSettings, +} diff --git a/kernel/src/ipc/message.rs b/kernel/src/ipc/message.rs index bc91825f..033851f2 100644 --- a/kernel/src/ipc/message.rs +++ b/kernel/src/ipc/message.rs @@ -1,3 +1,7 @@ +//! An ipc message structured in a nice convenient way + use alloc::vec::Vec; +/// TODO: Extend this into a full structure +/// DEPEND: This depends on an IDL pub type Message = Vec; diff --git a/kernel/src/kmain.rs b/kernel/src/kmain.rs index dde63b64..8be8f845 100644 --- a/kernel/src/kmain.rs +++ b/kernel/src/kmain.rs @@ -48,6 +48,17 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! { let mut sc = SERIAL_CONSOLE.lock(); loop { + // TODO: Implement an API for sending and recieving serial stuff + { + fn read_ipc_buff() {} + fn write_ipc_buff() {} + // TODO: read from the IPC buffer and push to serial stream + let _msg = read_ipc_buff(); + for byte in 0..0 { + sc.send(byte); + } + } + let byte = sc.receive(); if byte == b'\r' { sc.send(b'\n'); diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index aed3a2ff..32fb5d20 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -1,4 +1,6 @@ //! The ableOS kernel. +//! Named akern. +//! Akern is woefully undersupported at the moment but we are looking to add support improve hardware discovery and make our lives as kernel and operating system developers easier and better #![no_std] #![feature( @@ -14,7 +16,6 @@ #![deny(clippy::pedantic, warnings)] #![allow(dead_code)] #![test_runner(crate::test_runner)] - // #![deny(missing_docs)] extern crate alloc; diff --git a/kernel/src/utils.rs b/kernel/src/utils.rs index 5477d28c..405bf7e8 100644 --- a/kernel/src/utils.rs +++ b/kernel/src/utils.rs @@ -1 +1,5 @@ +//! A module for small utilities to be used kernel wide +//! Simple functions and constants + +/// Used when tab `\t` in hardware is not known and we will default to two spaces pub const TAB: &str = " ";