Moved some functions into the hal.

Replaced some functions by macros.

svn path=/trunk/; revision=1178
This commit is contained in:
Eric Kohl 2000-06-09 20:07:20 +00:00
parent 0aac416a18
commit 3cd7d0dcd3
15 changed files with 358 additions and 181 deletions

View file

@ -170,13 +170,21 @@ STDCALL
ExGetSharedWaiterCount (
PERESOURCE Resource
);
/* ReactOS Specific: begin */
VOID
FASTCALL
ExInitializeFastMutex (
PFAST_MUTEX FastMutex
);
/* ReactOS Specific: end */
/*
* VOID
* ExInitializeFastMutex (
* PFAST_MUTEX FastMutex
* );
*/
#define ExInitializeFastMutex(_FastMutex) \
(_FastMutex)->Count = 1; \
(_FastMutex)->Owner = NULL; \
(_FastMutex)->Contention = 0; \
KeInitializeEvent(&(_FastMutex)->Event, \
SynchronizationEvent, \
FALSE);
VOID
STDCALL
ExInitializeNPagedLookasideList (
@ -214,13 +222,22 @@ STDCALL
ExInitializeSListHead (
PSLIST_HEADER SListHead
);
VOID
STDCALL
ExInitializeWorkItem (
PWORK_QUEUE_ITEM Item,
PWORKER_THREAD_ROUTINE Routine,
PVOID Context
);
/*
* VOID
* ExInitializeWorkItem (
* PWORK_QUEUE_ITEM Item,
* PWORKER_THREAD_ROUTINE Routine,
* PVOID Context
* );
*/
#define ExInitializeWorkItem (Item, Routine, Context) \
ASSERT_IRQL(DISPATCH_LEVEL); \
(Item)->WorkerRoutine = (Routine); \
(Item)->Parameter = (Context); \
(Item)->List.Flink = NULL; \
(Item)->List.Blink = NULL;
NTSTATUS
STDCALL
ExInitializeZone (

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_IOFUNCS_H
#define _INCLUDE_DDK_IOFUNCS_H
/* $Id: iofuncs.h,v 1.11 2000/05/13 14:56:46 ea Exp $ */
/* $Id: iofuncs.h,v 1.12 2000/06/09 20:02:05 ekohl Exp $ */
/* --- EXPORTED BY NTOSKRNL --- */
@ -185,11 +185,28 @@ PMDL
STDCALL
IoAllocateMdl (
PVOID VirtualAddress,
ULONG Length,
ULONG Length,
BOOLEAN SecondaryBuffer,
BOOLEAN ChargeQuota,
PIRP Irp
);
/*
* FUNCTION: Creates a symbolic link between the ARC name of a physical
* device and the name of the corresponding device object
* ARGUMENTS:
* ArcName = ARC name of the device
* DeviceName = Name of the device object
* NOTES:
* VOID
* IoAssignArcName (
* PUNICODE_STRING ArcName,
* PUNICODE_STRING DeviceName
* );
*/
#define IoAssignArcName (ArcName, DeviceName) \
(IoCreateSymbolicLink ((ArcName), (DeviceName)))
/**********************************************************************
* NAME EXPORTED
* IoAssignResources@24
@ -485,6 +502,24 @@ IoCreateUnprotectedSymbolicLink (
PUNICODE_STRING SymbolicLinkName,
PUNICODE_STRING DeviceName
);
/*
* FUNCTION:
* Deletes a symbolic link between the ARC name of a physical
* device and the name of the corresponding device object
*
* ARGUMENTS:
* ArcName = ARC name of the device
*
* NOTES:
* VOID
* IoDeassignArcName (
* PUNICODE_STRING ArcName
* );
*/
#define IoDeassignArcName(ArcName) \
IoDeleteSymbolicLink((ArcName))
VOID
STDCALL
IoDeleteController (
@ -1012,22 +1047,6 @@ IoWritePartitionTable (
//NTSTATUS IoWMIRegistrationControl(DeviceObject, WMIREGACTION Action);
/*
* FUNCTION: Creates a symbolic link between the ARC name of a physical
* device and the name of the corresponding device object
* ARGUMENTS:
* ArcName = ARC name of the device
* DeviceName = Name of the device object
*/
VOID
IoAssignArcName (
PUNICODE_STRING ArcName,
PUNICODE_STRING DeviceName
);
VOID
IoDeassignArcName (
PUNICODE_STRING ArcName
);
/*
* FUNCTION: Returns a pointer to the callers
* stack location in the irp

View file

@ -76,9 +76,14 @@ KeClearEvent (
PKEVENT Event
);
NTSTATUS STDCALL KeDelayExecutionThread (KPROCESSOR_MODE WaitMode,
BOOLEAN Alertable,
PLARGE_INTEGER Internal);
NTSTATUS
STDCALL
KeDelayExecutionThread (
KPROCESSOR_MODE WaitMode,
BOOLEAN Alertable,
PLARGE_INTEGER Internal
);
BOOLEAN
STDCALL
KeDeregisterBugCheckCallback (
@ -556,6 +561,17 @@ KeFlushWriteBuffer (
VOID
);
KIRQL
FASTCALL
KfAcquireSpinLock (
IN PKSPIN_LOCK SpinLock
);
KIRQL
FASTCALL
KeAcquireSpinLockRaiseToSynch (
IN PKSPIN_LOCK SpinLock
);
VOID
FASTCALL
@ -570,4 +586,11 @@ KfRaiseIrql (
IN KIRQL NewIrql
);
VOID
FASTCALL
KfReleaseSpinLock (
IN PKSPIN_LOCK SpinLock,
IN KIRQL NewIrql
);
#endif /* __INCLUDE_DDK_KEFUNCS_H */

View file

@ -1,4 +1,4 @@
/* $Id: fmutex.c,v 1.5 2000/05/01 14:15:02 ea Exp $
/* $Id: fmutex.c,v 1.6 2000/06/09 20:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -15,16 +15,15 @@
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
/* FIXME: in HAL */
VOID FASTCALL EXPORTED ExAcquireFastMutex(PFAST_MUTEX FastMutex)
{
KeEnterCriticalRegion();
ExAcquireFastMutexUnsafe(FastMutex);
}
VOID FASTCALL EXPORTED ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex)
VOID
FASTCALL
EXPORTED
ExAcquireFastMutexUnsafe (
PFAST_MUTEX FastMutex
)
{
if (InterlockedDecrement(&(FastMutex->Count))==0)
{
@ -39,41 +38,20 @@ VOID FASTCALL EXPORTED ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex)
FastMutex->Owner=KeGetCurrentThread();
}
/* FIXME: convert it into a macro */
VOID FASTCALL ExInitializeFastMutex(PFAST_MUTEX FastMutex)
{
FastMutex->Count=1;
FastMutex->Owner=NULL;
FastMutex->Contention=0;
KeInitializeEvent(&(FastMutex->Event),
SynchronizationEvent,
FALSE);
}
VOID FASTCALL EXPORTED ExReleaseFastMutexUnsafe(PFAST_MUTEX FastMutex)
VOID
FASTCALL
EXPORTED
ExReleaseFastMutexUnsafe (
PFAST_MUTEX FastMutex
)
{
assert(FastMutex->Owner == KeGetCurrentThread());
FastMutex->Owner=NULL;
if (InterlockedIncrement(&(FastMutex->Count))<=0)
{
return;
}
}
KeSetEvent(&(FastMutex->Event),0,FALSE);
}
/* FIXME: in HAL */
VOID FASTCALL EXPORTED ExReleaseFastMutex(PFAST_MUTEX FastMutex)
{
ExReleaseFastMutexUnsafe(FastMutex);
KeLeaveCriticalRegion();
}
/* FIXME: in HAL */
BOOLEAN FASTCALL EXPORTED ExTryToAcquireFastMutex(PFAST_MUTEX FastMutex)
{
UNIMPLEMENTED;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: work.c,v 1.5 2000/06/07 13:04:34 ekohl Exp $
/* $Id: work.c,v 1.6 2000/06/09 20:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -135,6 +135,7 @@ VOID ExInitializeWorkerThreads(VOID)
HIGH_PRIORITY);
}
#if 0
VOID
STDCALL
ExInitializeWorkItem (
@ -158,6 +159,7 @@ ExInitializeWorkItem (
Item->Entry.Flink = NULL;
Item->Entry.Blink = NULL;
}
#endif
VOID
STDCALL

View file

@ -0,0 +1,72 @@
/* $Id: fmutex.c,v 1.1 2000/06/09 20:05:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/fmutex.c
* PURPOSE: Implements fast mutexes
* PROGRAMMER: David Welch (welch@cwcom.net)
* Eric Kohl (ekohl@rz-online.de)
* UPDATE HISTORY:
* Created 09/06/2000
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
VOID
FASTCALL
EXPORTED
ExAcquireFastMutex (
PFAST_MUTEX FastMutex
)
{
KeEnterCriticalRegion();
if (InterlockedDecrement(&(FastMutex->Count))==0)
{
return;
}
FastMutex->Contention++;
KeWaitForSingleObject(&(FastMutex->Event),
Executive,
KernelMode,
FALSE,
NULL);
FastMutex->Owner=KeGetCurrentThread();
}
VOID
FASTCALL
EXPORTED
ExReleaseFastMutex (
PFAST_MUTEX FastMutex
)
{
assert(FastMutex->Owner == KeGetCurrentThread());
FastMutex->Owner=NULL;
if (InterlockedIncrement(&(FastMutex->Count))<=0)
{
return;
}
KeSetEvent(&(FastMutex->Event),0,FALSE);
KeLeaveCriticalRegion();
}
BOOLEAN
FASTCALL
EXPORTED
ExTryToAcquireFastMutex (
PFAST_MUTEX FastMutex
)
{
UNIMPLEMENTED;
}
/* EOF */

View file

@ -0,0 +1,47 @@
/* $Id: perfcnt.c,v 1.1 2000/06/09 20:05:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/hal/x86/perfcnt.c
* PURPOSE: Performance counter functions
* PROGRAMMER: David Welch (welch@mcmail.com)
* Eric Kohl (ekohl@rz-online.de)
* UPDATE HISTORY:
* 09/06/2000: Created
*/
/* INCLUDES ***************************************************************/
#include <ddk/ntddk.h>
/* FUNCTIONS **************************************************************/
/*
HalCalibratePerformanceCounter@4
*/
LARGE_INTEGER
STDCALL
KeQueryPerformanceCounter (
PLARGE_INTEGER PerformanceFreq
)
/*
* FUNCTION: Queries the finest grained running count avaiable in the system
* ARGUMENTS:
* PerformanceFreq (OUT) = The routine stores the number of
* performance counters tick per second here
* RETURNS: The performance counter value in HERTZ
* NOTE: Returns the system tick count or the time-stamp on the pentium
*/
{
if (PerformanceFreq != NULL)
{
PerformanceFreq->QuadPart = 0;
}
return *PerformanceFreq;
}
/* EOF */

View file

@ -6,6 +6,7 @@ OBJECTS_HAL = \
hal/x86/display.o \
hal/x86/dma.o \
hal/x86/drive.o \
hal/x86/fmutex.o \
hal/x86/halinit.o \
hal/x86/irq.o \
hal/x86/irqhand.o \
@ -17,8 +18,10 @@ OBJECTS_HAL = \
hal/x86/mp.o \
hal/x86/parttab.o \
hal/x86/pci.o \
hal/x86/perfcnt.o \
hal/x86/portio.o \
hal/x86/reboot.o \
hal/x86/spinlock.o \
hal/x86/sysbus.o \
hal/x86/sysinfo.o \
hal/x86/time.o \

View file

@ -0,0 +1,100 @@
/* $Id: spinlock.c,v 1.10 2000/06/09 20:05:00 ekohl Exp $
*
* 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)
* Eric Kohl (ekohl@rz-online.de)
* UPDATE HISTORY:
* 09/06/2000 Created
*/
/*
* NOTE: On a uniprocessor machine spinlocks are implemented by raising
* the irq level
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <internal/debug.h>
/* FUNCTIONS ***************************************************************/
VOID
STDCALL
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
FASTCALL
KeAcquireSpinLockRaiseToSynch (
PKSPIN_LOCK SpinLock
)
{
UNIMPLEMENTED;
}
VOID
STDCALL
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);
}
KIRQL
FASTCALL
KfAcquireSpinLock (
PKSPIN_LOCK SpinLock
)
{
KIRQL OldIrql;
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
KeAcquireSpinLockAtDpcLevel(SpinLock);
return OldIrql;
}
VOID
FASTCALL
KfReleaseSpinLock (
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);
}
/* EOF */

