1
0
Fork 0
forked from AbleOS/ableos

DOCS: adding in some docs in various spots and added a contrib guide

This commit is contained in:
able 2023-05-28 04:51:51 -05:00
parent 03667f6039
commit b9b798efff
8 changed files with 54 additions and 4 deletions

4
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,4 @@
# Commit style
`[SCOPE]: [COMMENT]`
SCOPE is what you changed
COMMENT is why you changed that

View file

@ -13,6 +13,8 @@ TODO
- HBVM assembler (with IDL support) - HBVM assembler (with IDL support)
- HBVM Lisp/s-expr Compiler (Also (with (IDL (support)))) - HBVM Lisp/s-expr Compiler (Also (with (IDL (support))))
- Documentation - Documentation
# Community
[Discord](https://discord.gg/5TnJ8sa7)
# Compiling # Compiling
1. `git submodule update --init` 1. `git submodule update --init`

View file

@ -1,3 +1,4 @@
// TODO: Turn apic keyboard interrupt into a standard ipc message
use { use {
log::trace, log::trace,
spin::{Lazy, Mutex}, spin::{Lazy, Mutex},
@ -15,7 +16,7 @@ pub unsafe fn init() {
#[repr(u8)] #[repr(u8)]
enum Interrupt { enum Interrupt {
Timer = 32, Timer = 32,
Keyboard = 33,
ApicErr = u8::MAX - 1, ApicErr = u8::MAX - 1,
Spurious = u8::MAX, Spurious = u8::MAX,
} }
@ -46,7 +47,6 @@ static IDT: Lazy<InterruptDescriptorTable> = Lazy::new(|| {
idt[Interrupt::ApicErr as usize].set_handler_fn(apic_err); idt[Interrupt::ApicErr as usize].set_handler_fn(apic_err);
idt[Interrupt::Spurious as usize].set_handler_fn(spurious); idt[Interrupt::Spurious as usize].set_handler_fn(spurious);
idt[Interrupt::Timer as usize].set_handler_fn(timer); idt[Interrupt::Timer as usize].set_handler_fn(timer);
idt idt
@ -64,6 +64,8 @@ extern "x86-interrupt" fn page_fault(
} }
extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) { extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) {
// TODO: Pause the running program then schedule the next program
unsafe { LAPIC.lock().end_of_interrupt() }; unsafe { LAPIC.lock().end_of_interrupt() };
} }

View file

@ -12,4 +12,26 @@ pub struct IpcBuffer {
buffer: BufferTypes, 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,
}

View file

@ -1,3 +1,7 @@
//! An ipc message structured in a nice convenient way
use alloc::vec::Vec; use alloc::vec::Vec;
/// TODO: Extend this into a full structure
/// DEPEND: This depends on an IDL
pub type Message = Vec<u8>; pub type Message = Vec<u8>;

View file

@ -48,6 +48,17 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
let mut sc = SERIAL_CONSOLE.lock(); let mut sc = SERIAL_CONSOLE.lock();
loop { 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(); let byte = sc.receive();
if byte == b'\r' { if byte == b'\r' {
sc.send(b'\n'); sc.send(b'\n');

View file

@ -1,4 +1,6 @@
//! The ableOS kernel. //! 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] #![no_std]
#![feature( #![feature(
@ -14,7 +16,6 @@
#![deny(clippy::pedantic, warnings)] #![deny(clippy::pedantic, warnings)]
#![allow(dead_code)] #![allow(dead_code)]
#![test_runner(crate::test_runner)] #![test_runner(crate::test_runner)]
// #![deny(missing_docs)] // #![deny(missing_docs)]
extern crate alloc; extern crate alloc;

View file

@ -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 = " "; pub const TAB: &str = " ";