Author: ros-arm-bringup
Date: Wed Jun 11 13:39:44 2008
New Revision: 33934
URL:
http://svn.reactos.org/svn/reactos?rev=33934&view=rev
Log:
- We now make appropriate space on the stack to save the old IRQL in the trap frame.
- Save the old IRQL and assert it in the interrupt handler.
- Fix KTRAP_FRAME structure.
Modified:
trunk/reactos/include/ndk/arm/ketypes.h
trunk/reactos/include/reactos/armddk.h
trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h
trunk/reactos/ntoskrnl/ke/arm/trap.s
trunk/reactos/ntoskrnl/ke/arm/trapc.c
Modified: trunk/reactos/include/ndk/arm/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/arm/ketypes.h?…
==============================================================================
--- trunk/reactos/include/ndk/arm/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/arm/ketypes.h [iso-8859-1] Wed Jun 11 13:39:44 2008
@@ -59,6 +59,12 @@
//
typedef struct _KTRAP_FRAME
{
+ ULONG OldIrql;
+ // UCHAR PreviousMode;
+ // ULONG Fpscr;
+ // ULONG FpExc;
+ // ULONG S[33];
+ // ULONG FpExtra[8];
ULONG Spsr;
ULONG R0;
ULONG R1;
@@ -78,12 +84,6 @@
ULONG SvcSp;
ULONG SvcLr;
ULONG Pc;
- ULONG OldIrql;
-// UCHAR PreviousMode;
-// ULONG Fpscr;
-// ULONG FpExc;
-// ULONG S[33];
-// ULONG FpExtra[8];
} KTRAP_FRAME, *PKTRAP_FRAME;
#ifndef NTOS_MODE_USER
Modified: trunk/reactos/include/reactos/armddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/armddk.h?r…
==============================================================================
--- trunk/reactos/include/reactos/armddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/armddk.h [iso-8859-1] Wed Jun 11 13:39:44 2008
@@ -35,9 +35,9 @@
//
#define KeGetCurrentProcessorNumber() PCR->Number
#define KeGetCurrentIrql() PCR->CurrentIrql
-#define _KeGetCurrentThread() PCR->CurrentThread
-#define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
-#define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
+#define _KeGetCurrentThread() PCR->CurrentThread
+#define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
+#define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
#define KeGetDcacheFillSize() PCR->DcacheFillSize
//
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h [iso-8859-1] Wed Jun 11 13:39:44
2008
@@ -50,6 +50,11 @@
*/
.equ KiPcr, 0xFFFFF000
+/*
+ * PCR Offsets
+ */
+.equ PcCurrentIrql, 0x14C
+
#else
/*
Modified: trunk/reactos/ntoskrnl/ke/arm/trap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trap.s?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trap.s [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trap.s [iso-8859-1] Wed Jun 11 13:39:44 2008
@@ -68,10 +68,20 @@
str r0, [sp, #-4]!
//
+ // Make space for IRQL
+ //
+ sub sp, sp, #4
+
+ //
// Call the C handler
//
mov r0, sp
bl KiSoftwareInterruptHandler
+
+ //
+ // Skip IRQL
+ //
+ add sp, sp, #(4)
//
// Get the SPSR and restore it
@@ -140,12 +150,7 @@
// Save the SVC sp before we modify it
//
mov r2, sp
-
- //
- // Dummy OldIrql
- //
- //str r0, [sp, #-4]!
-
+
//
// Save the abort lr
//
@@ -185,6 +190,11 @@
//
mrs r0, spsr_all
str r0, [sp, #-4]!
+
+ //
+ // Make space for IRQL
+ //
+ sub sp, sp, #4
//
// Call the C handler
@@ -194,6 +204,11 @@
ldr pc, =KiDataAbortHandler
AbortExit:
+
+ //
+ // Skip IRQL
+ //
+ add sp, sp, #(4)
//
// Get the SPSR and restore it
@@ -253,11 +268,6 @@
mov r2, sp
//
- // Dummy OldIrql
- //
- //str r0, [sp, #-4]!
-
- //
// Save the IRQ lr
//
str r0, [sp, #-4]!
@@ -296,6 +306,11 @@
//
mrs r0, spsr_all
str r0, [sp, #-4]!
+
+ //
+ // Make space for IRQL
+ //
+ sub sp, sp, #4
//
// Call the C handler
Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Wed Jun 11 13:39:44 2008
@@ -125,13 +125,15 @@
//
// Get the old IRQL
//
- OldIrql = TrapFrame->OldIrql;
+ OldIrql = KeGetCurrentIrql();
+ TrapFrame->OldIrql = OldIrql;
//
// Get the interrupt source
//
InterruptCause = HalGetInterruptSource();
DPRINT1("Interrupt (%x) @ %p %p\n", InterruptCause, TrapFrame->SvcLr,
TrapFrame->Pc);
+ DPRINT1("OLD IRQL: %x\n", OldIrql);
//
// Get the new IRQL and Interrupt Mask
@@ -144,14 +146,14 @@
//
// Make sure the IRQL is valid
//
- //if (OldIrql < Irql)
- //{
+ if (OldIrql < Irql)
+ {
//
// We should just return, probably
//
- //DPRINT1("IRQL Race!\n");
- //while (TRUE);
- //}
+ DPRINT1("IRQL Race!\n");
+ while (TRUE);
+ }
//
// Check if this interrupt is at DISPATCH or higher