mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 06:52:07 +00:00
[HAL]: Implement KeGetCurrentIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, HalClearSoftwareInterrupt in C instead of ASM.
svn path=/trunk/; revision=45234
This commit is contained in:
parent
ab8a8ee784
commit
575fd458f2
2 changed files with 88 additions and 81 deletions
|
@ -174,20 +174,6 @@ NothingHardware:
|
|||
ret
|
||||
.endfunc
|
||||
|
||||
.globl @HalClearSoftwareInterrupt@4
|
||||
.func @HalClearSoftwareInterrupt@4, @HalClearSoftwareInterrupt@4
|
||||
@HalClearSoftwareInterrupt@4:
|
||||
|
||||
/* Get IRR mask */
|
||||
mov eax, 1
|
||||
shl eax, cl
|
||||
not eax
|
||||
|
||||
/* Set IRR */
|
||||
and PCR[KPCR_IRR], eax
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.globl @HalRequestSoftwareInterrupt@4
|
||||
.func @HalRequestSoftwareInterrupt@4, @HalRequestSoftwareInterrupt@4
|
||||
@HalRequestSoftwareInterrupt@4:
|
||||
|
@ -699,73 +685,6 @@ InvalidKfRaise:
|
|||
#endif
|
||||
.endfunc
|
||||
|
||||
.globl _KeGetCurrentIrql@0
|
||||
.func KeGetCurrentIrql@0
|
||||
_KeGetCurrentIrql@0:
|
||||
|
||||
/* Return the IRQL */
|
||||
mov eax, PCR[KPCR_IRQL]
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.globl _KeRaiseIrqlToDpcLevel@0
|
||||
.func KeRaiseIrqlToDpcLevel@0
|
||||
_KeRaiseIrqlToDpcLevel@0:
|
||||
|
||||
/* Get the current IRQL */
|
||||
mov eax, PCR[KPCR_IRQL]
|
||||
|
||||
/* Set DISPATCH_LEVEL */
|
||||
mov dword ptr PCR[KPCR_IRQL], DISPATCH_LEVEL
|
||||
|
||||
#if DBG
|
||||
/* Make sure we were not higher then synch */
|
||||
cmp eax, DISPATCH_LEVEL
|
||||
ja InvalidRaise
|
||||
#endif
|
||||
ret
|
||||
|
||||
#if DBG
|
||||
InvalidRaise:
|
||||
/* Bugcheck the system */
|
||||
push 1
|
||||
push 0
|
||||
push DISPATCH_LEVEL
|
||||
push eax
|
||||
push IRQL_NOT_GREATER_OR_EQUAL
|
||||
call _KeBugCheckEx@20
|
||||
#endif
|
||||
.endfunc
|
||||
|
||||
.globl _KeRaiseIrqlToSynchLevel@0
|
||||
.func KeRaiseIrqlToSynchLevel@0
|
||||
_KeRaiseIrqlToSynchLevel@0:
|
||||
|
||||
/* Get the current IRQL */
|
||||
mov eax, PCR[KPCR_IRQL]
|
||||
|
||||
/* Set SYNCH_LEVEL */
|
||||
mov dword ptr PCR[KPCR_IRQL], SYNCH_LEVEL
|
||||
|
||||
#if DBG
|
||||
/* Make sure we were not higher then dispatch */
|
||||
cmp eax, SYNCH_LEVEL
|
||||
ja InvalidSyRaise
|
||||
#endif
|
||||
ret
|
||||
|
||||
#if DBG
|
||||
InvalidSyRaise:
|
||||
/* Bugcheck the system */
|
||||
push 2
|
||||
push 0
|
||||
push SYNCH_LEVEL
|
||||
push eax
|
||||
push IRQL_NOT_GREATER_OR_EQUAL
|
||||
call _KeBugCheckEx@20
|
||||
#endif
|
||||
.endfunc
|
||||
|
||||
.globl _HalpApcInterrupt
|
||||
.func HalpApcInterrupt
|
||||
TRAP_FIXUPS hapc_a, hapc_t, DoFixupV86, DoFixupAbios
|
||||
|
|
|
@ -116,3 +116,91 @@ HalpInitializePICs(IN BOOLEAN EnableInterrupts)
|
|||
__writeeflags(EFlags);
|
||||
}
|
||||
|
||||
/* IRQL MANAGEMENT ************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
KIRQL
|
||||
NTAPI
|
||||
KeGetCurrentIrql(VOID)
|
||||
{
|
||||
/* Return the IRQL */
|
||||
return KeGetPcr()->Irql;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
KIRQL
|
||||
NTAPI
|
||||
KeRaiseIrqlToDpcLevel(VOID)
|
||||
{
|
||||
PKPCR Pcr = KeGetPcr();
|
||||
KIRQL CurrentIrql;
|
||||
|
||||
/* Save and update IRQL */
|
||||
CurrentIrql = Pcr->Irql;
|
||||
Pcr->Irql = DISPATCH_LEVEL;
|
||||
|
||||
#ifdef IRQL_DEBUG
|
||||
/* Validate correct raise */
|
||||
if (CurrentIrql > DISPATCH_LEVEL)
|
||||
{
|
||||
/* Crash system */
|
||||
KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
|
||||
CurrentIrql,
|
||||
DISPATCH_LEVEL,
|
||||
0,
|
||||
1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return the previous value */
|
||||
return CurrentIrql;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
KIRQL
|
||||
NTAPI
|
||||
KeRaiseIrqlToSynchLevel(VOID)
|
||||
{
|
||||
PKPCR Pcr = KeGetPcr();
|
||||
KIRQL CurrentIrql;
|
||||
|
||||
/* Save and update IRQL */
|
||||
CurrentIrql = Pcr->Irql;
|
||||
Pcr->Irql = SYNCH_LEVEL;
|
||||
|
||||
#ifdef IRQL_DEBUG
|
||||
/* Validate correct raise */
|
||||
if (CurrentIrql > SYNCH_LEVEL)
|
||||
{
|
||||
/* Crash system */
|
||||
KeBugCheckEx(IRQL_NOT_GREATER_OR_EQUAL,
|
||||
CurrentIrql,
|
||||
SYNCH_LEVEL,
|
||||
0,
|
||||
1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return the previous value */
|
||||
return CurrentIrql;
|
||||
}
|
||||
|
||||
|
||||
/* SOFTWARE INTERRUPTS ********************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
FASTCALL
|
||||
HalClearSoftwareInterrupt(IN KIRQL Irql)
|
||||
{
|
||||
/* Mask out the requested bit */
|
||||
KeGetPcr()->IRR &= ~(1 << Irql);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue