Start syscall interrupt handler
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 2023-01-03 21:05:18 +01:00
parent 6e64101d09
commit a1a01124de
2 changed files with 13 additions and 0 deletions

@ -2,6 +2,8 @@ use crate::drivers::vga::{self, Color, ColorCode};
use crate::hlt_loop;
use crate::memory::gdt;
use crate::println;
use core::arch::asm;
use lazy_static::lazy_static;
use pic::{
disk1_interrupt_handler, disk2_interrupt_handler, init_pic, keyboard_interrupt_handler,
@ -12,6 +14,8 @@ use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
pub mod pic;
const SYSCALL_32_INTERRUPT_NUMBER: usize = 0x80;
lazy_static! {
static ref IDT: InterruptDescriptorTable = {
let mut idt = InterruptDescriptorTable::new();
@ -26,6 +30,7 @@ lazy_static! {
idt[InterruptIndex::Keyboard.as_usize()].set_handler_fn(keyboard_interrupt_handler);
idt[InterruptIndex::HardDisk1.as_usize()].set_handler_fn(disk1_interrupt_handler);
idt[InterruptIndex::HardDisk2.as_usize()].set_handler_fn(disk2_interrupt_handler);
idt[SYSCALL_32_INTERRUPT_NUMBER].set_handler_fn(syscall_handler_32);
idt
};
}
@ -47,6 +52,10 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
vga::change_color(color);
}
extern "x86-interrupt" fn syscall_handler_32(_stack_frame: InterruptStackFrame) {
println!("Received syscall");
}
extern "x86-interrupt" fn page_fault_handler(
stack_frame: InterruptStackFrame,
error_code: PageFaultErrorCode,

@ -1 +1,5 @@
pub mod io;
pub fn syscall_dispatcher() -> u64 {
0
}