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 */
|
||||
.endr
|
||||
|
||||
SoftIntByteTable:
|
||||
.globl _SoftIntByteTable
|
||||
_SoftIntByteTable:
|
||||
.byte PASSIVE_LEVEL /* IRR 0 */
|
||||
.byte PASSIVE_LEVEL /* IRR 1 */
|
||||
.byte APC_LEVEL /* IRR 2 */
|
||||
|
@ -174,7 +175,7 @@ _@HalRequestSoftwareInterrupt@4:
|
|||
|
||||
/* Get highest pending software interrupt and check if it's higher */
|
||||
xor edx, edx
|
||||
mov dl, SoftIntByteTable[eax]
|
||||
mov dl, _SoftIntByteTable[eax]
|
||||
cmp dl, cl
|
||||
jbe AfterCall
|
||||
|
||||
|
@ -388,10 +389,12 @@ SkipMask2:
|
|||
|
||||
/* Set IRQL and check if there are pending software interrupts */
|
||||
mov [fs:KPCR_IRQL], cl
|
||||
#if 0
|
||||
mov eax, [fs:KPCR_IDR]
|
||||
mov al, SoftIntByteTable[eax]
|
||||
mov al, _SoftIntByteTable[eax]
|
||||
cmp al, cl
|
||||
ja DoCall
|
||||
#endif
|
||||
ret 8
|
||||
|
||||
DoCall:
|
||||
|
@ -401,6 +404,7 @@ DoCall:
|
|||
jmp SoftIntHandlerTable2[eax*4]
|
||||
.endfunc
|
||||
|
||||
|
||||
.globl @KfLowerIrql@4
|
||||
.func @KfLowerIrql@4
|
||||
_@KfLowerIrql@4:
|
||||
|
@ -427,14 +431,20 @@ SkipMask:
|
|||
/* Set the new IRQL and check if there's a pending software interrupt */
|
||||
mov [fs:KPCR_IRQL], cl
|
||||
mov eax, [fs:KPCR_IDR]
|
||||
mov al, SoftIntByteTable[eax]
|
||||
mov al, _SoftIntByteTable[eax]
|
||||
cmp al, cl
|
||||
jbe AfterCall2
|
||||
ja DoCall3
|
||||
|
||||
/* Restore interrupts and return */
|
||||
popf
|
||||
ret
|
||||
.align 4
|
||||
|
||||
DoCall3:
|
||||
|
||||
/* There is, call it */
|
||||
call SoftIntHandlerTable[eax*4]
|
||||
|
||||
AfterCall2:
|
||||
call _SoftIntHandlerTable[eax*4]
|
||||
jmp $
|
||||
|
||||
/* Restore interrupts and return */
|
||||
popf
|
||||
|
@ -629,7 +639,7 @@ SoftwareInt:
|
|||
mov [fs:KPCR_IRQL], cl
|
||||
#if 0
|
||||
mov eax, [fs:KPCR_IDR]
|
||||
mov al, SoftIntByteTable[eax]
|
||||
mov al, _SoftIntByteTable[eax]
|
||||
cmp al, cl
|
||||
ja DoCall2
|
||||
#endif
|
||||
|
|
|
@ -12,29 +12,22 @@
|
|||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include <ndk/asm.h>
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
UCHAR Table[8] =
|
||||
{
|
||||
0, 0,
|
||||
1, 1,
|
||||
2, 2, 2, 2
|
||||
};
|
||||
|
||||
typedef VOID (*PSW_HANDLER)(VOID);
|
||||
extern PSW_HANDLER SoftIntHandlerTable[];
|
||||
extern ULONG KiI8259MaskTable[];
|
||||
extern UCHAR SoftIntByteTable[];
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
extern ULONG KiI8259MaskTable[];
|
||||
|
||||
VOID STATIC
|
||||
HalpLowerIrql(KIRQL NewIrql)
|
||||
VOID FASTCALL
|
||||
KfLowerIrql (KIRQL NewIrql)
|
||||
{
|
||||
ULONG Mask;
|
||||
ULONG Flags;
|
||||
UCHAR Pending;
|
||||
|
||||
Ki386SaveFlags(Flags);
|
||||
Ki386DisableInterrupts();
|
||||
|
@ -47,66 +40,42 @@ HalpLowerIrql(KIRQL NewIrql)
|
|||
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;
|
||||
if (Table[KeGetPcr()->IRR] > NewIrql)
|
||||
Pending = SoftIntByteTable[KeGetPcr()->IRR];
|
||||
if (Pending > NewIrql)
|
||||
{
|
||||
SoftIntHandlerTable[Table[KeGetPcr()->IRR]]();
|
||||
SoftIntHandlerTable[Pending]();
|
||||
}
|
||||
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)
|
||||
VOID STDCALL HalEndSystemInterrupt (KIRQL Irql, ULONG Unknown2)
|
||||
{
|
||||
DPRINT("KfLowerIrql(NewIrql %d)\n", NewIrql);
|
||||
ULONG Mask;
|
||||
ULONG Flags;
|
||||
UCHAR Pending;
|
||||
|
||||
if (NewIrql > KeGetPcr()->Irql)
|
||||
Ki386SaveFlags(Flags);
|
||||
Ki386DisableInterrupts();
|
||||
|
||||
if (KeGetPcr()->Irql > DISPATCH_LEVEL)
|
||||
{
|
||||
DbgPrint ("(%s:%d) NewIrql %x CurrentIrql %x\n",
|
||||
__FILE__, __LINE__, NewIrql, KeGetPcr()->Irql);
|
||||
KEBUGCHECK(0);
|
||||
for(;;);
|
||||
Mask = KeGetPcr()->IDR | KiI8259MaskTable[Irql];
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x21, (UCHAR)Mask);
|
||||
Mask >>= 8;
|
||||
WRITE_PORT_UCHAR((PUCHAR)0xa1, (UCHAR)Mask);
|
||||
}
|
||||
|
||||
HalpLowerIrql(NewIrql);
|
||||
|
||||
KeGetPcr()->Irql = Irql;
|
||||
Pending = SoftIntByteTable[KeGetPcr()->IRR];
|
||||
if (Pending > Irql)
|
||||
{
|
||||
SoftIntHandlerTable[Pending]();
|
||||
}
|
||||
Ki386RestoreFlags(Flags);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
HalpLowerIrql(Irql);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue