diff --git a/xtoskrnl/hl/x86/pic.c b/xtoskrnl/hl/x86/pic.c index 8d7b9e3..f0fa4f0 100644 --- a/xtoskrnl/hl/x86/pic.c +++ b/xtoskrnl/hl/x86/pic.c @@ -10,6 +10,21 @@ #include +/** + * Clears all errors on the APIC. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +HlClearApicErrors() +{ + /* Clear APIC errors */ + HlWriteApicRegister(APIC_ESR, 0); +} + /** * Disables the legacy 8259 Programmable Interrupt Controller (PIC). * @@ -17,9 +32,9 @@ * * @since XT 1.0 */ -XTCDECL +XTAPI VOID -HlDisablePic(VOID) +HlDisableLegacyPic() { HlIoPortOutByte(PIC1_DATA_PORT, 0xFF); HlIoPortOutByte(PIC2_DATA_PORT, 0xFF); @@ -51,6 +66,21 @@ HlReadApicRegister(IN APIC_REGISTER Register) } } +/** + * Signals to the APIC that handling an interrupt is complete. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTAPI +VOID +HlSendEoi() +{ + /* Send APIC EOI */ + HlWriteApicRegister(APIC_EOI, 0); +} + /** * Writes to the APIC register. * diff --git a/xtoskrnl/includes/amd64/hli.h b/xtoskrnl/includes/amd64/hli.h index 1e07920..681b94f 100644 --- a/xtoskrnl/includes/amd64/hli.h +++ b/xtoskrnl/includes/amd64/hli.h @@ -13,14 +13,22 @@ /* HAL library routines forward references */ -XTCDECL +XTAPI VOID -HlDisablePic(VOID); +HlClearApicErrors(); + +XTAPI +VOID +HlDisableLegacyPic(); XTFASTCALL ULONG HlReadApicRegister(IN APIC_REGISTER Register); +XTAPI +VOID +HlSendEoi(); + XTFASTCALL VOID HlWriteApicRegister(IN APIC_REGISTER Register, diff --git a/xtoskrnl/includes/i686/hli.h b/xtoskrnl/includes/i686/hli.h index 4c5bcf5..a57cd62 100644 --- a/xtoskrnl/includes/i686/hli.h +++ b/xtoskrnl/includes/i686/hli.h @@ -13,14 +13,22 @@ /* HAL library routines forward references */ -XTCDECL +XTAPI VOID -HlDisablePic(VOID); +HlClearApicErrors(); + +XTAPI +VOID +HlDisableLegacyPic(); XTFASTCALL ULONG HlReadApicRegister(IN APIC_REGISTER Register); +XTAPI +VOID +HlSendEoi(); + XTFASTCALL VOID HlWriteApicRegister(IN APIC_REGISTER Register, diff --git a/xtoskrnl/ke/amd64/krnlinit.c b/xtoskrnl/ke/amd64/krnlinit.c index a89b80a..1ef5bb5 100644 --- a/xtoskrnl/ke/amd64/krnlinit.c +++ b/xtoskrnl/ke/amd64/krnlinit.c @@ -71,7 +71,7 @@ KepInitializeMachine(VOID) HlIoPortOutByte(0x3F6, 0); /* Disable the legacy PIC */ - HlDisablePic(); + HlDisableLegacyPic(); /* Initialize frame buffer */ HlInitializeFrameBuffer(); diff --git a/xtoskrnl/ke/i686/krnlinit.c b/xtoskrnl/ke/i686/krnlinit.c index 78c01c5..7e904ed 100644 --- a/xtoskrnl/ke/i686/krnlinit.c +++ b/xtoskrnl/ke/i686/krnlinit.c @@ -71,7 +71,7 @@ KepInitializeMachine(VOID) HlIoPortOutByte(0x3F6, 0); /* Disable the legacy PIC */ - HlDisablePic(); + HlDisableLegacyPic(); /* Initialize frame buffer */ HlInitializeFrameBuffer();