From 3e973716f8da044f46c1f17a600c3a9cd1914796 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 9 Mar 2016 01:23:06 -0500 Subject: [PATCH] Create a system interrupt handler and call initialize() Loads interrupt table and programs PIC chips --- src/Interrupts.cc | 5 +++++ src/Main.cc | 13 +++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Interrupts.cc b/src/Interrupts.cc index 3dd27ad..0155261 100644 --- a/src/Interrupts.cc +++ b/src/Interrupts.cc @@ -7,6 +7,7 @@ */ #include "Interrupts.hh" +#include "Console.hh" namespace x86 { @@ -34,8 +35,12 @@ InterruptHandler::InterruptHandler() void InterruptHandler::initialize() { + auto console = kernel::Console::systemConsole(); + mIDT.load(); + console.writeString("Interrupt table loaded\n"); mPIC.remap(0x20, 0x28, 2); // Map hardware IRQs to interrupt vectors 32 through 48. + console.writeString("Hardware interrupts initialized\n"); } diff --git a/src/Main.cc b/src/Main.cc index 2665469..4bfdc6a 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -2,7 +2,7 @@ #include #include "Console.hh" #include "Descriptors.hh" -#include "PIC.hh" +#include "Interrupts.hh" #if defined(__linux__) #error "This file should be compiled with a cross-compiler, not the Linux system compiler!" @@ -46,13 +46,6 @@ kmain() console.writeString("GDT loaded\n"); - auto idt = x86::IDT::systemIDT(); - idt.load(); - - console.writeString("IDT loaded\n"); - - auto pic = x86::PIC::systemPIC(); - pic.remap(0x20, 0x28, 2); // Map hardware IRQs to interrupt vectors 32 through 48. - - console.writeString("Hardware interrupts programmed\n"); + auto interruptHandler = x86::InterruptHandler::systemInterruptHandler(); + interruptHandler.initialize(); }