mirror of
https://github.com/reactos/reactos.git
synced 2024-09-11 05:12:43 +00:00
- Duplicate code between the remaining functions (KfLowerIRql and HalEndSystemInterrupt) so testing the switch to their ASM versions will be easier.
- Use same table as in ASM code. svn path=/trunk/; revision=23660
This commit is contained in:
parent
955d04b6ff
commit
c30a8d1cd4
|
@ -83,7 +83,8 @@ HalpSysIntHandler:
|
||||||
.long GenericIRQ /* IRQ 16-35 */
|
.long GenericIRQ /* IRQ 16-35 */
|
||||||
.endr
|
.endr
|
||||||
|
|
||||||
SoftIntByteTable:
|
.globl _SoftIntByteTable
|
||||||
|
_SoftIntByteTable:
|
||||||
.byte PASSIVE_LEVEL /* IRR 0 */
|
.byte PASSIVE_LEVEL /* IRR 0 */
|
||||||
.byte PASSIVE_LEVEL /* IRR 1 */
|
.byte PASSIVE_LEVEL /* IRR 1 */
|
||||||
.byte APC_LEVEL /* IRR 2 */
|
.byte APC_LEVEL /* IRR 2 */
|
||||||
|
@ -174,7 +175,7 @@ _@HalRequestSoftwareInterrupt@4:
|
||||||
|
|
||||||
/* Get highest pending software interrupt and check if it's higher */
|
/* Get highest pending software interrupt and check if it's higher */
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov dl, SoftIntByteTable[eax]
|
mov dl, _SoftIntByteTable[eax]
|
||||||
cmp dl, cl
|
cmp dl, cl
|
||||||
jbe AfterCall
|
jbe AfterCall
|
||||||
|
|
||||||
|
@ -388,10 +389,12 @@ SkipMask2:
|
||||||
|
|
||||||
/* Set IRQL and check if there are pending software interrupts */
|
/* Set IRQL and check if there are pending software interrupts */
|
||||||
mov [fs:KPCR_IRQL], cl
|
mov [fs:KPCR_IRQL], cl
|
||||||
|
#if 0
|
||||||
mov eax, [fs:KPCR_IDR]
|
mov eax, [fs:KPCR_IDR]
|
||||||
mov al, SoftIntByteTable[eax]
|
mov al, _SoftIntByteTable[eax]
|
||||||
cmp al, cl
|
cmp al, cl
|
||||||
ja DoCall
|
ja DoCall
|
||||||
|
#endif
|
||||||
ret 8
|
ret 8
|
||||||
|
|
||||||
DoCall:
|
DoCall:
|
||||||
|
@ -401,6 +404,7 @@ DoCall:
|
||||||
jmp SoftIntHandlerTable2[eax*4]
|
jmp SoftIntHandlerTable2[eax*4]
|
||||||
.endfunc
|
.endfunc
|
||||||
|
|
||||||
|
|
||||||
.globl @KfLowerIrql@4
|
.globl @KfLowerIrql@4
|
||||||
.func @KfLowerIrql@4
|
.func @KfLowerIrql@4
|
||||||
_@KfLowerIrql@4:
|
_@KfLowerIrql@4:
|
||||||
|
@ -427,14 +431,20 @@ SkipMask:
|
||||||
/* Set the new IRQL and check if there's a pending software interrupt */
|
/* Set the new IRQL and check if there's a pending software interrupt */
|
||||||
mov [fs:KPCR_IRQL], cl
|
mov [fs:KPCR_IRQL], cl
|
||||||
mov eax, [fs:KPCR_IDR]
|
mov eax, [fs:KPCR_IDR]
|
||||||
mov al, SoftIntByteTable[eax]
|
mov al, _SoftIntByteTable[eax]
|
||||||
cmp al, cl
|
cmp al, cl
|
||||||
jbe AfterCall2
|
ja DoCall3
|
||||||
|
|
||||||
|
/* Restore interrupts and return */
|
||||||
|
popf
|
||||||
|
ret
|
||||||
|
.align 4
|
||||||
|
|
||||||
|
DoCall3:
|
||||||
|
|
||||||
/* There is, call it */
|
/* There is, call it */
|
||||||
call SoftIntHandlerTable[eax*4]
|
call _SoftIntHandlerTable[eax*4]
|
||||||
|
jmp $
|
||||||
AfterCall2:
|
|
||||||
|
|
||||||
/* Restore interrupts and return */
|
/* Restore interrupts and return */
|
||||||
popf
|
popf
|
||||||
|
@ -629,7 +639,7 @@ SoftwareInt:
|
||||||
mov [fs:KPCR_IRQL], cl
|
mov [fs:KPCR_IRQL], cl
|
||||||
#if 0
|
#if 0
|
||||||
mov eax, [fs:KPCR_IDR]
|
mov eax, [fs:KPCR_IDR]
|
||||||
mov al, SoftIntByteTable[eax]
|
mov al, _SoftIntByteTable[eax]
|
||||||
cmp al, cl
|
cmp al, cl
|
||||||
ja DoCall2
|
ja DoCall2
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,29 +12,22 @@
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <ndk/asm.h>
|
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
UCHAR Table[8] =
|
|
||||||
{
|
|
||||||
0, 0,
|
|
||||||
1, 1,
|
|
||||||
2, 2, 2, 2
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef VOID (*PSW_HANDLER)(VOID);
|
typedef VOID (*PSW_HANDLER)(VOID);
|
||||||
extern PSW_HANDLER SoftIntHandlerTable[];
|
extern PSW_HANDLER SoftIntHandlerTable[];
|
||||||
|
extern ULONG KiI8259MaskTable[];
|
||||||
|
extern UCHAR SoftIntByteTable[];
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
extern ULONG KiI8259MaskTable[];
|
VOID FASTCALL
|
||||||
|
KfLowerIrql (KIRQL NewIrql)
|
||||||
VOID STATIC
|
|
||||||
HalpLowerIrql(KIRQL NewIrql)
|
|
||||||
{
|
{
|
||||||
ULONG Mask;
|
ULONG Mask;
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
|
UCHAR Pending;
|
||||||
|
|
||||||
Ki386SaveFlags(Flags);
|
Ki386SaveFlags(Flags);
|
||||||
Ki386DisableInterrupts();
|
Ki386DisableInterrupts();
|
||||||
|
@ -47,66 +40,42 @@ HalpLowerIrql(KIRQL NewIrql)
|
||||||
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NewIrql >= PROFILE_LEVEL)
|
|
||||||
{
|
|
||||||
KeGetPcr()->Irql = NewIrql;
|
|
||||||
Ki386RestoreFlags(Flags);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (NewIrql >= DISPATCH_LEVEL)
|
|
||||||
{
|
|
||||||
KeGetPcr()->Irql = NewIrql;
|
|
||||||
Ki386RestoreFlags(Flags);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
KeGetPcr()->Irql = NewIrql;
|
KeGetPcr()->Irql = NewIrql;
|
||||||
if (Table[KeGetPcr()->IRR] > NewIrql)
|
Pending = SoftIntByteTable[KeGetPcr()->IRR];
|
||||||
|
if (Pending > NewIrql)
|
||||||
{
|
{
|
||||||
SoftIntHandlerTable[Table[KeGetPcr()->IRR]]();
|
SoftIntHandlerTable[Pending]();
|
||||||
}
|
}
|
||||||
Ki386RestoreFlags(Flags);
|
Ki386RestoreFlags(Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* KfLowerIrql
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Restores the irq level on the current processor
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* NewIrql = Irql to lower to
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* NOTES
|
|
||||||
* Uses fastcall convention
|
|
||||||
*/
|
|
||||||
VOID FASTCALL
|
|
||||||
KfLowerIrql (KIRQL NewIrql)
|
|
||||||
{
|
|
||||||
DPRINT("KfLowerIrql(NewIrql %d)\n", NewIrql);
|
|
||||||
|
|
||||||
if (NewIrql > KeGetPcr()->Irql)
|
|
||||||
{
|
|
||||||
DbgPrint ("(%s:%d) NewIrql %x CurrentIrql %x\n",
|
|
||||||
__FILE__, __LINE__, NewIrql, KeGetPcr()->Irql);
|
|
||||||
KEBUGCHECK(0);
|
|
||||||
for(;;);
|
|
||||||
}
|
|
||||||
|
|
||||||
HalpLowerIrql(NewIrql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL HalEndSystemInterrupt (KIRQL Irql, ULONG Unknown2)
|
VOID STDCALL HalEndSystemInterrupt (KIRQL Irql, ULONG Unknown2)
|
||||||
/*
|
|
||||||
* FUNCTION: Finish a system interrupt and restore the specified irq level.
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
//DPRINT1("ENDING: %lx %lx\n", Irql, Unknown2);
|
ULONG Mask;
|
||||||
HalpLowerIrql(Irql);
|
ULONG Flags;
|
||||||
|
UCHAR Pending;
|
||||||
|
|
||||||
|
Ki386SaveFlags(Flags);
|
||||||
|
Ki386DisableInterrupts();
|
||||||
|
|
||||||
|
if (KeGetPcr()->Irql > DISPATCH_LEVEL)
|
||||||
|
{
|
||||||
|
Mask = KeGetPcr()->IDR | KiI8259MaskTable[Irql];
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
|
||||||
|
Mask >>= 8;
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KeGetPcr()->Irql = Irql;
|
||||||
|
Pending = SoftIntByteTable[KeGetPcr()->IRR];
|
||||||
|
if (Pending > Irql)
|
||||||
|
{
|
||||||
|
SoftIntHandlerTable[Pending]();
|
||||||
|
}
|
||||||
|
Ki386RestoreFlags(Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue