2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
1998-09-05 17:33:57 +00:00
|
|
|
|
2002-09-07 15:13:13 +00:00
|
|
|
/* INCLUDES *****************************************************************/
|
1998-09-05 17:33:57 +00:00
|
|
|
|
2002-10-19 14:24:16 +00:00
|
|
|
#include "arch/ke.h"
|
2002-08-14 20:58:39 +00:00
|
|
|
|
2021-03-26 08:32:34 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2005-05-05 22:40:05 +00:00
|
|
|
/* INTERNAL KERNEL TYPES ****************************************************/
|
|
|
|
|
|
|
|
typedef struct _WOW64_PROCESS
|
|
|
|
{
|
|
|
|
PVOID Wow64;
|
|
|
|
} WOW64_PROCESS, *PWOW64_PROCESS;
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
typedef struct _KPROFILE_SOURCE_OBJECT
|
|
|
|
{
|
|
|
|
KPROFILE_SOURCE Source;
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
} KPROFILE_SOURCE_OBJECT, *PKPROFILE_SOURCE_OBJECT;
|
|
|
|
|
2006-08-24 23:25:37 +00:00
|
|
|
typedef enum _CONNECT_TYPE
|
|
|
|
{
|
|
|
|
NoConnect,
|
|
|
|
NormalConnect,
|
|
|
|
ChainConnect,
|
|
|
|
UnknownConnect
|
|
|
|
} CONNECT_TYPE, *PCONNECT_TYPE;
|
|
|
|
|
|
|
|
typedef struct _DISPATCH_INFO
|
|
|
|
{
|
|
|
|
CONNECT_TYPE Type;
|
|
|
|
PKINTERRUPT Interrupt;
|
|
|
|
PKINTERRUPT_ROUTINE NoDispatch;
|
|
|
|
PKINTERRUPT_ROUTINE InterruptDispatch;
|
|
|
|
PKINTERRUPT_ROUTINE FloatingDispatch;
|
|
|
|
PKINTERRUPT_ROUTINE ChainedDispatch;
|
|
|
|
PKINTERRUPT_ROUTINE *FlatDispatch;
|
|
|
|
} DISPATCH_INFO, *PDISPATCH_INFO;
|
|
|
|
|
2018-05-25 19:40:39 +00:00
|
|
|
typedef struct _PROCESS_VALUES
|
|
|
|
{
|
|
|
|
LARGE_INTEGER TotalKernelTime;
|
|
|
|
LARGE_INTEGER TotalUserTime;
|
|
|
|
IO_COUNTERS IoInfo;
|
|
|
|
} PROCESS_VALUES, *PPROCESS_VALUES;
|
|
|
|
|
2012-02-25 20:40:06 +00:00
|
|
|
typedef struct _DEFERRED_REVERSE_BARRIER
|
|
|
|
{
|
|
|
|
ULONG Barrier;
|
|
|
|
ULONG TotalProcessors;
|
|
|
|
} DEFERRED_REVERSE_BARRIER, *PDEFERRED_REVERSE_BARRIER;
|
|
|
|
|
2007-01-18 06:23:14 +00:00
|
|
|
typedef struct _KI_SAMPLE_MAP
|
|
|
|
{
|
|
|
|
LARGE_INTEGER PerfStart;
|
|
|
|
LARGE_INTEGER PerfEnd;
|
|
|
|
LONGLONG PerfDelta;
|
|
|
|
LARGE_INTEGER PerfFreq;
|
|
|
|
LONGLONG TSCStart;
|
|
|
|
LONGLONG TSCEnd;
|
|
|
|
LONGLONG TSCDelta;
|
|
|
|
ULONG MHz;
|
|
|
|
} KI_SAMPLE_MAP, *PKI_SAMPLE_MAP;
|
|
|
|
|
2007-01-24 06:50:28 +00:00
|
|
|
#define MAX_TIMER_DPCS 16
|
|
|
|
|
|
|
|
typedef struct _DPC_QUEUE_ENTRY
|
|
|
|
{
|
|
|
|
PKDPC Dpc;
|
|
|
|
PKDEFERRED_ROUTINE Routine;
|
|
|
|
PVOID Context;
|
|
|
|
} DPC_QUEUE_ENTRY, *PDPC_QUEUE_ENTRY;
|
|
|
|
|
2010-01-02 04:48:22 +00:00
|
|
|
typedef struct _KNMI_HANDLER_CALLBACK
|
|
|
|
{
|
|
|
|
struct _KNMI_HANDLER_CALLBACK* Next;
|
|
|
|
PNMI_CALLBACK Callback;
|
|
|
|
PVOID Context;
|
|
|
|
PVOID Handle;
|
|
|
|
} KNMI_HANDLER_CALLBACK, *PKNMI_HANDLER_CALLBACK;
|
|
|
|
|
2006-08-30 19:29:16 +00:00
|
|
|
typedef PCHAR
|
|
|
|
(NTAPI *PKE_BUGCHECK_UNICODE_TO_ANSI)(
|
|
|
|
IN PUNICODE_STRING Unicode,
|
|
|
|
IN PCHAR Ansi,
|
|
|
|
IN ULONG Length
|
|
|
|
);
|
|
|
|
|
2015-09-29 18:34:33 +00:00
|
|
|
extern KAFFINITY KeActiveProcessors;
|
2010-01-02 05:12:29 +00:00
|
|
|
extern PKNMI_HANDLER_CALLBACK KiNmiCallbackListHead;
|
|
|
|
extern KSPIN_LOCK KiNmiCallbackListLock;
|
2005-08-05 03:44:24 +00:00
|
|
|
extern PVOID KeUserApcDispatcher;
|
|
|
|
extern PVOID KeUserCallbackDispatcher;
|
|
|
|
extern PVOID KeUserExceptionDispatcher;
|
|
|
|
extern PVOID KeRaiseUserExceptionDispatcher;
|
2006-10-08 04:05:27 +00:00
|
|
|
extern LARGE_INTEGER KeBootTime;
|
2007-01-25 05:14:55 +00:00
|
|
|
extern ULONGLONG KeBootTimeBias;
|
|
|
|
extern BOOLEAN ExCmosClockIsSane;
|
[HAL/NDK]
- Make Vector parameter in HalEnableSystemInterrupt, HalDisableSystemInterrupt and HalBeginSystemInterrupt an ULONG, not an UCHAR
[NDK]
- 64bit fixes for HANDLE_TABLE, KPROCESS, SECTION_IMAGE_INFORMATION, MMADDRESS_LIST, MMVAD_FLAGS, MMVAD, MMVAD_LONG, MMVAD_SHORT, MEMORY_DESCRIPTOR, MEMORY_ALLOCATION_DESCRIPTOR, LdrVerifyMappedImageMatchesChecksum
- KDPC_DATA::DpcQueueDepth is signed on amd64, unsigned on x86
[NTOSKRNL]
- Fix hundreds of MSVC and amd64 warnings
- add a pragma message to FstubFixupEfiPartition, since it looks broken
- Move portable Ke constants from <arch>/cpu.c to krnlinit.c
- Fixed a bug in amd64 KiGeneralProtectionFaultHandler
svn path=/trunk/; revision=53734
2011-09-18 13:11:45 +00:00
|
|
|
extern USHORT KeProcessorArchitecture;
|
|
|
|
extern USHORT KeProcessorLevel;
|
|
|
|
extern USHORT KeProcessorRevision;
|
2006-09-01 03:05:30 +00:00
|
|
|
extern ULONG KeFeatureBits;
|
2006-09-03 21:06:30 +00:00
|
|
|
extern KNODE KiNode0;
|
2006-07-17 01:40:10 +00:00
|
|
|
extern PKNODE KeNodeBlock[1];
|
|
|
|
extern UCHAR KeNumberNodes;
|
|
|
|
extern UCHAR KeProcessNodeSeed;
|
2006-09-03 21:06:30 +00:00
|
|
|
extern ETHREAD KiInitialThread;
|
|
|
|
extern EPROCESS KiInitialProcess;
|
2006-08-24 23:25:37 +00:00
|
|
|
extern PULONG KiInterruptTemplateObject;
|
|
|
|
extern PULONG KiInterruptTemplateDispatch;
|
|
|
|
extern PULONG KiInterruptTemplate2ndDispatch;
|
|
|
|
extern ULONG KiUnexpectedEntrySize;
|
2010-01-19 18:27:24 +00:00
|
|
|
extern ULONG_PTR KiDoubleFaultStack;
|
- Okay so...listen up. First off: When you acquire a lock such as a fast mutex, you should never acquire it recursively.
For example, when you handle a page fault in a section, then page fault while handling that page fault (which is perfectly okay),
you shouldn't be trying to re-acquire the address space lock that you're already holding. After this fix, this scenario works
and countless others. Apps like QTInfo now work and load, and PictureViewer doesn't BSOD the system anymore. I've fixed this by changing
the lock to a pushlock. It not only increases speed inside the memory manager significantly (such as during page fault handling), but
does allow recursive acquisition without any problems.
- Now if that wasn't bad enough, here's a couple more tips. Fast Mutexes actually require APC_LEVEL to be effective. If you're going
to be using a Fast Mutex and calling it with the "Unsafe" version, then don't expect anything to work. Also, using functions like
"CcTryToAcquireBrokenMutex" where correct code is duplicated then hacked to work isn't a big help either. And that's not all. Fast Mutex
disables kernel APCs by setting the KernelApcDisable flag on, and it's expected that the count inside the fast mutex will match the count
inside the thread. In other words, LOCK ACQUISITION AND RELEASE MUST BE ORDERED. You can't acquire LOCK A and B, and then release lock A
and B, because that leads to deadlocks and other issues. So of course, the Cache Manager acquired a view lock, then acquired a segment lock,
then released the view lock, then released the segment lock, then re-acquired the view lock. Uh, no, that won't work. You know what else
doesn't work so well? Disabling APCs about 6-9 times to acquire a single lock, and using spinlocks in the same code path as well. Just how
paranoid are you about thread safety, but still manage to get it wrong? Okay, so we've got recursion, out-of-order lock acquision and
release, made-up "broken" acquire functions, and using a lock that depends on APC_LEVEL at PASSIVE_LEVEL. The best part is when Cc builds
an array of cache segments, and locks each of them... then during release, the list gets parsed head-first, so the first acquired locks
get released first. So locks a, b, c, d get acquired, then a, b, c, d get released. Great! Sounds about right for ReactOS's Cache Manager
design. I've changed the view lock to a guarded mutex -- which actually properly disables APCs and works at PASSIVE_LEVEL, and changed the
segment locks to be push locks. First it'll be 10 times faster then acquiring a bazillion fast mutexes, especially since APCs have already
been disabled at this point, and it also allows you to do most of the stupid things the Cache Manager does. Out-of-order release is still
not going to work well, so eventually on a multi-processor machine the code will completely die -- but at least it'll work on UP for now.
In the end, this makes things like the Inkscape installer and Quicktime Installer to work, and probably countless other things that generated
ASSERTS in the fast mutex code.
-- Alex Ionescu
svn path=/trunk/; revision=30401
2007-11-12 19:00:26 +00:00
|
|
|
extern EX_PUSH_LOCK KernelAddressSpaceLock;
|
2006-09-01 03:05:30 +00:00
|
|
|
extern ULONG KiMaximumDpcQueueDepth;
|
|
|
|
extern ULONG KiMinimumDpcRate;
|
|
|
|
extern ULONG KiAdjustDpcThreshold;
|
|
|
|
extern ULONG KiIdealDpcRate;
|
2006-10-04 03:37:11 +00:00
|
|
|
extern BOOLEAN KeThreadDpcEnable;
|
2006-09-02 04:40:09 +00:00
|
|
|
extern LARGE_INTEGER KiTimeIncrementReciprocal;
|
|
|
|
extern UCHAR KiTimeIncrementShiftCount;
|
2006-10-04 05:29:30 +00:00
|
|
|
extern ULONG KiTimeLimitIsrMicroseconds;
|
2006-10-05 02:02:27 +00:00
|
|
|
extern ULONG KiServiceLimit;
|
2007-02-19 18:52:23 +00:00
|
|
|
extern LIST_ENTRY KeBugcheckCallbackListHead, KeBugcheckReasonCallbackListHead;
|
2006-09-02 04:40:09 +00:00
|
|
|
extern KSPIN_LOCK BugCheckCallbackLock;
|
2007-01-24 06:50:28 +00:00
|
|
|
extern KDPC KiTimerExpireDpc;
|
2006-09-02 04:40:09 +00:00
|
|
|
extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE];
|
2007-01-18 06:23:14 +00:00
|
|
|
extern FAST_MUTEX KiGenericCallDpcMutex;
|
2006-09-02 04:40:09 +00:00
|
|
|
extern LIST_ENTRY KiProfileListHead, KiProfileSourceListHead;
|
|
|
|
extern KSPIN_LOCK KiProfileLock;
|
2006-09-03 07:13:02 +00:00
|
|
|
extern LIST_ENTRY KiProcessListHead;
|
2006-09-02 04:40:09 +00:00
|
|
|
extern LIST_ENTRY KiProcessInSwapListHead, KiProcessOutSwapListHead;
|
|
|
|
extern LIST_ENTRY KiStackInSwapListHead;
|
|
|
|
extern KEVENT KiSwapEvent;
|
2006-09-02 16:19:00 +00:00
|
|
|
extern PKPRCB KiProcessorBlock[];
|
|
|
|
extern ULONG KiMask32Array[MAXIMUM_PRIORITY];
|
[HAL/NDK]
- Make Vector parameter in HalEnableSystemInterrupt, HalDisableSystemInterrupt and HalBeginSystemInterrupt an ULONG, not an UCHAR
[NDK]
- 64bit fixes for HANDLE_TABLE, KPROCESS, SECTION_IMAGE_INFORMATION, MMADDRESS_LIST, MMVAD_FLAGS, MMVAD, MMVAD_LONG, MMVAD_SHORT, MEMORY_DESCRIPTOR, MEMORY_ALLOCATION_DESCRIPTOR, LdrVerifyMappedImageMatchesChecksum
- KDPC_DATA::DpcQueueDepth is signed on amd64, unsigned on x86
[NTOSKRNL]
- Fix hundreds of MSVC and amd64 warnings
- add a pragma message to FstubFixupEfiPartition, since it looks broken
- Move portable Ke constants from <arch>/cpu.c to krnlinit.c
- Fixed a bug in amd64 KiGeneralProtectionFaultHandler
svn path=/trunk/; revision=53734
2011-09-18 13:11:45 +00:00
|
|
|
extern ULONG_PTR KiIdleSummary;
|
2006-09-17 05:20:24 +00:00
|
|
|
extern PVOID KeUserApcDispatcher;
|
|
|
|
extern PVOID KeUserCallbackDispatcher;
|
|
|
|
extern PVOID KeUserExceptionDispatcher;
|
|
|
|
extern PVOID KeRaiseUserExceptionDispatcher;
|
2007-02-19 18:52:23 +00:00
|
|
|
extern ULONG KeTimeIncrement;
|
2008-12-27 11:44:18 +00:00
|
|
|
extern ULONG KeTimeAdjustment;
|
2011-10-11 16:11:59 +00:00
|
|
|
extern BOOLEAN KiTimeAdjustmentEnabled;
|
2010-01-23 21:24:36 +00:00
|
|
|
extern LONG KiTickOffset;
|
2007-03-03 04:39:25 +00:00
|
|
|
extern ULONG KiFreezeFlag;
|
2008-07-19 06:53:03 +00:00
|
|
|
extern ULONG KiDPCTimeout;
|
2010-01-19 09:45:30 +00:00
|
|
|
extern PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch;
|
2010-01-28 15:51:18 +00:00
|
|
|
extern ULONGLONG BootCycles, BootCyclesEnd;
|
|
|
|
extern ULONG ProcessCount;
|
2010-02-01 03:51:45 +00:00
|
|
|
extern VOID __cdecl KiInterruptTemplate(VOID);
|
2004-11-27 16:32:10 +00:00
|
|
|
|
2005-04-15 06:24:35 +00:00
|
|
|
/* MACROS *************************************************************************/
|
|
|
|
|
2006-07-17 01:40:10 +00:00
|
|
|
#define AFFINITY_MASK(Id) KiMask32Array[Id]
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
#define PRIORITY_MASK(Id) KiMask32Array[Id]
|
2006-07-17 01:40:10 +00:00
|
|
|
|
2006-01-10 21:36:42 +00:00
|
|
|
/* Tells us if the Timer or Event is a Syncronization or Notification Object */
|
|
|
|
#define TIMER_OR_EVENT_TYPE 0x7L
|
|
|
|
|
|
|
|
/* One of the Reserved Wait Blocks, this one is for the Thread's Timer */
|
|
|
|
#define TIMER_WAIT_BLOCK 0x3L
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
/* INTERNAL KERNEL FUNCTIONS ************************************************/
|
|
|
|
|
2006-01-06 08:00:09 +00:00
|
|
|
/* Finds a new thread to run */
|
2010-01-13 22:35:43 +00:00
|
|
|
LONG_PTR
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
FASTCALL
|
2006-01-06 08:00:09 +00:00
|
|
|
KiSwapThread(
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
IN PKTHREAD Thread,
|
|
|
|
IN PKPRCB Prcb
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2006-09-14 12:13:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeReadyThread(
|
|
|
|
IN PKTHREAD Thread
|
|
|
|
);
|
|
|
|
|
2007-01-25 22:39:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeSetDisableBoostThread(
|
|
|
|
IN OUT PKTHREAD Thread,
|
|
|
|
IN BOOLEAN Disable
|
|
|
|
);
|
|
|
|
|
2011-12-18 04:27:20 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeSetDisableBoostProcess(
|
|
|
|
IN PKPROCESS Process,
|
|
|
|
IN BOOLEAN Disable
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeSetAutoAlignmentProcess(
|
|
|
|
IN PKPROCESS Process,
|
|
|
|
IN BOOLEAN Enable
|
|
|
|
);
|
|
|
|
|
|
|
|
KAFFINITY
|
|
|
|
NTAPI
|
|
|
|
KeSetAffinityProcess(
|
|
|
|
IN PKPROCESS Process,
|
|
|
|
IN KAFFINITY Affinity
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeBoostPriorityThread(
|
|
|
|
IN PKTHREAD Thread,
|
|
|
|
IN KPRIORITY Increment
|
|
|
|
);
|
|
|
|
|
2007-01-25 18:48:56 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeBalanceSetManager(IN PVOID Context);
|
|
|
|
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
VOID
|
2006-07-13 22:52:18 +00:00
|
|
|
NTAPI
|
|
|
|
KiReadyThread(IN PKTHREAD Thread);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2007-01-25 22:39:32 +00:00
|
|
|
ULONG
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-04-18 02:12:30 +00:00
|
|
|
KeSuspendThread(PKTHREAD Thread);
|
2005-04-22 12:52:25 +00:00
|
|
|
|
2007-01-18 09:44:49 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeReadStateThread(IN PKTHREAD Thread);
|
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
BOOLEAN
|
2005-04-22 12:52:25 +00:00
|
|
|
FASTCALL
|
2006-08-20 19:08:57 +00:00
|
|
|
KiSwapContext(
|
2010-11-08 11:56:22 +00:00
|
|
|
IN KIRQL WaitIrql,
|
|
|
|
IN PKTHREAD CurrentThread
|
2006-08-20 19:08:57 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-07-30 23:43:45 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-07-30 23:43:45 +00:00
|
|
|
KiAdjustQuantumThread(IN PKTHREAD Thread);
|
|
|
|
|
2006-01-05 15:32:08 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiExitDispatcher(KIRQL OldIrql);
|
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
VOID
|
2009-09-30 20:30:57 +00:00
|
|
|
FASTCALL
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
KiDeferredReadyThread(IN PKTHREAD Thread);
|
|
|
|
|
2008-10-07 17:55:32 +00:00
|
|
|
PKTHREAD
|
|
|
|
FASTCALL
|
|
|
|
KiIdleSchedule(
|
|
|
|
IN PKPRCB Prcb
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiProcessDeferredReadyList(
|
|
|
|
IN PKPRCB Prcb
|
|
|
|
);
|
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
KAFFINITY
|
2007-01-17 01:56:15 +00:00
|
|
|
FASTCALL
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
KiSetAffinityThread(
|
|
|
|
IN PKTHREAD Thread,
|
2007-01-17 01:56:15 +00:00
|
|
|
IN KAFFINITY Affinity
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
PKTHREAD
|
2007-01-17 01:56:15 +00:00
|
|
|
FASTCALL
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
KiSelectNextThread(
|
|
|
|
IN PKPRCB Prcb
|
|
|
|
);
|
|
|
|
|
2007-01-24 06:50:28 +00:00
|
|
|
BOOLEAN
|
|
|
|
FASTCALL
|
|
|
|
KiInsertTimerTable(
|
|
|
|
IN PKTIMER Timer,
|
|
|
|
IN ULONG Hand
|
|
|
|
);
|
|
|
|
|
2008-11-01 15:33:05 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiTimerListExpire(
|
|
|
|
IN PLIST_ENTRY ExpiredListHead,
|
|
|
|
IN KIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
2007-01-24 06:50:28 +00:00
|
|
|
BOOLEAN
|
|
|
|
FASTCALL
|
|
|
|
KiInsertTreeTimer(
|
|
|
|
IN PKTIMER Timer,
|
|
|
|
IN LARGE_INTEGER Interval
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiCompleteTimer(
|
|
|
|
IN PKTIMER Timer,
|
|
|
|
IN PKSPIN_LOCK_QUEUE LockQueue
|
|
|
|
);
|
|
|
|
|
2005-04-15 06:24:35 +00:00
|
|
|
/* gmutex.c ********************************************************************/
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
2009-01-30 16:45:17 +00:00
|
|
|
KiAcquireGuardedMutex(
|
|
|
|
IN OUT PKGUARDED_MUTEX GuardedMutex
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiAcquireFastMutex(
|
|
|
|
IN PFAST_MUTEX FastMutex
|
|
|
|
);
|
2005-04-15 06:24:35 +00:00
|
|
|
|
|
|
|
/* gate.c **********************************************************************/
|
2005-05-09 01:38:29 +00:00
|
|
|
|
|
|
|
VOID
|
2005-04-15 06:24:35 +00:00
|
|
|
FASTCALL
|
|
|
|
KeInitializeGate(PKGATE Gate);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KeSignalGateBoostPriority(PKGATE Gate);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
2005-09-14 01:44:19 +00:00
|
|
|
KeWaitForGate(
|
|
|
|
PKGATE Gate,
|
|
|
|
KWAIT_REASON WaitReason,
|
|
|
|
KPROCESSOR_MODE WaitMode
|
|
|
|
);
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
|
2004-11-27 16:32:10 +00:00
|
|
|
/* ipi.c ********************************************************************/
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2008-11-01 11:44:04 +00:00
|
|
|
FASTCALL
|
|
|
|
KiIpiSend(
|
2005-09-14 01:44:19 +00:00
|
|
|
KAFFINITY TargetSet,
|
|
|
|
ULONG IpiRequest
|
|
|
|
);
|
2004-11-27 16:32:10 +00:00
|
|
|
|
2008-11-01 11:44:04 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiIpiSendPacket(
|
|
|
|
IN KAFFINITY TargetProcessors,
|
|
|
|
IN PKIPI_WORKER WorkerFunction,
|
|
|
|
IN PKIPI_BROADCAST_WORKER BroadcastFunction,
|
|
|
|
IN ULONG_PTR Context,
|
|
|
|
IN PULONG Count
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiIpiSignalPacketDone(
|
|
|
|
IN PKIPI_CONTEXT PacketContext
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiIpiSignalPacketDoneAndStall(
|
|
|
|
IN PKIPI_CONTEXT PacketContext,
|
|
|
|
IN volatile PULONG ReverseStall
|
|
|
|
);
|
|
|
|
|
2004-11-27 16:32:10 +00:00
|
|
|
/* next file ***************************************************************/
|
|
|
|
|
2006-07-17 01:40:10 +00:00
|
|
|
UCHAR
|
|
|
|
NTAPI
|
|
|
|
KeFindNextRightSetAffinity(
|
|
|
|
IN UCHAR Number,
|
|
|
|
IN ULONG Set
|
|
|
|
);
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2004-03-06 22:26:05 +00:00
|
|
|
DbgBreakPointNoBugCheck(VOID);
|
|
|
|
|
2005-03-13 18:41:59 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeInitializeProfile(
|
|
|
|
struct _KPROFILE* Profile,
|
|
|
|
struct _KPROCESS* Process,
|
|
|
|
PVOID ImageBase,
|
[HAL/NDK]
- Make Vector parameter in HalEnableSystemInterrupt, HalDisableSystemInterrupt and HalBeginSystemInterrupt an ULONG, not an UCHAR
[NDK]
- 64bit fixes for HANDLE_TABLE, KPROCESS, SECTION_IMAGE_INFORMATION, MMADDRESS_LIST, MMVAD_FLAGS, MMVAD, MMVAD_LONG, MMVAD_SHORT, MEMORY_DESCRIPTOR, MEMORY_ALLOCATION_DESCRIPTOR, LdrVerifyMappedImageMatchesChecksum
- KDPC_DATA::DpcQueueDepth is signed on amd64, unsigned on x86
[NTOSKRNL]
- Fix hundreds of MSVC and amd64 warnings
- add a pragma message to FstubFixupEfiPartition, since it looks broken
- Move portable Ke constants from <arch>/cpu.c to krnlinit.c
- Fixed a bug in amd64 KiGeneralProtectionFaultHandler
svn path=/trunk/; revision=53734
2011-09-18 13:11:45 +00:00
|
|
|
SIZE_T ImageSize,
|
2005-09-14 01:44:19 +00:00
|
|
|
ULONG BucketSize,
|
|
|
|
KPROFILE_SOURCE ProfileSource,
|
|
|
|
KAFFINITY Affinity
|
|
|
|
);
|
2005-03-13 18:41:59 +00:00
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
BOOLEAN
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeStartProfile(
|
|
|
|
struct _KPROFILE* Profile,
|
|
|
|
PVOID Buffer
|
|
|
|
);
|
2005-03-13 18:41:59 +00:00
|
|
|
|
2005-12-29 17:55:31 +00:00
|
|
|
BOOLEAN
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-03-13 18:41:59 +00:00
|
|
|
KeStopProfile(struct _KPROFILE* Profile);
|
|
|
|
|
|
|
|
ULONG
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-03-13 18:41:59 +00:00
|
|
|
KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource);
|
|
|
|
|
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeSetIntervalProfile(
|
2015-08-29 14:30:29 +00:00
|
|
|
ULONG Interval,
|
|
|
|
KPROFILE_SOURCE ProfileSource
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
2005-03-13 18:41:59 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeUpdateRunTime(
|
|
|
|
PKTRAP_FRAME TrapFrame,
|
|
|
|
KIRQL Irql
|
|
|
|
);
|
2005-02-14 05:36:04 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiExpireTimers(
|
|
|
|
PKDPC Dpc,
|
|
|
|
PVOID DeferredContext,
|
|
|
|
PVOID SystemArgument1,
|
|
|
|
PVOID SystemArgument2
|
|
|
|
);
|
|
|
|
|
2005-04-22 12:52:25 +00:00
|
|
|
VOID
|
2006-07-17 01:40:10 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeInitializeThread(
|
2006-07-17 01:40:10 +00:00
|
|
|
IN PKPROCESS Process,
|
|
|
|
IN OUT PKTHREAD Thread,
|
|
|
|
IN PKSYSTEM_ROUTINE SystemRoutine,
|
|
|
|
IN PKSTART_ROUTINE StartRoutine,
|
|
|
|
IN PVOID StartContext,
|
|
|
|
IN PCONTEXT Context,
|
|
|
|
IN PVOID Teb,
|
|
|
|
IN PVOID KernelStack
|
|
|
|
);
|
|
|
|
|
2006-07-23 17:45:30 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeUninitThread(
|
|
|
|
IN PKTHREAD Thread
|
|
|
|
);
|
|
|
|
|
2006-07-17 01:40:10 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KeInitThread(
|
|
|
|
IN OUT PKTHREAD Thread,
|
|
|
|
IN PVOID KernelStack,
|
|
|
|
IN PKSYSTEM_ROUTINE SystemRoutine,
|
|
|
|
IN PKSTART_ROUTINE StartRoutine,
|
|
|
|
IN PVOID StartContext,
|
|
|
|
IN PCONTEXT Context,
|
|
|
|
IN PVOID Teb,
|
|
|
|
IN PKPROCESS Process
|
|
|
|
);
|
|
|
|
|
2009-09-27 10:09:38 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiInitializeContextThread(
|
|
|
|
PKTHREAD Thread,
|
|
|
|
PKSYSTEM_ROUTINE SystemRoutine,
|
|
|
|
PKSTART_ROUTINE StartRoutine,
|
|
|
|
PVOID StartContext,
|
|
|
|
PCONTEXT Context
|
|
|
|
);
|
|
|
|
|
2006-07-17 01:40:10 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeStartThread(
|
|
|
|
IN OUT PKTHREAD Thread
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
|
2006-07-18 14:34:06 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeAlertThread(
|
|
|
|
IN PKTHREAD Thread,
|
|
|
|
IN KPROCESSOR_MODE AlertMode
|
|
|
|
);
|
|
|
|
|
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
KeAlertResumeThread(
|
|
|
|
IN PKTHREAD Thread
|
|
|
|
);
|
|
|
|
|
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
KeResumeThread(
|
|
|
|
IN PKTHREAD Thread
|
|
|
|
);
|
|
|
|
|
2006-07-17 17:32:58 +00:00
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
KeSwitchKernelStack(
|
|
|
|
IN PVOID StackBase,
|
|
|
|
IN PVOID StackLimit
|
|
|
|
);
|
|
|
|
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
KeRundownThread(VOID);
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KeReleaseThread(PKTHREAD Thread);
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiSuspendRundown(
|
|
|
|
IN PKAPC Apc
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiSuspendNop(
|
|
|
|
IN PKAPC Apc,
|
|
|
|
IN PKNORMAL_ROUTINE *NormalRoutine,
|
|
|
|
IN PVOID *NormalContext,
|
|
|
|
IN PVOID *SystemArgument1,
|
|
|
|
IN PVOID *SystemArgument2
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiSuspendThread(
|
|
|
|
IN PVOID NormalContext,
|
|
|
|
IN PVOID SystemArgument1,
|
|
|
|
IN PVOID SystemArgument2
|
|
|
|
);
|
|
|
|
|
2005-08-09 06:23:16 +00:00
|
|
|
LONG
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-08-09 06:23:16 +00:00
|
|
|
KeQueryBasePriorityThread(IN PKTHREAD Thread);
|
|
|
|
|
2005-08-09 08:50:57 +00:00
|
|
|
VOID
|
2007-01-17 21:53:45 +00:00
|
|
|
FASTCALL
|
2005-09-14 01:44:19 +00:00
|
|
|
KiSetPriorityThread(
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
IN PKTHREAD Thread,
|
2007-01-17 21:53:45 +00:00
|
|
|
IN KPRIORITY Priority
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
|
|
|
|
2006-09-14 03:49:20 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiUnlinkThread(
|
|
|
|
IN PKTHREAD Thread,
|
[HAL/NDK]
- Make Vector parameter in HalEnableSystemInterrupt, HalDisableSystemInterrupt and HalBeginSystemInterrupt an ULONG, not an UCHAR
[NDK]
- 64bit fixes for HANDLE_TABLE, KPROCESS, SECTION_IMAGE_INFORMATION, MMADDRESS_LIST, MMVAD_FLAGS, MMVAD, MMVAD_LONG, MMVAD_SHORT, MEMORY_DESCRIPTOR, MEMORY_ALLOCATION_DESCRIPTOR, LdrVerifyMappedImageMatchesChecksum
- KDPC_DATA::DpcQueueDepth is signed on amd64, unsigned on x86
[NTOSKRNL]
- Fix hundreds of MSVC and amd64 warnings
- add a pragma message to FstubFixupEfiPartition, since it looks broken
- Move portable Ke constants from <arch>/cpu.c to krnlinit.c
- Fixed a bug in amd64 KiGeneralProtectionFaultHandler
svn path=/trunk/; revision=53734
2011-09-18 13:11:45 +00:00
|
|
|
IN LONG_PTR WaitStatus
|
2006-09-14 03:49:20 +00:00
|
|
|
);
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeDumpStackFrames(PULONG Frame);
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KiTestAlert(VOID);
|
2004-11-21 18:42:58 +00:00
|
|
|
|
2005-03-14 06:44:31 +00:00
|
|
|
VOID
|
2005-05-09 01:38:29 +00:00
|
|
|
FASTCALL
|
2006-09-14 03:49:20 +00:00
|
|
|
KiUnwaitThread(
|
2006-07-13 22:52:18 +00:00
|
|
|
IN PKTHREAD Thread,
|
2010-01-13 22:35:43 +00:00
|
|
|
IN LONG_PTR WaitStatus,
|
2006-07-13 22:52:18 +00:00
|
|
|
IN KPRIORITY Increment
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-04-18 00:42:31 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeInitializeProcess(
|
|
|
|
struct _KPROCESS *Process,
|
|
|
|
KPRIORITY Priority,
|
|
|
|
KAFFINITY Affinity,
|
[HAL/NDK]
- Make Vector parameter in HalEnableSystemInterrupt, HalDisableSystemInterrupt and HalBeginSystemInterrupt an ULONG, not an UCHAR
[NDK]
- 64bit fixes for HANDLE_TABLE, KPROCESS, SECTION_IMAGE_INFORMATION, MMADDRESS_LIST, MMVAD_FLAGS, MMVAD, MMVAD_LONG, MMVAD_SHORT, MEMORY_DESCRIPTOR, MEMORY_ALLOCATION_DESCRIPTOR, LdrVerifyMappedImageMatchesChecksum
- KDPC_DATA::DpcQueueDepth is signed on amd64, unsigned on x86
[NTOSKRNL]
- Fix hundreds of MSVC and amd64 warnings
- add a pragma message to FstubFixupEfiPartition, since it looks broken
- Move portable Ke constants from <arch>/cpu.c to krnlinit.c
- Fixed a bug in amd64 KiGeneralProtectionFaultHandler
svn path=/trunk/; revision=53734
2011-09-18 13:11:45 +00:00
|
|
|
PULONG_PTR DirectoryTableBase,
|
2006-09-10 23:17:22 +00:00
|
|
|
IN BOOLEAN Enable
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2006-07-21 19:28:38 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeSetQuantumProcess(
|
|
|
|
IN PKPROCESS Process,
|
|
|
|
IN UCHAR Quantum
|
|
|
|
);
|
|
|
|
|
|
|
|
KPRIORITY
|
|
|
|
NTAPI
|
|
|
|
KeSetPriorityAndQuantumProcess(
|
|
|
|
IN PKPROCESS Process,
|
|
|
|
IN KPRIORITY Priority,
|
|
|
|
IN UCHAR Quantum OPTIONAL
|
|
|
|
);
|
|
|
|
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
ULONG
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
KeForceResumeThread(IN PKTHREAD Thread);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2006-10-22 20:52:13 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeThawAllThreads(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2006-10-22 20:39:08 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeFreezeAllThreads(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2005-07-23 17:40:48 +00:00
|
|
|
BOOLEAN
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-07-23 17:40:48 +00:00
|
|
|
KeDisableThreadApcQueueing(IN PKTHREAD Thread);
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiWaitTest(
|
2006-01-05 04:26:55 +00:00
|
|
|
PVOID Object,
|
2005-09-14 01:44:19 +00:00
|
|
|
KPRIORITY Increment
|
|
|
|
);
|
Dispatching & Queue Rewrite II:
- Rewrote wait code. It is now cleaner, more optimized and faster. All waiting
functions are now clearly differentiated instead of sharing code. These functions
are called up to a dozen times a second, so having dedicated code for each of
them is a real boost in speed.
- Fixed several queue issues, made a dedicated queue wait/wake function (you are not
supposed to use KeWaitFor on a queue, and this is also a speed boost), and make it
compatible with new wait code.
- Optimized Work Queue code to be much smaller and better organized, by using an
array instead of hard-coded multiple static variables. Also, add support for the
real NT structures and implementation, paving the road for Dynamic Work Items, which
also have timeouts, and deadlock dection + debug info.
- Simplified PsBlockThread and made it compatible with wait code.
- Added support for priority boosting when unwaiting a thread; will use later, as well
as put proper boosting for dispatch objects.
- Inlined all dispatcher lock functions and header initialization for speed.
- Moved executive wait code into ob.
svn path=/trunk/; revision=14047
2005-03-14 05:54:32 +00:00
|
|
|
|
2006-01-15 09:23:55 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeContextToTrapFrame(
|
|
|
|
PCONTEXT Context,
|
|
|
|
PKEXCEPTION_FRAME ExeptionFrame,
|
|
|
|
PKTRAP_FRAME TrapFrame,
|
2006-01-15 09:23:55 +00:00
|
|
|
ULONG ContextFlags,
|
2005-09-14 01:44:19 +00:00
|
|
|
KPROCESSOR_MODE PreviousMode
|
|
|
|
);
|
|
|
|
|
2012-02-18 23:59:31 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
Ke386SetIOPL(VOID);
|
|
|
|
|
2005-04-15 06:24:35 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-11-03 16:58:43 +00:00
|
|
|
KiCheckForKernelApcDelivery(VOID);
|
2005-09-14 01:44:19 +00:00
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
LONG
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiInsertQueue(
|
|
|
|
IN PKQUEUE Queue,
|
|
|
|
IN PLIST_ENTRY Entry,
|
|
|
|
BOOLEAN Head
|
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2007-01-24 06:50:28 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiTimerExpiration(
|
|
|
|
IN PKDPC Dpc,
|
|
|
|
IN PVOID DeferredContext,
|
|
|
|
IN PVOID SystemArgument1,
|
|
|
|
IN PVOID SystemArgument2
|
|
|
|
);
|
|
|
|
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
ULONG
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeSetProcess(
|
|
|
|
struct _KPROCESS* Process,
|
2006-07-09 18:54:13 +00:00
|
|
|
KPRIORITY Increment,
|
|
|
|
BOOLEAN InWait
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeInitializeEventPair(PKEVENT_PAIR EventPair);
|
2005-03-14 02:08:17 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiInitializeUserApc(
|
|
|
|
IN PKEXCEPTION_FRAME Reserved,
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKNORMAL_ROUTINE NormalRoutine,
|
|
|
|
IN PVOID NormalContext,
|
|
|
|
IN PVOID SystemArgument1,
|
|
|
|
IN PVOID SystemArgument2
|
|
|
|
);
|
2004-11-10 02:51:00 +00:00
|
|
|
|
2005-07-23 17:40:48 +00:00
|
|
|
PLIST_ENTRY
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeFlushQueueApc(
|
|
|
|
IN PKTHREAD Thread,
|
|
|
|
IN KPROCESSOR_MODE PreviousMode
|
|
|
|
);
|
2005-07-23 17:40:48 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiAttachProcess(
|
|
|
|
struct _KTHREAD *Thread,
|
|
|
|
struct _KPROCESS *Process,
|
2006-09-10 18:26:50 +00:00
|
|
|
PKLOCK_QUEUE_HANDLE ApcLock,
|
2005-09-14 01:44:19 +00:00
|
|
|
struct _KAPC_STATE *SavedApcState
|
|
|
|
);
|
2004-11-11 22:23:52 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiSwapProcess(
|
|
|
|
struct _KPROCESS *NewProcess,
|
|
|
|
struct _KPROCESS *OldProcess
|
|
|
|
);
|
2004-11-11 22:23:52 +00:00
|
|
|
|
2004-11-10 02:51:00 +00:00
|
|
|
BOOLEAN
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2004-11-10 02:51:00 +00:00
|
|
|
KeTestAlertThread(IN KPROCESSOR_MODE AlertMode);
|
2000-07-01 18:27:03 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
BOOLEAN
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeRemoveQueueApc(PKAPC Apc);
|
2003-03-19 23:17:52 +00:00
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
2006-09-14 15:48:02 +00:00
|
|
|
KiActivateWaiterQueue(IN PKQUEUE Queue);
|
2005-09-14 01:44:19 +00:00
|
|
|
|
2008-12-08 12:57:53 +00:00
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
KeQueryRuntimeProcess(IN PKPROCESS Process,
|
|
|
|
OUT PULONG UserTime);
|
|
|
|
|
2018-05-25 19:40:39 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeQueryValuesProcess(IN PKPROCESS Process,
|
|
|
|
PPROCESS_VALUES Values);
|
|
|
|
|
1998-09-05 17:33:57 +00:00
|
|
|
/* INITIALIZATION FUNCTIONS *************************************************/
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-10-05 16:38:58 +00:00
|
|
|
BOOLEAN
|
2005-09-14 01:44:19 +00:00
|
|
|
NTAPI
|
2006-10-04 03:37:11 +00:00
|
|
|
KeInitSystem(VOID);
|
2005-09-14 01:44:19 +00:00
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-10-04 03:37:11 +00:00
|
|
|
KeInitExceptions(VOID);
|
2005-09-14 01:44:19 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-10-04 03:37:11 +00:00
|
|
|
KeInitInterrupts(VOID);
|
1998-09-05 17:33:57 +00:00
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiInitializeBugCheck(VOID);
|
2000-07-10 21:55:49 +00:00
|
|
|
|
2020-09-09 01:46:56 +00:00
|
|
|
DECLSPEC_NORETURN
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2010-01-19 18:27:24 +00:00
|
|
|
KiSystemStartup(
|
2006-09-30 03:33:50 +00:00
|
|
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
|
2003-11-27 01:13:05 +00:00
|
|
|
|
2004-11-11 22:23:52 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiMoveApcState(
|
|
|
|
PKAPC_STATE OldState,
|
|
|
|
PKAPC_STATE NewState
|
|
|
|
);
|
2003-11-27 01:13:05 +00:00
|
|
|
|
2000-12-26 05:32:44 +00:00
|
|
|
VOID
|
2005-09-14 01:44:19 +00:00
|
|
|
NTAPI
|
|
|
|
KiAddProfileEvent(
|
|
|
|
KPROFILE_SOURCE Source,
|
|
|
|
ULONG Pc
|
|
|
|
);
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
Major refactoring of the exception handling code + misc fixes:
- Fix/add prototypes for RtlCaptureContext, RtlDispatchException and RtlUnwind
- Fix EXCEPTION_REGISTRATION_RECORD structure and PEXCEPTION_ROUTINE
- Add w32api excpt.h (based on mingw) with PSDK compatibility fixes
- Fix seriously broken User-Mode Ldr thunk and APC Callback prototypes
- Fix KiUserExceptionDispatcher
- Remove useless NTDLL entrypoint
- Implement NTDLL Ki* callbacks in ASM
- Implement RtlCaptureContext
- Fix RtlRaiseException to handle cases when a user-mode debugger is present
- Fix RtlRaiseStatus as above, plus set the exception address and capture context
- Little cleanup of RTL headers
- Implement RtlpGetStackLimits, RtlpGetExceptionList, RtlpSetExceptionList, RtlpGetExceptionAddress in ASM
- Fix RtlDispatchException, add cases for exceptions in the DPC stack and validate the validity of the
exception frames. Add support for exception logging by the global flag. Use TRAP_FRAME/EXCPETION_FRAME instead of
Context.
- Fix RtlUnwind logic, support cases where it's called with custom arguments instead of NULL.
- Reimplement RtlpCaptureContext to work properly, convert exception handler calling functions to INTEL syntax
and fix some bugs (like checking for the right unwind flag, clearing volatile register values, etc. Also use some
optimizations to increase speed.
- Modify some kernel functions (like KeContextToTrapFrame, KiDispatchException, KiInitializeUserApc, etc.) to
support a PKEXCEPTION_FRAME for future PPC compatibility.
- Reimplement RtlCaptureUnicodeString/FreeUnicodeString as inlined probe macros and optimize them.
- Export ExRaiseStatus/Exception as Rtl*
- Reimplement NtContinue to have more platform-independent code, and to protect and validate user-mode context
and parameters with SEH.
- Implement KiRaiseException, add SEH to all user-mode parameters and when copying data to the user-mode stack.
- Fix KiInitializeUserApc to use KeTrapFrameToContext, to save the debug registers, not to deliver APCs during
v86 mode, and to protect user-mode stack operations in SEH and probing. Also make it generate the proper stack for the
user-mode callback.
- Implement KiUnexpectedInterrupt and KiCoprocessorError
- Reimplement NtRaiseException in ASM to take advantage of optimizations due to the trap frame being in the
stack when called through System call interface.
- Fix Ntcontinue to respect AlertThread paramter
- Fix some functiosn to return with KiServiceExit2 instead of KiServiceExit when required/needed
- Fix KiDispatchException's logic, fix hacks when calling KeUserExceptionDispatcher, use correct context
flags,...
- Make NTDLL Ki* callbacks have SEH to protect them and return to kernel-mode with notification of any
exceptions (the kernel-mode code to handle this isn't written yet though)
svn path=/trunk/; revision=17811
2005-09-11 22:32:20 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KiDispatchException(
|
|
|
|
PEXCEPTION_RECORD ExceptionRecord,
|
|
|
|
PKEXCEPTION_FRAME ExceptionFrame,
|
|
|
|
PKTRAP_FRAME Tf,
|
|
|
|
KPROCESSOR_MODE PreviousMode,
|
|
|
|
BOOLEAN SearchFrames
|
|
|
|
);
|
|
|
|
|
2005-09-13 19:33:49 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeTrapFrameToContext(
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKEXCEPTION_FRAME ExceptionFrame,
|
|
|
|
IN OUT PCONTEXT Context
|
|
|
|
);
|
|
|
|
|
2009-06-21 17:06:34 +00:00
|
|
|
DECLSPEC_NORETURN
|
2002-05-02 23:45:33 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeBugCheckWithTf(
|
|
|
|
ULONG BugCheckCode,
|
2008-08-27 22:40:17 +00:00
|
|
|
ULONG_PTR BugCheckParameter1,
|
|
|
|
ULONG_PTR BugCheckParameter2,
|
|
|
|
ULONG_PTR BugCheckParameter3,
|
|
|
|
ULONG_PTR BugCheckParameter4,
|
2005-09-14 01:44:19 +00:00
|
|
|
PKTRAP_FRAME Tf
|
|
|
|
);
|
2011-07-25 00:01:29 +00:00
|
|
|
|
2010-01-06 00:40:07 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KiHandleNmi(VOID);
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-01 03:05:30 +00:00
|
|
|
NTAPI
|
2005-09-14 01:44:19 +00:00
|
|
|
KeFlushCurrentTb(VOID);
|
2005-06-25 14:04:56 +00:00
|
|
|
|
2007-09-26 16:41:35 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeInvalidateAllCaches(VOID);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KeZeroPages(IN PVOID Address,
|
|
|
|
IN ULONG Size);
|
|
|
|
|
2007-09-27 18:07:44 +00:00
|
|
|
BOOLEAN
|
|
|
|
FASTCALL
|
|
|
|
KeInvalidAccessAllowed(IN PVOID TrapInformation OPTIONAL);
|
|
|
|
|
2005-09-14 01:44:19 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2005-06-25 14:04:56 +00:00
|
|
|
KeRosDumpStackFrames(
|
2010-07-16 00:34:26 +00:00
|
|
|
PULONG_PTR Frame,
|
2005-09-14 01:44:19 +00:00
|
|
|
ULONG FrameCount
|
|
|
|
);
|
2005-06-25 14:04:56 +00:00
|
|
|
|
2004-11-28 12:59:33 +00:00
|
|
|
VOID
|
2005-09-14 01:44:19 +00:00
|
|
|
NTAPI
|
2007-01-25 01:13:09 +00:00
|
|
|
KeSetSystemTime(
|
|
|
|
IN PLARGE_INTEGER NewSystemTime,
|
|
|
|
OUT PLARGE_INTEGER OldSystemTime,
|
|
|
|
IN BOOLEAN FixInterruptTime,
|
|
|
|
IN PLARGE_INTEGER HalTime
|
|
|
|
);
|
2004-11-28 12:59:33 +00:00
|
|
|
|
2005-09-13 23:28:21 +00:00
|
|
|
ULONG
|
2005-09-14 01:44:19 +00:00
|
|
|
NTAPI
|
2005-09-13 23:28:21 +00:00
|
|
|
KeV86Exception(
|
2005-09-14 01:44:19 +00:00
|
|
|
ULONG ExceptionNr,
|
|
|
|
PKTRAP_FRAME Tf,
|
2005-09-13 23:28:21 +00:00
|
|
|
ULONG address
|
|
|
|
);
|
|
|
|
|
2006-08-24 23:25:37 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiStartUnexpectedRange(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiEndUnexpectedRange(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-01-19 08:26:25 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KiRaiseException(
|
|
|
|
IN PEXCEPTION_RECORD ExceptionRecord,
|
|
|
|
IN PCONTEXT Context,
|
|
|
|
IN PKEXCEPTION_FRAME ExceptionFrame,
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN BOOLEAN SearchFrames
|
|
|
|
);
|
|
|
|
|
2010-01-19 08:20:12 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KiContinue(
|
|
|
|
IN PCONTEXT Context,
|
|
|
|
IN PKEXCEPTION_FRAME ExceptionFrame,
|
|
|
|
IN PKTRAP_FRAME TrapFrame
|
|
|
|
);
|
|
|
|
|
2010-07-26 21:32:38 +00:00
|
|
|
DECLSPEC_NORETURN
|
2010-01-19 08:41:03 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiServiceExit(
|
2010-01-19 08:51:37 +00:00
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN NTSTATUS Status
|
2010-01-19 08:41:03 +00:00
|
|
|
);
|
|
|
|
|
2010-07-26 21:32:38 +00:00
|
|
|
DECLSPEC_NORETURN
|
2010-01-19 06:34:15 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiServiceExit2(
|
|
|
|
IN PKTRAP_FRAME TrapFrame
|
|
|
|
);
|
|
|
|
|
2012-03-28 19:41:40 +00:00
|
|
|
#ifndef _M_AMD64
|
2010-01-11 17:44:09 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiInterruptDispatch(
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKINTERRUPT Interrupt
|
|
|
|
);
|
2012-03-28 19:41:40 +00:00
|
|
|
#endif
|
2010-01-11 17:44:09 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiChainedDispatch(
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKINTERRUPT Interrupt
|
|
|
|
);
|
2006-08-24 23:25:37 +00:00
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-09-30 05:42:22 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiInitializeMachineType(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2007-08-06 23:55:35 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiSetupStackAndInitializeKernel(
|
|
|
|
IN PKPROCESS InitProcess,
|
|
|
|
IN PKTHREAD InitThread,
|
|
|
|
IN PVOID IdleStack,
|
|
|
|
IN PKPRCB Prcb,
|
|
|
|
IN CCHAR Number,
|
|
|
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-09-03 21:06:30 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiInitSpinLocks(
|
|
|
|
IN PKPRCB Prcb,
|
|
|
|
IN CCHAR Number
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-09-03 21:06:30 +00:00
|
|
|
LARGE_INTEGER
|
|
|
|
NTAPI
|
|
|
|
KiComputeReciprocal(
|
|
|
|
IN LONG Divisor,
|
|
|
|
OUT PUCHAR Shift
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-09-03 21:06:30 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiInitSystem(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiInsertQueueApc(
|
|
|
|
IN PKAPC Apc,
|
|
|
|
IN KPRIORITY PriorityBoost
|
|
|
|
);
|
|
|
|
|
2006-09-13 01:00:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
KiCallUserMode(
|
|
|
|
IN PVOID *OutputBuffer,
|
|
|
|
IN PULONG OutputLength
|
|
|
|
);
|
|
|
|
|
2013-10-19 18:04:15 +00:00
|
|
|
DECLSPEC_NORETURN
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiCallbackReturn(
|
|
|
|
IN PVOID Stack,
|
|
|
|
IN NTSTATUS Status
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-10-04 03:37:11 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiInitMachineDependent(VOID);
|
|
|
|
|
- Add EXCEPTION_RECORD64 and LIST_ENTRY64, KeTryToAcquireSpinLockAtDpcLevel, BREAKPOINT_COMMAND_STRING, Ke386SetCr2, Ke386SetDr3, Ke386SetDr6.
- Remove non-kernel routines from kdfuncs.h and remove deprecated routines from ke.h.
- Implement KiRestoreProcessorControlState, KeFreezeExecution, KeThawExecution, ExAcquireTimeRefreshLock, ExReleaseTimeRefreshLock.
- Rename ModuleLoadList to PsLoadedModuleList. Add PsNtosImageBase and set value in it.
- Add skeleton wdbgexts.h with what's needed until now, this is a PSDK header.
- Add kddll.h for KDCOM/1394/USB2.DLL prototypes.
- Add windbgkd.h with KD protocol definitions. Used to be an NT5 DDK header, but was removed, so this goes into include\reactos.
svn path=/branches/alex-kd-branch/; revision=25833
2007-02-18 07:21:03 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
KeFreezeExecution(IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKEXCEPTION_FRAME ExceptionFrame);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KeThawExecution(IN BOOLEAN Enable);
|
|
|
|
|
2021-05-21 07:44:32 +00:00
|
|
|
_IRQL_requires_min_(DISPATCH_LEVEL)
|
|
|
|
_Acquires_nonreentrant_lock_(*LockHandle->Lock)
|
|
|
|
_Acquires_exclusive_lock_(*LockHandle->Lock)
|
2007-09-24 14:01:54 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KeAcquireQueuedSpinLockAtDpcLevel(
|
2021-05-21 07:44:32 +00:00
|
|
|
_Inout_ PKSPIN_LOCK_QUEUE LockQueue
|
2007-09-24 14:01:54 +00:00
|
|
|
);
|
|
|
|
|
2021-05-21 07:44:32 +00:00
|
|
|
_IRQL_requires_min_(DISPATCH_LEVEL)
|
|
|
|
_Releases_nonreentrant_lock_(*LockHandle->Lock)
|
|
|
|
_Releases_exclusive_lock_(*LockHandle->Lock)
|
2007-09-24 14:01:54 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KeReleaseQueuedSpinLockFromDpcLevel(
|
2021-05-21 07:44:32 +00:00
|
|
|
_Inout_ PKSPIN_LOCK_QUEUE LockQueue
|
2007-09-24 14:01:54 +00:00
|
|
|
);
|
|
|
|
|
2008-02-07 20:04:31 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiRestoreProcessorControlState(
|
|
|
|
IN PKPROCESSOR_STATE ProcessorState
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiSaveProcessorControlState(
|
|
|
|
OUT PKPROCESSOR_STATE ProcessorState
|
|
|
|
);
|
|
|
|
|
2010-01-11 06:08:11 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
KiSaveProcessorState(
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN PKEXCEPTION_FRAME ExceptionFrame
|
|
|
|
);
|
|
|
|
|
2008-07-19 06:13:10 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiRetireDpcList(
|
|
|
|
IN PKPRCB Prcb
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
2008-07-19 08:04:47 +00:00
|
|
|
NTAPI
|
2008-07-19 06:13:10 +00:00
|
|
|
KiQuantumEnd(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2020-09-09 01:46:56 +00:00
|
|
|
DECLSPEC_NORETURN
|
2008-07-19 06:13:10 +00:00
|
|
|
VOID
|
|
|
|
KiIdleLoop(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-03-18 16:30:54 +00:00
|
|
|
DECLSPEC_NORETURN
|
2010-01-24 05:40:04 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KiSystemFatalException(
|
|
|
|
IN ULONG ExceptionCode,
|
|
|
|
IN PKTRAP_FRAME TrapFrame
|
|
|
|
);
|
|
|
|
|
2010-07-23 23:50:26 +00:00
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
KiPcToFileHeader(IN PVOID Eip,
|
|
|
|
OUT PLDR_DATA_TABLE_ENTRY *LdrEntry,
|
|
|
|
IN BOOLEAN DriversOnly,
|
|
|
|
OUT PBOOLEAN InKernel);
|
|
|
|
|
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
KiRosPcToUserFileHeader(IN PVOID Eip,
|
|
|
|
OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
|
|
|
|
|
2012-03-26 13:51:15 +00:00
|
|
|
PCHAR
|
|
|
|
NTAPI
|
|
|
|
KeBugCheckUnicodeToAnsi(
|
|
|
|
IN PUNICODE_STRING Unicode,
|
|
|
|
OUT PCHAR Ansi,
|
|
|
|
IN ULONG Length
|
|
|
|
);
|
|
|
|
|
2021-03-26 08:32:34 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
2021-05-11 14:14:03 +00:00
|
|
|
|
|
|
|
namespace ntoskrnl
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Like std::lock_guard, but for a Queued Spinlock */
|
|
|
|
template <KSPIN_LOCK_QUEUE_NUMBER n>
|
|
|
|
class KiQueuedSpinLockGuard
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
KIRQL m_OldIrql;
|
|
|
|
public:
|
|
|
|
|
|
|
|
_Requires_lock_not_held_(n)
|
|
|
|
_Acquires_lock_(n)
|
|
|
|
_IRQL_raises_(DISPATCH_LEVEL)
|
|
|
|
explicit KiQueuedSpinLockGuard()
|
|
|
|
{
|
|
|
|
m_OldIrql = KeAcquireQueuedSpinLock(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
_Requires_lock_held_(n)
|
|
|
|
_Releases_lock_(n)
|
|
|
|
~KiQueuedSpinLockGuard()
|
|
|
|
{
|
|
|
|
KeReleaseQueuedSpinLock(n, m_OldIrql);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
KiQueuedSpinLockGuard(KiQueuedSpinLockGuard const&) = delete;
|
|
|
|
KiQueuedSpinLockGuard& operator=(KiQueuedSpinLockGuard const&) = delete;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-03-26 08:32:34 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-13 04:20:18 +00:00
|
|
|
#include "ke_x.h"
|