diff --git a/sdk/xtdk/amd64/hlfuncs.h b/sdk/xtdk/amd64/hlfuncs.h index 77f8eb8..2029c81 100644 --- a/sdk/xtdk/amd64/hlfuncs.h +++ b/sdk/xtdk/amd64/hlfuncs.h @@ -18,6 +18,10 @@ extern ULONG ComPortAddress[]; /* HAL library routines forward references */ +XTCDECL +VOID +HlClearInterruptFlag(); + XTCDECL BOOLEAN HlCpuId(IN OUT PCPUID_REGISTERS Registers); @@ -39,6 +43,10 @@ XTCDECL ULONG_PTR HlReadControlRegister(IN USHORT ControlRegister); +XTCDECL +VOID +HlSetInterruptFlag(); + XTCDECL VOID HlWriteControlRegister(IN USHORT ControlRegister, diff --git a/sdk/xtdk/i686/hlfuncs.h b/sdk/xtdk/i686/hlfuncs.h index c7f4727..25dd59c 100644 --- a/sdk/xtdk/i686/hlfuncs.h +++ b/sdk/xtdk/i686/hlfuncs.h @@ -18,6 +18,10 @@ extern ULONG ComPortAddress[]; /* HAL library routines forward references */ +XTCDECL +VOID +HlClearInterruptFlag(); + XTCDECL BOOLEAN HlCpuId(IN OUT PCPUID_REGISTERS Registers); @@ -39,6 +43,10 @@ XTCDECL ULONG_PTR HlReadControlRegister(IN USHORT ControlRegister); +XTCDECL +VOID +HlSetInterruptFlag(); + XTCDECL VOID HlWriteControlRegister(IN USHORT ControlRegister, diff --git a/xtldr/xtldr.c b/xtldr/xtldr.c index 9e7a359..3bb9a8d 100644 --- a/xtldr/xtldr.c +++ b/xtldr/xtldr.c @@ -380,6 +380,7 @@ BlStartNewStack() /* Infinite bootloader loop */ BlEfiPrint(L"System halted!"); + HlClearInterruptFlag(); HlHalt(); /* Return success */ @@ -461,6 +462,7 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle, /* Infinite bootloader loop */ BlDbgPrint(L"ERROR: Unexpected exception occurred, probably did not create a new stack\n"); BlEfiPrint(L"System halted!"); + HlClearInterruptFlag(); HlHalt(); /* Return success */ diff --git a/xtoskrnl/hl/amd64/cpufunc.c b/xtoskrnl/hl/amd64/cpufunc.c index 6023be4..72626f9 100644 --- a/xtoskrnl/hl/amd64/cpufunc.c +++ b/xtoskrnl/hl/amd64/cpufunc.c @@ -9,6 +9,20 @@ #include "xtkmapi.h" +/** + * Instructs the processor to clear the interrupt flag. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCDECL +VOID +HlClearInterruptFlag() +{ + asm volatile("cli"); +} + /** * Retrieves a various amount of information about the CPU. * @@ -176,6 +190,20 @@ HlReadControlRegister(IN USHORT ControlRegister) return Value; } +/** + * Instructs the processor to set the interrupt flag. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCDECL +VOID +HlSetInterruptFlag() +{ + asm volatile("sti"); +} + /** * Writes a value to the specified CPU control register. * diff --git a/xtoskrnl/hl/i686/cpufunc.c b/xtoskrnl/hl/i686/cpufunc.c index ddc17c5..ebf56ea 100644 --- a/xtoskrnl/hl/i686/cpufunc.c +++ b/xtoskrnl/hl/i686/cpufunc.c @@ -9,6 +9,20 @@ #include "xtkmapi.h" +/** + * Instructs the processor to clear the interrupt flag. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCDECL +VOID +HlClearInterruptFlag() +{ + asm volatile("cli"); +} + /** * Retrieves a various amount of information about the CPU. * @@ -170,6 +184,20 @@ HlReadControlRegister(IN USHORT ControlRegister) return Value; } +/** + * Instructs the processor to set the interrupt flag. + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCDECL +VOID +HlSetInterruptFlag() +{ + asm volatile("sti"); +} + /** * Writes a value to the specified CPU control register. *