Moved spinlock.c and head.s from 'hal/x86' to 'ke'.

This is needed for the hal separation.

svn path=/trunk/; revision=1028
This commit is contained in:
Eric Kohl 2000-03-04 13:44:59 +00:00
parent 92857818cb
commit 2b0d467176
5 changed files with 8 additions and 123 deletions

View file

@ -1,4 +1,4 @@
HAL_OBJECTS = hal/x86/head.o hal/x86/irq.o hal/x86/isa.o \
HAL_OBJECTS = hal/x86/irq.o hal/x86/isa.o \
hal/x86/pci.o hal/x86/irqhand.o hal/x86/halinit.o \
hal/x86/irql.o hal/x86/bios32.o \
hal/x86/mp.o hal/x86/dma.o hal/x86/bus.o hal/x86/mbr.o \

View file

@ -1,118 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/spinlock.c
* PURPOSE: Implements spinlocks
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
* 3/6/98: Created
*/
/*
* NOTE: On a uniprocessor machine spinlocks are implemented by raising
* the irq level
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <internal/debug.h>
/* FUNCTIONS ***************************************************************/
BOOLEAN KeSynchronizeExecution(PKINTERRUPT Interrupt,
PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
PVOID SynchronizeContext)
/*
* FUNCTION: Synchronizes the execution of a given routine with the ISR
* of a given interrupt object
* ARGUMENTS:
* Interrupt = Interrupt object to synchronize with
* SynchronizeRoutine = Routine to call whose execution is
* synchronized with the ISR
* SynchronizeContext = Parameter to pass to the synchronized routine
* RETURNS: TRUE if the operation succeeded
*/
{
KIRQL oldlvl;
BOOLEAN ret;
KeRaiseIrql(Interrupt->SynchLevel,&oldlvl);
KeAcquireSpinLockAtDpcLevel(Interrupt->IrqLock);
ret = SynchronizeRoutine(SynchronizeContext);
KeReleaseSpinLockFromDpcLevel(Interrupt->IrqLock);
KeLowerIrql(oldlvl);
return(ret);
}
VOID KeInitializeSpinLock(PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Initalizes a spinlock
* ARGUMENTS:
* SpinLock = Caller supplied storage for the spinlock
*/
{
SpinLock->Lock = 0;
}
VOID KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Acquires a spinlock when the caller is already running at
* dispatch level
* ARGUMENTS:
* SpinLock = Spinlock to acquire
*/
{
ULONG i;
while ((i = InterlockedExchange(&SpinLock->Lock, 1)) == 1)
{
DbgPrint("Spinning on spinlock %x current value %x\n", SpinLock, i);
KeBugCheck(0);
}
}
VOID KeReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
/*
* FUNCTION: Releases a spinlock when the caller was running at dispatch
* level before acquiring it
* ARGUMENTS:
* SpinLock = Spinlock to release
*/
{
if (SpinLock->Lock != 1)
{
DbgPrint("Releasing unacquired spinlock %x\n", SpinLock);
KeBugCheck(0);
}
(void)InterlockedExchange(&SpinLock->Lock, 0);
}
VOID KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
/*
* FUNCTION: Acquires a spinlock
* ARGUMENTS:
* SpinLock = Spinlock to acquire
* OldIrql (OUT) = Caller supplied storage for the previous irql
*/
{
KeRaiseIrql(DISPATCH_LEVEL,OldIrql);
KeAcquireSpinLockAtDpcLevel(SpinLock);
}
VOID KeReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL NewIrql)
/*
* FUNCTION: Releases a spinlock
* ARGUMENTS:
* SpinLock = Spinlock to release
* NewIrql = Irql level before acquiring the spinlock
*/
{
KeReleaseSpinLockFromDpcLevel(SpinLock);
KeLowerIrql(NewIrql);
}

View file

@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/spinlock.c
* FILE: ntoskrnl/ke/spinlock.c
* PURPOSE: Implements spinlocks
* PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:

View file

@ -1,9 +1,10 @@
# $Id: makefile_rex,v 1.56 2000/03/03 00:43:28 ekohl Exp $
# $Id: makefile_rex,v 1.57 2000/03/04 13:41:56 ekohl Exp $
#
# ReactOS Operating System
#
TARGET=ntoskrnl
BASE_CFLAGS = -I../include -D__NTOSKRNL__
@ -25,7 +26,7 @@ RTL_OBJECTS = rtl/ctype.o rtl/interlck.o rtl/largeint.o rtl/list.o \
rtl/stdlib.o rtl/string.o rtl/time.o rtl/unalign.o \
rtl/unicode.o rtl/wstring.o rtl/bitmap.o
KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o \
KE_OBJECTS = ke/head.o ke/main.o ke/timer.o ke/error.o ke/catch.o \
ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \
ke/sem.o ke/critical.o ke/event.o ke/apc.o ke/bug.o \
ke/mutex.o ke/kernel.o ke/ldt.o ke/spinlock.o\
@ -140,13 +141,15 @@ objects/kd.o: $(KD_OBJECTS)
$(TARGET).coff: $(TARGET).rc ../include/reactos/resource.h
OBJECTS = objects/hal.o objects/ke.o objects/rtl.o objects/mm.o \
OBJECTS = objects/ke.o objects/rtl.o objects/mm.o \
objects/io.o objects/ob.o objects/ps.o objects/ex.o \
objects/se.o objects/cm.o objects/dbg.o objects/nt.o \
objects/cc.o objects/kd.o objects/ldr.o objects/fs.o \
objects/po.o objects/nls.o \
objects/hal.o \
$(TARGET).coff
ifeq ($(DOSCLI),yes)
CLEAN_FILES = objects\*.o cc\*.o cm\*.o dbg\*.o ex\*.o hal\x86\*.o io\*.o \
ke\*.o ldr\*.o mm\*.o nt\*.o ob\*.o ps\*.o rtl\*.o se\*.o \