Introducing the hottest library crate in town (libk!)

This commit is contained in:
2025-02-23 04:42:30 +00:00
parent c763f512f1
commit 43b1db41ca
30 changed files with 1491 additions and 132 deletions
+1 -7
View File
@@ -5,13 +5,7 @@ edition = "2021"
[dependencies]
limine = "0.3.1"
lib_framebuffer = { version = "0.1.0", path = "../lib/lib_framebuffer", registry = "gitea" }
lib_serial = { version = "0.1.0", path = "../lib/lib_serial", registry = "gitea" }
lib_ascii = { version = "0.1.0", path = "../lib/lib_ascii", registry = "gitea" }
lib_application = { version = "0.1.0", path = "../lib/lib_application", registry = "gitea" }
lib_async = { version = "0.1.0", path = "../lib/lib_async", registry = "gitea" }
lib_keyboard = { version = "0.1.0", path = "../lib/lib_keyboard", registry = "gitea" }
lib_alloc = { version = "0.1.0", path = "../lib/lib_alloc", registry = "gitea" }
libk = { path = "../libk" }
x86_64 = "0.15.2"
spin = "0.9.8"
pic8259 = "0.11.0"
+2 -4
View File
@@ -1,6 +1,4 @@
use lib_ascii::println_log;
use lib_serial::serial_println;
// use x86_64::instructions::port::Port;
use libk::prelude::*;
use x86_64::registers::control::Cr2;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame, PageFaultErrorCode};
@@ -98,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() };
lib_keyboard::add_scancode(scancode);
libk::io::keyboard::add_scancode(scancode);
unsafe {
PICS.lock()
+4 -6
View File
@@ -4,13 +4,11 @@
extern crate alloc;
use core::arch::asm;
use lib_alloc::allocator::init_heap;
use limine::BaseRevision;
pub use lib_ascii::{print, print_log, println, println_log, WRITER};
pub use lib_serial::{serial_print, serial_println, serial_read};
// use x86_64::structures::paging::Translate;
// use x86_64::PhysAddr;
use libk::alloc::init_heap;
use libk::prelude::*;
use x86_64::VirtAddr;
mod arch;
@@ -53,7 +51,7 @@ pub fn boot() -> Result<(), &'static str> {
let memory_map = memmap::get_memory_map();
print_log!(" Initialising Serial... ");
lib_serial::init()?;
libk::io::serial::init()?;
println_log!("[Success]");
print_log!(" Setting Up Global Descriptor Table... ");
+8 -6
View File
@@ -3,9 +3,11 @@
extern crate alloc;
use foundry_os::{println, println_log};
use lib_async::task::{Executor, Task};
use lib_keyboard::print_keypresses;
use libk::{
io,
prelude::*,
scheduling::task::{Executor, Task},
};
#[no_mangle]
extern "C" fn kmain() -> ! {
@@ -16,8 +18,8 @@ extern "C" fn kmain() -> ! {
println_log!("[ Kernel Initialised Successfully ] ");
let dimensions = lib_ascii::screensize_chars();
let dimensions2 = lib_framebuffer::screensize_px();
let dimensions = io::ascii::screensize_chars();
let dimensions2 = io::ascii::screensize_px();
println!("Dimensions: {}x{} (px)", dimensions2.0, dimensions2.1);
println!("Dimensions: {}x{} (chars)", dimensions.0, dimensions.1);
@@ -44,7 +46,7 @@ extern "C" fn kmain() -> ! {
);
let mut executor = Executor::new();
executor.spawn(Task::new(print_keypresses()));
executor.spawn(Task::new(io::keyboard::print_keypresses()));
executor.try_run();
loop {}