From d958a103faa4442b9fe6436b5399248e9ce37fe5 Mon Sep 17 00:00:00 2001 From: koniifer Date: Sat, 16 Nov 2024 09:34:17 +0000 Subject: [PATCH] fix --- kernel/src/arch/x86_64/interrupts.rs | 44 ++++++++++++---------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/kernel/src/arch/x86_64/interrupts.rs b/kernel/src/arch/x86_64/interrupts.rs index 0d3215d53..4bd3c8a96 100644 --- a/kernel/src/arch/x86_64/interrupts.rs +++ b/kernel/src/arch/x86_64/interrupts.rs @@ -11,11 +11,9 @@ static mut LAPIC: LocalApic = unsafe { MaybeUninit::zeroed().assume_init() }; static mut IDT: InterruptDescriptorTable = unsafe { MaybeUninit::zeroed().assume_init() }; #[repr(u8)] -#[derive(Debug)]#[derive(Eq, Hash, PartialEq)] +#[derive(Debug, Eq, Hash, PartialEq)] - -pub -enum Interrupt { +pub enum Interrupt { Timer = 32, ApicErr = u8::MAX - 1, Spurious = u8::MAX, @@ -64,7 +62,7 @@ extern "x86-interrupt" fn page_fault( } extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) { - interrupt(Interrupt::Timer); + // interrupt(Interrupt::Timer); unsafe { LAPIC.end_of_interrupt(); @@ -85,8 +83,7 @@ extern "x86-interrupt" fn spurious(_: InterruptStackFrame) { } } -fn interrupt(interrupt_type: Interrupt){ - +fn interrupt(interrupt_type: Interrupt) { use crate::arch::INTERRUPT_LIST; let il = INTERRUPT_LIST.lock(); let val = il.list.get(&interrupt_type).unwrap(); @@ -94,23 +91,20 @@ fn interrupt(interrupt_type: Interrupt){ use crate::holeybytes::kernel_services::service_definition_service::sds_search_service; let buffer = sds_search_service(val); if buffer != 0 { - use alloc::vec::Vec;use crate::kmain::IPC_BUFFERS; - 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); + 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); + } } -} \ No newline at end of file