mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 00:25:41 +00:00
[HAL] Merge HalpAcquireSystemHardwareSpinLock and HalpReleaseCmosSpinLock from Timo's AMD64 branch, and delete ASM implementations.
svn path=/trunk/; revision=45233
This commit is contained in:
parent
47d6a16b10
commit
ab8a8ee784
2 changed files with 42 additions and 70 deletions
|
@ -113,6 +113,46 @@ KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
|
|||
|
||||
#endif
|
||||
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
ULONG HalpSystemHardwareFlags;
|
||||
KSPIN_LOCK HalpSystemHardwareLock;
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpAcquireSystemHardwareSpinLock(VOID)
|
||||
{
|
||||
ULONG Flags;
|
||||
|
||||
/* Get flags and disable interrupts */
|
||||
Flags = __readeflags();
|
||||
_disable();
|
||||
|
||||
/* Acquire the lock */
|
||||
KxAcquireSpinLock(&HalpSystemHardwareLock);
|
||||
|
||||
/* We have the lock, save the flags now */
|
||||
HalpSystemHardwareFlags = Flags;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpReleaseCmosSpinLock(VOID)
|
||||
{
|
||||
ULONG Flags;
|
||||
|
||||
/* Get the flags */
|
||||
Flags = HalpSystemHardwareFlags;
|
||||
|
||||
/* Release the lock */
|
||||
KxReleaseSpinLock(&HalpSystemHardwareLock);
|
||||
|
||||
/* Restore the flags */
|
||||
__writeeflags(Flags);
|
||||
}
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
.globl _HalpPerfCounter
|
||||
_HalpLastPerfCounterLow: .long 0
|
||||
_HalpLastPerfCounterHigh: .long 0
|
||||
_HalpPerfCounter:
|
||||
_HalpPerfCounterLow: .long 0
|
||||
_HalpPerfCounterHigh: .long 0
|
||||
_HalpSystemHardwareFlags: .long 0
|
||||
|
@ -24,76 +26,6 @@ _UnhandledMsg:
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
.global _HalpReleaseCmosSpinLock@0
|
||||
.func HalpReleaseCmosSpinLock@0
|
||||
_HalpReleaseCmosSpinLock@0:
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Save clobbered register */
|
||||
push eax
|
||||
|
||||
/* Push saved EFLAGS */
|
||||
push _HalpSystemHardwareFlags
|
||||
|
||||
/* Release the lock */
|
||||
lea eax, _HalpSystemHardwareLock
|
||||
RELEASE_SPINLOCK(eax)
|
||||
|
||||
/* Restore EFLAGS */
|
||||
popf
|
||||
|
||||
/* Return */
|
||||
pop eax
|
||||
ret
|
||||
#else
|
||||
/* Restore EFLAGS and return */
|
||||
push _HalpSystemHardwareFlags
|
||||
popf
|
||||
ret
|
||||
#endif
|
||||
|
||||
.endfunc
|
||||
|
||||
.global _HalpAcquireSystemHardwareSpinLock@0
|
||||
.func HalpAcquireSystemHardwareSpinLock@0
|
||||
_HalpAcquireSystemHardwareSpinLock@0:
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Save clobbered register */
|
||||
push eax
|
||||
|
||||
HardwareLock:
|
||||
/* Save EFLAGS and disable interrupts */
|
||||
pushf
|
||||
cli
|
||||
|
||||
/* This is the CMOS lock, acquire it */
|
||||
lea eax, _HalpSystemHardwareLock
|
||||
ACQUIRE_SPINLOCK(eax, CmosSpin)
|
||||
|
||||
/* We have it, return the flags */
|
||||
pop _HalpSystemHardwareFlags
|
||||
pop eax
|
||||
ret
|
||||
|
||||
CmosSpin:
|
||||
|
||||
/* Restore EFLAGS */
|
||||
pushf _HalpSystemHardwareLock
|
||||
popf
|
||||
|
||||
/* Spin */
|
||||
SPIN_ON_LOCK(eax, HardwareLock)
|
||||
#else
|
||||
/* Save EFLAGS, disable interrupts and return */
|
||||
pushf
|
||||
cli
|
||||
pop _HalpSystemHardwareFlags
|
||||
ret
|
||||
#endif
|
||||
|
||||
.endfunc
|
||||
|
||||
.global _HalpCalibrateStallExecution@0
|
||||
.func HalpCalibrateStallExecution@0
|
||||
_HalpCalibrateStallExecution@0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue