mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:03:12 +00:00
- 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:
parent
e6d9765059
commit
0eec889557
5 changed files with 48 additions and 26 deletions
|
@ -59,6 +59,12 @@ Author:
|
||||||
//
|
//
|
||||||
typedef struct _KTRAP_FRAME
|
typedef struct _KTRAP_FRAME
|
||||||
{
|
{
|
||||||
|
ULONG OldIrql;
|
||||||
|
// UCHAR PreviousMode;
|
||||||
|
// ULONG Fpscr;
|
||||||
|
// ULONG FpExc;
|
||||||
|
// ULONG S[33];
|
||||||
|
// ULONG FpExtra[8];
|
||||||
ULONG Spsr;
|
ULONG Spsr;
|
||||||
ULONG R0;
|
ULONG R0;
|
||||||
ULONG R1;
|
ULONG R1;
|
||||||
|
@ -78,12 +84,6 @@ typedef struct _KTRAP_FRAME
|
||||||
ULONG SvcSp;
|
ULONG SvcSp;
|
||||||
ULONG SvcLr;
|
ULONG SvcLr;
|
||||||
ULONG Pc;
|
ULONG Pc;
|
||||||
ULONG OldIrql;
|
|
||||||
// UCHAR PreviousMode;
|
|
||||||
// ULONG Fpscr;
|
|
||||||
// ULONG FpExc;
|
|
||||||
// ULONG S[33];
|
|
||||||
// ULONG FpExtra[8];
|
|
||||||
} KTRAP_FRAME, *PKTRAP_FRAME;
|
} KTRAP_FRAME, *PKTRAP_FRAME;
|
||||||
|
|
||||||
#ifndef NTOS_MODE_USER
|
#ifndef NTOS_MODE_USER
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
//
|
//
|
||||||
#define KeGetCurrentProcessorNumber() PCR->Number
|
#define KeGetCurrentProcessorNumber() PCR->Number
|
||||||
#define KeGetCurrentIrql() PCR->CurrentIrql
|
#define KeGetCurrentIrql() PCR->CurrentIrql
|
||||||
#define _KeGetCurrentThread() PCR->CurrentThread
|
#define _KeGetCurrentThread() PCR->CurrentThread
|
||||||
#define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
|
#define _KeGetPreviousMode() PCR->CurrentThread->PreviousMode
|
||||||
#define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
|
#define _KeIsExecutingDpc() (PCR->DpcRoutineActive != 0)
|
||||||
#define KeGetDcacheFillSize() PCR->DcacheFillSize
|
#define KeGetDcacheFillSize() PCR->DcacheFillSize
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -50,6 +50,11 @@
|
||||||
*/
|
*/
|
||||||
.equ KiPcr, 0xFFFFF000
|
.equ KiPcr, 0xFFFFF000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PCR Offsets
|
||||||
|
*/
|
||||||
|
.equ PcCurrentIrql, 0x14C
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -67,12 +67,22 @@
|
||||||
mrs r0, spsr_all
|
mrs r0, spsr_all
|
||||||
str r0, [sp, #-4]!
|
str r0, [sp, #-4]!
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make space for IRQL
|
||||||
|
//
|
||||||
|
sub sp, sp, #4
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call the C handler
|
// Call the C handler
|
||||||
//
|
//
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
bl KiSoftwareInterruptHandler
|
bl KiSoftwareInterruptHandler
|
||||||
|
|
||||||
|
//
|
||||||
|
// Skip IRQL
|
||||||
|
//
|
||||||
|
add sp, sp, #(4)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the SPSR and restore it
|
// Get the SPSR and restore it
|
||||||
//
|
//
|
||||||
|
@ -140,12 +150,7 @@
|
||||||
// Save the SVC sp before we modify it
|
// Save the SVC sp before we modify it
|
||||||
//
|
//
|
||||||
mov r2, sp
|
mov r2, sp
|
||||||
|
|
||||||
//
|
|
||||||
// Dummy OldIrql
|
|
||||||
//
|
|
||||||
//str r0, [sp, #-4]!
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save the abort lr
|
// Save the abort lr
|
||||||
//
|
//
|
||||||
|
@ -185,6 +190,11 @@
|
||||||
//
|
//
|
||||||
mrs r0, spsr_all
|
mrs r0, spsr_all
|
||||||
str r0, [sp, #-4]!
|
str r0, [sp, #-4]!
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make space for IRQL
|
||||||
|
//
|
||||||
|
sub sp, sp, #4
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call the C handler
|
// Call the C handler
|
||||||
|
@ -194,6 +204,11 @@
|
||||||
ldr pc, =KiDataAbortHandler
|
ldr pc, =KiDataAbortHandler
|
||||||
|
|
||||||
AbortExit:
|
AbortExit:
|
||||||
|
|
||||||
|
//
|
||||||
|
// Skip IRQL
|
||||||
|
//
|
||||||
|
add sp, sp, #(4)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the SPSR and restore it
|
// Get the SPSR and restore it
|
||||||
|
@ -252,11 +267,6 @@ AbortExit:
|
||||||
//
|
//
|
||||||
mov r2, sp
|
mov r2, sp
|
||||||
|
|
||||||
//
|
|
||||||
// Dummy OldIrql
|
|
||||||
//
|
|
||||||
//str r0, [sp, #-4]!
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save the IRQ lr
|
// Save the IRQ lr
|
||||||
//
|
//
|
||||||
|
@ -296,6 +306,11 @@ AbortExit:
|
||||||
//
|
//
|
||||||
mrs r0, spsr_all
|
mrs r0, spsr_all
|
||||||
str r0, [sp, #-4]!
|
str r0, [sp, #-4]!
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make space for IRQL
|
||||||
|
//
|
||||||
|
sub sp, sp, #4
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call the C handler
|
// Call the C handler
|
||||||
|
|
|
@ -125,13 +125,15 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,
|
||||||
//
|
//
|
||||||
// Get the old IRQL
|
// Get the old IRQL
|
||||||
//
|
//
|
||||||
OldIrql = TrapFrame->OldIrql;
|
OldIrql = KeGetCurrentIrql();
|
||||||
|
TrapFrame->OldIrql = OldIrql;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the interrupt source
|
// Get the interrupt source
|
||||||
//
|
//
|
||||||
InterruptCause = HalGetInterruptSource();
|
InterruptCause = HalGetInterruptSource();
|
||||||
DPRINT1("Interrupt (%x) @ %p %p\n", InterruptCause, TrapFrame->SvcLr, TrapFrame->Pc);
|
DPRINT1("Interrupt (%x) @ %p %p\n", InterruptCause, TrapFrame->SvcLr, TrapFrame->Pc);
|
||||||
|
DPRINT1("OLD IRQL: %x\n", OldIrql);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the new IRQL and Interrupt Mask
|
// Get the new IRQL and Interrupt Mask
|
||||||
|
@ -144,14 +146,14 @@ KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,
|
||||||
//
|
//
|
||||||
// Make sure the IRQL is valid
|
// Make sure the IRQL is valid
|
||||||
//
|
//
|
||||||
//if (OldIrql < Irql)
|
if (OldIrql < Irql)
|
||||||
//{
|
{
|
||||||
//
|
//
|
||||||
// We should just return, probably
|
// We should just return, probably
|
||||||
//
|
//
|
||||||
//DPRINT1("IRQL Race!\n");
|
DPRINT1("IRQL Race!\n");
|
||||||
//while (TRUE);
|
while (TRUE);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if this interrupt is at DISPATCH or higher
|
// Check if this interrupt is at DISPATCH or higher
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue