From 0238e44efc2940f03cc8f42696e8a75b61739a68 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 9 Mar 2016 00:28:19 -0500 Subject: [PATCH] Remove kernel namespace from PIC --- src/Main.cc | 2 +- src/PIC.cc | 16 +++++++--------- src/PIC.hh | 4 +--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Main.cc b/src/Main.cc index 7c2401c..4b3c5d5 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -51,7 +51,7 @@ kmain() console.writeString("IDT loaded\n"); - auto pic = kernel::x86::PIC::systemPIC(); + 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"); diff --git a/src/PIC.cc b/src/PIC.cc index 4e8c0ba..e958b16 100644 --- a/src/PIC.cc +++ b/src/PIC.cc @@ -42,7 +42,6 @@ namespace { } PIC1 { 0x0020, 0x0021 }, PIC2 { 0x00A0, 0x00A1 }; } -namespace kernel { namespace x86 { /* @@ -120,8 +119,8 @@ PIC::remap(uint8_t pic1Offset, } // Save the current IRQ masks for each PIC - uint8_t pic1Mask = io::inb(PIC1.data); - uint8_t pic2Mask = io::inb(PIC2.data); + uint8_t pic1Mask = kernel::io::inb(PIC1.data); + uint8_t pic2Mask = kernel::io::inb(PIC2.data); #ifdef CONFIG_PIC_SHOULD_WAIT # define waitIfRequired() io::wait() @@ -130,7 +129,7 @@ PIC::remap(uint8_t pic1Offset, #endif #define sendToPIC(port, byte) \ - io::outb((port), (byte)); \ + kernel::io::outb((port), (byte)); \ waitIfRequired() sendToPIC(PIC1.command, ICW1::Initialize + ICW1::ICW4Required); @@ -147,8 +146,8 @@ PIC::remap(uint8_t pic1Offset, #undef waitIfRequired // Restore the saved masks - io::outb(PIC2.data, pic1Mask); - io::outb(PIC2.data, pic2Mask); + kernel::io::outb(PIC2.data, pic1Mask); + kernel::io::outb(PIC2.data, pic2Mask); } void @@ -160,10 +159,9 @@ PIC::endOfInterrupt(uint8_t irq) * notified. Otherwise, only PIC1 needs to be notified. */ if (irq >= 8) { - io::outb(PIC2.command, OCW2::NOPEOI); + kernel::io::outb(PIC2.command, OCW2::NOPEOI); } - io::outb(PIC1.command, OCW2::NOPEOI); + kernel::io::outb(PIC1.command, OCW2::NOPEOI); } } /* namespace x86 */ -} /* namespace kernel */ diff --git a/src/PIC.hh b/src/PIC.hh index 92ab822..aebad34 100644 --- a/src/PIC.hh +++ b/src/PIC.hh @@ -12,7 +12,6 @@ #include -namespace kernel { namespace x86 { /** @@ -50,8 +49,7 @@ struct PIC */ void enableInterrupt(uint8_t irq, bool enabled); }; - + } /* namespace x86 */ -} /* namespace kernel */ #endif /* __PIC_HH__ */