- added a new libary libm containing procedural macros for the kernel.

these should be used to include external files and resources in the kernel binary
  at compile time.
  - libm currently supports loading psf-1 formatted fonts
- added two fonts that are included in the binary at compile time
- refactored libk to make the crate structure more organised and maintainable in future.
  new structure:
    - drivers   (hardware interaction)
    - resources (consts and statics included either manually or via macros)
    - std       (standard functions for higher level interaction with the os, for example creating windows)
- added geometry.rs
  - provides the Vec2<T> struct for use with dimensions, coordinates etc.
- added window.rs
  - provides the Window struct for rendering the state of an application to the screen
- added application.rs
  - provides the Application trait for custom programs to implement in order to run
This commit is contained in:
2025-02-24 03:26:49 +00:00
parent 7ff33659fe
commit d9bbdff08c
36 changed files with 421 additions and 39 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
let mut port = Port::new(0x60);
let scancode: u8 = unsafe { port.read() };
libk::io::keyboard::add_scancode(scancode);
libk::drivers::io::keyboard::add_scancode(scancode);
unsafe {
PICS.lock()
+2 -2
View File
@@ -6,7 +6,7 @@ extern crate alloc;
use core::arch::asm;
use limine::BaseRevision;
use libk::kalloc::init_heap;
use libk::drivers::kalloc::allocator::init_heap;
use libk::prelude::*;
use x86_64::VirtAddr;
@@ -51,7 +51,7 @@ pub fn boot() -> Result<(), &'static str> {
let memory_map = memmap::get_memory_map();
print_log!(" Initialising Serial... ");
libk::io::serial::init()?;
libk::drivers::io::serial::init()?;
println_log!("[Success]");
print_log!(" Setting Up Global Descriptor Table... ");
+7 -6
View File
@@ -4,10 +4,13 @@
extern crate alloc;
use libk::{
io::{self, keyboard},
prelude::*,
scheduling::task::{Executor, Task},
// scheduling::task::{Executor, Task},
drivers::{
io::{self, ascii::WRITER, keyboard},
scheduling::task::{Executor, Task},
},
prelude::*,
resources::font::FONT_SPLEEN_8X16,
};
#[unsafe(no_mangle)]
@@ -20,7 +23,7 @@ extern "C" fn kmain() -> ! {
println_log!("[ Kernel Initialised Successfully ] ");
let dimensions = io::ascii::screensize_chars();
let dimensions2 = io::ascii::screensize_px();
let dimensions2 = io::framebuffer::display::screensize_px();
println!("Dimensions: {}x{} (px)", dimensions2.0, dimensions2.1);
println!("Dimensions: {}x{} (chars)", dimensions.0, dimensions.1);
@@ -49,6 +52,4 @@ extern "C" fn kmain() -> ! {
let mut executor = Executor::new();
executor.spawn(Task::new(keyboard::print_keypresses()));
executor.run();
loop {}
}