diff --git a/arch/ioapic.cc b/arch/ioapic.cc index c610c01..cd67118 100644 --- a/arch/ioapic.cc +++ b/arch/ioapic.cc @@ -1,6 +1,7 @@ #include "ioapic.h" #include "apic.h" #include "core.h" +#include "../debug/assert.h" namespace IOAPIC { /*! \brief IOAPIC registers memory mapped into the CPU's address space. @@ -60,14 +61,17 @@ void init() { } void config(uint8_t slot, Core::Interrupt::Vector vector, - TriggerMode trigger_mode, Polarity polarity) { - (void)slot; - (void)vector; - (void)trigger_mode; - (void)polarity; + TriggerMode trigger_mode, Polarity polarity) { + assert(slot < slot_max); + RedirectionTableEntry entry = readEntry(slot); + entry.vector = vector; + entry.trigger_mode = trigger_mode; + entry.polarity = polarity; + writeEntry(slot, entry); } -void allow(uint8_t slot) { (void)slot; } +void allow(uint8_t slot) { +} void forbid(uint8_t slot) { (void)slot; } diff --git a/device/ps2controller.cc b/device/ps2controller.cc index a2d541f..7d25307 100644 --- a/device/ps2controller.cc +++ b/device/ps2controller.cc @@ -1,5 +1,6 @@ #include "ps2controller.h" +#include "../arch/system.h" #include "../arch/core_interrupt.h" #include "../arch/ioport.h" #include "../compiler/fix.h" @@ -120,6 +121,9 @@ bool fetch(Key &pressed) { return false; pressed = key_decoder.decode(out_buffer); + + if (pressed.ctrl() && pressed.alt() && pressed.scancode == Key::KEY_DEL) + System::reboot(); if (pressed.alt() || pressed.ctrl() || !pressed.valid()) return false; diff --git a/main.cc b/main.cc index f8654e2..e322cc4 100644 --- a/main.cc +++ b/main.cc @@ -10,6 +10,8 @@ #include "device/serialstream.h" #include "device/textstream.h" #include "device/ps2controller.h" +#include "arch/ioapic.h" + TextStream kout = TextStream(0, 80, 0, 10, true); //TextStream dout[8] = { @@ -55,6 +57,9 @@ OutputStream* copyout[Core::MAX]{ &dout[7] }; +void test(){ + kout << "test" << endl << flush; +} // Main function // (the bootstrap processor starts here)} @@ -112,6 +117,10 @@ extern "C" int main() { ApplicationProcessor::boot(); PS2Controller::init(); + + IOAPIC::init(); + //IOAPIC::config(Core::Interrupt::KEYBOARD, Core::Interrupt::Vector vect); + Core::Interrupt::enable(); Key key = Key();