View file

@ -1,28 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/arc.c
* PURPOSE: arc names
* PROGRAMMER: David Welch (welch@mcmail.com)
* UPDATE HISTORY:
* Created 22/05/98
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/debug.h>
/* FUNCTIONS *****************************************************************/
VOID IoAssignArcName(PUNICODE_STRING ArcName,
PUNICODE_STRING DeviceName)
{
IoCreateSymbolicLink(ArcName,DeviceName);
}
VOID IoDeassignArcName(PUNICODE_STRING ArcName)
{
IoDeleteSymbolicLink(ArcName);
}

View file

@ -1,4 +1,5 @@
/*
/* $Id: spinlock.c,v 1.4 2000/06/09 20:07:20 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/spinlock.c
@ -108,37 +109,4 @@ KeReleaseSpinLockFromDpcLevel (
(void)InterlockedExchange(&SpinLock->Lock, 0);
}
VOID
STDCALL
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
STDCALL
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);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: timer.c,v 1.28 2000/06/04 19:50:12 ekohl Exp $
/* $Id: timer.c,v 1.29 2000/06/09 20:07:20 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -171,28 +171,6 @@ KeDelayExecutionThread (
NULL));
}
LARGE_INTEGER
STDCALL
KeQueryPerformanceCounter (
PLARGE_INTEGER PerformanceFreq
)
/*
* FUNCTION: Queries the finest grained running count avaiable in the system
* ARGUMENTS:
* PerformanceFreq (OUT) = The routine stores the number of
* performance counters tick per second here
* RETURNS: The performance counter value in HERTZ
* NOTE: Returns the system tick count or the time-stamp on the pentium
*/
{
if (PerformanceFreq != NULL)
{
PerformanceFreq->QuadPart = 0;
}
return *PerformanceFreq;
}
ULONG
STDCALL
KeQueryTimeIncrement (

View file

@ -1,4 +1,4 @@
# $Id: makefile_rex,v 1.71 2000/06/04 17:27:35 ea Exp $
# $Id: makefile_rex,v 1.72 2000/06/09 20:02:37 ekohl Exp $
#
# ReactOS Operating System
#
@ -119,7 +119,6 @@ OBJECTS_MM_I386 = \
# I/O Subsystem (Io)
OBJECTS_IO = \
io/adapter.o \
io/arc.o \
io/buildirp.o \
io/cancel.o \
io/cleanup.o \

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.73 2000/06/07 13:04:05 ekohl Exp $
; $Id: ntoskrnl.def,v 1.74 2000/06/09 20:02:37 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -46,15 +46,12 @@ ExGetCurrentResourceThread@0
ExGetExclusiveWaiterCount@4
;ExGetPreviousMode
ExGetSharedWaiterCount@4
;FIXME: ExInitializeFastMutex is a macro!
ExInitializeFastMutex@4
ExInitializeNPagedLookasideList
ExInitializePagedLookasideList
ExInitializeResource@4
ExInitializeResourceLite@4
;FIXME: ExInitializeSListHead is a macro!
ExInitializeSListHead@4
;FIXME: ExInitializeWorkItem is a macro!
ExInitializeWorkItem@12
ExInitializeZone@16
ExInterlockedAddLargeInteger@16
;ExInterlockedAddLargeStatistic
@ -1089,22 +1086,25 @@ KdPortPutByte@4
KdPortRestore@0
KdPortSave@0
KeAcquireSpinLock@8
;KeAcquireSpinLockRaiseToSynch
;@KeAcquireSpinLockRaiseToSynch@4
KeAcquireSpinLockRaiseToSynch@4
KeFlushWriteBuffer@0
KeGetCurrentIrql@0
KeLowerIrql@4
KeQueryPerformanceCounter@4
KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel
;KeRaiseIrqlToSynchLevel
;KeRaiseIrqlToDpcLevel@0
;KeRaiseIrqlToSynchLevel@0
KeReleaseSpinLock@8
KeStallExecutionProcessor@4
;KfAcquireSpinLock
;@KfAcquireSpinLock@4
KfAcquireSpinLock@4
;@KfLowerIrql@4
KfLowerIrql@4
;@KfRaiseIrql@4
KfRaiseIrql@4
;KfReleaseSpinLock
;@KfReleaseSpinLock@8
KfReleaseSpinLock@8
READ_PORT_BUFFER_UCHAR@12
READ_PORT_BUFFER_ULONG@12
READ_PORT_BUFFER_USHORT@12

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.60 2000/06/07 13:04:05 ekohl Exp $
; $Id: ntoskrnl.edf,v 1.61 2000/06/09 20:02:37 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -46,15 +46,11 @@ ExGetCurrentResourceThread=ExGetCurrentResourceThread@0
ExGetExclusiveWaiterCount=ExGetExclusiveWaiterCount@4
;ExGetPreviousMode
ExGetSharedWaiterCount=ExGetSharedWaiterCount@4
;FIXME: ExInitializeFastMutex is a macro!
ExInitializeFastMutex=ExInitializeFastMutex@4
ExInitializeNPagedLookasideList=ExInitializeNPagedLookasideList@28
ExInitializePagedLookasideList=ExInitializePagedLookasideList@28
ExInitializeResource=ExInitializeResource@4
ExInitializeResourceLite=ExInitializeResourceLite@4
ExInitializeSListHead=ExInitializeSListHead@4
;FIXME: ExInitializeWorkItem is a macro!
ExInitializeWorkItem=ExInitializeWorkItem@12
ExInitializeZone=ExInitializeZone@16
ExInterlockedAddLargeInteger=ExInterlockedAddLargeInteger@16
;ExInterlockedAddLargeStatistic
@ -1019,22 +1015,25 @@ KdPortPutByte=KdPortPutByte@4
KdPortRestore=KdPortRestore@0
KdPortSave=KdPortSave@0
KeAcquireSpinLock=KeAcquireSpinLock@8
;KeAcquireSpinLockRaiseToSynch
;KeAcquireSpinLockRaiseToSynch=@KeAcquireSpinLockRaiseToSynch@4
KeAcquireSpinLockRaiseToSynch=KeAcquireSpinLockRaiseToSynch@4
KeFlushWriteBuffer=KeFlushWriteBuffer@0
KeGetCurrentIrql=KeGetCurrentIrql@0
KeLowerIrql=KeLowerIrql@4
KeQueryPerformanceCounter=KeQueryPerformanceCounter@4
KeRaiseIrql=KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel
;KeRaiseIrqlToSynchLevel
;KeRaiseIrqlToDpcLevel=KeRaiseIrqlToDpcLevel@0
;KeRaiseIrqlToSynchLevel=KeRaiseIrqlToSynchLevel@0
KeReleaseSpinLock=KeReleaseSpinLock@8
KeStallExecutionProcessor=KeStallExecutionProcessor@4
;KfAcquireSpinLock
;KfAcquireSpinLock=@KfAcquireSpinLock@4
KfAcquireSpinLock=KfAcquireSpinLock@4
;KfLowerIrql=@KfLowerIrql@4
KfLowerIrql=KfLowerIrql@4
;KfRaiseIrql=@KfRaiseIrql@4
KfRaiseIrql=KfRaiseIrql@4
;KfReleaseSpinLock
;KfReleaseSpinLock=@KfReleaseSpinLock@8
KfReleaseSpinLock=KfReleaseSpinLock@8
READ_PORT_BUFFER_UCHAR=READ_PORT_BUFFER_UCHAR@12
READ_PORT_BUFFER_ULONG=READ_PORT_BUFFER_ULONG@12
READ_PORT_BUFFER_USHORT=READ_PORT_BUFFER_USHORT@12