This commit is contained in:
koniifer 2024-11-16 09:34:17 +00:00
parent ee82bc5705
commit d958a103fa

View file

@ -11,11 +11,9 @@ static mut LAPIC: LocalApic = unsafe { MaybeUninit::zeroed().assume_init() };
static mut IDT: InterruptDescriptorTable = unsafe { MaybeUninit::zeroed().assume_init() }; static mut IDT: InterruptDescriptorTable = unsafe { MaybeUninit::zeroed().assume_init() };
#[repr(u8)] #[repr(u8)]
#[derive(Debug)]#[derive(Eq, Hash, PartialEq)] #[derive(Debug, Eq, Hash, PartialEq)]
pub enum Interrupt {
pub
enum Interrupt {
Timer = 32, Timer = 32,
ApicErr = u8::MAX - 1, ApicErr = u8::MAX - 1,
Spurious = u8::MAX, Spurious = u8::MAX,
@ -64,7 +62,7 @@ extern "x86-interrupt" fn page_fault(
} }
extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) { extern "x86-interrupt" fn timer(_isf: InterruptStackFrame) {
interrupt(Interrupt::Timer); // interrupt(Interrupt::Timer);
unsafe { unsafe {
LAPIC.end_of_interrupt(); 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; use crate::arch::INTERRUPT_LIST;
let il = INTERRUPT_LIST.lock(); let il = INTERRUPT_LIST.lock();
let val = il.list.get(&interrupt_type).unwrap(); let val = il.list.get(&interrupt_type).unwrap();
@ -94,12 +91,12 @@ fn interrupt(interrupt_type: Interrupt){
use crate::holeybytes::kernel_services::service_definition_service::sds_search_service; use crate::holeybytes::kernel_services::service_definition_service::sds_search_service;
let buffer = sds_search_service(val); let buffer = sds_search_service(val);
if buffer != 0 { if buffer != 0 {
use alloc::vec::Vec;use crate::kmain::IPC_BUFFERS; use {crate::kmain::IPC_BUFFERS, alloc::vec::Vec};
let mut buffs = IPC_BUFFERS.lock(); let mut buffs = IPC_BUFFERS.lock();
match buffs.get_mut(&buffer) { match buffs.get_mut(&buffer) {
Some(buff) => { Some(buff) => {
let mut msg_vec = Vec::new(); let mut msg_vec = Vec::new();
msg_vec.push(0xff); msg_vec.push(0xFF);
buff.push(msg_vec.to_vec()); buff.push(msg_vec.to_vec());
log::debug!("Sent Message {:?} to Buffer({})", msg_vec, buffer); log::debug!("Sent Message {:?} to Buffer({})", msg_vec, buffer);
} }
@ -108,9 +105,6 @@ fn interrupt(interrupt_type: Interrupt){
} }
} }
// log::info!("{}", buffer); // log::info!("{}", buffer);
}
}
} }