- Fix some bugs in INT_PROLOG so that it can be used in cases like Unexepcted interrupts, where we don't want to push a fake error code, and want to use our own parameter.

svn path=/trunk/; revision=23672
This commit is contained in:
Alex Ionescu 2006-08-23 18:02:52 +00:00
parent daedfda3d4
commit da725d9d30
7 changed files with 35 additions and 15 deletions

View file

@ -20,8 +20,6 @@
PVOID HalpZeroPageMapping = NULL; PVOID HalpZeroPageMapping = NULL;
HALP_HOOKS HalpHooks; HALP_HOOKS HalpHooks;
VOID NTAPI HalpClockInterrupt(VOID);
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
NTSTATUS NTSTATUS
@ -44,15 +42,6 @@ HalInitSystem (ULONG BootPhase,
} }
else if (BootPhase == 1) else if (BootPhase == 1)
{ {
#if 0
/* Enable the clock interrupt */
((PKIPCR)KeGetPcr())->IDT[IRQ2VECTOR(0)].ExtendedOffset =
(USHORT)(((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF);
((PKIPCR)KeGetPcr())->IDT[IRQ2VECTOR(0)].Offset =
(USHORT)HalpClockInterrupt;
HalEnableSystemInterrupt(IRQ2VECTOR(0), CLOCK2_LEVEL, Latched);
#endif
/* Initialize display and make the screen black */ /* Initialize display and make the screen black */
HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock); HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
HalpInitBusHandlers(); HalpInitBusHandlers();

View file

@ -537,7 +537,7 @@ _HalpApcInterrupt:
push eax push eax
/* Enter interrupt */ /* Enter interrupt */
INT_PROLOG(hapc) INT_PROLOG hapc, DoPushFakeErrorCode
.endfunc .endfunc
.globl _HalpApcInterrupt2ndEntry .globl _HalpApcInterrupt2ndEntry
@ -584,7 +584,7 @@ _HalpDispatchInterrupt:
push eax push eax
/* Enter interrupt */ /* Enter interrupt */
INT_PROLOG(hapc) INT_PROLOG hapc, DoPushFakeErrorCode
.endfunc .endfunc
.globl _HalpDispatchInterrupt2ndEntry .globl _HalpDispatchInterrupt2ndEntry

View file

@ -21,4 +21,5 @@
.func HalpClockInterrupt@0 .func HalpClockInterrupt@0
_HalpClockInterrupt@0: _HalpClockInterrupt@0:
jmp $
.endfunc .endfunc

View file

@ -15,6 +15,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
VOID NTAPI HalpClockInterrupt(VOID);
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
VOID VOID
@ -22,6 +24,15 @@ HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
{ {
HalpInitPICs(); HalpInitPICs();
/* Enable the clock interrupt */
#if 0
((PKIPCR)KeGetPcr())->IDT[IRQ2VECTOR(0)].ExtendedOffset =
(USHORT)(((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF);
((PKIPCR)KeGetPcr())->IDT[IRQ2VECTOR(0)].Offset =
(USHORT)HalpClockInterrupt;
#endif
HalEnableSystemInterrupt(IRQ2VECTOR(0), CLOCK2_LEVEL, Latched);
/* Setup busy waiting */ /* Setup busy waiting */
HalpCalibrateStallExecution(); HalpCalibrateStallExecution();
} }

View file

@ -16,11 +16,13 @@
#define DoRestoreEverything 1 #define DoRestoreEverything 1
#define DoRestoreSegments 1 #define DoRestoreSegments 1
#define DoRestoreVolatiles 1 #define DoRestoreVolatiles 1
#define DoPushFakeErrorCode 1
#define NotFromSystemCall 0 #define NotFromSystemCall 0
#define DoNotRestorePreviousMode 0 #define DoNotRestorePreviousMode 0
#define DoNotRestoreEverything 0 #define DoNotRestoreEverything 0
#define DoNotRestoreSegments 0 #define DoNotRestoreSegments 0
#define DoNotRestoreVolatiles 0 #define DoNotRestoreVolatiles 0
#define DoNotPushFakeErrorCode 0
// Arguments for idt // Arguments for idt
#define INT_32_DPL0 0x8E00 #define INT_32_DPL0 0x8E00
@ -332,9 +334,12 @@ _KiUnexpectedInterrupt&Number:
// //
// @remark For software interrupts, make sure that a fake INT stack is created. // @remark For software interrupts, make sure that a fake INT stack is created.
// //
.macro INT_PROLOG Label .macro INT_PROLOG Label FakeErrorCode
.if \FakeErrorCode
/* Save fake error code */ /* Save fake error code */
push esp push esp
.endif
/* Save the non-volatiles */ /* Save the non-volatiles */
push ebp push ebp
@ -388,6 +393,14 @@ _KiUnexpectedInterrupt&Number:
/* Save the previous exception list */ /* Save the previous exception list */
mov [esp+KTRAP_FRAME_EXCEPTION_LIST], ebx mov [esp+KTRAP_FRAME_EXCEPTION_LIST], ebx
.ifeq \FakeErrorCode
/* Setup the 16-bit stack */
lea eax, [esp+KTRAP_FRAME_ERROR_CODE]
lea ecx, [esp+KTRAP_FRAME_EIP]
mov ebx, ss:[eax]
mov ss:[eax], ecx
.endif
/* Check if this is the ABIOS stack */ /* Check if this is the ABIOS stack */
/* cmp esp, 0x10000*/ /* cmp esp, 0x10000*/
/* jb Abios_Label*/ /* jb Abios_Label*/
@ -405,6 +418,11 @@ _KiUnexpectedInterrupt&Number:
/* Check if the thread was being debugged */ /* Check if the thread was being debugged */
test byte ptr [ecx+KTHREAD_DEBUG_ACTIVE], 0xFF test byte ptr [ecx+KTHREAD_DEBUG_ACTIVE], 0xFF
.ifeq \FakeErrorCode
/* Push parameter */
push ebx
.endif
/* Save DR registers if needed */ /* Save DR registers if needed */
//jnz Dr_&Label //jnz Dr_&Label

View file

@ -292,6 +292,7 @@ KiInterruptDispatch (ULONG vector, PKIRQ_TRAPFRAME Trapframe)
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
if (VECTOR2IRQ(vector) == 0) if (VECTOR2IRQ(vector) == 0)
{ {
DPRINT1("Tick\n");
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame); KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
KeUpdateSystemTime(&KernelTrapFrame, old_level); KeUpdateSystemTime(&KernelTrapFrame, old_level);
} }

View file

@ -1309,7 +1309,7 @@ _KiEndUnexpected:
_KiUnexpectedInterruptTail: _KiUnexpectedInterruptTail:
/* Enter interrupt trap */ /* Enter interrupt trap */
INT_PROLOG(kui) INT_PROLOG kui, DoNotPushFakeErrorCode
/* Increase interrupt count */ /* Increase interrupt count */
inc dword ptr [fs:KPCR_PRCB_INTERRUPT_COUNT] inc dword ptr [fs:KPCR_PRCB_INTERRUPT_COUNT]