diff --git a/reactos/include/ddk/kefuncs.h b/reactos/include/ddk/kefuncs.h index 1ba1f8e5ecf..3e2b0fe9b27 100644 --- a/reactos/include/ddk/kefuncs.h +++ b/reactos/include/ddk/kefuncs.h @@ -22,16 +22,6 @@ KeSaveFloatingPointState( VOID STDCALL KeAttachProcess(struct _KPROCESS *Process); -BOOLEAN -STDCALL -KeIsAttachedProcess(VOID); - -VOID FASTCALL KiAcquireSpinLock(PKSPIN_LOCK SpinLock); - -VOID FASTCALL KiReleaseSpinLock(PKSPIN_LOCK SpinLock); - -VOID KeDrainApcQueue(VOID); - struct _KPROCESS* STDCALL KeGetCurrentProcess(VOID); /* @@ -99,8 +89,6 @@ BOOLEAN STDCALL KeCancelTimer (PKTIMER Timer); VOID STDCALL KeClearEvent (PKEVENT Event); -BOOLEAN STDCALL KeConnectInterrupt(PKINTERRUPT InterruptObject); - NTSTATUS STDCALL KeDelayExecutionThread (KPROCESSOR_MODE WaitMode, BOOLEAN Alertable, PLARGE_INTEGER Internal); @@ -110,17 +98,8 @@ BOOLEAN STDCALL KeDeregisterBugCheckCallback ( VOID STDCALL KeDetachProcess (VOID); -VOID STDCALL KeDisconnectInterrupt(PKINTERRUPT InterruptObject); - VOID STDCALL KeEnterCriticalRegion (VOID); -/* - * FUNCTION: Enters the kernel debugger - * ARGUMENTS: - * None - */ -VOID STDCALL KeEnterKernelDebugger (VOID); - KIRQL STDCALL KeGetCurrentIrql (VOID); #ifndef __USE_W32API @@ -131,16 +110,6 @@ KPROCESSOR_MODE STDCALL KeGetPreviousMode (VOID); struct _KTHREAD* STDCALL KeGetCurrentThread (VOID); -VOID STDCALL KeInitializeApc (IN PKAPC Apc, - IN PKTHREAD Thread, - IN KAPC_ENVIRONMENT TargetEnvironment, - IN PKKERNEL_ROUTINE KernelRoutine, - IN PKRUNDOWN_ROUTINE RundownRoutine, - IN PKNORMAL_ROUTINE NormalRoutine, - IN KPROCESSOR_MODE Mode, - IN PVOID Context); - - /* * VOID * KeInitializeCallbackRecord ( @@ -162,18 +131,6 @@ VOID STDCALL KeInitializeEvent (PKEVENT Event, EVENT_TYPE Type, BOOLEAN State); -VOID STDCALL KeInitializeInterrupt(PKINTERRUPT InterruptObject, - PKSERVICE_ROUTINE ServiceRoutine, - PVOID ServiceContext, - PKSPIN_LOCK SpinLock, - ULONG Vector, - KIRQL Irql, - KIRQL SynchronizeIrql, - KINTERRUPT_MODE InterruptMode, - BOOLEAN ShareVector, - CHAR ProcessorNumber, - BOOLEAN FloatingSave); - VOID STDCALL KeInitializeMutant(IN PKMUTANT Mutant, IN BOOLEAN InitialOwner); @@ -218,11 +175,6 @@ LONG STDCALL KeInsertQueue(IN PKQUEUE Queue, IN PLIST_ENTRY Entry); -BOOLEAN STDCALL KeInsertQueueApc (PKAPC Apc, - PVOID SystemArgument1, - PVOID SystemArgument2, - KPRIORITY PriorityBoost); - BOOLEAN STDCALL KeInsertQueueDpc (PKDPC Dpc, PVOID SystemArgument1, PVOID SystemArgument2); @@ -377,16 +329,6 @@ KeRemoveQueueDpc(IN PKDPC Dpc); LONG STDCALL KeResetEvent(IN PKEVENT Event); -VOID STDCALL -KeRosDumpStackFrames ( PULONG Frame, ULONG FrameCount ); - -ULONG STDCALL -KeRosGetStackFrames ( PULONG Frames, ULONG FrameCount ); - -NTSTATUS STDCALL -KeSetAffinityThread(PKTHREAD Thread, - KAFFINITY Affinity); - LONG STDCALL KeSetBasePriorityThread(struct _KTHREAD* Thread, LONG Increment); @@ -447,92 +389,6 @@ KeWaitForSingleObject ( ); - -/* io permission map has a 8k size - * Each bit in the IOPM corresponds to an io port byte address. The bitmap - * is initialized to allow IO at any port. [ all bits set ]. - */ -typedef struct _IOPM -{ - UCHAR Bitmap[8192]; -} IOPM, *PIOPM; - -/* - * FUNCTION: Provides the kernel with a new access map for a driver - * ARGUMENTS: - * NewMap: = If FALSE the kernel's map is set to all disabled. If TRUE - * the kernel disables access to a particular port. - * IoPortMap = Caller supplies storage for the io permission map. - * REMARKS - * Each bit in the IOPM corresponds to an io port byte address. The bitmap - * is initialized to allow IO at any port. [ all bits set ]. The IOPL determines - * the minium privilege level required to perform IO prior to checking the permission map. - */ -BOOL STDCALL -Ke386SetIoAccessMap(ULONG NewMap, PULONG IoPermissionMap); - -/* - * FUNCTION: Queries the io permission map. - * ARGUMENTS: - * NewMap: = If FALSE the kernel's map is set to all disabled. If TRUE - * the kernel disables access to a particular port. - * IoPortMap = Caller supplies storage for the io permission map. - * REMARKS - * Each bit in the IOPM corresponds to an io port byte address. The bitmap - * is initialized to allow IO at any port. [ all bits set ]. The IOPL determines - * the minium privilege level required to perform IO prior to checking the permission map. - */ -BOOL STDCALL -Ke386QueryIoAccessMap(ULONG NewMap, PULONG IoPermissionMap); - -/* - * FUNCTION: Set the process IOPL - * ARGUMENTS: - * Eprocess = Pointer to a executive process object - * EnableIo = Specify TRUE to enable IO and FALSE to disable - */ -BOOL STDCALL -Ke386IoSetAccessProcess(struct _EPROCESS* Eprocess, BOOL EnableIo); - -/* - * FUNCTION: Sets the contents of a gdt descriptor. - * ARGUMENTS: - * Entry = The selector to set. - * Value1 = The value of the low dword of the descriptor. - * Value2 = The value of the high dword of the descriptor. - */ -VOID -KeSetGdtSelector( - ULONG Entry, - ULONG Value1, - ULONG Value2 -); - -/* - * FUNCTION: Releases a set of Global Descriptor Table Selectors - * ARGUMENTS: - * SelArray = - * NumOfSelectors = - */ -NTSTATUS -KeI386ReleaseGdtSelectors( - OUT PULONG SelArray, - IN ULONG NumOfSelectors -); - -/* - * FUNCTION: Allocates a set of Global Descriptor Table Selectors - * ARGUMENTS: - * SelArray = - * NumOfSelectors = - */ -NTSTATUS -KeI386AllocateGdtSelectors( - OUT PULONG SelArray, - IN ULONG NumOfSelectors -); - - KIRQL FASTCALL KfAcquireSpinLock ( @@ -560,8 +416,6 @@ KfReleaseSpinLock ( ); -VOID STDCALL KiDispatchInterrupt(VOID); - /* Stubs Start here */ VOID @@ -617,97 +471,6 @@ KeRegisterBugCheckReasonCallback( IN PUCHAR Component ); -VOID -STDCALL -KeTerminateThread( - IN KPRIORITY Increment -); - -BOOLEAN -STDCALL -KeIsExecutingDpc( - VOID -); - -VOID -STDCALL -KeSetEventBoostPriority( - IN PKEVENT Event, - IN PKTHREAD *Thread OPTIONAL -); - -PCONFIGURATION_COMPONENT_DATA -STDCALL -KeFindConfigurationNextEntry( - IN PCONFIGURATION_COMPONENT_DATA Child, - IN CONFIGURATION_CLASS Class, - IN CONFIGURATION_TYPE Type, - IN PULONG ComponentKey OPTIONAL, - IN PCONFIGURATION_COMPONENT_DATA *NextLink -); - -PCONFIGURATION_COMPONENT_DATA -STDCALL -KeFindConfigurationEntry( - IN PCONFIGURATION_COMPONENT_DATA Child, - IN CONFIGURATION_CLASS Class, - IN CONFIGURATION_TYPE Type, - IN PULONG ComponentKey OPTIONAL -); - -VOID -STDCALL -KeFlushEntireTb( - IN BOOLEAN Unknown, - IN BOOLEAN CurrentCpuOnly -); - -VOID -STDCALL -KeRevertToUserAffinityThread( - VOID -); - -VOID -STDCALL -KiCoprocessorError( - VOID -); - -VOID -STDCALL -KiUnexpectedInterrupt( - VOID -); - -VOID -STDCALL -KeSetDmaIoCoherency( - IN ULONG Coherency -); - -VOID -STDCALL -KeSetProfileIrql( - IN KIRQL ProfileIrql -); - -VOID -STDCALL -KeSetSystemAffinityThread( - IN KAFFINITY Affinity -); - -NTSTATUS -STDCALL -KeUserModeCallback( - IN ULONG FunctionID, - IN PVOID InputBuffer, - IN ULONG InputLength, - OUT PVOID *OutputBuffer, - OUT PULONG OutputLength -); - VOID STDCALL KeSetTimeIncrement( @@ -715,31 +478,6 @@ KeSetTimeIncrement( IN ULONG MinIncrement ); -VOID -STDCALL -KeCapturePersistentThreadState( - IN PVOID CurrentThread, - IN ULONG Setting1, - IN ULONG Setting2, - IN ULONG Setting3, - IN ULONG Setting4, - IN ULONG Setting5, - IN PVOID ThreadState -); - -BOOLEAN -STDCALL -KeRemoveSystemServiceTable( - IN ULONG TableIndex -); - -NTSTATUS -KeI386FlatToGdtSelector( - IN ULONG Base, - IN USHORT Length, - IN USHORT Selector -); - CCHAR STDCALL KeSetIdealProcessorThread ( @@ -804,12 +542,6 @@ KeSaveStateForHibernate( IN PVOID State ); -NTSTATUS -STDCALL -KeRaiseUserException( - IN NTSTATUS ExceptionCode -); - VOID FASTCALL KeAcquireGuardedMutex( diff --git a/reactos/include/ddk/ketypes.h b/reactos/include/ddk/ketypes.h index 1eb0b75e005..8f5c4ee7f08 100644 --- a/reactos/include/ddk/ketypes.h +++ b/reactos/include/ddk/ketypes.h @@ -341,14 +341,6 @@ typedef struct _M128 { LONGLONG High; } M128, *PM128; -typedef struct _CONFIGURATION_COMPONENT_DATA -{ - struct _CONFIGURATION_COMPONENT_DATA *Parent; - struct _CONFIGURATION_COMPONENT_DATA *Child; - struct _CONFIGURATION_COMPONENT_DATA *Sibling; - CONFIGURATION_COMPONENT Component; -} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA; - typedef struct _KEXCEPTION_FRAME { ULONG64 P1Home; ULONG64 P2Home; diff --git a/reactos/include/ntos/kefuncs.h b/reactos/include/ntos/kefuncs.h index a45c2ea165d..70487666672 100644 --- a/reactos/include/ntos/kefuncs.h +++ b/reactos/include/ntos/kefuncs.h @@ -9,6 +9,7 @@ #define KEBUGCHECK(a) DbgPrint("KeBugCheck (0x%X) at %s:%i\n", a, __FILE__,__LINE__), KeBugCheck(a) #define KEBUGCHECKEX(a,b,c,d,e) DbgPrint("KeBugCheckEx (0x%X, 0x%X, 0x%X, 0x%X, 0x%X) at %s:%i\n", a, b, c, d, e, __FILE__,__LINE__), KeBugCheckEx(a,b,c,d,e) +#include #ifdef __NTOSKRNL__ extern CHAR EXPORTED KeNumberProcessors; @@ -30,7 +31,249 @@ extern ULONG IMPORTED KeMaximumIncrement; extern ULONG IMPORTED KeMinimumIncrement; #endif +/* io permission map has a 8k size + * Each bit in the IOPM corresponds to an io port byte address. The bitmap + * is initialized to allow IO at any port. [ all bits set ]. + */ +typedef struct _IOPM +{ + UCHAR Bitmap[8192]; +} IOPM, *PIOPM; -VOID STDCALL KeFlushWriteBuffer (VOID); +typedef struct _CONFIGURATION_COMPONENT_DATA +{ + struct _CONFIGURATION_COMPONENT_DATA *Parent; + struct _CONFIGURATION_COMPONENT_DATA *Child; + struct _CONFIGURATION_COMPONENT_DATA *Sibling; + CONFIGURATION_COMPONENT Component; +} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA; + +VOID STDCALL +KeCapturePersistentThreadState( + IN PVOID CurrentThread, + IN ULONG Setting1, + IN ULONG Setting2, + IN ULONG Setting3, + IN ULONG Setting4, + IN ULONG Setting5, + IN PVOID ThreadState); + +BOOLEAN STDCALL +KeConnectInterrupt( + PKINTERRUPT InterruptObject); + +VOID STDCALL +KeDisconnectInterrupt( + PKINTERRUPT InterruptObject); + +VOID STDCALL +KeDrainApcQueue( + VOID); + +VOID STDCALL +KeEnterKernelDebugger( + VOID); + +PCONFIGURATION_COMPONENT_DATA STDCALL +KeFindConfigurationNextEntry( + IN PCONFIGURATION_COMPONENT_DATA Child, + IN CONFIGURATION_CLASS Class, + IN CONFIGURATION_TYPE Type, + IN PULONG ComponentKey OPTIONAL, + IN PCONFIGURATION_COMPONENT_DATA *NextLink); + +PCONFIGURATION_COMPONENT_DATA STDCALL +KeFindConfigurationEntry( + IN PCONFIGURATION_COMPONENT_DATA Child, + IN CONFIGURATION_CLASS Class, + IN CONFIGURATION_TYPE Type, + IN PULONG ComponentKey OPTIONAL); + +VOID STDCALL +KeFlushEntireTb( + IN BOOLEAN Unknown, + IN BOOLEAN CurrentCpuOnly); + +VOID STDCALL +KeFlushWriteBuffer( + VOID); + +VOID STDCALL +KeInitializeApc( + IN PKAPC Apc, + IN PKTHREAD Thread, + IN KAPC_ENVIRONMENT TargetEnvironment, + IN PKKERNEL_ROUTINE KernelRoutine, + IN PKRUNDOWN_ROUTINE RundownRoutine, + IN PKNORMAL_ROUTINE NormalRoutine, + IN KPROCESSOR_MODE Mode, + IN PVOID Context); + +VOID STDCALL +KeInitializeInterrupt( + PKINTERRUPT InterruptObject, + PKSERVICE_ROUTINE ServiceRoutine, + PVOID ServiceContext, + PKSPIN_LOCK SpinLock, + ULONG Vector, + KIRQL Irql, + KIRQL SynchronizeIrql, + KINTERRUPT_MODE InterruptMode, + BOOLEAN ShareVector, + CHAR ProcessorNumber, + BOOLEAN FloatingSave); + +BOOLEAN STDCALL +KeInsertQueueApc( + PKAPC Apc, + PVOID SystemArgument1, + PVOID SystemArgument2, + KPRIORITY PriorityBoost); + +BOOLEAN STDCALL +KeIsAttachedProcess( + VOID); + +BOOLEAN STDCALL +KeIsExecutingDpc( + VOID); + +VOID STDCALL +KeRevertToUserAffinityThread( + VOID); + +BOOLEAN STDCALL +KeRemoveSystemServiceTable( + IN ULONG TableIndex); + +NTSTATUS STDCALL +KeSetAffinityThread( + PKTHREAD Thread, + KAFFINITY Affinity); + +VOID STDCALL +KeSetDmaIoCoherency( + IN ULONG Coherency); + +VOID STDCALL +KeSetEventBoostPriority( + IN PKEVENT Event, + IN PKTHREAD *Thread OPTIONAL); + +VOID STDCALL +KeSetProfileIrql( + IN KIRQL ProfileIrql); + +VOID STDCALL +KeSetSystemAffinityThread( + IN KAFFINITY Affinity); + +VOID STDCALL +KeTerminateThread( + IN KPRIORITY Increment); + +NTSTATUS STDCALL +KeUserModeCallback( + IN ULONG FunctionID, + IN PVOID InputBuffer, + IN ULONG InputLength, + OUT PVOID *OutputBuffer, + OUT PULONG OutputLength); + +NTSTATUS STDCALL +KeRaiseUserException( + IN NTSTATUS ExceptionCode); + +/* + * FUNCTION: Provides the kernel with a new access map for a driver + * ARGUMENTS: + * NewMap: = If FALSE the kernel's map is set to all disabled. If TRUE + * the kernel disables access to a particular port. + * IoPortMap = Caller supplies storage for the io permission map. + * REMARKS + * Each bit in the IOPM corresponds to an io port byte address. The bitmap + * is initialized to allow IO at any port. [ all bits set ]. The IOPL determines + * the minium privilege level required to perform IO prior to checking the permission map. + */ +BOOL STDCALL +Ke386SetIoAccessMap( + ULONG NewMap, + PULONG IoPermissionMap); + +/* + * FUNCTION: Queries the io permission map. + * ARGUMENTS: + * NewMap: = If FALSE the kernel's map is set to all disabled. If TRUE + * the kernel disables access to a particular port. + * IoPortMap = Caller supplies storage for the io permission map. + * REMARKS + * Each bit in the IOPM corresponds to an io port byte address. The bitmap + * is initialized to allow IO at any port. [ all bits set ]. The IOPL determines + * the minium privilege level required to perform IO prior to checking the permission map. + */ +BOOL STDCALL +Ke386QueryIoAccessMap( + ULONG NewMap, + PULONG IoPermissionMap); + +/* Set the process IOPL. */ +BOOL STDCALL +Ke386IoSetAccessProcess( + struct _EPROCESS *Process, + BOOL EnableIo); + +NTSTATUS STDCALL +KeI386FlatToGdtSelector( + IN ULONG Base, + IN USHORT Length, + IN USHORT Selector); + +/* Releases a set of Global Descriptor Table Selectors. */ +NTSTATUS STDCALL +KeI386ReleaseGdtSelectors( + OUT PULONG SelArray, + IN ULONG NumOfSelectors); + +/* Allocates a set of Global Descriptor Table Selectors. */ +NTSTATUS STDCALL +KeI386AllocateGdtSelectors( + OUT PULONG SelArray, + IN ULONG NumOfSelectors); + +VOID FASTCALL +KiAcquireSpinLock( + PKSPIN_LOCK SpinLock); + +VOID STDCALL +KiCoprocessorError( + VOID); + +VOID STDCALL +KiDispatchInterrupt( + VOID); + +NTSTATUS STDCALL +KeRaiseUserException( + IN NTSTATUS ExceptionCode); + +VOID FASTCALL +KiReleaseSpinLock( + PKSPIN_LOCK SpinLock); + +VOID STDCALL +KiUnexpectedInterrupt( + VOID); + +/* REACTOS SPECIFIC */ + +VOID STDCALL +KeRosDumpStackFrames( + PULONG Frame, + ULONG FrameCount); + +ULONG STDCALL +KeRosGetStackFrames( + PULONG Frames, + ULONG FrameCount); #endif /* __INCLUDE_NTOS_KEFUNCS_H */ diff --git a/reactos/ntoskrnl/ke/i386/gdt.c b/reactos/ntoskrnl/ke/i386/gdt.c index b599e2c36b8..7c9b1d89629 100644 --- a/reactos/ntoskrnl/ke/i386/gdt.c +++ b/reactos/ntoskrnl/ke/i386/gdt.c @@ -148,7 +148,7 @@ l4: /* * @unimplemented */ -NTSTATUS +NTSTATUS STDCALL KeI386FlatToGdtSelector( IN ULONG Base, IN USHORT Length, @@ -162,7 +162,7 @@ KeI386FlatToGdtSelector( /* * @unimplemented */ -NTSTATUS +NTSTATUS STDCALL KeI386ReleaseGdtSelectors( OUT PULONG SelArray, IN ULONG NumOfSelectors @@ -175,10 +175,10 @@ KeI386ReleaseGdtSelectors( /* * @unimplemented */ -NTSTATUS +NTSTATUS STDCALL KeI386AllocateGdtSelectors( OUT PULONG SelArray, - IN ULONG NumOfSelectors + IN ULONG NumOfSelectors ) { UNIMPLEMENTED; diff --git a/reactos/ntoskrnl/ke/i386/ldt.c b/reactos/ntoskrnl/ke/i386/ldt.c index 3bef069dc3f..b273455e577 100644 --- a/reactos/ntoskrnl/ke/i386/ldt.c +++ b/reactos/ntoskrnl/ke/i386/ldt.c @@ -20,6 +20,9 @@ static KSPIN_LOCK LdtLock; /* FUNCTIONS *****************************************************************/ +/* gdt.c */ +extern VOID KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2); + BOOL PspIsDescriptorValid(PLDT_ENTRY ldt_entry) { ULONG Base, SegLimit; diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index f6f638dd01e..73871af02f4 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -541,13 +541,13 @@ KeGetCurrentThread@0 KeGetPreviousMode@0 KeGetRecommendedSharedDataAlignment@0 ;KeI386AbiosCall -KeI386AllocateGdtSelectors +KeI386AllocateGdtSelectors@8 ;KeI386Call16BitCStyleFunction ;KeI386Call16BitFunction -KeI386FlatToGdtSelector +KeI386FlatToGdtSelector@12 ;KeI386GetLid ;KeI386MachineType DATA -KeI386ReleaseGdtSelectors +KeI386ReleaseGdtSelectors@8 ;KeI386ReleaseLid ;KeI386SetGdtSelector KeIcacheFlushCount DATA