From 2b0d4671760b7d88aa3642c24bb5320f82b4d069 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 4 Mar 2000 13:44:59 +0000 Subject: [PATCH] Moved spinlock.c and head.s from 'hal/x86' to 'ke'. This is needed for the hal separation. svn path=/trunk/; revision=1028 --- reactos/ntoskrnl/hal/x86/sources | 2 +- reactos/ntoskrnl/hal/x86/spinlock.c | 118 ------------------------ reactos/ntoskrnl/{hal/x86 => ke}/head.s | 0 reactos/ntoskrnl/ke/spinlock.c | 2 +- reactos/ntoskrnl/makefile_rex | 9 +- 5 files changed, 8 insertions(+), 123 deletions(-) delete mode 100644 reactos/ntoskrnl/hal/x86/spinlock.c rename reactos/ntoskrnl/{hal/x86 => ke}/head.s (100%) diff --git a/reactos/ntoskrnl/hal/x86/sources b/reactos/ntoskrnl/hal/x86/sources index 6d43da75caf..ee21ae8751d 100644 --- a/reactos/ntoskrnl/hal/x86/sources +++ b/reactos/ntoskrnl/hal/x86/sources @@ -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 \ diff --git a/reactos/ntoskrnl/hal/x86/spinlock.c b/reactos/ntoskrnl/hal/x86/spinlock.c deleted file mode 100644 index 05d1c094e32..00000000000 --- a/reactos/ntoskrnl/hal/x86/spinlock.c +++ /dev/null @@ -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 - -#include - -/* 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); -} - diff --git a/reactos/ntoskrnl/hal/x86/head.s b/reactos/ntoskrnl/ke/head.s similarity index 100% rename from reactos/ntoskrnl/hal/x86/head.s rename to reactos/ntoskrnl/ke/head.s diff --git a/reactos/ntoskrnl/ke/spinlock.c b/reactos/ntoskrnl/ke/spinlock.c index 05d1c094e32..62cf7f49109 100644 --- a/reactos/ntoskrnl/ke/spinlock.c +++ b/reactos/ntoskrnl/ke/spinlock.c @@ -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: diff --git a/reactos/ntoskrnl/makefile_rex b/reactos/ntoskrnl/makefile_rex index 6e36a83b6af..43c895e1310 100644 --- a/reactos/ntoskrnl/makefile_rex +++ b/reactos/ntoskrnl/makefile_rex @@ -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 \