feature: start to implement keyboard handler and better isrs/irqs
This commit is contained in:
7
headers/drivers.h
Normal file
7
headers/drivers.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "interrupts.h"
|
||||
|
||||
void load_drivers(void);
|
||||
void keyboard_handler(struct registers *regs);
|
||||
void clock_handler(struct registers *regs);
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// doc : https://wiki.osdev.org/Interrupt_Descriptor_Table#IDTR
|
||||
struct idt_descriptor {
|
||||
uint16_t size;
|
||||
@ -17,4 +19,4 @@ struct idt_entry {
|
||||
|
||||
#define IDT_SIZE 256
|
||||
|
||||
void init_idt(void);
|
||||
void init_idt(void);
|
||||
|
@ -2,5 +2,19 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void exception_handler(void);
|
||||
struct registers {
|
||||
// data segment selector
|
||||
uint32_t ds;
|
||||
// general purpose registers pushed by pusha
|
||||
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
|
||||
// pushed by isr procedure
|
||||
uint32_t int_no, err_code;
|
||||
// pushed by CPU automatically
|
||||
uint32_t eip, cs, eflags, useresp, ss;
|
||||
};
|
||||
|
||||
typedef void (*isr_t)(struct registers *);
|
||||
|
||||
void isr_handler(struct registers *regs);
|
||||
void pic_send_eoi(uint8_t irq);
|
||||
void register_interrupt_handler(int index, isr_t handler);
|
||||
|
Reference in New Issue
Block a user