feat(pic): create pit module
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2022-04-21 16:47:56 +02:00
parent bdf28e38f4
commit d14ad3a912
3 changed files with 14 additions and 7 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ iso
julios
.gdb_history
peda-session-julios.txt
*.swp

View File

@ -5,6 +5,9 @@ use pc_keyboard::{layouts, DecodedKey, HandleControl, Keyboard, ScancodeSet1};
use x86_64::structures::idt::{InterruptStackFrame};
use x86_64::instructions::port::Port;
use spin::{self, Mutex};
pub use pit::timer_interrupt_handler;
pub mod pit;
pub const PIC_1_OFFSET: u8 = 32;
pub const PIC_2_OFFSET: u8 = PIC_1_OFFSET + 8;
@ -37,13 +40,6 @@ pub fn init_pic() {
unsafe { PICS.lock().initialize() };
}
pub extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFrame) {
// print!(".");
unsafe {
PICS.lock()
.notify_end_of_interrupt(InterruptIndex::Timer.as_u8());
}
}
pub extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) {
lazy_static! {

10
src/interrupts/pic/pit.rs Normal file
View File

@ -0,0 +1,10 @@
use super::{PICS, InterruptIndex};
use x86_64::structures::idt::InterruptStackFrame;
pub extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFrame) {
// print!(".");
unsafe {
PICS.lock()
.notify_end_of_interrupt(InterruptIndex::Timer.as_u8());
}
}