ReactOS  0.4.12-dev-919-gfc3b8d5
kefuncs.h File Reference
#include <umtypes.h>
#include <ketypes.h>
#include <section_attribs.h>
Include dependency graph for kefuncs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VOID NTAPI KeInitializeApc (_In_ PKAPC Apc, _In_ PKTHREAD Thread, _In_ KAPC_ENVIRONMENT TargetEnvironment, _In_ PKKERNEL_ROUTINE KernelRoutine, _In_opt_ PKRUNDOWN_ROUTINE RundownRoutine, _In_ PKNORMAL_ROUTINE NormalRoutine, _In_ KPROCESSOR_MODE Mode, _In_ PVOID Context)
 
BOOLEAN NTAPI KeInsertQueueApc (_In_ PKAPC Apc, _In_ PVOID SystemArgument1, _In_ PVOID SystemArgument2, _In_ KPRIORITY PriorityBoost)
 
VOID NTAPI KiDeliverApc (_In_ KPROCESSOR_MODE PreviousMode, _Reserved_ PKEXCEPTION_FRAME ExceptionFrame, _In_ PKTRAP_FRAME TrapFrame)
 
VOID NTAPI KeTerminateThread (_In_ KPRIORITY Increment)
 
BOOLEAN NTAPI KeIsAttachedProcess (VOID)
 
VOID NTAPI KeSetEventBoostPriority (_In_ PKEVENT Event, _In_opt_ PKTHREAD *Thread)
 
KAFFINITY NTAPI KeSetAffinityThread (_Inout_ PKTHREAD Thread, _In_ KAFFINITY Affinity)
 
PKPROCESS NTAPI KeGetCurrentProcess (VOID)
 
BOOLEAN NTAPI KeAddSystemServiceTable (_In_ PULONG_PTR Base, _In_opt_ PULONG Count, _In_ ULONG Limit, _In_ PUCHAR Number, _In_ ULONG Index)
 
VOID FASTCALL KiAcquireSpinLock (_Inout_ PKSPIN_LOCK SpinLock)
 
VOID FASTCALL KiReleaseSpinLock (_Inout_ PKSPIN_LOCK SpinLock)
 
KIRQL FASTCALL KeAcquireQueuedSpinLockRaiseToSynch (_In_ KSPIN_LOCK_QUEUE_NUMBER LockNumber)
 
BOOLEAN FASTCALL KeTryToAcquireQueuedSpinLockRaiseToSynch (_In_ KSPIN_LOCK_QUEUE_NUMBER LockNumber, _In_ PKIRQL OldIrql)
 
VOID FASTCALL KeAcquireInStackQueuedSpinLockRaiseToSynch (_In_ PKSPIN_LOCK SpinLock, _In_ PKLOCK_QUEUE_HANDLE LockHandle)
 
VOID NTAPI KeInitializeInterrupt (_Out_ PKINTERRUPT InterruptObject, _In_ PKSERVICE_ROUTINE ServiceRoutine, _In_ PVOID ServiceContext, _In_ PKSPIN_LOCK SpinLock, _In_ ULONG Vector, _In_ KIRQL Irql, _In_ KIRQL SynchronizeIrql, _In_ KINTERRUPT_MODE InterruptMode, _In_ BOOLEAN ShareVector, _In_ CHAR ProcessorNumber, _In_ BOOLEAN FloatingSave)
 
BOOLEAN NTAPI KeConnectInterrupt (_Inout_ PKINTERRUPT InterruptObject)
 
BOOLEAN NTAPI KeDisconnectInterrupt (_Inout_ PKINTERRUPT InterruptObject)
 
VOID NTAPI KiDispatchInterrupt (VOID)
 
VOID NTAPI KiCoprocessorError (VOID)
 
DECLSPEC_NORETURN VOID __cdecl KiUnexpectedInterrupt (VOID)
 
VOID NTAPI KeEnterKernelDebugger (VOID)
 
BOOLEAN NTAPI KeIsExecutingDpc (VOID)
 
BOOLEAN NTAPI KiIpiServiceRoutine (_In_ PKTRAP_FRAME TrapFrame, _Reserved_ PKEXCEPTION_FRAME ExceptionFrame)
 
VOID NTAPI KeGenericCallDpc (_In_ PKDEFERRED_ROUTINE Routine, _In_ PVOID Context)
 
VOID NTAPI KeSignalCallDpcDone (_In_ PVOID SystemArgument1)
 
BOOLEAN NTAPI KeSignalCallDpcSynchronize (_In_ PVOID SystemArgument2)
 
VOID NTAPI KeFlushEntireTb (_In_ BOOLEAN Invalid, _In_ BOOLEAN AllProcessors)
 
VOID NTAPI KeSetDmaIoCoherency (_In_ ULONG Coherency)
 
VOID KeSetGdtSelector (_In_ ULONG Entry, _In_ ULONG Value1, _In_ ULONG Value2)
 
VOID NTAPI KeProfileInterrupt (_In_ PKTRAP_FRAME TrapFrame)
 
VOID NTAPI KeProfileInterruptWithSource (_In_ PKTRAP_FRAME TrapFrame, _In_ KPROFILE_SOURCE Source)
 
VOID NTAPI KeSetProfileIrql (_In_ KIRQL ProfileIrql)
 
VOID NTAPI KeSetTimeIncrement (_In_ ULONG MaxIncrement, _In_ ULONG MinIncrement)
 
NTSTATUS NTAPI Ke386CallBios (_In_ ULONG BiosCommand, _Inout_ PCONTEXT BiosArguments)
 
