From e0eea608a60baedfa235f65cd014344a9ff3f9bf Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Wed, 14 Sep 2005 01:44:19 +0000 Subject: [PATCH] ntoskrnl header cleanups svn path=/trunk/; revision=17847 --- reactos/include/ndk/i386/ketypes.h | 6 + reactos/ntoskrnl/cc/cacheman.c | 1 + reactos/ntoskrnl/cc/copy.c | 4 + reactos/ntoskrnl/cc/view.c | 27 +- reactos/ntoskrnl/include/internal/cc.h | 45 +- reactos/ntoskrnl/include/internal/fs.h | 89 --- reactos/ntoskrnl/include/internal/fsrtl.h | 96 +++ reactos/ntoskrnl/include/internal/i386/ke.h | 55 ++ reactos/ntoskrnl/include/internal/io.h | 57 ++ reactos/ntoskrnl/include/internal/ke.h | 653 +++++++++++------- reactos/ntoskrnl/include/internal/ldr.h | 34 +- .../include/internal/{port.h => lpc.h} | 0 reactos/ntoskrnl/include/internal/ntoskrnl.h | 6 +- reactos/ntoskrnl/include/internal/v86m.h | 15 - reactos/ntoskrnl/include/internal/xhal.h | 69 -- reactos/ntoskrnl/ke/bug.c | 1 + reactos/ntoskrnl/ke/clock.c | 2 + reactos/ntoskrnl/ke/dpc.c | 1 + reactos/ntoskrnl/ke/i386/exp.c | 6 +- reactos/ntoskrnl/ke/i386/irq.c | 4 +- reactos/ntoskrnl/ke/i386/kernel.c | 13 +- reactos/ntoskrnl/ke/i386/usertrap.c | 1 + reactos/ntoskrnl/ke/i386/v86m.c | 1 + reactos/ntoskrnl/ke/ipi.c | 10 +- reactos/ntoskrnl/ke/kthread.c | 2 +- reactos/ntoskrnl/ldr/loader.c | 20 +- 26 files changed, 757 insertions(+), 461 deletions(-) delete mode 100644 reactos/ntoskrnl/include/internal/fs.h create mode 100644 reactos/ntoskrnl/include/internal/fsrtl.h rename reactos/ntoskrnl/include/internal/{port.h => lpc.h} (100%) delete mode 100644 reactos/ntoskrnl/include/internal/v86m.h delete mode 100644 reactos/ntoskrnl/include/internal/xhal.h diff --git a/reactos/include/ndk/i386/ketypes.h b/reactos/include/ndk/i386/ketypes.h index f690ff53802..2e3be267015 100644 --- a/reactos/include/ndk/i386/ketypes.h +++ b/reactos/include/ndk/i386/ketypes.h @@ -20,6 +20,12 @@ #define I386_INTERRUPT_GATE 0xE #define I386_TRAP_GATE 0xF +#define IPI_APC 1 +#define IPI_DPC 2 +#define IPI_FREEZE 3 +#define IPI_PACKET_READY 4 +#define IPI_SYNCH_REQUEST 10 + /* EXPORTED DATA *************************************************************/ /* ENUMERATIONS **************************************************************/ diff --git a/reactos/ntoskrnl/cc/cacheman.c b/reactos/ntoskrnl/cc/cacheman.c index 389bf79c905..d5d1fe78e49 100644 --- a/reactos/ntoskrnl/cc/cacheman.c +++ b/reactos/ntoskrnl/cc/cacheman.c @@ -16,6 +16,7 @@ /* FUNCTIONS *****************************************************************/ VOID +NTAPI CcInit(VOID) { CcInitView(); diff --git a/reactos/ntoskrnl/cc/copy.c b/reactos/ntoskrnl/cc/copy.c index 0d775e5edf3..4870cfa97e9 100644 --- a/reactos/ntoskrnl/cc/copy.c +++ b/reactos/ntoskrnl/cc/copy.c @@ -39,6 +39,7 @@ ULONG CcFastReadResourceMiss; /* FUNCTIONS *****************************************************************/ VOID +NTAPI CcInitCacheZeroPage(VOID) { NTSTATUS Status; @@ -58,6 +59,7 @@ CcInitCacheZeroPage(VOID) } NTSTATUS +NTAPI ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length, PVOID Buffer) { @@ -187,6 +189,7 @@ ReadCacheSegmentChain(PBCB Bcb, ULONG ReadOffset, ULONG Length, } NTSTATUS +NTAPI ReadCacheSegment(PCACHE_SEGMENT CacheSeg) { ULONG Size; @@ -228,6 +231,7 @@ ReadCacheSegment(PCACHE_SEGMENT CacheSeg) } NTSTATUS +NTAPI WriteCacheSegment(PCACHE_SEGMENT CacheSeg) { ULONG Size; diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index ebddf938782..da5b810251b 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -159,6 +159,7 @@ CcRosTraceCacheMap ( } NTSTATUS +NTAPI CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment) { NTSTATUS Status; @@ -179,6 +180,7 @@ CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment) } NTSTATUS +NTAPI CcRosFlushDirtyPages(ULONG Target, PULONG Count) { PLIST_ENTRY current_entry; @@ -355,6 +357,7 @@ CcRosTrimCache(ULONG Target, ULONG Priority, PULONG NrFreed) } NTSTATUS +NTAPI CcRosReleaseCacheSegment(PBCB Bcb, PCACHE_SEGMENT CacheSeg, BOOLEAN Valid, @@ -403,6 +406,7 @@ CcRosReleaseCacheSegment(PBCB Bcb, } PCACHE_SEGMENT +NTAPI CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset) { PLIST_ENTRY current_entry; @@ -434,6 +438,7 @@ CcRosLookupCacheSegment(PBCB Bcb, ULONG FileOffset) } NTSTATUS +NTAPI CcRosMarkDirtyCacheSegment(PBCB Bcb, ULONG FileOffset) { PCACHE_SEGMENT CacheSeg; @@ -470,6 +475,7 @@ CcRosMarkDirtyCacheSegment(PBCB Bcb, ULONG FileOffset) } NTSTATUS +NTAPI CcRosUnmapCacheSegment(PBCB Bcb, ULONG FileOffset, BOOLEAN NowDirty) { PCACHE_SEGMENT CacheSeg; @@ -689,6 +695,7 @@ CcRosCreateCacheSegment(PBCB Bcb, } NTSTATUS +NTAPI CcRosGetCacheSegmentChain(PBCB Bcb, ULONG FileOffset, ULONG Length, @@ -752,6 +759,7 @@ CcRosGetCacheSegmentChain(PBCB Bcb, } NTSTATUS +NTAPI CcRosGetCacheSegment(PBCB Bcb, ULONG FileOffset, PULONG BaseOffset, @@ -889,6 +897,7 @@ CcRosInternalFreeCacheSegment(PCACHE_SEGMENT CacheSeg) } NTSTATUS +NTAPI CcRosFreeCacheSegment(PBCB Bcb, PCACHE_SEGMENT CacheSeg) { NTSTATUS Status; @@ -995,6 +1004,7 @@ CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointers, } NTSTATUS +NTAPI CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb) /* * FUNCTION: Releases the BCB associated with a file object @@ -1065,7 +1075,9 @@ CcRosDeleteFileCache(PFILE_OBJECT FileObject, PBCB Bcb) return(STATUS_SUCCESS); } -VOID CcRosReferenceCache(PFILE_OBJECT FileObject) +VOID +NTAPI +CcRosReferenceCache(PFILE_OBJECT FileObject) { PBCB Bcb; ExAcquireFastMutex(&ViewLock); @@ -1086,7 +1098,9 @@ VOID CcRosReferenceCache(PFILE_OBJECT FileObject) ExReleaseFastMutex(&ViewLock); } -VOID CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer) +VOID +NTAPI +CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer) { PBCB Bcb; DPRINT("CcRosSetRemoveOnClose()\n"); @@ -1104,7 +1118,9 @@ VOID CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer) } -VOID CcRosDereferenceCache(PFILE_OBJECT FileObject) +VOID +NTAPI +CcRosDereferenceCache(PFILE_OBJECT FileObject) { PBCB Bcb; ExAcquireFastMutex(&ViewLock); @@ -1171,6 +1187,7 @@ CcRosReleaseFileCache(PFILE_OBJECT FileObject) } NTSTATUS +NTAPI CcTryToInitializeFileCache(PFILE_OBJECT FileObject) { PBCB Bcb; @@ -1328,7 +1345,9 @@ CmLazyCloseThreadMain(PVOID Ignored) } } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI CcInitView(VOID) { #ifdef CACHE_BITMAP diff --git a/reactos/ntoskrnl/include/internal/cc.h b/reactos/ntoskrnl/include/internal/cc.h index 8181f69ef42..1c2d0f0f7b7 100644 --- a/reactos/ntoskrnl/include/internal/cc.h +++ b/reactos/ntoskrnl/include/internal/cc.h @@ -77,36 +77,45 @@ CcMdlWriteCompleteDev( ); NTSTATUS +NTAPI CcRosFlushCacheSegment(PCACHE_SEGMENT CacheSegment); NTSTATUS +NTAPI CcRosGetCacheSegment( PBCB Bcb, ULONG FileOffset, PULONG BaseOffset, - PVOID* BaseAddress, + PVOID *BaseAddress, PBOOLEAN UptoDate, - PCACHE_SEGMENT* CacheSeg + PCACHE_SEGMENT *CacheSeg ); VOID +NTAPI CcInitView(VOID); NTSTATUS +NTAPI CcRosFreeCacheSegment( PBCB, PCACHE_SEGMENT ); NTSTATUS +NTAPI ReadCacheSegment(PCACHE_SEGMENT CacheSeg); NTSTATUS +NTAPI WriteCacheSegment(PCACHE_SEGMENT CacheSeg); -VOID CcInit(VOID); +VOID +NTAPI +CcInit(VOID); NTSTATUS +NTAPI CcRosUnmapCacheSegment( PBCB Bcb, ULONG FileOffset, @@ -114,12 +123,14 @@ CcRosUnmapCacheSegment( ); PCACHE_SEGMENT +NTAPI CcRosLookupCacheSegment( PBCB Bcb, ULONG FileOffset ); NTSTATUS +NTAPI CcRosGetCacheSegmentChain( PBCB Bcb, ULONG FileOffset, @@ -128,49 +139,57 @@ CcRosGetCacheSegmentChain( ); VOID +NTAPI CcInitCacheZeroPage(VOID); NTSTATUS +NTAPI CcRosMarkDirtyCacheSegment( PBCB Bcb, ULONG FileOffset ); NTSTATUS +NTAPI CcRosFlushDirtyPages( ULONG Target, PULONG Count ); VOID +NTAPI CcRosDereferenceCache(PFILE_OBJECT FileObject); VOID +NTAPI CcRosReferenceCache(PFILE_OBJECT FileObject); VOID +NTAPI CcRosSetRemoveOnClose(PSECTION_OBJECT_POINTERS SectionObjectPointer); NTSTATUS +NTAPI CcRosReleaseCacheSegment( - BCB* Bcb, - CACHE_SEGMENT* CacheSeg, - BOOLEAN Valid, - BOOLEAN Dirty, - BOOLEAN Mapped + BCB* Bcb, + CACHE_SEGMENT *CacheSeg, + BOOLEAN Valid, + BOOLEAN Dirty, + BOOLEAN Mapped ); NTSTATUS STDCALL CcRosRequestCacheSegment( - BCB* Bcb, - ULONG FileOffset, - PVOID* BaseAddress, - PBOOLEAN UptoDate, - CACHE_SEGMENT** CacheSeg + BCB *Bcb, + ULONG FileOffset, + PVOID* BaseAddress, + PBOOLEAN UptoDate, + CACHE_SEGMENT **CacheSeg ); NTSTATUS +NTAPI CcTryToInitializeFileCache(PFILE_OBJECT FileObject); /* diff --git a/reactos/ntoskrnl/include/internal/fs.h b/reactos/ntoskrnl/include/internal/fs.h deleted file mode 100644 index 428e9b8671a..00000000000 --- a/reactos/ntoskrnl/include/internal/fs.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef __INCLUDE_INTERNAL_IFS_H -#define __INCLUDE_INTERNAL_IFS_H - -typedef struct _FILE_LOCK_GRANTED { - LIST_ENTRY ListEntry; - FILE_LOCK_INFO Lock; - PVOID UnlockContext; -} FILE_LOCK_GRANTED, *PFILE_LOCK_GRANTED; - - -typedef struct _FILE_LOCK_TOC { - KSPIN_LOCK SpinLock; - LIST_ENTRY GrantedListHead; - LIST_ENTRY PendingListHead; -} FILE_LOCK_TOC, *PFILE_LOCK_TOC; - -VOID -STDCALL INIT_FUNCTION -FsRtlpInitNotifyImplementation(VOID); - - -VOID STDCALL -FsRtlpInitFileLockingImplementation(VOID); - -VOID STDCALL -FsRtlpFileLockCancelRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -BOOLEAN FASTCALL -FsRtlpCheckLockForReadOrWriteAccess( - IN PFILE_LOCK FileLock, - IN PLARGE_INTEGER FileOffset, - IN PLARGE_INTEGER Length, - IN ULONG Key, - IN PFILE_OBJECT FileObject, - IN PEPROCESS Process, - IN BOOLEAN Read - ); - -NTSTATUS FASTCALL -FsRtlpFastUnlockAllByKey( - IN PFILE_LOCK FileLock, - IN PFILE_OBJECT FileObject, - IN PEPROCESS Process, - IN DWORD Key, /* FIXME: guess */ - IN BOOLEAN UseKey, /* FIXME: guess */ - IN PVOID Context OPTIONAL - ); - -BOOLEAN FASTCALL -FsRtlpAddLock( - IN PFILE_LOCK_TOC LockToc, - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, - IN PLARGE_INTEGER Length, - IN PEPROCESS Process, - IN ULONG Key, - IN BOOLEAN ExclusiveLock, - IN PVOID UnlockContext - ); - -VOID FASTCALL -FsRtlpCompletePendingLocks( - IN PFILE_LOCK FileLock, - IN PFILE_LOCK_TOC LockToc, - IN OUT PKIRQL oldirql, - IN PVOID Context - ); - -NTSTATUS FASTCALL -FsRtlpUnlockSingle( - IN PFILE_LOCK FileLock, - IN PFILE_OBJECT FileObject, - IN PLARGE_INTEGER FileOffset, - IN PLARGE_INTEGER Length, - IN PEPROCESS Process, - IN ULONG Key, - IN PVOID Context OPTIONAL, - IN BOOLEAN CallUnlockRoutine - ); - -VOID FASTCALL -FsRtlpDumpFileLocks( - IN PFILE_LOCK FileLock - ); - -#endif diff --git a/reactos/ntoskrnl/include/internal/fsrtl.h b/reactos/ntoskrnl/include/internal/fsrtl.h new file mode 100644 index 00000000000..c74f5719a70 --- /dev/null +++ b/reactos/ntoskrnl/include/internal/fsrtl.h @@ -0,0 +1,96 @@ +#ifndef __INCLUDE_INTERNAL_IFS_H +#define __INCLUDE_INTERNAL_IFS_H + +typedef struct _FILE_LOCK_GRANTED +{ + LIST_ENTRY ListEntry; + FILE_LOCK_INFO Lock; + PVOID UnlockContext; +} FILE_LOCK_GRANTED, *PFILE_LOCK_GRANTED; + +typedef struct _FILE_LOCK_TOC +{ + KSPIN_LOCK SpinLock; + LIST_ENTRY GrantedListHead; + LIST_ENTRY PendingListHead; +} FILE_LOCK_TOC, *PFILE_LOCK_TOC; + +VOID +INIT_FUNCTION +STDCALL +FsRtlpInitNotifyImplementation(VOID); + +VOID +STDCALL +FsRtlpInitFileLockingImplementation(VOID); + +VOID +STDCALL +FsRtlpFileLockCancelRoutine( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + +BOOLEAN +FASTCALL +FsRtlpCheckLockForReadOrWriteAccess( + IN PFILE_LOCK FileLock, + IN PLARGE_INTEGER FileOffset, + IN PLARGE_INTEGER Length, + IN ULONG Key, + IN PFILE_OBJECT FileObject, + IN PEPROCESS Process, + IN BOOLEAN Read +); + +NTSTATUS +FASTCALL +FsRtlpFastUnlockAllByKey( + IN PFILE_LOCK FileLock, + IN PFILE_OBJECT FileObject, + IN PEPROCESS Process, + IN DWORD Key, + IN BOOLEAN UseKey, + IN PVOID Context OPTIONAL +); + +BOOLEAN +FASTCALL +FsRtlpAddLock( + IN PFILE_LOCK_TOC LockToc, + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN PLARGE_INTEGER Length, + IN PEPROCESS Process, + IN ULONG Key, + IN BOOLEAN ExclusiveLock, + IN PVOID UnlockContext +); + +VOID +FASTCALL +FsRtlpCompletePendingLocks( + IN PFILE_LOCK FileLock, + IN PFILE_LOCK_TOC LockToc, + IN OUT PKIRQL oldirql, + IN PVOID Context +); + +NTSTATUS +FASTCALL +FsRtlpUnlockSingle( + IN PFILE_LOCK FileLock, + IN PFILE_OBJECT FileObject, + IN PLARGE_INTEGER FileOffset, + IN PLARGE_INTEGER Length, + IN PEPROCESS Process, + IN ULONG Key, + IN PVOID Context OPTIONAL, + IN BOOLEAN CallUnlockRoutine +); + +VOID +FASTCALL +FsRtlpDumpFileLocks(IN PFILE_LOCK FileLock); + +#endif diff --git a/reactos/ntoskrnl/include/internal/i386/ke.h b/reactos/ntoskrnl/include/internal/i386/ke.h index 7d16153242d..1b6546a8030 100644 --- a/reactos/ntoskrnl/include/internal/i386/ke.h +++ b/reactos/ntoskrnl/include/internal/i386/ke.h @@ -71,6 +71,61 @@ typedef struct _KIRQ_TRAPFRAME ULONG Eflags; } KIRQ_TRAPFRAME, *PKIRQ_TRAPFRAME; +/* Emulate cli/sti instructions */ +#define KV86M_EMULATE_CLI_STI (0x1) +/* Allow the v86 mode code to access i/o ports */ +#define KV86M_ALLOW_IO_PORT_ACCESS (0x2) + +typedef struct _KV86M_REGISTERS +{ + /* + * General purpose registers + */ + ULONG Ebp; + ULONG Edi; + ULONG Esi; + ULONG Edx; + ULONG Ecx; + ULONG Ebx; + ULONG Eax; + ULONG Ds; + ULONG Es; + ULONG Fs; + ULONG Gs; + + /* + * Control registers + */ + ULONG Eip; + ULONG Cs; + ULONG Eflags; + ULONG Esp; + ULONG Ss; + + /* + * Control structures + */ + ULONG RecoveryAddress; + UCHAR RecoveryInstruction[4]; + ULONG Vif; + ULONG Flags; + PNTSTATUS PStatus; +} KV86M_REGISTERS, *PKV86M_REGISTERS; + +typedef struct _KV86M_TRAP_FRAME +{ + KTRAP_FRAME Tf; + + ULONG SavedExceptionStack; + + /* + * These are put on the top of the stack by the routine that entered + * v86 mode so the exception handlers can find the control information + */ + struct _KV86M_REGISTERS* regs; + ULONG orig_ebp; +} KV86M_TRAP_FRAME, *PKV86M_TRAP_FRAME; + extern ULONG Ke386CacheAlignment; struct _KPCR; diff --git a/reactos/ntoskrnl/include/internal/io.h b/reactos/ntoskrnl/include/internal/io.h index a80f22cede0..d3e9087ebc6 100644 --- a/reactos/ntoskrnl/include/internal/io.h +++ b/reactos/ntoskrnl/include/internal/io.h @@ -1,6 +1,8 @@ #ifndef __NTOSKRNL_INCLUDE_INTERNAL_IO_H #define __NTOSKRNL_INCLUDE_INTERNAL_IO_H +#include + #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003) extern POBJECT_TYPE IoCompletionType; @@ -478,4 +480,59 @@ IopInitIoCompletionImplementation(VOID); : \ FIELD_OFFSET(CM_RESOURCE_LIST, List) +/* xhal.c */ +NTSTATUS +FASTCALL +xHalQueryDriveLayout( + IN PUNICODE_STRING DeviceName, + OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo +); + +#undef HalExamineMBR +VOID +FASTCALL +HalExamineMBR( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG SectorSize, + IN ULONG MBRTypeIdentifier, + OUT PVOID *Buffer +); + +VOID +FASTCALL +xHalIoAssignDriveLetters( + IN PLOADER_PARAMETER_BLOCK LoaderBlock, + IN PSTRING NtDeviceName, + OUT PUCHAR NtSystemPath, + OUT PSTRING NtSystemPathString +); + +NTSTATUS +FASTCALL +xHalIoReadPartitionTable( + PDEVICE_OBJECT DeviceObject, + ULONG SectorSize, + BOOLEAN ReturnRecognizedPartitions, + PDRIVE_LAYOUT_INFORMATION *PartitionBuffer +); + +NTSTATUS +FASTCALL +xHalIoSetPartitionInformation( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG SectorSize, + IN ULONG PartitionNumber, + IN ULONG PartitionType +); + +NTSTATUS +FASTCALL +xHalIoWritePartitionTable( + IN PDEVICE_OBJECT DeviceObject, + IN ULONG SectorSize, + IN ULONG SectorsPerTrack, + IN ULONG NumberOfHeads, + IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer +); + #endif diff --git a/reactos/ntoskrnl/include/internal/ke.h b/reactos/ntoskrnl/include/internal/ke.h index cb9046e7f03..d47d29946fe 100644 --- a/reactos/ntoskrnl/include/internal/ke.h +++ b/reactos/ntoskrnl/include/internal/ke.h @@ -12,7 +12,23 @@ typedef struct _WOW64_PROCESS PVOID Wow64; } WOW64_PROCESS, *PWOW64_PROCESS; -/* INTERNAL KERNEL FUNCTIONS ************************************************/ +typedef struct _KPROFILE_SOURCE_OBJECT +{ + KPROFILE_SOURCE Source; + LIST_ENTRY ListEntry; +} KPROFILE_SOURCE_OBJECT, *PKPROFILE_SOURCE_OBJECT; + +/* Cached modules from the loader block */ +typedef enum _CACHED_MODULE_TYPE +{ + AnsiCodepage, + OemCodepage, + UnicodeCasemap, + SystemRegistry, + HardwareRegistry, + MaximumCachedModuleType, +} CACHED_MODULE_TYPE, *PCACHED_MODULE_TYPE; +extern PLOADER_MODULE CachedModules[MaximumCachedModuleType]; struct _KIRQ_TRAPFRAME; struct _KPCR; @@ -23,11 +39,8 @@ extern PVOID KeUserApcDispatcher; extern PVOID KeUserCallbackDispatcher; extern PVOID KeUserExceptionDispatcher; extern PVOID KeRaiseUserExceptionDispatcher; - -#define IPI_REQUEST_FUNCTIONCALL 0 -#define IPI_REQUEST_APC 1 -#define IPI_REQUEST_DPC 2 -#define IPI_REQUEST_FREEZE 3 +extern LARGE_INTEGER SystemBootTime; +extern ULONG_PTR KERNEL_BASE; /* MACROS *************************************************************************/ @@ -49,6 +62,14 @@ extern PVOID KeRaiseUserExceptionDispatcher; } \ } +#define KEBUGCHECKWITHTF(a,b,c,d,e,f) \ + DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f) + +#define MAXIMUM_PROCESSORS 32 + + +/* INTERNAL KERNEL FUNCTIONS ************************************************/ + /* threadsch.c ********************************************************************/ /* Thread Scheduler Functions */ @@ -66,17 +87,21 @@ KiDispatchThread(ULONG NewThreadStatus); /* Puts a Thread into a block state. */ VOID STDCALL -KiBlockThread(PNTSTATUS Status, - UCHAR Alertable, - ULONG WaitMode, - UCHAR WaitReason); +KiBlockThread( + PNTSTATUS Status, + UCHAR Alertable, + ULONG WaitMode, + UCHAR WaitReason +); /* Removes a thread out of a block state. */ VOID STDCALL -KiUnblockThread(PKTHREAD Thread, - PNTSTATUS WaitStatus, - KPRIORITY Increment); +KiUnblockThread( + PKTHREAD Thread, + PNTSTATUS WaitStatus, + KPRIORITY Increment +); NTSTATUS STDCALL @@ -108,62 +133,59 @@ KeSignalGateBoostPriority(PKGATE Gate); VOID FASTCALL -KeWaitForGate(PKGATE Gate, - KWAIT_REASON WaitReason, - KPROCESSOR_MODE WaitMode); +KeWaitForGate( + PKGATE Gate, + KWAIT_REASON WaitReason, + KPROCESSOR_MODE WaitMode +); /* ipi.c ********************************************************************/ -BOOLEAN STDCALL -KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame, - IN struct _KEXCEPTION_FRAME* ExceptionFrame); +BOOLEAN +STDCALL +KiIpiServiceRoutine( + IN PKTRAP_FRAME TrapFrame, + IN struct _KEXCEPTION_FRAME* ExceptionFrame +); VOID -KiIpiSendRequest(KAFFINITY TargetSet, - ULONG IpiRequest); +NTAPI +KiIpiSendRequest( + KAFFINITY TargetSet, + ULONG IpiRequest +); VOID -KeIpiGenericCall(VOID (STDCALL *WorkerRoutine)(PVOID), - PVOID Argument); +NTAPI +KeIpiGenericCall( + VOID (STDCALL *WorkerRoutine)(PVOID), + PVOID Argument +); /* next file ***************************************************************/ -typedef struct _KPROFILE_SOURCE_OBJECT -{ - KPROFILE_SOURCE Source; - LIST_ENTRY ListEntry; -} KPROFILE_SOURCE_OBJECT, *PKPROFILE_SOURCE_OBJECT; - -/* Cached modules from the loader block */ -typedef enum _CACHED_MODULE_TYPE -{ - AnsiCodepage, - OemCodepage, - UnicodeCasemap, - SystemRegistry, - HardwareRegistry, - MaximumCachedModuleType, -} CACHED_MODULE_TYPE, *PCACHED_MODULE_TYPE; -extern PLOADER_MODULE CachedModules[MaximumCachedModuleType]; - VOID STDCALL DbgBreakPointNoBugCheck(VOID); VOID STDCALL -KeInitializeProfile(struct _KPROFILE* Profile, - struct _KPROCESS* Process, - PVOID ImageBase, - ULONG ImageSize, - ULONG BucketSize, - KPROFILE_SOURCE ProfileSource, - KAFFINITY Affinity); +KeInitializeProfile( + struct _KPROFILE* Profile, + struct _KPROCESS* Process, + PVOID ImageBase, + ULONG ImageSize, + ULONG BucketSize, + KPROFILE_SOURCE ProfileSource, + KAFFINITY Affinity +); VOID STDCALL -KeStartProfile(struct _KPROFILE* Profile, - PVOID Buffer); +KeStartProfile( + struct _KPROFILE* Profile, + PVOID Buffer +); VOID STDCALL @@ -175,8 +197,10 @@ KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource); VOID STDCALL -KeSetIntervalProfile(KPROFILE_SOURCE ProfileSource, - ULONG Interval); +KeSetIntervalProfile( + KPROFILE_SOURCE ProfileSource, + ULONG Interval +); VOID STDCALL @@ -187,40 +211,77 @@ KeProfileInterrupt( VOID STDCALL KeProfileInterruptWithSource( - IN PKTRAP_FRAME TrapFrame, - IN KPROFILE_SOURCE Source + IN PKTRAP_FRAME TrapFrame, + IN KPROFILE_SOURCE Source ); BOOLEAN STDCALL KiRosPrintAddress(PVOID Address); -VOID STDCALL KeUpdateSystemTime(PKTRAP_FRAME TrapFrame, KIRQL Irql); -VOID STDCALL KeUpdateRunTime(PKTRAP_FRAME TrapFrame, KIRQL Irql); - -VOID STDCALL KiExpireTimers(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2); - -KIRQL inline FASTCALL KeAcquireDispatcherDatabaseLock(VOID); -VOID inline FASTCALL KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID); -VOID inline FASTCALL KeReleaseDispatcherDatabaseLock(KIRQL Irql); -VOID inline FASTCALL KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID); +VOID +STDCALL +KeUpdateSystemTime( + PKTRAP_FRAME TrapFrame, + KIRQL Irql +); VOID STDCALL -KeInitializeThread(struct _KPROCESS* Process, - PKTHREAD Thread, - PKSYSTEM_ROUTINE SystemRoutine, - PKSTART_ROUTINE StartRoutine, - PVOID StartContext, - PCONTEXT Context, - PVOID Teb, - PVOID KernelStack); +KeUpdateRunTime( + PKTRAP_FRAME TrapFrame, + KIRQL Irql +); + +VOID +STDCALL +KiExpireTimers( + PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2 +); + +KIRQL +inline +FASTCALL +KeAcquireDispatcherDatabaseLock(VOID); + +VOID +__inline +FASTCALL +KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID); + +VOID +__inline +FASTCALL +KeReleaseDispatcherDatabaseLock(KIRQL Irql); + +VOID +__inline +FASTCALL +KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID); + +VOID +STDCALL +KeInitializeThread( + struct _KPROCESS* Process, + PKTHREAD Thread, + PKSYSTEM_ROUTINE SystemRoutine, + PKSTART_ROUTINE StartRoutine, + PVOID StartContext, + PCONTEXT Context, + PVOID Teb, + PVOID KernelStack +); VOID STDCALL KeRundownThread(VOID); -NTSTATUS KeReleaseThread(PKTHREAD Thread); +NTSTATUS +NTAPI +KeReleaseThread(PKTHREAD Thread); LONG STDCALL @@ -228,45 +289,62 @@ KeQueryBasePriorityThread(IN PKTHREAD Thread); VOID STDCALL -KiSetPriorityThread(PKTHREAD Thread, - KPRIORITY Priority, - PBOOLEAN Released); +KiSetPriorityThread( + PKTHREAD Thread, + KPRIORITY Priority, + PBOOLEAN Released +); + +BOOLEAN +NTAPI +KiDispatcherObjectWake( + DISPATCHER_HEADER* hdr, + KPRIORITY increment +); VOID STDCALL -KeStackAttachProcess ( - IN struct _KPROCESS* Process, - OUT PKAPC_STATE ApcState - ); +KeExpireTimers( + PKDPC Apc, + PVOID Arg1, + PVOID Arg2, + PVOID Arg3 +); VOID -STDCALL -KeUnstackDetachProcess ( - IN PKAPC_STATE ApcState - ); +__inline +FASTCALL +KeInitializeDispatcherHeader( + DISPATCHER_HEADER* Header, + ULONG Type, + ULONG Size, + ULONG SignalState +); -BOOLEAN KiDispatcherObjectWake(DISPATCHER_HEADER* hdr, KPRIORITY increment); -VOID STDCALL KeExpireTimers(PKDPC Apc, - PVOID Arg1, - PVOID Arg2, - PVOID Arg3); -VOID inline FASTCALL KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type, - ULONG Size, ULONG SignalState); -VOID KeDumpStackFrames(PULONG Frame); -BOOLEAN KiTestAlert(VOID); +VOID +NTAPI +KeDumpStackFrames(PULONG Frame); + +BOOLEAN +NTAPI +KiTestAlert(VOID); VOID FASTCALL -KiAbortWaitThread(PKTHREAD Thread, - NTSTATUS WaitStatus, - KPRIORITY Increment); +KiAbortWaitThread( + PKTHREAD Thread, + NTSTATUS WaitStatus, + KPRIORITY Increment +); VOID STDCALL -KeInitializeProcess(struct _KPROCESS *Process, - KPRIORITY Priority, - KAFFINITY Affinity, - LARGE_INTEGER DirectoryTableBase); +KeInitializeProcess( + struct _KPROCESS *Process, + KPRIORITY Priority, + KAFFINITY Affinity, + LARGE_INTEGER DirectoryTableBase +); ULONG STDCALL @@ -276,215 +354,302 @@ BOOLEAN STDCALL KeDisableThreadApcQueueing(IN PKTHREAD Thread); -BOOLEAN STDCALL KiInsertTimer(PKTIMER Timer, LARGE_INTEGER DueTime); +BOOLEAN +STDCALL +KiInsertTimer( + PKTIMER Timer, + LARGE_INTEGER DueTime +); -VOID inline FASTCALL KiSatisfyObjectWait(PDISPATCHER_HEADER Object, PKTHREAD Thread); +VOID +inline +FASTCALL +KiSatisfyObjectWait( + PDISPATCHER_HEADER Object, + PKTHREAD Thread +); -BOOLEAN inline FASTCALL KiIsObjectSignaled(PDISPATCHER_HEADER Object, PKTHREAD Thread); +BOOLEAN +inline +FASTCALL +KiIsObjectSignaled( + PDISPATCHER_HEADER Object, + PKTHREAD Thread +); -VOID inline FASTCALL KiSatisifyMultipleObjectWaits(PKWAIT_BLOCK WaitBlock); +VOID +inline +FASTCALL +KiSatisifyMultipleObjectWaits(PKWAIT_BLOCK WaitBlock); -VOID FASTCALL KiWaitTest(PDISPATCHER_HEADER Object, KPRIORITY Increment); +VOID +FASTCALL +KiWaitTest( + PDISPATCHER_HEADER Object, + KPRIORITY Increment +); + +PULONG +NTAPI +KeGetStackTopThread(struct _ETHREAD* Thread); + +BOOLEAN +STDCALL +KeContextToTrapFrame( + PCONTEXT Context, + PKEXCEPTION_FRAME ExeptionFrame, + PKTRAP_FRAME TrapFrame, + KPROCESSOR_MODE PreviousMode +); + +VOID +STDCALL +KiDeliverApc( + KPROCESSOR_MODE PreviousMode, + PVOID Reserved, + PKTRAP_FRAME TrapFrame +); -PULONG KeGetStackTopThread(struct _ETHREAD* Thread); -BOOLEAN STDCALL KeContextToTrapFrame(PCONTEXT Context, - PKEXCEPTION_FRAME ExeptionFrame, - PKTRAP_FRAME TrapFrame, - KPROCESSOR_MODE PreviousMode); -VOID STDCALL KiDeliverApc(KPROCESSOR_MODE PreviousMode, - PVOID Reserved, - PKTRAP_FRAME TrapFrame); VOID STDCALL KiKernelApcDeliveryCheck(VOID); + LONG STDCALL -KiInsertQueue(IN PKQUEUE Queue, - IN PLIST_ENTRY Entry, - BOOLEAN Head); +KiInsertQueue( + IN PKQUEUE Queue, + IN PLIST_ENTRY Entry, + BOOLEAN Head +); ULONG STDCALL -KeSetProcess(struct _KPROCESS* Process, - KPRIORITY Increment); +KeSetProcess( + struct _KPROCESS* Process, + KPRIORITY Increment +); +VOID +STDCALL +KeInitializeEventPair(PKEVENT_PAIR EventPair); -VOID STDCALL KeInitializeEventPair(PKEVENT_PAIR EventPair); - -VOID STDCALL KiInitializeUserApc(IN PKEXCEPTION_FRAME Reserved, - IN PKTRAP_FRAME TrapFrame, - IN PKNORMAL_ROUTINE NormalRoutine, - IN PVOID NormalContext, - IN PVOID SystemArgument1, - IN PVOID SystemArgument2); +VOID +STDCALL +KiInitializeUserApc( + IN PKEXCEPTION_FRAME Reserved, + IN PKTRAP_FRAME TrapFrame, + IN PKNORMAL_ROUTINE NormalRoutine, + IN PVOID NormalContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2 +); PLIST_ENTRY STDCALL -KeFlushQueueApc(IN PKTHREAD Thread, - IN KPROCESSOR_MODE PreviousMode); +KeFlushQueueApc( + IN PKTHREAD Thread, + IN KPROCESSOR_MODE PreviousMode +); +VOID +STDCALL +KiAttachProcess( + struct _KTHREAD *Thread, + struct _KPROCESS *Process, + KIRQL ApcLock, + struct _KAPC_STATE *SavedApcState +); -VOID STDCALL KiAttachProcess(struct _KTHREAD *Thread, struct _KPROCESS *Process, KIRQL ApcLock, struct _KAPC_STATE *SavedApcState); - -VOID STDCALL KiSwapProcess(struct _KPROCESS *NewProcess, struct _KPROCESS *OldProcess); +VOID +STDCALL +KiSwapProcess( + struct _KPROCESS *NewProcess, + struct _KPROCESS *OldProcess +); BOOLEAN STDCALL KeTestAlertThread(IN KPROCESSOR_MODE AlertMode); -BOOLEAN STDCALL KeRemoveQueueApc (PKAPC Apc); -VOID FASTCALL KiWakeQueue(IN PKQUEUE Queue); -PLIST_ENTRY STDCALL KeRundownQueue(IN PKQUEUE Queue); +BOOLEAN +STDCALL +KeRemoveQueueApc(PKAPC Apc); -extern LARGE_INTEGER SystemBootTime; +VOID +FASTCALL +KiWakeQueue(IN PKQUEUE Queue); + +PLIST_ENTRY +STDCALL +KeRundownQueue(IN PKQUEUE Queue); /* INITIALIZATION FUNCTIONS *************************************************/ -extern ULONG_PTR KERNEL_BASE; +VOID +NTAPI +KeInitExceptions(VOID); -VOID KeInitExceptions(VOID); -VOID KeInitInterrupts(VOID); -VOID KeInitTimer(VOID); -VOID KeInitDpc(struct _KPRCB* Prcb); -VOID KeInitDispatcher(VOID); -VOID inline FASTCALL KeInitializeDispatcher(VOID); -VOID KiInitializeSystemClock(VOID); -VOID KiInitializeBugCheck(VOID); -VOID Phase1Initialization(PVOID Context); +VOID +NTAPI +KeInitInterrupts(VOID); -VOID KeInit1(PCHAR CommandLine, PULONG LastKernelAddress); -VOID KeInit2(VOID); +VOID +NTAPI +KeInitTimer(VOID); -BOOLEAN KiDeliverUserApc(PKTRAP_FRAME TrapFrame); +VOID +NTAPI +KeInitDpc(struct _KPRCB* Prcb); + +VOID +NTAPI +KeInitDispatcher(VOID); + +VOID +__inline +FASTCALL +KeInitializeDispatcher(VOID); + +VOID +NTAPI +KiInitializeSystemClock(VOID); + +VOID +NTAPI +KiInitializeBugCheck(VOID); + +VOID +NTAPI +Phase1Initialization(PVOID Context); + +VOID +NTAPI +KeInit1( + PCHAR CommandLine, + PULONG LastKernelAddress +); + +VOID +NTAPI +KeInit2(VOID); + +BOOLEAN +NTAPI +KiDeliverUserApc(PKTRAP_FRAME TrapFrame); VOID STDCALL -KiMoveApcState (PKAPC_STATE OldState, - PKAPC_STATE NewState); +KiMoveApcState( + PKAPC_STATE OldState, + PKAPC_STATE NewState +); VOID -KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Pc); +NTAPI +KiAddProfileEvent( + KPROFILE_SOURCE Source, + ULONG Pc +); + VOID NTAPI -KiDispatchException(PEXCEPTION_RECORD ExceptionRecord, - PKEXCEPTION_FRAME ExceptionFrame, - PKTRAP_FRAME Tf, - KPROCESSOR_MODE PreviousMode, - BOOLEAN SearchFrames); +KiDispatchException( + PEXCEPTION_RECORD ExceptionRecord, + PKEXCEPTION_FRAME ExceptionFrame, + PKTRAP_FRAME Tf, + KPROCESSOR_MODE PreviousMode, + BOOLEAN SearchFrames +); + VOID NTAPI -KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame, - IN PKEXCEPTION_FRAME ExceptionFrame, - IN OUT PCONTEXT Context); +KeTrapFrameToContext( + IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame, + IN OUT PCONTEXT Context +); + VOID +NTAPI KeApplicationProcessorInit(VOID); + VOID +NTAPI KePrepareForApplicationProcessorInit(ULONG id); + ULONG -KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2); -VOID STDCALL -KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack); -VOID STDCALL -KeStackSwitchAndRet(PVOID NewStack); -VOID STDCALL -KeBugCheckWithTf(ULONG BugCheckCode, - ULONG BugCheckParameter1, - ULONG BugCheckParameter2, - ULONG BugCheckParameter3, - ULONG BugCheckParameter4, - PKTRAP_FRAME Tf); -#define KEBUGCHECKWITHTF(a,b,c,d,e,f) DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f) +NTAPI +KiUserTrapHandler( + PKTRAP_FRAME Tf, + ULONG ExceptionNr, + PVOID Cr2 +); + VOID -KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2); +STDCALL +KePushAndStackSwitchAndSysRet( + ULONG Push, + PVOID NewStack +); + +VOID +STDCALL +KeStackSwitchAndRet(PVOID NewStack); + +VOID +STDCALL +KeBugCheckWithTf( + ULONG BugCheckCode, + ULONG BugCheckParameter1, + ULONG BugCheckParameter2, + ULONG BugCheckParameter3, + ULONG BugCheckParameter4, + PKTRAP_FRAME Tf +); + +VOID +STDCALL +KiDumpTrapFrame( + PKTRAP_FRAME Tf, + ULONG ExceptionNr, + ULONG cr2 +); VOID STDCALL KeFlushCurrentTb(VOID); -/* REACTOS SPECIFIC */ - -VOID STDCALL -KeRosDumpStackFrames( - PULONG Frame, - ULONG FrameCount); - -ULONG STDCALL -KeRosGetStackFrames( - PULONG Frames, - ULONG FrameCount); - VOID +STDCALL +KeRosDumpStackFrames( + PULONG Frame, + ULONG FrameCount +); + +ULONG +STDCALL +KeRosGetStackFrames( + PULONG Frames, + ULONG FrameCount +); + +VOID +NTAPI KiSetSystemTime(PLARGE_INTEGER NewSystemTime); -/* Emulate cli/sti instructions */ -#define KV86M_EMULATE_CLI_STI (0x1) -/* Allow the v86 mode code to access i/o ports */ -#define KV86M_ALLOW_IO_PORT_ACCESS (0x2) - -typedef struct _KV86M_REGISTERS -{ - /* - * General purpose registers - */ - ULONG Ebp; - ULONG Edi; - ULONG Esi; - ULONG Edx; - ULONG Ecx; - ULONG Ebx; - ULONG Eax; - ULONG Ds; - ULONG Es; - ULONG Fs; - ULONG Gs; - - /* - * Control registers - */ - ULONG Eip; - ULONG Cs; - ULONG Eflags; - ULONG Esp; - ULONG Ss; - - /* - * Control structures - */ - ULONG RecoveryAddress; - UCHAR RecoveryInstruction[4]; - ULONG Vif; - ULONG Flags; - PNTSTATUS PStatus; -} KV86M_REGISTERS, *PKV86M_REGISTERS; - -typedef struct _KV86M_TRAP_FRAME -{ - KTRAP_FRAME Tf; - - ULONG SavedExceptionStack; - - /* - * These are put on the top of the stack by the routine that entered - * v86 mode so the exception handlers can find the control information - */ - struct _KV86M_REGISTERS* regs; - ULONG orig_ebp; -} KV86M_TRAP_FRAME, *PKV86M_TRAP_FRAME; - NTSTATUS STDCALL Ke386CallBios( - UCHAR Int, + UCHAR Int, PKV86M_REGISTERS Regs ); ULONG +NTAPI KeV86Exception( - ULONG ExceptionNr, - PKTRAP_FRAME Tf, + ULONG ExceptionNr, + PKTRAP_FRAME Tf, ULONG address ); -#define MAXIMUM_PROCESSORS 32 - #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */ diff --git a/reactos/ntoskrnl/include/internal/ldr.h b/reactos/ntoskrnl/include/internal/ldr.h index 73bfde37f85..f33b0a0c07a 100644 --- a/reactos/ntoskrnl/include/internal/ldr.h +++ b/reactos/ntoskrnl/include/internal/ldr.h @@ -1,33 +1,38 @@ #ifndef __INCLUDE_INTERNAL_LDR_H #define __INCLUDE_INTERNAL_LDR_H -#define KERNEL_MODULE_NAME L"ntoskrnl.exe" -#define HAL_MODULE_NAME L"hal.dll" -#define DRIVER_ROOT_NAME L"\\Driver\\" -#define FILESYSTEM_ROOT_NAME L"\\FileSystem\\" +#define KERNEL_MODULE_NAME L"ntoskrnl.exe" +#define HAL_MODULE_NAME L"hal.dll" +#define DRIVER_ROOT_NAME L"\\Driver\\" +#define FILESYSTEM_ROOT_NAME L"\\FileSystem\\" extern ULONG_PTR LdrHalBase; NTSTATUS +NTAPI LdrLoadInitialProcess( PHANDLE ProcessHandle, PHANDLE ThreadHandle ); VOID -LdrLoadAutoConfigDrivers (VOID); +NTAPI +LdrLoadAutoConfigDrivers(VOID); VOID -LdrInitModuleManagement (VOID); +NTAPI +LdrInitModuleManagement(VOID); NTSTATUS +NTAPI LdrpMapImage( - HANDLE ProcessHandle, - HANDLE SectionHandle, - PVOID * ImageBase + HANDLE ProcessHandle, + HANDLE SectionHandle, + PVOID *ImageBase ); NTSTATUS +NTAPI LdrpLoadImage( PUNICODE_STRING DriverName, PVOID *ModuleBase, @@ -37,12 +42,15 @@ LdrpLoadImage( ); NTSTATUS +NTAPI LdrpUnloadImage(PVOID ModuleBase); NTSTATUS +NTAPI LdrpLoadAndCallImage(PUNICODE_STRING DriverName); NTSTATUS +NTAPI LdrpQueryModuleInformation( PVOID Buffer, ULONG Size, @@ -50,15 +58,18 @@ LdrpQueryModuleInformation( ); VOID +NTAPI LdrInit1(VOID); VOID +NTAPI LdrInitDebug( - PLOADER_MODULE Module, + PLOADER_MODULE Module, PWCH Name ); PVOID +NTAPI LdrSafePEProcessModule( PVOID ModuleLoadBase, PVOID DriverBase, @@ -67,15 +78,18 @@ LdrSafePEProcessModule( ); NTSTATUS +NTAPI LdrLoadModule( PUNICODE_STRING Filename, PLDR_DATA_TABLE_ENTRY *ModuleObject ); NTSTATUS +NTAPI LdrUnloadModule(PLDR_DATA_TABLE_ENTRY ModuleObject); PLDR_DATA_TABLE_ENTRY +NTAPI LdrGetModuleObject(PUNICODE_STRING ModuleName); #endif /* __INCLUDE_INTERNAL_LDR_H */ diff --git a/reactos/ntoskrnl/include/internal/port.h b/reactos/ntoskrnl/include/internal/lpc.h similarity index 100% rename from reactos/ntoskrnl/include/internal/port.h rename to reactos/ntoskrnl/include/internal/lpc.h diff --git a/reactos/ntoskrnl/include/internal/ntoskrnl.h b/reactos/ntoskrnl/include/internal/ntoskrnl.h index ac39b77ffb2..44b750e3533 100644 --- a/reactos/ntoskrnl/include/internal/ntoskrnl.h +++ b/reactos/ntoskrnl/include/internal/ntoskrnl.h @@ -24,10 +24,8 @@ #include "ldr.h" #include "kd.h" #include "ex.h" -#include "xhal.h" -#include "v86m.h" -#include "fs.h" -#include "port.h" +#include "fsrtl.h" +#include "lpc.h" #include "rtl.h" #ifdef KDBG #include "../kdbg/kdb.h" diff --git a/reactos/ntoskrnl/include/internal/v86m.h b/reactos/ntoskrnl/include/internal/v86m.h deleted file mode 100644 index 78384f89157..00000000000 --- a/reactos/ntoskrnl/include/internal/v86m.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Kernel - * FILE: ntoskrnl/include/internal/v86m.h - * PURPOSE: V86 Headers - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) - */ - -/* INCLUDES ******************************************************************/ -#ifndef __NTOSKRNL_INCLUDE_INTERNAL_V86M_H -#define __NTOSKRNL_INCLUDE_INTERNAL_V86M_H - - - -#endif /* __NTOSKRNL_INCLUDE_INTERNAL_V86M_H */ diff --git a/reactos/ntoskrnl/include/internal/xhal.h b/reactos/ntoskrnl/include/internal/xhal.h deleted file mode 100644 index 4d12f2beb9c..00000000000 --- a/reactos/ntoskrnl/include/internal/xhal.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Kernel - * FILE: ntoskrnl/include/internal/xhal.h - * PURPOSE: HAL Callbacks - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) - */ - -/* INCLUDES ******************************************************************/ -#ifndef __INCLUDE_INTERNAL_XHAL_H -#define __INCLUDE_INTERNAL_XHAL_H - -#include - -NTSTATUS -FASTCALL -xHalQueryDriveLayout( - IN PUNICODE_STRING DeviceName, - OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo -); - -#undef HalExamineMBR -VOID -FASTCALL -HalExamineMBR( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG SectorSize, - IN ULONG MBRTypeIdentifier, - OUT PVOID *Buffer -); - -VOID -FASTCALL -xHalIoAssignDriveLetters( - IN PLOADER_PARAMETER_BLOCK LoaderBlock, - IN PSTRING NtDeviceName, - OUT PUCHAR NtSystemPath, - OUT PSTRING NtSystemPathString -); - -NTSTATUS -FASTCALL -xHalIoReadPartitionTable( - PDEVICE_OBJECT DeviceObject, - ULONG SectorSize, - BOOLEAN ReturnRecognizedPartitions, - PDRIVE_LAYOUT_INFORMATION *PartitionBuffer -); - -NTSTATUS -FASTCALL -xHalIoSetPartitionInformation( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG SectorSize, - IN ULONG PartitionNumber, - IN ULONG PartitionType -); - -NTSTATUS -FASTCALL -xHalIoWritePartitionTable( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG SectorSize, - IN ULONG SectorsPerTrack, - IN ULONG NumberOfHeads, - IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer -); - -#endif diff --git a/reactos/ntoskrnl/ke/bug.c b/reactos/ntoskrnl/ke/bug.c index 9fa6d74e1cd..e527bfecd7d 100644 --- a/reactos/ntoskrnl/ke/bug.c +++ b/reactos/ntoskrnl/ke/bug.c @@ -27,6 +27,7 @@ static ULONG KeBugCheckCount = 1; VOID INIT_FUNCTION +NTAPI KiInitializeBugCheck(VOID) { PRTL_MESSAGE_RESOURCE_DATA BugCheckData; diff --git a/reactos/ntoskrnl/ke/clock.c b/reactos/ntoskrnl/ke/clock.c index 885aa596652..d3b30e448f0 100644 --- a/reactos/ntoskrnl/ke/clock.c +++ b/reactos/ntoskrnl/ke/clock.c @@ -73,6 +73,7 @@ EXPORTED ULONG KeMinimumIncrement = 100000; */ VOID INIT_FUNCTION +NTAPI KiInitializeSystemClock(VOID) { TIME_FIELDS TimeFields; @@ -100,6 +101,7 @@ KiInitializeSystemClock(VOID) } VOID +NTAPI KiSetSystemTime(PLARGE_INTEGER NewSystemTime) { LARGE_INTEGER OldSystemTime; diff --git a/reactos/ntoskrnl/ke/dpc.c b/reactos/ntoskrnl/ke/dpc.c index 0dcda58b57c..b2365046532 100644 --- a/reactos/ntoskrnl/ke/dpc.c +++ b/reactos/ntoskrnl/ke/dpc.c @@ -32,6 +32,7 @@ */ VOID INIT_FUNCTION +NTAPI KeInitDpc(PKPRCB Prcb) { InitializeListHead(&Prcb->DpcData[0].DpcListHead); diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index 9667945f10b..aa5630fb100 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -400,6 +400,7 @@ KiDoubleFaultHandler(VOID) } VOID +NTAPI KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG Parameter1, ULONG Parameter2) { ULONG cr3_; @@ -926,6 +927,7 @@ KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame, } VOID +NTAPI KeDumpStackFrames(PULONG Frame) { PULONG StackBase, StackEnd; @@ -1109,7 +1111,9 @@ set_task_gate(unsigned int sel, unsigned task_sel) KiIdt[sel].b = 0x8500; } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI KeInitExceptions(VOID) /* * FUNCTION: Initalize CPU exception handling diff --git a/reactos/ntoskrnl/ke/i386/irq.c b/reactos/ntoskrnl/ke/i386/irq.c index 1ee5fc664dc..ee170c8ed01 100644 --- a/reactos/ntoskrnl/ke/i386/irq.c +++ b/reactos/ntoskrnl/ke/i386/irq.c @@ -137,7 +137,9 @@ static ISR_TABLE IsrTable[NR_IRQS][1]; #define PRESENT (0x8000) #define I486_INTERRUPT_GATE (0xe00) -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI KeInitInterrupts (VOID) { int i, j; diff --git a/reactos/ntoskrnl/ke/i386/kernel.c b/reactos/ntoskrnl/ke/i386/kernel.c index 29c0535cd9f..c08af36c7de 100644 --- a/reactos/ntoskrnl/ke/i386/kernel.c +++ b/reactos/ntoskrnl/ke/i386/kernel.c @@ -165,7 +165,9 @@ KeCreateApplicationProcessorIdleThread(ULONG Id) Id, IdleThread->Cid.UniqueThread); } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI KePrepareForApplicationProcessorInit(ULONG Id) { DPRINT("KePrepareForApplicationProcessorInit(Id %d)\n", Id); @@ -205,6 +207,7 @@ KePrepareForApplicationProcessorInit(ULONG Id) } VOID +NTAPI KeApplicationProcessorInit(VOID) { ULONG Offset; @@ -266,7 +269,9 @@ KeApplicationProcessorInit(VOID) Ke386EnableInterrupts(); } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI KeInit1(PCHAR CommandLine, PULONG LastKernelAddress) { PKIPCR KPCR; @@ -401,7 +406,9 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress) } } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI KeInit2(VOID) { PKIPCR Pcr = (PKIPCR)KeGetCurrentKPCR(); diff --git a/reactos/ntoskrnl/ke/i386/usertrap.c b/reactos/ntoskrnl/ke/i386/usertrap.c index 5264f752df2..2710823f319 100644 --- a/reactos/ntoskrnl/ke/i386/usertrap.c +++ b/reactos/ntoskrnl/ke/i386/usertrap.c @@ -78,6 +78,7 @@ print_user_address(PVOID address) } ULONG +NTAPI KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2) { EXCEPTION_RECORD Er; diff --git a/reactos/ntoskrnl/ke/i386/v86m.c b/reactos/ntoskrnl/ke/i386/v86m.c index 712f15031eb..07646d3bd9b 100644 --- a/reactos/ntoskrnl/ke/i386/v86m.c +++ b/reactos/ntoskrnl/ke/i386/v86m.c @@ -681,6 +681,7 @@ KeV86GPF(PKV86M_TRAP_FRAME VTf, PKTRAP_FRAME Tf) } ULONG +NTAPI KeV86Exception(ULONG ExceptionNr, PKTRAP_FRAME Tf, ULONG address) { PUCHAR Ip; diff --git a/reactos/ntoskrnl/ke/ipi.c b/reactos/ntoskrnl/ke/ipi.c index 2fb603ddb0e..4a1470d5176 100644 --- a/reactos/ntoskrnl/ke/ipi.c +++ b/reactos/ntoskrnl/ke/ipi.c @@ -22,6 +22,7 @@ KSPIN_LOCK KiIpiLock; /* FUNCTIONS *****************************************************************/ VOID +NTAPI KiIpiSendRequest(KAFFINITY TargetSet, ULONG IpiRequest) { LONG i; @@ -59,18 +60,18 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame, Prcb = KeGetCurrentPrcb(); - if (Ke386TestAndClearBit(IPI_REQUEST_APC, &Prcb->IpiFrozen)) + if (Ke386TestAndClearBit(IPI_APC, &Prcb->IpiFrozen)) { HalRequestSoftwareInterrupt(APC_LEVEL); } - if (Ke386TestAndClearBit(IPI_REQUEST_DPC, &Prcb->IpiFrozen)) + if (Ke386TestAndClearBit(IPI_DPC, &Prcb->IpiFrozen)) { Prcb->DpcInterruptRequested = TRUE; HalRequestSoftwareInterrupt(DISPATCH_LEVEL); } - if (Ke386TestAndClearBit(IPI_REQUEST_FUNCTIONCALL, &Prcb->IpiFrozen)) + if (Ke386TestAndClearBit(IPI_SYNCH_REQUEST, &Prcb->IpiFrozen)) { InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]); if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0)) @@ -140,7 +141,7 @@ KiIpiSendPacket(KAFFINITY TargetSet, VOID (STDCALL*WorkerRoutine)(PVOID), PVOID { Prcb = ((PKPCR)(KPCR_BASE + i * PAGE_SIZE))->Prcb; while(0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0)); - Ke386TestAndSetBit(IPI_REQUEST_FUNCTIONCALL, &Prcb->IpiFrozen); + Ke386TestAndSetBit(IPI_SYNCH_REQUEST, &Prcb->IpiFrozen); if (Processor != CurrentPrcb->SetMember) { HalRequestIpi(i); @@ -156,6 +157,7 @@ KiIpiSendPacket(KAFFINITY TargetSet, VOID (STDCALL*WorkerRoutine)(PVOID), PVOID } VOID +NTAPI KeIpiGenericCall(VOID (STDCALL *Function)(PVOID), PVOID Argument) { KIRQL oldIrql; diff --git a/reactos/ntoskrnl/ke/kthread.c b/reactos/ntoskrnl/ke/kthread.c index 51b8addd6d2..bbb96d8992b 100644 --- a/reactos/ntoskrnl/ke/kthread.c +++ b/reactos/ntoskrnl/ke/kthread.c @@ -38,7 +38,7 @@ KiRequestReschedule(CCHAR Processor) Pcr = (PKPCR)(KPCR_BASE + Processor * PAGE_SIZE); Pcr->Prcb->QuantumEnd = TRUE; - KiIpiSendRequest(1 << Processor, IPI_REQUEST_DPC); + KiIpiSendRequest(1 << Processor, IPI_DPC); } STATIC diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 346a8a5ef6e..b3c1d587209 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -89,18 +89,23 @@ LdrPEFixupImports ( PLDR_DATA_TABLE_ENTRY Module ); /* FUNCTIONS *****************************************************************/ VOID +NTAPI LdrInitDebug ( PLOADER_MODULE Module, PWCH Name ) { } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI LdrInit1 ( VOID ) { /* Hook for KDB on initialization of the loader. */ KDB_LOADERINIT_HOOK(&NtoskrnlModuleObject, &HalModuleObject); } -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +NTAPI LdrInitModuleManagement ( VOID ) { PIMAGE_NT_HEADERS NtHeader; @@ -138,6 +143,7 @@ LdrInitModuleManagement ( VOID ) } NTSTATUS +NTAPI LdrpLoadImage ( PUNICODE_STRING DriverName, PVOID *ModuleBase, @@ -175,6 +181,7 @@ LdrpLoadImage ( NTSTATUS +NTAPI LdrpUnloadImage ( PVOID ModuleBase ) { return(STATUS_NOT_IMPLEMENTED); @@ -182,6 +189,7 @@ LdrpUnloadImage ( PVOID ModuleBase ) NTSTATUS +NTAPI LdrpLoadAndCallImage ( PUNICODE_STRING ModuleName ) { PDRIVER_INITIALIZE DriverEntry; @@ -217,6 +225,7 @@ LdrpLoadAndCallImage ( PUNICODE_STRING ModuleName ) NTSTATUS +NTAPI LdrLoadModule( PUNICODE_STRING Filename, PLDR_DATA_TABLE_ENTRY *ModuleObject ) @@ -321,6 +330,7 @@ LdrLoadModule( NTSTATUS +NTAPI LdrUnloadModule ( PLDR_DATA_TABLE_ENTRY ModuleObject ) { KIRQL Irql; @@ -365,6 +375,7 @@ LdrProcessModule( } NTSTATUS +NTAPI LdrpQueryModuleInformation ( PVOID Buffer, ULONG Size, @@ -542,6 +553,7 @@ LdrpCompareModuleNames ( } PLDR_DATA_TABLE_ENTRY +NTAPI LdrGetModuleObject ( PUNICODE_STRING ModuleName ) { PLDR_DATA_TABLE_ENTRY Module; @@ -870,7 +882,9 @@ LdrPEProcessModule( } -PVOID INIT_FUNCTION +PVOID +INIT_FUNCTION +NTAPI LdrSafePEProcessModule ( PVOID ModuleLoadBase, PVOID DriverBase,