- 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.


svn path=/trunk/; revision=33934
This commit is contained in:
ReactOS Portable Systems Group 2008-06-11 18:39:44 +00:00
parent e6d9765059
commit 0eec889557
5 changed files with 48 additions and 26 deletions

View file

@ -59,6 +59,12 @@ Author:
//
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 @@ typedef struct _KTRAP_FRAME
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

View file

@ -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
//

View file

@ -50,6 +50,11 @@
*/
.equ KiPcr, 0xFFFFF000
/*
* PCR Offsets
*/
.equ PcCurrentIrql, 0x14C
#else
/*

View file

@ -67,12 +67,22 @@
mrs r0, spsr_all
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
@ -252,11 +267,6 @@ AbortExit:
//
mov r2, sp
//
// Dummy OldIrql
//
//str r0, [sp, #-4]!
//
// Save the IRQ lr
//
@ -296,6 +306,11 @@ AbortExit:
//
mrs r0, spsr_all
str r0, [sp, #-4]!
//
// Make space for IRQL
//
sub sp, sp, #4
//
// Call the C handler

View file

@ -125,13 +125,15 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,
//
// 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 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,
//
// 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