diff --git a/src/interrupts/mod.rs b/src/interrupts/mod.rs index 355c43b..02f3d66 100644 --- a/src/interrupts/mod.rs +++ b/src/interrupts/mod.rs @@ -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, diff --git a/src/syscalls/mod.rs b/src/syscalls/mod.rs index af514a1..a253f3a 100644 --- a/src/syscalls/mod.rs +++ b/src/syscalls/mod.rs @@ -1 +1,5 @@ pub mod io; + +pub fn syscall_dispatcher() -> u64 { + 0 +} \ No newline at end of file