...
This commit is contained in:
@@ -2,7 +2,4 @@
|
|||||||
|
|
||||||
#include "isr.h"
|
#include "isr.h"
|
||||||
|
|
||||||
typedef void (*exception_handler_t)(const isr_frame_t*);
|
|
||||||
|
|
||||||
void handle_exception(const isr_frame_t* frame);
|
void handle_exception(const isr_frame_t* frame);
|
||||||
void register_exception_handler(uint8_t irq, exception_handler_t handler);
|
|
||||||
@@ -8,20 +8,6 @@
|
|||||||
|
|
||||||
static irq_handler_t irq_handlers[16] = {0};
|
static irq_handler_t irq_handlers[16] = {0};
|
||||||
|
|
||||||
bool cpu_has_apic()
|
|
||||||
{
|
|
||||||
uint32_t eax, edx;
|
|
||||||
cpuid(1, &eax, &edx);
|
|
||||||
return (edx & CPUID_FEAT_EDX_APIC) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void enable_apic()
|
|
||||||
{
|
|
||||||
uint64_t apic_base = rdmsr(0x1B);
|
|
||||||
apic_base |= (1 << 11);
|
|
||||||
wrmsr(0x1B, apic_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
void remap_pic()
|
void remap_pic()
|
||||||
{
|
{
|
||||||
outb(PIC1_COMMAND, 0x11);
|
outb(PIC1_COMMAND, 0x11);
|
||||||
@@ -40,12 +26,6 @@ void remap_pic()
|
|||||||
outb(PIC2_DATA, 0);
|
outb(PIC2_DATA, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable_pic()
|
|
||||||
{
|
|
||||||
outb(PIC1_DATA, 0xFF);
|
|
||||||
outb(PIC2_DATA, 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_irq_handler(uint8_t irq, irq_handler_t handler)
|
void register_irq_handler(uint8_t irq, irq_handler_t handler)
|
||||||
{
|
{
|
||||||
if (irq >= 16)
|
if (irq >= 16)
|
||||||
|
|||||||
@@ -5,8 +5,5 @@
|
|||||||
typedef void (*irq_handler_t)(const isr_frame_t*);
|
typedef void (*irq_handler_t)(const isr_frame_t*);
|
||||||
|
|
||||||
void remap_pic();
|
void remap_pic();
|
||||||
void disable_pic();
|
|
||||||
bool cpu_has_apic();
|
|
||||||
void enable_apic();
|
|
||||||
void handle_irq(const isr_frame_t* frame);
|
void handle_irq(const isr_frame_t* frame);
|
||||||
void register_irq_handler(uint8_t irq, irq_handler_t handler);
|
void register_irq_handler(uint8_t irq, irq_handler_t handler);
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "panic.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void panic(const char* msg)
|
void panic(const char* msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user