diff --git a/xtoskrnl/hl/x86/pic.c b/xtoskrnl/hl/x86/pic.c index f61e158..f3794b0 100644 --- a/xtoskrnl/hl/x86/pic.c +++ b/xtoskrnl/hl/x86/pic.c @@ -9,95 +9,6 @@ #include -/** - * Initializes the 8259 PIC. - * - * @return This routine does not return any value. - * - * @since XT 1.0 - */ -XTCDECL -VOID -HlInitializePic(VOID) -{ - /* Start in cascade mode */ - HlWritePic(PIC1_CONTROL_PORT, PIC_ICW1_INIT | PIC_ICW1_ICW4); - HlWritePic(PIC2_CONTROL_PORT, PIC_ICW1_INIT | PIC_ICW1_ICW4); - - /* PIC Vector offset */ - HlWritePic(PIC1_DATA_PORT, 0x20); - HlWritePic(PIC2_DATA_PORT, 0x28); - - /* Tell Master PIC that there is a Slave PIC */ - HlWritePic(PIC1_DATA_PORT, 4); - - /* Tell Slave PIC its cascade identity */ - HlWritePic(PIC2_DATA_PORT, 2); - - /* Tell PIC to use 8086 mode */ - HlWritePic(PIC1_DATA_PORT, PIC_ICW4_8086); - HlWritePic(PIC2_DATA_PORT, PIC_ICW4_8086); - - /* Mask all IRQs by default */ - /* This makes sure we don't get any interrupts we can't handle yet. */ - for (UCHAR Irq = 0; Irq < 16; Irq++) - { - HlSetMaskIrqPic(Irq); - } -} - -/** - * Masks an IRQ in the 8259 PIC. - * - * @param Irq - * Supplies the IRQ number to be masked. - * - * @return This routine does not return any value. - * - * @since XT 1.0 - */ -XTCDECL -VOID -HlSetMaskIrqPic(UCHAR Irq) -{ - UINT Port; - - if(Irq < 8) { - Port = PIC1_DATA_PORT; - } else { - Port = PIC2_DATA_PORT; - Irq -= 8; - } - - HlWritePic(Port, HlIoPortInByte(Port) | (1 << Irq)); -} - -/** - * Clears an IRQ mask in the 8259 PIC. - * - * @param Irq - * Supplies the IRQ number to be unmasked. - * - * @return This routine does not return any value. - * - * @since XT 1.0 - */ -XTCDECL -VOID -HlClearMaskIrqPic(UCHAR Irq) -{ - UINT Port; - - if(Irq < 8) { - Port = PIC1_DATA_PORT; - } else { - Port = PIC2_DATA_PORT; - Irq -= 8; - } - - HlWritePic(Port, HlIoPortInByte(Port) & ~(1 << Irq)); -} - /** * Disables the 8259 PIC. * @@ -113,17 +24,6 @@ HlDisablePic(VOID) HlIoPortOutByte(PIC2_DATA_PORT, 0xFF); } -XTFASTCALL -VOID -HlWritePic(IN UCHAR Register, IN UCHAR Value) -{ - /* Send data */ - HlIoPortOutByte(Register, Value); - - /* Wait for some time to make sure PIC has processed the data */ - HlIoPortOutByte(0x80, 0x00); -} - /** * Reads from the APIC register. * diff --git a/xtoskrnl/includes/hl.h b/xtoskrnl/includes/hl.h index c89aeee..4c680d5 100644 --- a/xtoskrnl/includes/hl.h +++ b/xtoskrnl/includes/hl.h @@ -11,28 +11,11 @@ #include - /* HAL library routines forward references */ -XTCDECL -VOID -HlInitializePic(VOID); - -XTCDECL -VOID -HlSetMaskIrqPic(UCHAR Irq); - -XTCDECL -VOID -HlClearMaskIrqPic(UCHAR Irq); - XTCDECL VOID HlDisablePic(VOID); -XTFASTCALL -VOID -HlWritePic(IN UCHAR Register, IN UCHAR Value); - XTAPI VOID HlClearScreen(VOID); diff --git a/xtoskrnl/ke/amd64/krnlinit.c b/xtoskrnl/ke/amd64/krnlinit.c index b3022be..90bdb66 100644 --- a/xtoskrnl/ke/amd64/krnlinit.c +++ b/xtoskrnl/ke/amd64/krnlinit.c @@ -71,7 +71,6 @@ KepInitializeMachine(VOID) HlIoPortOutByte(0x3F6, 0); /* Disable the legacy PIC */ - HlInitializePic(); HlDisablePic(); } diff --git a/xtoskrnl/ke/i686/krnlinit.c b/xtoskrnl/ke/i686/krnlinit.c index faefae0..f8ec530 100644 --- a/xtoskrnl/ke/i686/krnlinit.c +++ b/xtoskrnl/ke/i686/krnlinit.c @@ -69,6 +69,9 @@ KepInitializeMachine(VOID) /* Re-enable IDE interrupts */ HlIoPortOutByte(0x376, 0); HlIoPortOutByte(0x3F6, 0); + + /* Disable the legacy PIC */ + HlDisablePic(); } /**