Interrupt Dispatch and Handling (for first common vectors)
This commit is contained in:
@@ -40,6 +40,7 @@ interrupt_stub:
|
||||
push rdx
|
||||
push rsi
|
||||
push rdi
|
||||
push rsp
|
||||
push rbp
|
||||
push r8
|
||||
push r9
|
||||
@@ -65,6 +66,7 @@ interrupt_stub:
|
||||
pop r9
|
||||
pop r8
|
||||
pop rbp
|
||||
pop rsp
|
||||
pop rdi
|
||||
pop rsi
|
||||
pop rdx
|
||||
|
||||
@@ -44,13 +44,14 @@ void idt_init()
|
||||
// Each vector handler is 16-byte aligned, so <vector_no>*16 = address of that handler
|
||||
idt_set_entry(i, vector_0_handler + (i*16), 0);
|
||||
}
|
||||
idt_load(&idt);
|
||||
serial_kputs("kernel: idt: Initialized IDT!\n");
|
||||
}
|
||||
|
||||
struct cpu_status_t* interrupt_dispatch(struct cpu_status_t* context)
|
||||
{
|
||||
switch(context->vector_number)
|
||||
{
|
||||
// TODO: add serial logs for all interrupts
|
||||
case 0:
|
||||
serial_kputs("kernel: idt: Divide Error!\n");
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void idt_init();
|
||||
|
||||
struct interrupt_descriptor
|
||||
{
|
||||
uint16_t address_low;
|
||||
@@ -34,6 +36,7 @@ struct cpu_status_t
|
||||
uint64_t r9;
|
||||
uint64_t r8;
|
||||
uint64_t rbp;
|
||||
uint64_t rsp;
|
||||
uint64_t rdi;
|
||||
uint64_t rsi;
|
||||
uint64_t rdx;
|
||||
|
||||
Reference in New Issue
Block a user