NTSTATUS NTAPI KeUserModeCallback (_In_ ULONG FunctionID, _In_reads_opt_(InputLength) PVOID InputBuffer, _In_ ULONG InputLength, _Outptr_result_buffer_(*OutputLength) PVOID *OutputBuffer, _Out_ PULONG OutputLength)
 
NTSTATUS NTAPI KeRaiseUserException (_In_ NTSTATUS ExceptionCode)
 
NTSYSCALLAPI NTSTATUS NTAPI NtContinue (_In_ PCONTEXT Context, _In_ BOOLEAN TestAlert)
 
NTSYSCALLAPI NTSTATUS NTAPI NtCallbackReturn (_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
 
NTSYSCALLAPI NTSTATUS NTAPI NtCreateProfile (_Out_ PHANDLE ProfileHandle, _In_ HANDLE ProcessHandle, _In_ PVOID ImageBase, _In_ SIZE_T ImageSize, _In_ ULONG Granularity, _Out_ PVOID Buffer, _In_ ULONG ProfilingSize, _In_ KPROFILE_SOURCE Source, _In_ KAFFINITY ProcessorMask)
 
NTSYSCALLAPI NTSTATUS NTAPI NtCreateProfileEx (_Out_ PHANDLE ProfileHandle, _In_ HANDLE ProcessHandle, _In_ PVOID ImageBase, _In_ SIZE_T ImageSize, _In_ ULONG Granularity, _Out_ PVOID Buffer, _In_ ULONG ProfilingSize, _In_ KPROFILE_SOURCE Source, _In_ USHORT GroupCount, _In_reads_(GroupCount) PGROUP_AFFINITY Affinity)
 
NTSYSCALLAPI NTSTATUS NTAPI NtDelayExecution (_In_ BOOLEAN Alertable, _In_ LARGE_INTEGER *Interval)
 
ULONG NTAPI NtGetCurrentProcessorNumber (VOID)
 
NTSYSCALLAPI NTSTATUS NTAPI NtGetContextThread (_In_ HANDLE ThreadHandle, _Out_ PCONTEXT Context)
 
NTSYSCALLAPI ULONG NTAPI NtGetTickCount (VOID)
 
NTSYSCALLAPI NTSTATUS NTAPI NtQueryIntervalProfile (_In_ KPROFILE_SOURCE ProfileSource, _Out_ PULONG Interval)
 
NTSYSCALLAPI NTSTATUS NTAPI NtQueryPerformanceCounter (_Out_ PLARGE_INTEGER Counter, _Out_opt_ PLARGE_INTEGER Frequency)
 
NTSYSCALLAPI NTSTATUS NTAPI NtQuerySystemTime (_Out_ PLARGE_INTEGER CurrentTime)
 
NTSYSCALLAPI NTSTATUS NTAPI NtQueryTimerResolution (_Out_ PULONG MinimumResolution, _Out_ PULONG MaximumResolution, _Out_ PULONG ActualResolution)
 
NTSYSCALLAPI NTSTATUS NTAPI NtQueueApcThread (_In_ HANDLE ThreadHandle, _In_ PKNORMAL_ROUTINE ApcRoutine, _In_opt_ PVOID NormalContext, _In_opt_ PVOID SystemArgument1, _In_opt_ PVOID SystemArgument2)
 
NTSYSCALLAPI NTSTATUS NTAPI NtRaiseException (_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context, _In_ BOOLEAN SearchFrames)
 
NTSYSCALLAPI NTSTATUS NTAPI NtSetContextThread (_In_ HANDLE ThreadHandle, _In_ PCONTEXT Context)
 
NTSYSCALLAPI NTSTATUS NTAPI NtSetIntervalProfile (_In_ ULONG Interval, _In_ KPROFILE_SOURCE ClockSource)
 
NTSYSCALLAPI NTSTATUS NTAPI NtSetLdtEntries (_In_ ULONG Selector1, _In_ LDT_ENTRY LdtEntry1, _In_ ULONG Selector2, _In_ LDT_ENTRY LdtEntry2)
 
NTSYSCALLAPI NTSTATUS NTAPI NtSetSystemTime (_In_ PLARGE_INTEGER SystemTime, _In_opt_ PLARGE_INTEGER NewSystemTime)
 
NTSYSCALLAPI NTSTATUS NTAPI NtSetTimerResolution (_In_ ULONG RequestedResolution, _In_ BOOLEAN SetOrUnset, _Out_ PULONG ActualResolution)
 
NTSYSCALLAPI NTSTATUS NTAPI NtStartProfile (_In_ HANDLE ProfileHandle)
 
NTSYSCALLAPI NTSTATUS NTAPI NtStopProfile (_In_ HANDLE ProfileHandle)
 
NTSYSCALLAPI NTSTATUS NTAPI NtTestAlert (VOID)
 
NTSYSCALLAPI NTSTATUS NTAPI NtVdmControl (_In_ ULONG ControlCode, _In_ PVOID ControlData)
 
NTSYSCALLAPI NTSTATUS NTAPI NtW32Call (_In_ ULONG RoutineIndex, _In_ PVOID Argument, _In_ ULONG ArgumentLength, _Out_opt_ PVOID *Result, _Out_opt_ PULONG ResultLength)
 
NTSYSCALLAPI NTSTATUS NTAPI NtYieldExecution (VOID)
 
NTSYSAPI NTSTATUS NTAPI ZwContinue (_In_ PCONTEXT Context, _In_ BOOLEAN TestAlert)
 
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn (_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
 
NTSYSAPI NTSTATUS NTAPI ZwCreateProfile (_Out_ PHANDLE ProfileHandle, _In_ HANDLE ProcessHandle, _In_ PVOID ImageBase, _In_ ULONG ImageSize, _In_ ULONG Granularity, _Out_ PVOID Buffer, _In_ ULONG ProfilingSize, _In_ KPROFILE_SOURCE Source, _In_ KAFFINITY ProcessorMask)
 
NTSYSAPI NTSTATUS NTAPI ZwDelayExecution (_In_ BOOLEAN Alertable, _In_ LARGE_INTEGER *Interval)
 
NTSYSAPI NTSTATUS NTAPI ZwFlushInstructionCache (_In_ HANDLE ProcessHandle, _In_ PVOID BaseAddress, _In_ ULONG NumberOfBytesToFlush)
 
NTSYSAPI NTSTATUS NTAPI ZwGetContextThread (_In_ HANDLE ThreadHandle, _Out_ PCONTEXT Context)
 
NTSYSAPI ULONG NTAPI ZwGetTickCount (VOID)
 
NTSYSAPI NTSTATUS NTAPI ZwQueryIntervalProfile (_In_ KPROFILE_SOURCE ProfileSource, _Out_ PULONG Interval)
 
NTSYSAPI NTSTATUS NTAPI ZwQueryPerformanceCounter (_Out_ PLARGE_INTEGER Counter, _Out_opt_ PLARGE_INTEGER Frequency)
 
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemTime (_Out_ PLARGE_INTEGER CurrentTime)
 
NTSYSAPI NTSTATUS NTAPI ZwQueryTimerResolution (_Out_ PULONG MinimumResolution, _Out_ PULONG MaximumResolution, _Out_ PULONG ActualResolution)
 
NTSYSAPI NTSTATUS NTAPI ZwQueueApcThread (_In_ HANDLE ThreadHandle, _In_ PKNORMAL_ROUTINE ApcRoutine, _In_opt_ PVOID NormalContext, _In_opt_ PVOID SystemArgument1, _In_opt_ PVOID SystemArgument2)
 
NTSYSAPI NTSTATUS NTAPI ZwRaiseException (_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context, _In_ BOOLEAN SearchFrames)
 
NTSYSAPI NTSTATUS NTAPI ZwSetContextThread (_In_ HANDLE ThreadHandle, _In_ PCONTEXT Context)
 
NTSYSAPI NTSTATUS NTAPI ZwSetIntervalProfile (_In_ ULONG Interval, _In_ KPROFILE_SOURCE ClockSource)
 
NTSYSAPI NTSTATUS NTAPI ZwSetLdtEntries (_In_ ULONG Selector1, _In_ LDT_ENTRY LdtEntry1, _In_ ULONG Selector2, _In_ LDT_ENTRY LdtEntry2)
 
NTSYSAPI NTSTATUS NTAPI ZwSetSystemTime (_In_ PLARGE_INTEGER SystemTime, _In_opt_ PLARGE_INTEGER NewSystemTime)
 
NTSYSAPI NTSTATUS NTAPI ZwSetTimerResolution (_In_ ULONG RequestedResolution, _In_ BOOLEAN SetOrUnset, _Out_ PULONG ActualResolution)
 
NTSYSAPI NTSTATUS NTAPI ZwStartProfile (_In_ HANDLE ProfileHandle)
 
NTSYSAPI NTSTATUS NTAPI ZwStopProfile (_In_ HANDLE ProfileHandle)
 
NTSYSAPI NTSTATUS NTAPI ZwTestAlert (VOID)
 
NTSYSAPI NTSTATUS NTAPI ZwVdmControl (_In_ ULONG ControlCode, _In_ PVOID ControlData)
 
NTSYSAPI NTSTATUS NTAPI ZwW32Call (_In_ ULONG RoutineIndex, _In_ PVOID Argument, _In_ ULONG ArgumentLength, _Out_opt_ PVOID *Result, _Out_opt_ PULONG ResultLength)
 
NTSYSAPI NTSTATUS NTAPI ZwYieldExecution (VOID)
 

Function Documentation

◆ Ke386CallBios()

NTSTATUS NTAPI Ke386CallBios ( _In_ ULONG  BiosCommand,
_Inout_ PCONTEXT  BiosArguments 
)

◆ KeAcquireInStackQueuedSpinLockRaiseToSynch()

VOID FASTCALL KeAcquireInStackQueuedSpinLockRaiseToSynch ( _In_ PKSPIN_LOCK  SpinLock,
_In_ PKLOCK_QUEUE_HANDLE  LockHandle 
)

◆ KeAcquireQueuedSpinLockRaiseToSynch()

KIRQL FASTCALL KeAcquireQueuedSpinLockRaiseToSynch ( _In_ KSPIN_LOCK_QUEUE_NUMBER  LockNumber)

◆ KeAddSystemServiceTable()

BOOLEAN NTAPI KeAddSystemServiceTable ( _In_ PULONG_PTR  Base,
_In_opt_ PULONG  Count,
_In_ ULONG  Limit,
_In_ PUCHAR  Number,
_In_ ULONG  Index 
)

◆ KeConnectInterrupt()

BOOLEAN NTAPI KeConnectInterrupt ( _Inout_ PKINTERRUPT  InterruptObject)

◆ KeDisconnectInterrupt()

BOOLEAN NTAPI KeDisconnectInterrupt ( _Inout_ PKINTERRUPT  InterruptObject)

◆ KeEnterKernelDebugger()

VOID NTAPI KeEnterKernelDebugger ( VOID  )

Definition at line 1480 of file bug.c.

1481 {
1482  /* Disable interrupts */
1483  KiHardwareTrigger = 1;
1484  _disable();
1485 
1486  /* Check the bugcheck count */
1488  {
1489  /* There was only one, is the debugger disabled? */
1490  if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
1491  {
1492  /* Enable the debugger */
1493  KdInitSystem(0, NULL);
1494  }
1495  }
1496 
1497  /* Break in the debugger */
1499 }
#define DBG_STATUS_FATAL
Definition: kdtypes.h:43
VOID NTAPI KiBugCheckDebugBreak(IN ULONG StatusCode)
Definition: bug.c:527
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN KdDebuggerEnabled
Definition: kdmain.c:16
#define InterlockedDecrement
Definition: armddk.h:52
BOOLEAN KdPitchDebugger
Definition: kdmain.c:21
BOOLEAN NTAPI KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:174
void __cdecl _disable(void)
Definition: intrin_arm.h:365
signed int * PLONG
Definition: retypes.h:5
ULONG KiHardwareTrigger
Definition: bug.c:28
ULONG KeBugCheckCount
Definition: bug.c:27

◆ KeFlushEntireTb()

VOID NTAPI KeFlushEntireTb ( _In_ BOOLEAN  Invalid,
_In_ BOOLEAN  AllProcessors 
)

◆ KeGenericCallDpc()

VOID NTAPI KeGenericCallDpc ( _In_ PKDEFERRED_ROUTINE  Routine,
_In_ PVOID  Context 
)

◆ KeGetCurrentProcess()

PKPROCESS NTAPI KeGetCurrentProcess ( VOID  )

◆ KeInitializeApc()

VOID NTAPI KeInitializeApc ( _In_ PKAPC  Apc,
_In_ PKTHREAD  Thread,
_In_ KAPC_ENVIRONMENT  TargetEnvironment,
_In_ PKKERNEL_ROUTINE  KernelRoutine,
_In_opt_ PKRUNDOWN_ROUTINE  RundownRoutine,
_In_ PKNORMAL_ROUTINE  NormalRoutine,
_In_ KPROCESSOR_MODE  Mode,
_In_ PVOID  Context 
)

◆ KeInitializeInterrupt()

VOID NTAPI KeInitializeInterrupt ( _Out_ PKINTERRUPT  InterruptObject,
_In_ PKSERVICE_ROUTINE  ServiceRoutine,
_In_ PVOID  ServiceContext,
_In_ PKSPIN_LOCK  SpinLock,
_In_ ULONG  Vector,
_In_ KIRQL  Irql,
_In_ KIRQL  SynchronizeIrql,
_In_ KINTERRUPT_MODE  InterruptMode,
_In_ BOOLEAN  ShareVector,
_In_ CHAR  ProcessorNumber,
_In_ BOOLEAN  FloatingSave 
)

◆ KeInsertQueueApc()

BOOLEAN NTAPI KeInsertQueueApc ( _In_ PKAPC  Apc,
_In_ PVOID  SystemArgument1,
_In_ PVOID  SystemArgument2,
_In_ KPRIORITY  PriorityBoost 
)

◆ KeIsAttachedProcess()

BOOLEAN NTAPI KeIsAttachedProcess ( VOID  )

Definition at line 690 of file procobj.c.

691 {
692  /* Return the APC State */
693  return KeGetCurrentThread()->ApcStateIndex;
694 }
#define KeGetCurrentThread
Definition: hal.h:44

Referenced by MiAccessCheck(), MiCheckForUserStackOverflow(), ObpCloseHandle(), PspExitThread(), and RtlWalkFrameChain().

◆ KeIsExecutingDpc()

◆ KeProfileInterrupt()

VOID NTAPI KeProfileInterrupt ( _In_ PKTRAP_FRAME  TrapFrame)

◆ KeProfileInterruptWithSource()

VOID NTAPI KeProfileInterruptWithSource ( _In_ PKTRAP_FRAME  TrapFrame,
_In_ KPROFILE_SOURCE  Source 
)

◆ KeRaiseUserException()

NTSTATUS NTAPI KeRaiseUserException ( _In_ NTSTATUS  ExceptionCode)

Definition at line 266 of file exp.c.

268 {
269  ASSERT(FALSE);
270  return STATUS_NOT_IMPLEMENTED;
271 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ KeSetAffinityThread()

KAFFINITY NTAPI KeSetAffinityThread ( _Inout_ PKTHREAD  Thread,
_In_ KAFFINITY  Affinity 
)

◆ KeSetDmaIoCoherency()

VOID NTAPI KeSetDmaIoCoherency ( _In_ ULONG  Coherency)

◆ KeSetEventBoostPriority()

VOID NTAPI KeSetEventBoostPriority ( _In_ PKEVENT  Event,
_In_opt_ PKTHREAD Thread 
)

◆ KeSetGdtSelector()

VOID KeSetGdtSelector ( _In_ ULONG  Entry,
_In_ ULONG  Value1,
_In_ ULONG  Value2 
)

◆ KeSetProfileIrql()

VOID NTAPI KeSetProfileIrql ( _In_ KIRQL  ProfileIrql)

◆ KeSetTimeIncrement()

VOID NTAPI KeSetTimeIncrement ( _In_ ULONG  MaxIncrement,
_In_ ULONG  MinIncrement 
)

◆ KeSignalCallDpcDone()

VOID NTAPI KeSignalCallDpcDone ( _In_ PVOID  SystemArgument1)

◆ KeSignalCallDpcSynchronize()

BOOLEAN NTAPI KeSignalCallDpcSynchronize ( _In_ PVOID  SystemArgument2)

◆ KeTerminateThread()

VOID NTAPI KeTerminateThread ( _In_ KPRIORITY  Increment)

◆ KeTryToAcquireQueuedSpinLockRaiseToSynch()

BOOLEAN FASTCALL KeTryToAcquireQueuedSpinLockRaiseToSynch ( _In_ KSPIN_LOCK_QUEUE_NUMBER  LockNumber,
_In_ PKIRQL  OldIrql 
)

◆ KeUserModeCallback()

NTSTATUS NTAPI KeUserModeCallback ( _In_ ULONG  FunctionID,
_In_reads_opt_(InputLength) PVOID  InputBuffer,
_In_ ULONG  InputLength,
_Outptr_result_buffer_ *OutputLength PVOID OutputBuffer,
_Out_ PULONG  OutputLength 
)

◆ KiAcquireSpinLock()

VOID FASTCALL KiAcquireSpinLock ( _Inout_ PKSPIN_LOCK  SpinLock)

◆ KiCoprocessorError()

VOID NTAPI KiCoprocessorError ( VOID  )

Definition at line 1350 of file cpu.c.

1351 {
1352  PFX_SAVE_AREA NpxArea;
1353 
1354  /* Get the FPU area */
1356 
1357  /* Set CR0_TS */
1358  NpxArea->Cr0NpxState = CR0_TS;
1360 }
#define CR0_TS
Definition: asm.h:248
__INTRIN_INLINE void __writecr0(unsigned int Data)
Definition: intrin_x86.h:1675
ULONG Cr0NpxState
Definition: ketypes.h:449
FORCEINLINE PFX_SAVE_AREA KiGetThreadNpxArea(IN PKTHREAD Thread)
Definition: ke.h:600
__INTRIN_INLINE unsigned long __readcr0(void)
Definition: intrin_x86.h:1697
#define KeGetCurrentThread
Definition: hal.h:44

◆ KiDeliverApc()

VOID NTAPI KiDeliverApc ( _In_ KPROCESSOR_MODE  PreviousMode,
_Reserved_ PKEXCEPTION_FRAME  ExceptionFrame,
_In_ PKTRAP_FRAME  TrapFrame 
)

◆ KiDispatchInterrupt()

VOID NTAPI KiDispatchInterrupt ( VOID  )

Definition at line 295 of file thrdini.c.

296 {
297  PKIPCR Pcr = (PKIPCR)KeGetPcr();
298  PKPRCB Prcb = &Pcr->Prcb;
299  PKTHREAD NewThread, OldThread;
300 
301  /* Disable interrupts */
302  _disable();
303 
304  /* Check for pending timers, pending DPCs, or pending ready threads */
305  if ((Prcb->DpcData[0].DpcQueueDepth) ||
306  (Prcb->TimerRequest) ||
307  (Prcb->DeferredReadyListHead.Next))
308  {
309  /* Retire DPCs while under the DPC stack */
310  //KiRetireDpcListInDpcStack(Prcb, Prcb->DpcStack);
311  // FIXME!!! //
312  KiRetireDpcList(Prcb);
313  }
314 
315  /* Re-enable interrupts */
316  _enable();
317 
318  /* Check for quantum end */
319  if (Prcb->QuantumEnd)
320  {
321  /* Handle quantum end */
322  Prcb->QuantumEnd = FALSE;
323  KiQuantumEnd();
324  }
325  else if (Prcb->NextThread)
326  {
327  /* Capture current thread data */
328  OldThread = Prcb->CurrentThread;
329  NewThread = Prcb->NextThread;
330 
331  /* Set new thread data */
332  Prcb->NextThread = NULL;
333  Prcb->CurrentThread = NewThread;
334 
335  /* The thread is now running */
336  NewThread->State = Running;
337  OldThread->WaitReason = WrDispatchInt;
338 
339  /* Make the old thread ready */
340  KxQueueReadyThread(OldThread, Prcb);
341 
342  /* Swap to the new thread */
343  KiSwapContext(APC_LEVEL, OldThread);
344  }
345 }
KDPC_DATA DpcData[2]
Definition: ketypes.h:676
void __cdecl _enable(void)
Definition: intrin_arm.h:373
struct _KIPCR * PKIPCR
VOID NTAPI KiQuantumEnd(VOID)
Definition: dpc.c:465
UCHAR QuantumEnd
Definition: ketypes.h:696
struct _KTHREAD * NextThread
Definition: ketypes.h:567
#define KeGetPcr()
Definition: ke.h:25
BOOLEAN FASTCALL KiSwapContext(IN KIRQL WaitIrql, IN PKTHREAD CurrentThread)
FORCEINLINE VOID KxQueueReadyThread(IN PKTHREAD Thread, IN PKPRCB Prcb)
Definition: ke_x.h:1343
struct _KTHREAD * CurrentThread
Definition: ketypes.h:566
smooth NULL
Definition: ftsmooth.c:416
UCHAR WaitReason
Definition: ketypes.h:1854
UINT64 TimerRequest
Definition: ketypes.h:691
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:636
KPRCB Prcb
Definition: ketypes.h:889
SINGLE_LIST_ENTRY DeferredReadyListHead
Definition: ketypes.h:628
volatile ULONG DpcQueueDepth
Definition: ketypes.h:746
volatile UCHAR State
Definition: ketypes.h:1679
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define APC_LEVEL
Definition: env_spec_w32.h:695
VOID FASTCALL KiRetireDpcList(IN PKPRCB Prcb)
Definition: dpc.c:561

Referenced by _HalpDispatchInterruptHandler(), HalpDispatchInterruptHandler(), HalpLowerIrql(), and KiInitializePcr().

◆ KiIpiServiceRoutine()

BOOLEAN NTAPI KiIpiServiceRoutine ( _In_ PKTRAP_FRAME  TrapFrame,
_Reserved_ PKEXCEPTION_FRAME  ExceptionFrame 
)

◆ KiReleaseSpinLock()

VOID FASTCALL KiReleaseSpinLock ( _Inout_ PKSPIN_LOCK  SpinLock)

◆ KiUnexpectedInterrupt()

DECLSPEC_NORETURN VOID __cdecl KiUnexpectedInterrupt ( VOID  )

Definition at line 51 of file interrupt.c.

52 {
53  /* Crash the machine */
54  KeBugCheck(TRAP_CAUSE_UNKNOWN);
55 }
VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1469

Referenced by KiInitializeKernel().

◆ NtCallbackReturn()

NTSYSCALLAPI NTSTATUS NTAPI NtCallbackReturn ( _In_ PVOID  Result,
_In_ ULONG  ResultLength,
_In_ NTSTATUS  Status 
)

Definition at line 331 of file usercall.c.

335 {
336  ASSERT(FALSE);
337  return STATUS_NOT_IMPLEMENTED;
338 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ NtContinue()

NTSYSCALLAPI NTSTATUS NTAPI NtContinue ( _In_ PCONTEXT  Context,
_In_ BOOLEAN  TestAlert 
)

◆ NtCreateProfile()

NTSYSCALLAPI NTSTATUS NTAPI NtCreateProfile ( _Out_ PHANDLE  ProfileHandle,
_In_ HANDLE  ProcessHandle,
_In_ PVOID  ImageBase,
_In_ SIZE_T  ImageSize,
_In_ ULONG  Granularity,
_Out_ PVOID  Buffer,
_In_ ULONG  ProfilingSize,
_In_ KPROFILE_SOURCE  Source,
_In_ KAFFINITY  ProcessorMask 
)

◆ NtCreateProfileEx()

NTSYSCALLAPI NTSTATUS NTAPI NtCreateProfileEx ( _Out_ PHANDLE  ProfileHandle,
_In_ HANDLE  ProcessHandle,
_In_ PVOID  ImageBase,
_In_ SIZE_T  ImageSize,
_In_ ULONG  Granularity,
_Out_ PVOID  Buffer,
_In_ ULONG  ProfilingSize,
_In_ KPROFILE_SOURCE  Source,
_In_ USHORT  GroupCount,
_In_reads_(GroupCount) PGROUP_AFFINITY  Affinity 
)

◆ NtDelayExecution()

NTSYSCALLAPI NTSTATUS NTAPI NtDelayExecution ( _In_ BOOLEAN  Alertable,
_In_ LARGE_INTEGER Interval 
)

◆ NtGetContextThread()

NTSYSCALLAPI NTSTATUS NTAPI NtGetContextThread ( _In_ HANDLE  ThreadHandle,
_Out_ PCONTEXT  Context 
)

◆ NtGetCurrentProcessorNumber()

ULONG NTAPI NtGetCurrentProcessorNumber ( VOID  )

Definition at line 2957 of file sysinfo.c.

2958 {
2959  /* Just use Ke */
2960  return KeGetCurrentProcessorNumber();
2961 }
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:325

◆ NtGetTickCount()

NTSYSCALLAPI ULONG NTAPI NtGetTickCount ( VOID  )

◆ NtQueryIntervalProfile()

NTSYSCALLAPI NTSTATUS NTAPI NtQueryIntervalProfile ( _In_ KPROFILE_SOURCE  ProfileSource,
_Out_ PULONG  Interval 
)

◆ NtQueryPerformanceCounter()

NTSYSCALLAPI NTSTATUS NTAPI NtQueryPerformanceCounter ( _Out_ PLARGE_INTEGER  Counter,
_Out_opt_ PLARGE_INTEGER  Frequency 
)

◆ NtQuerySystemTime()

NTSYSCALLAPI NTSTATUS NTAPI NtQuerySystemTime ( _Out_ PLARGE_INTEGER  CurrentTime)

◆ NtQueryTimerResolution()

NTSYSCALLAPI NTSTATUS NTAPI NtQueryTimerResolution ( _Out_ PULONG  MinimumResolution,
_Out_ PULONG  MaximumResolution,
_Out_ PULONG  ActualResolution 
)

◆ NtQueueApcThread()

NTSYSCALLAPI NTSTATUS NTAPI NtQueueApcThread ( _In_ HANDLE  ThreadHandle,
_In_ PKNORMAL_ROUTINE  ApcRoutine,
_In_opt_ PVOID  NormalContext,
_In_opt_ PVOID  SystemArgument1,
_In_opt_ PVOID  SystemArgument2 
)

◆ NtRaiseException()

NTSYSCALLAPI NTSTATUS NTAPI NtRaiseException ( _In_ PEXCEPTION_RECORD  ExceptionRecord,
_In_ PCONTEXT  Context,
_In_ BOOLEAN  SearchFrames 
)

◆ NtSetContextThread()

NTSYSCALLAPI NTSTATUS NTAPI NtSetContextThread ( _In_ HANDLE  ThreadHandle,
_In_ PCONTEXT  Context 
)

◆ NtSetIntervalProfile()

NTSYSCALLAPI NTSTATUS NTAPI NtSetIntervalProfile ( _In_ ULONG  Interval,
_In_ KPROFILE_SOURCE  ClockSource 
)

◆ NtSetLdtEntries()

NTSYSCALLAPI NTSTATUS NTAPI NtSetLdtEntries ( _In_ ULONG  Selector1,
_In_ LDT_ENTRY  LdtEntry1,
_In_ ULONG  Selector2,
_In_ LDT_ENTRY  LdtEntry2 
)

◆ NtSetSystemTime()

NTSYSCALLAPI NTSTATUS NTAPI NtSetSystemTime ( _In_ PLARGE_INTEGER  SystemTime,
_In_opt_ PLARGE_INTEGER  NewSystemTime 
)

◆ NtSetTimerResolution()

NTSYSCALLAPI NTSTATUS NTAPI NtSetTimerResolution ( _In_ ULONG  RequestedResolution,
_In_ BOOLEAN  SetOrUnset,
_Out_ PULONG  ActualResolution 
)

◆ NtStartProfile()

NTSYSCALLAPI NTSTATUS NTAPI NtStartProfile ( _In_ HANDLE  ProfileHandle)

◆ NtStopProfile()

NTSYSCALLAPI NTSTATUS NTAPI NtStopProfile ( _In_ HANDLE  ProfileHandle)

◆ NtTestAlert()

NTSYSCALLAPI NTSTATUS NTAPI NtTestAlert ( VOID  )

Definition at line 465 of file state.c.

466 {
467  /* Check and Alert Thread if needed */
470 }
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2966
#define STATUS_ALERTED
Definition: ntstatus.h:80
BOOLEAN NTAPI KeTestAlertThread(IN KPROCESSOR_MODE AlertMode)
Definition: thrdobj.c:731
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ NtVdmControl()

NTSYSCALLAPI NTSTATUS NTAPI NtVdmControl ( _In_ ULONG  ControlCode,
_In_ PVOID  ControlData 
)

◆ NtW32Call()

NTSYSCALLAPI NTSTATUS NTAPI NtW32Call ( _In_ ULONG  RoutineIndex,
_In_ PVOID  Argument,
_In_ ULONG  ArgumentLength,
_Out_opt_ PVOID Result,
_Out_opt_ PULONG  ResultLength 
)

◆ NtYieldExecution()

NTSYSCALLAPI NTSTATUS NTAPI NtYieldExecution ( VOID  )

Definition at line 744 of file thrdschd.c.

745 {
747  KIRQL OldIrql;
748  PKPRCB Prcb;
749  PKTHREAD Thread, NextThread;
750 
751  /* NB: No instructions (other than entry code) should preceed this line */
752 
753  /* Fail if there's no ready summary */
755 
756  /* Now get the current thread, set the status... */
759 
760  /* Raise IRQL to synch and get the KPRCB now */
762  Prcb = KeGetCurrentPrcb();
763 
764  /* Now check if there's still a ready summary */
765  if (Prcb->ReadySummary)
766  {
767  /* Acquire thread and PRCB lock */
769  KiAcquirePrcbLock(Prcb);
770 
771  /* Find a new thread to run if none was selected */
772  if (!Prcb->NextThread) Prcb->NextThread = KiSelectReadyThread(1, Prcb);
773 
774  /* Make sure we still have a next thread to schedule */
775  NextThread = Prcb->NextThread;
776  if (NextThread)
777  {
778  /* Reset quantum and recalculate priority */
779  Thread->Quantum = Thread->QuantumReset;
780  Thread->Priority = KiComputeNewPriority(Thread, 1);
781 
782  /* Release the thread lock */
784 
785  /* Set context swap busy */
787 
788  /* Set the new thread as running */
789  Prcb->NextThread = NULL;
790  Prcb->CurrentThread = NextThread;
791  NextThread->State = Running;
792 
793  /* Setup a yield wait and queue the thread */
794  Thread->WaitReason = WrYieldExecution;
795  KxQueueReadyThread(Thread, Prcb);
796 
797  /* Make it wait at APC_LEVEL */
798  Thread->WaitIrql = APC_LEVEL;
799 
800  /* Sanity check */
802 
803  /* Swap to new thread */
806  }
807  else
808  {
809  /* Release the PRCB and thread lock */
810  KiReleasePrcbLock(Prcb);
812  }
813  }
814 
815  /* Lower IRQL and return */
817  return Status;
818 }
FORCEINLINE VOID KiReleaseThreadLock(IN PKTHREAD Thread)
Definition: ke_x.h:244
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
FORCEINLINE VOID KiReleasePrcbLock(IN PKPRCB Prcb)
Definition: ke_x.h:224
#define STATUS_NO_YIELD_PERFORMED
Definition: ntstatus.h:150
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE VOID KiSetThreadSwapBusy(IN PKTHREAD Thread)
Definition: ke_x.h:204
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
struct _KTHREAD * NextThread
Definition: ketypes.h:567
BOOLEAN FASTCALL KiSwapContext(IN KIRQL WaitIrql, IN PKTHREAD CurrentThread)
FORCEINLINE SCHAR KiComputeNewPriority(IN PKTHREAD Thread, IN SCHAR Adjustment)
Definition: ke_x.h:1458
UCHAR KIRQL
Definition: env_spec_w32.h:591
FORCEINLINE VOID KxQueueReadyThread(IN PKTHREAD Thread, IN PKPRCB Prcb)
Definition: ke_x.h:1343
#define KiGetCurrentReadySummary()
Definition: thrdschd.c:736
struct _KTHREAD * CurrentThread
Definition: ketypes.h:566
FORCEINLINE VOID KiAcquirePrcbLock(IN PKPRCB Prcb)
Definition: ke_x.h:214
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE VOID KiAcquireThreadLock(IN PKTHREAD Thread)
Definition: ke_x.h:234
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Status
Definition: gdiplustypes.h:24
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG ReadySummary
Definition: ketypes.h:726
FORCEINLINE PKTHREAD KiSelectReadyThread(IN KPRIORITY Priority, IN PKPRCB Prcb)
Definition: ke_x.h:1408
volatile UCHAR State
Definition: ketypes.h:1679
#define KeGetCurrentThread
Definition: hal.h:44
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define APC_LEVEL
Definition: env_spec_w32.h:695
KIRQL NTAPI KeRaiseIrqlToSynchLevel(VOID)
Definition: pic.c:156

◆ ZwCallbackReturn()

◆ ZwContinue()

NTSYSAPI NTSTATUS NTAPI ZwContinue ( _In_ PCONTEXT  Context,
_In_ BOOLEAN  TestAlert 
)

Referenced by RtlRaiseException(), and RtlUnwind().

◆ ZwCreateProfile()

NTSYSAPI NTSTATUS NTAPI ZwCreateProfile ( _Out_ PHANDLE  ProfileHandle,
_In_ HANDLE  ProcessHandle,
_In_ PVOID  ImageBase,
_In_ ULONG  ImageSize,
_In_ ULONG  Granularity,
_Out_ PVOID  Buffer,
_In_ ULONG  ProfilingSize,
_In_ KPROFILE_SOURCE  Source,
_In_ KAFFINITY  ProcessorMask 
)

◆ ZwDelayExecution()

NTSYSAPI NTSTATUS NTAPI ZwDelayExecution ( _In_ BOOLEAN  Alertable,
_In_ LARGE_INTEGER Interval 
)

Referenced by LdrpInit().

◆ ZwFlushInstructionCache()

NTSYSAPI NTSTATUS NTAPI ZwFlushInstructionCache ( _In_ HANDLE  ProcessHandle,
_In_ PVOID  BaseAddress,
_In_ ULONG  NumberOfBytesToFlush 
)

◆ ZwGetContextThread()

NTSYSAPI NTSTATUS NTAPI ZwGetContextThread ( _In_ HANDLE  ThreadHandle,
_Out_ PCONTEXT  Context 
)

◆ ZwGetTickCount()

NTSYSAPI ULONG NTAPI ZwGetTickCount ( VOID  )

◆ ZwQueryIntervalProfile()

NTSYSAPI NTSTATUS NTAPI ZwQueryIntervalProfile ( _In_ KPROFILE_SOURCE  ProfileSource,
_Out_ PULONG  Interval 
)

◆ ZwQueryPerformanceCounter()

NTSYSAPI NTSTATUS NTAPI ZwQueryPerformanceCounter ( _Out_ PLARGE_INTEGER  Counter,
_Out_opt_ PLARGE_INTEGER  Frequency 
)

Referenced by RtlpPageHeapCreate().

◆ ZwQuerySystemTime()

NTSYSAPI NTSTATUS NTAPI ZwQuerySystemTime ( _Out_ PLARGE_INTEGER  CurrentTime)

◆ ZwQueryTimerResolution()

NTSYSAPI NTSTATUS NTAPI ZwQueryTimerResolution ( _Out_ PULONG  MinimumResolution,
_Out_ PULONG  MaximumResolution,
_Out_ PULONG  ActualResolution 
)

◆ ZwQueueApcThread()

NTSYSAPI NTSTATUS NTAPI ZwQueueApcThread ( _In_ HANDLE  ThreadHandle,
_In_ PKNORMAL_ROUTINE  ApcRoutine,
_In_opt_ PVOID  NormalContext,
_In_opt_ PVOID  SystemArgument1,
_In_opt_ PVOID  SystemArgument2 
)

◆ ZwRaiseException()

NTSYSAPI NTSTATUS NTAPI ZwRaiseException ( _In_ PEXCEPTION_RECORD  ExceptionRecord,
_In_ PCONTEXT  Context,
_In_ BOOLEAN  SearchFrames 
)

◆ ZwSetContextThread()

NTSYSAPI NTSTATUS NTAPI ZwSetContextThread ( _In_ HANDLE  ThreadHandle,
_In_ PCONTEXT  Context 
)

◆ ZwSetIntervalProfile()

NTSYSAPI NTSTATUS NTAPI ZwSetIntervalProfile ( _In_ ULONG  Interval,
_In_ KPROFILE_SOURCE  ClockSource 
)

◆ ZwSetLdtEntries()

NTSYSAPI NTSTATUS NTAPI ZwSetLdtEntries ( _In_ ULONG  Selector1,
_In_ LDT_ENTRY  LdtEntry1,
_In_ ULONG  Selector2,
_In_ LDT_ENTRY  LdtEntry2 
)

◆ ZwSetSystemTime()

NTSYSAPI NTSTATUS NTAPI ZwSetSystemTime ( _In_ PLARGE_INTEGER  SystemTime,
_In_opt_ PLARGE_INTEGER  NewSystemTime 
)

◆ ZwSetTimerResolution()

NTSYSAPI NTSTATUS NTAPI ZwSetTimerResolution ( _In_ ULONG  RequestedResolution,
_In_ BOOLEAN  SetOrUnset,
_Out_ PULONG  ActualResolution 
)

Referenced by PspExitProcess().

◆ ZwStartProfile()

NTSYSAPI NTSTATUS NTAPI ZwStartProfile ( _In_ HANDLE  ProfileHandle)

◆ ZwStopProfile()

NTSYSAPI NTSTATUS NTAPI ZwStopProfile ( _In_ HANDLE  ProfileHandle)

◆ ZwTestAlert()

NTSYSAPI NTSTATUS NTAPI ZwTestAlert ( VOID  )

◆ ZwVdmControl()

NTSYSAPI NTSTATUS NTAPI ZwVdmControl ( _In_ ULONG  ControlCode,
_In_ PVOID  ControlData 
)

◆ ZwW32Call()

NTSYSAPI NTSTATUS NTAPI ZwW32Call ( _In_ ULONG  RoutineIndex,
_In_ PVOID  Argument,
_In_ ULONG  ArgumentLength,
_Out_opt_ PVOID Result,
_Out_opt_ PULONG  ResultLength 
)

◆ ZwYieldExecution()