[ros-diffs] [ion] 23672: - 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.

ion at svn.reactos.org ion at svn.reactos.org
Wed Aug 23 20:02:53 CEST 2006


Author: ion
Date: Wed Aug 23 22:02:52 2006
New Revision: 23672

URL: http://svn.reactos.org/svn/reactos?rev=23672&view=rev
Log:
- 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.

Modified:
    trunk/reactos/hal/halx86/generic/halinit.c
    trunk/reactos/hal/halx86/generic/irq.S
    trunk/reactos/hal/halx86/generic/systimer.S
    trunk/reactos/hal/halx86/up/halinit_up.c
    trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
    trunk/reactos/ntoskrnl/ke/i386/irq.c
    trunk/reactos/ntoskrnl/ke/i386/trap.s

Modified: trunk/reactos/hal/halx86/generic/halinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit.c?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/generic/halinit.c (original)
+++ trunk/reactos/hal/halx86/generic/halinit.c Wed Aug 23 22:02:52 2006
@@ -19,8 +19,6 @@
 
 PVOID HalpZeroPageMapping = NULL;
 HALP_HOOKS HalpHooks;
-
-VOID NTAPI HalpClockInterrupt(VOID);
 
 /* FUNCTIONS ***************************************************************/
 
@@ -44,15 +42,6 @@
     }
   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 */
       HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
       HalpInitBusHandlers();

Modified: trunk/reactos/hal/halx86/generic/irq.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/irq.S?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/generic/irq.S (original)
+++ trunk/reactos/hal/halx86/generic/irq.S Wed Aug 23 22:02:52 2006
@@ -537,7 +537,7 @@
     push eax
 
     /* Enter interrupt */
-    INT_PROLOG(hapc)
+    INT_PROLOG hapc, DoPushFakeErrorCode
 .endfunc
 
 .globl _HalpApcInterrupt2ndEntry
@@ -584,7 +584,7 @@
     push eax
 
     /* Enter interrupt */
-    INT_PROLOG(hapc)
+    INT_PROLOG hapc, DoPushFakeErrorCode
 .endfunc
 
 .globl _HalpDispatchInterrupt2ndEntry

Modified: trunk/reactos/hal/halx86/generic/systimer.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/systimer.S?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/generic/systimer.S (original)
+++ trunk/reactos/hal/halx86/generic/systimer.S Wed Aug 23 22:02:52 2006
@@ -21,4 +21,5 @@
 .func HalpClockInterrupt at 0
 _HalpClockInterrupt at 0:
 
+    jmp $
 .endfunc

Modified: trunk/reactos/hal/halx86/up/halinit_up.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/halinit_up.c?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/up/halinit_up.c (original)
+++ trunk/reactos/hal/halx86/up/halinit_up.c Wed Aug 23 22:02:52 2006
@@ -15,6 +15,8 @@
 #define NDEBUG
 #include <debug.h>
 
+VOID NTAPI HalpClockInterrupt(VOID);
+
 /* FUNCTIONS ***************************************************************/
 
 VOID
@@ -22,6 +24,15 @@
 {
   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 */
   HalpCalibrateStallExecution();
 }

Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S Wed Aug 23 22:02:52 2006
@@ -16,11 +16,13 @@
 #define DoRestoreEverything         1
 #define DoRestoreSegments           1
 #define DoRestoreVolatiles          1
+#define DoPushFakeErrorCode         1
 #define NotFromSystemCall           0
 #define DoNotRestorePreviousMode    0
 #define DoNotRestoreEverything      0
 #define DoNotRestoreSegments        0
 #define DoNotRestoreVolatiles       0
+#define DoNotPushFakeErrorCode      0
 
 // Arguments for idt
 #define INT_32_DPL0                 0x8E00
@@ -332,9 +334,12 @@
 //
 // @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 */
     push esp
+.endif
 
     /* Save the non-volatiles */
     push ebp
@@ -388,6 +393,14 @@
     /* Save the previous exception list */
     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 */
     /* cmp esp, 0x10000*/
     /* jb Abios_Label*/
@@ -404,6 +417,11 @@
 
     /* Check if the thread was being debugged */
     test byte ptr [ecx+KTHREAD_DEBUG_ACTIVE], 0xFF
+
+.ifeq \FakeErrorCode
+    /* Push parameter */
+    push ebx
+.endif
 
     /* Save DR registers if needed */
     //jnz Dr_&Label

Modified: trunk/reactos/ntoskrnl/ke/i386/irq.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/irq.c?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/irq.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/irq.c Wed Aug 23 22:02:52 2006
@@ -292,6 +292,7 @@
 #ifndef CONFIG_SMP
    if (VECTOR2IRQ(vector) == 0)
    {
+       DPRINT1("Tick\n");
       KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
       KeUpdateSystemTime(&KernelTrapFrame, old_level);
    }

Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?rev=23672&r1=23671&r2=23672&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/trap.s (original)
+++ trunk/reactos/ntoskrnl/ke/i386/trap.s Wed Aug 23 22:02:52 2006
@@ -1309,7 +1309,7 @@
 _KiUnexpectedInterruptTail:
 
     /* Enter interrupt trap */
-    INT_PROLOG(kui)
+    INT_PROLOG kui, DoNotPushFakeErrorCode
 
     /* Increase interrupt count */
     inc dword ptr [fs:KPCR_PRCB_INTERRUPT_COUNT]




More information about the Ros-diffs mailing list