From fd26ec734bed77d6aae9b2ff78e36899b6920196 Mon Sep 17 00:00:00 2001 From: koniifer Date: Wed, 27 Nov 2024 12:52:48 +0000 Subject: [PATCH] temp interrupt fix, problem with sds_search_service --- kernel/src/arch/x86_64/interrupts.rs | 46 +++++++++++++--------------- kernel/src/task.rs | 16 +++++----- sysdata/system_config.toml | 22 ++++++------- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/kernel/src/arch/x86_64/interrupts.rs b/kernel/src/arch/x86_64/interrupts.rs index 28b432c..336f0c8 100644 --- a/kernel/src/arch/x86_64/interrupts.rs +++ b/kernel/src/arch/x86_64/interrupts.rs @@ -83,33 +83,31 @@ extern "x86-interrupt" fn spurious(_: InterruptStackFrame) { } } +#[allow(unused_imports)] fn interrupt(interrupt_type: Interrupt) { - use crate::arch::INTERRUPT_LIST; - use crate::kmain::EXECUTOR; - let il = INTERRUPT_LIST.lock(); - let val = il.list.get(&interrupt_type).unwrap(); + use crate::{arch::INTERRUPT_LIST, kmain::EXECUTOR}; + // let il = INTERRUPT_LIST.lock(); + // let val = il.list.get(&interrupt_type).unwrap(); - use crate::holeybytes::kernel_services::service_definition_service::sds_search_service; - let buffer = sds_search_service(val); - if buffer != 0 { - use {crate::kmain::IPC_BUFFERS, alloc::vec::Vec}; - let mut buffs = IPC_BUFFERS.lock(); - match buffs.get_mut(&buffer) { - Some(buff) => { - let mut msg_vec = Vec::new(); - msg_vec.push(0xFF); - buff.push(msg_vec.to_vec()); - log::debug!("Sent Message {:?} to Buffer({})", msg_vec, buffer); - } - None => { - log::error!("Access of non-existent buffer {}", buffer) - } - } + // use crate::holeybytes::kernel_services::service_definition_service::sds_search_service; + // let buffer = sds_search_service(val); + // if buffer != 0 { + // use {crate::kmain::IPC_BUFFERS, alloc::vec::Vec}; + // let mut buffs = IPC_BUFFERS.lock(); + // match buffs.get_mut(&buffer) { + // Some(buff) => { + // let mut msg_vec = Vec::new(); + // msg_vec.push(0xFF); + // buff.push(msg_vec.to_vec()); + // log::debug!("Sent Message {:?} to Buffer({})", msg_vec, buffer); + // } + // None => { + // log::error!("Access of non-existent buffer {}", buffer) + // } + // } + // } - // log::info!("{}", buffer); - } - - unsafe{ + unsafe { EXECUTOR.send_interrupt(interrupt_type as u8); } } diff --git a/kernel/src/task.rs b/kernel/src/task.rs index c79140f..1040fb9 100644 --- a/kernel/src/task.rs +++ b/kernel/src/task.rs @@ -33,7 +33,7 @@ pub trait Process: Future + Send {} impl + Send> Process for T {} pub struct Executor { - tasks: Slab, + tasks: Slab, task_queue: Arc>, interrupt_lookup: [Option; u8::MAX as usize], } @@ -41,7 +41,7 @@ pub struct Executor { impl Executor { pub fn new() -> Self { Self { - tasks: Slab::new(), + tasks: Slab::new(), task_queue: Arc::new(SegQueue::new()), interrupt_lookup: [None; u8::MAX as usize], } @@ -67,7 +67,7 @@ impl Executor { } } - pub fn interrupt_subscribe(&mut self, pid : usize, interrupt_type: u8){ + pub fn interrupt_subscribe(&mut self, pid: usize, interrupt_type: u8) { self.interrupt_lookup[interrupt_type as usize] = Some(pid); } @@ -85,7 +85,7 @@ impl Executor { } if batch_len == 0 { - //break; + // break; continue; } @@ -100,8 +100,8 @@ impl Executor { if let Poll::Ready(()) = task.poll(&mut cx) { self.tasks.remove(id); - self.interrupt_lookup.map(|pid|{ - if let Some(pid) = pid{ + self.interrupt_lookup.map(|pid| { + if let Some(pid) = pid { if pid == id { return None; } @@ -114,9 +114,9 @@ impl Executor { } } - pub fn send_interrupt(&self, interrupt : u8){ + pub fn send_interrupt(&self, interrupt: u8) { let id = self.interrupt_lookup[interrupt as usize]; - if let Some(id) = id{ + if let Some(id) = id { self.unpause(id); } } diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 72445ba..72ef8b4 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -28,26 +28,26 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.horizon] # path = "boot:///horizon.hbf" -# path = "boot:///ps2_mouse_driver.hbf" -# [boot.limine.ableos.modules.ps2_mouse_driver] +[boot.limine.ableos.modules.ps2_mouse_driver] +path = "boot:///ps2_mouse_driver.hbf" # [boot.limine.ableos.modules.ps2_keyboard_driver] # path = "boot:///ps2_keyboard_driver.hbf" # [boot.limine.ableos.modules.sunset_client] # path = "boot:///sunset_client.hbf" -# + # [boot.limine.ableos.modules.sunset_client_2] # path = "boot:///sunset_client_2.hbf" -# -# [boot.limine.ableos.modules.sdoom] -# path = "boot:///sdoom.hbf" -# -# [boot.limine.ableos.modules.sunset_server] -# path = "boot:///sunset_server.hbf" + +[boot.limine.ableos.modules.sdoom] +path = "boot:///sdoom.hbf" + +[boot.limine.ableos.modules.sunset_server] +path = "boot:///sunset_server.hbf" # [boot.limine.ableos.modules.pcspkr] # path = "boot:///pcspkr.hbf" -[boot.limine.ableos.modules.test] -path = "boot:///test.hbf" +# [boot.limine.ableos.modules.test] +# path = "boot:///test.hbf"