Sync with trunk (48237)
[reactos.git] / ntoskrnl / include / internal / ke.h
1 #pragma once
2
3 /* INCLUDES *****************************************************************/
4
5 #include "arch/ke.h"
6
7 /* INTERNAL KERNEL TYPES ****************************************************/
8
9 typedef struct _WOW64_PROCESS
10 {
11 PVOID Wow64;
12 } WOW64_PROCESS, *PWOW64_PROCESS;
13
14 typedef struct _KPROFILE_SOURCE_OBJECT
15 {
16 KPROFILE_SOURCE Source;
17 LIST_ENTRY ListEntry;
18 } KPROFILE_SOURCE_OBJECT, *PKPROFILE_SOURCE_OBJECT;
19
20 typedef enum _CONNECT_TYPE
21 {
22 NoConnect,
23 NormalConnect,
24 ChainConnect,
25 UnknownConnect
26 } CONNECT_TYPE, *PCONNECT_TYPE;
27
28 typedef struct _DISPATCH_INFO
29 {
30 CONNECT_TYPE Type;
31 PKINTERRUPT Interrupt;
32 PKINTERRUPT_ROUTINE NoDispatch;
33 PKINTERRUPT_ROUTINE InterruptDispatch;
34 PKINTERRUPT_ROUTINE FloatingDispatch;
35 PKINTERRUPT_ROUTINE ChainedDispatch;
36 PKINTERRUPT_ROUTINE *FlatDispatch;
37 } DISPATCH_INFO, *PDISPATCH_INFO;
38
39 typedef struct _KI_SAMPLE_MAP
40 {
41 LARGE_INTEGER PerfStart;
42 LARGE_INTEGER PerfEnd;
43 LONGLONG PerfDelta;
44 LARGE_INTEGER PerfFreq;
45 LONGLONG TSCStart;
46 LONGLONG TSCEnd;
47 LONGLONG TSCDelta;
48 ULONG MHz;
49 } KI_SAMPLE_MAP, *PKI_SAMPLE_MAP;
50
51 typedef struct _KTIMER_TABLE_ENTRY
52 {
53 LIST_ENTRY Entry;
54 ULARGE_INTEGER Time;
55 } KTIMER_TABLE_ENTRY, *PKTIMER_TABLE_ENTRY;
56
57 #define MAX_TIMER_DPCS 16
58
59 typedef struct _DPC_QUEUE_ENTRY
60 {
61 PKDPC Dpc;
62 PKDEFERRED_ROUTINE Routine;
63 PVOID Context;
64 } DPC_QUEUE_ENTRY, *PDPC_QUEUE_ENTRY;
65
66 typedef struct _KNMI_HANDLER_CALLBACK
67 {
68 struct _KNMI_HANDLER_CALLBACK* Next;
69 PNMI_CALLBACK Callback;
70 PVOID Context;
71 PVOID Handle;
72 } KNMI_HANDLER_CALLBACK, *PKNMI_HANDLER_CALLBACK;
73
74 typedef PCHAR
75 (NTAPI *PKE_BUGCHECK_UNICODE_TO_ANSI)(
76 IN PUNICODE_STRING Unicode,
77 IN PCHAR Ansi,
78 IN ULONG Length
79 );
80
81 extern PKNMI_HANDLER_CALLBACK KiNmiCallbackListHead;
82 extern KSPIN_LOCK KiNmiCallbackListLock;
83 extern PVOID KeUserApcDispatcher;
84 extern PVOID KeUserCallbackDispatcher;
85 extern PVOID KeUserExceptionDispatcher;
86 extern PVOID KeRaiseUserExceptionDispatcher;
87 extern LARGE_INTEGER KeBootTime;
88 extern ULONGLONG KeBootTimeBias;
89 extern BOOLEAN ExCmosClockIsSane;
90 extern ULONG KeProcessorArchitecture;
91 extern ULONG KeProcessorLevel;
92 extern ULONG KeProcessorRevision;
93 extern ULONG KeFeatureBits;
94 extern KNODE KiNode0;
95 extern PKNODE KeNodeBlock[1];
96 extern UCHAR KeNumberNodes;
97 extern UCHAR KeProcessNodeSeed;
98 extern ETHREAD KiInitialThread;
99 extern EPROCESS KiInitialProcess;
100 extern PULONG KiInterruptTemplateObject;
101 extern PULONG KiInterruptTemplateDispatch;
102 extern PULONG KiInterruptTemplate2ndDispatch;
103 extern ULONG KiUnexpectedEntrySize;
104 extern ULONG_PTR KiDoubleFaultStack;
105 extern EX_PUSH_LOCK KernelAddressSpaceLock;
106 extern ULONG KiMaximumDpcQueueDepth;
107 extern ULONG KiMinimumDpcRate;
108 extern ULONG KiAdjustDpcThreshold;
109 extern ULONG KiIdealDpcRate;
110 extern BOOLEAN KeThreadDpcEnable;
111 extern LARGE_INTEGER KiTimeIncrementReciprocal;
112 extern UCHAR KiTimeIncrementShiftCount;
113 extern ULONG KiTimeLimitIsrMicroseconds;
114 extern ULONG KiServiceLimit;
115 extern LIST_ENTRY KeBugcheckCallbackListHead, KeBugcheckReasonCallbackListHead;
116 extern KSPIN_LOCK BugCheckCallbackLock;
117 extern KDPC KiTimerExpireDpc;
118 extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE];
119 extern FAST_MUTEX KiGenericCallDpcMutex;
120 extern LIST_ENTRY KiProfileListHead, KiProfileSourceListHead;
121 extern KSPIN_LOCK KiProfileLock;
122 extern LIST_ENTRY KiProcessListHead;
123 extern LIST_ENTRY KiProcessInSwapListHead, KiProcessOutSwapListHead;
124 extern LIST_ENTRY KiStackInSwapListHead;
125 extern KEVENT KiSwapEvent;
126 extern PKPRCB KiProcessorBlock[];
127 extern ULONG KiMask32Array[MAXIMUM_PRIORITY];
128 extern ULONG KiIdleSummary;
129 extern PVOID KeUserApcDispatcher;
130 extern PVOID KeUserCallbackDispatcher;
131 extern PVOID KeUserExceptionDispatcher;
132 extern PVOID KeRaiseUserExceptionDispatcher;
133 extern ULONG KeTimeIncrement;
134 extern ULONG KeTimeAdjustment;
135 extern LONG KiTickOffset;
136 extern ULONG_PTR KiBugCheckData[5];
137 extern ULONG KiFreezeFlag;
138 extern ULONG KiDPCTimeout;
139 extern PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch;
140 extern ULONGLONG BootCycles, BootCyclesEnd;
141 extern ULONG ProcessCount;
142 extern VOID __cdecl KiInterruptTemplate(VOID);
143
144 /* MACROS *************************************************************************/
145
146 #define AFFINITY_MASK(Id) KiMask32Array[Id]
147 #define PRIORITY_MASK(Id) KiMask32Array[Id]
148
149 /* The following macro initializes a dispatcher object's header */
150 #define KeInitializeDispatcherHeader(Header, t, s, State) \
151 { \
152 (Header)->Type = t; \
153 (Header)->Absolute = 0; \
154 (Header)->Size = s; \
155 (Header)->Inserted = 0; \
156 (Header)->SignalState = State; \
157 InitializeListHead(&((Header)->WaitListHead)); \
158 }
159
160 /* Tells us if the Timer or Event is a Syncronization or Notification Object */
161 #define TIMER_OR_EVENT_TYPE 0x7L
162
163 /* One of the Reserved Wait Blocks, this one is for the Thread's Timer */
164 #define TIMER_WAIT_BLOCK 0x3L
165
166 #ifdef _M_ARM // FIXME: remove this once our headers are cleaned up
167 //
168 // A system call ID is formatted as such:
169 // .________________________________________________________________.
170 // | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
171 // |--------------|-------------------------------------------------|
172 // | TABLE NUMBER | TABLE OFFSET |
173 // \----------------------------------------------------------------/
174 //
175 //
176 // The table number is then used as an index into the service descriptor table.
177 #define TABLE_NUMBER_BITS 3
178 #define TABLE_OFFSET_BITS 12
179
180 //
181 // There are 2 tables (kernel and shadow, used by Win32K)
182 //
183 #define NUMBER_SERVICE_TABLES 2
184 #define NTOS_SERVICE_INDEX 0
185 #define WIN32K_SERVICE_INDEX 1
186
187 //
188 // NB. From assembly code, the table number must be computed as an offset into
189 // the service descriptor table.
190 //
191 // Each entry into the table is 16 bytes long on 32-bit architectures, and
192 // 32 bytes long on 64-bit architectures.
193 //
194 // Thus, Table Number 1 is offset 16 (0x10) on x86, and offset 32 (0x20) on
195 // x64.
196 //
197 #ifdef _WIN64
198 #define BITS_PER_ENTRY 5 // (1 << 5) = 32 bytes
199 #else
200 #define BITS_PER_ENTRY 4 // (1 << 4) = 16 bytes
201 #endif
202
203 //
204 // We want the table number, but leave some extra bits to we can have the offset
205 // into the descriptor table.
206 //
207 #define SERVICE_TABLE_SHIFT (12 - BITS_PER_ENTRY)
208
209 //
210 // Now the table number (as an offset) is corrupted with part of the table offset
211 // This mask will remove the extra unwanted bits, and give us the offset into the
212 // descriptor table proper.
213 //
214 #define SERVICE_TABLE_MASK (((1 << TABLE_NUMBER_BITS) - 1) << BITS_PER_ENTRY)
215
216 //
217 // To get the table offset (ie: the service call number), just keep the 12 bits
218 //
219 #define SERVICE_NUMBER_MASK ((1 << TABLE_OFFSET_BITS) - 1)
220
221 //
222 // We'll often need to check if this is a graphics call. This is done by comparing
223 // the table number offset with the known Win32K table number offset.
224 // This is usually index 1, so table number offset 0x10 (x86) or 0x20 (x64)
225 //
226 #define SERVICE_TABLE_TEST (WIN32K_SERVICE_INDEX << BITS_PER_ENTRY)
227
228 #endif
229
230 #define KTS_SYSCALL_BIT (((KTRAP_STATE_BITS) { { .SystemCall = TRUE } }).Bits)
231 #define KTS_PM_BIT (((KTRAP_STATE_BITS) { { .PreviousMode = TRUE } }).Bits)
232 #define KTS_SEG_BIT (((KTRAP_STATE_BITS) { { .Segments = TRUE } }).Bits)
233 #define KTS_VOL_BIT (((KTRAP_STATE_BITS) { { .Volatiles = TRUE } }).Bits)
234 #define KTS_FULL_BIT (((KTRAP_STATE_BITS) { { .Full = TRUE } }).Bits)
235
236 /* INTERNAL KERNEL FUNCTIONS ************************************************/
237
238 VOID
239 NTAPI
240 CPUID(
241 IN ULONG InfoType,
242 OUT PULONG CpuInfoEax,
243 OUT PULONG CpuInfoEbx,
244 OUT PULONG CpuInfoEcx,
245 OUT PULONG CpuInfoEdx
246 );
247
248 LONGLONG
249 FASTCALL
250 RDMSR(
251 IN ULONG Register
252 );
253
254 VOID
255 NTAPI
256 WRMSR(
257 IN ULONG Register,
258 IN LONGLONG Value
259 );
260
261 /* Finds a new thread to run */
262 LONG_PTR
263 FASTCALL
264 KiSwapThread(
265 IN PKTHREAD Thread,
266 IN PKPRCB Prcb
267 );
268
269 VOID
270 NTAPI
271 KeReadyThread(
272 IN PKTHREAD Thread
273 );
274
275 BOOLEAN
276 NTAPI
277 KeSetDisableBoostThread(
278 IN OUT PKTHREAD Thread,
279 IN BOOLEAN Disable
280 );
281
282 VOID
283 NTAPI
284 KeBalanceSetManager(IN PVOID Context);
285
286 VOID
287 NTAPI
288 KiReadyThread(IN PKTHREAD Thread);
289
290 ULONG
291 NTAPI
292 KeSuspendThread(PKTHREAD Thread);
293
294 BOOLEAN
295 NTAPI
296 KeReadStateThread(IN PKTHREAD Thread);
297
298 BOOLEAN
299 FASTCALL
300 KiSwapContext(
301 IN PKTHREAD CurrentThread,
302 IN PKTHREAD NewThread
303 );
304
305 VOID
306 NTAPI
307 KiAdjustQuantumThread(IN PKTHREAD Thread);
308
309 VOID
310 FASTCALL
311 KiExitDispatcher(KIRQL OldIrql);
312
313 VOID
314 FASTCALL
315 KiDeferredReadyThread(IN PKTHREAD Thread);
316
317 PKTHREAD
318 FASTCALL
319 KiIdleSchedule(
320 IN PKPRCB Prcb
321 );
322
323 VOID
324 FASTCALL
325 KiProcessDeferredReadyList(
326 IN PKPRCB Prcb
327 );
328
329 KAFFINITY
330 FASTCALL
331 KiSetAffinityThread(
332 IN PKTHREAD Thread,
333 IN KAFFINITY Affinity
334 );
335
336 PKTHREAD
337 FASTCALL
338 KiSelectNextThread(
339 IN PKPRCB Prcb
340 );
341
342 BOOLEAN
343 FASTCALL
344 KiInsertTimerTable(
345 IN PKTIMER Timer,
346 IN ULONG Hand
347 );
348
349 VOID
350 FASTCALL
351 KiTimerListExpire(
352 IN PLIST_ENTRY ExpiredListHead,
353 IN KIRQL OldIrql
354 );
355
356 BOOLEAN
357 FASTCALL
358 KiInsertTreeTimer(
359 IN PKTIMER Timer,
360 IN LARGE_INTEGER Interval
361 );
362
363 VOID
364 FASTCALL
365 KiCompleteTimer(
366 IN PKTIMER Timer,
367 IN PKSPIN_LOCK_QUEUE LockQueue
368 );
369
370 /* gmutex.c ********************************************************************/
371
372 VOID
373 FASTCALL
374 KiAcquireGuardedMutex(
375 IN OUT PKGUARDED_MUTEX GuardedMutex
376 );
377
378 VOID
379 FASTCALL
380 KiAcquireFastMutex(
381 IN PFAST_MUTEX FastMutex
382 );
383
384 /* gate.c **********************************************************************/
385
386 VOID
387 FASTCALL
388 KeInitializeGate(PKGATE Gate);
389
390 VOID
391 FASTCALL
392 KeSignalGateBoostPriority(PKGATE Gate);
393
394 VOID
395 FASTCALL
396 KeWaitForGate(
397 PKGATE Gate,
398 KWAIT_REASON WaitReason,
399 KPROCESSOR_MODE WaitMode
400 );
401
402 /* ipi.c ********************************************************************/
403
404 VOID
405 FASTCALL
406 KiIpiSend(
407 KAFFINITY TargetSet,
408 ULONG IpiRequest
409 );
410
411 VOID
412 NTAPI
413 KiIpiSendPacket(
414 IN KAFFINITY TargetProcessors,
415 IN PKIPI_WORKER WorkerFunction,
416 IN PKIPI_BROADCAST_WORKER BroadcastFunction,
417 IN ULONG_PTR Context,
418 IN PULONG Count
419 );
420
421 VOID
422 FASTCALL
423 KiIpiSignalPacketDone(
424 IN PKIPI_CONTEXT PacketContext
425 );
426
427 VOID
428 FASTCALL
429 KiIpiSignalPacketDoneAndStall(
430 IN PKIPI_CONTEXT PacketContext,
431 IN volatile PULONG ReverseStall
432 );
433
434 /* next file ***************************************************************/
435
436 UCHAR
437 NTAPI
438 KeFindNextRightSetAffinity(
439 IN UCHAR Number,
440 IN ULONG Set
441 );
442
443 VOID
444 NTAPI
445 DbgBreakPointNoBugCheck(VOID);
446
447 VOID
448 NTAPI
449 KeInitializeProfile(
450 struct _KPROFILE* Profile,
451 struct _KPROCESS* Process,
452 PVOID ImageBase,
453 ULONG ImageSize,
454 ULONG BucketSize,
455 KPROFILE_SOURCE ProfileSource,
456 KAFFINITY Affinity
457 );
458
459 BOOLEAN
460 NTAPI
461 KeStartProfile(
462 struct _KPROFILE* Profile,
463 PVOID Buffer
464 );
465
466 BOOLEAN
467 NTAPI
468 KeStopProfile(struct _KPROFILE* Profile);
469
470 ULONG
471 NTAPI
472 KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource);
473
474 VOID
475 NTAPI
476 KeSetIntervalProfile(
477 KPROFILE_SOURCE ProfileSource,
478 ULONG Interval
479 );
480
481 VOID
482 NTAPI
483 KeProfileInterrupt(
484 PKTRAP_FRAME TrapFrame
485 );
486
487 VOID
488 NTAPI
489 KeProfileInterruptWithSource(
490 IN PKTRAP_FRAME TrapFrame,
491 IN KPROFILE_SOURCE Source
492 );
493
494 VOID
495 NTAPI
496 KeUpdateRunTime(
497 PKTRAP_FRAME TrapFrame,
498 KIRQL Irql
499 );
500
501 VOID
502 NTAPI
503 KiExpireTimers(
504 PKDPC Dpc,
505 PVOID DeferredContext,
506 PVOID SystemArgument1,
507 PVOID SystemArgument2
508 );
509
510 VOID
511 NTAPI
512 KeInitializeThread(
513 IN PKPROCESS Process,
514 IN OUT PKTHREAD Thread,
515 IN PKSYSTEM_ROUTINE SystemRoutine,
516 IN PKSTART_ROUTINE StartRoutine,
517 IN PVOID StartContext,
518 IN PCONTEXT Context,
519 IN PVOID Teb,
520 IN PVOID KernelStack
521 );
522
523 VOID
524 NTAPI
525 KeUninitThread(
526 IN PKTHREAD Thread
527 );
528
529 NTSTATUS
530 NTAPI
531 KeInitThread(
532 IN OUT PKTHREAD Thread,
533 IN PVOID KernelStack,
534 IN PKSYSTEM_ROUTINE SystemRoutine,
535 IN PKSTART_ROUTINE StartRoutine,
536 IN PVOID StartContext,
537 IN PCONTEXT Context,
538 IN PVOID Teb,
539 IN PKPROCESS Process
540 );
541
542 VOID
543 NTAPI
544 KiInitializeContextThread(
545 PKTHREAD Thread,
546 PKSYSTEM_ROUTINE SystemRoutine,
547 PKSTART_ROUTINE StartRoutine,
548 PVOID StartContext,
549 PCONTEXT Context
550 );
551
552 VOID
553 NTAPI
554 KeStartThread(
555 IN OUT PKTHREAD Thread
556 );
557
558 BOOLEAN
559 NTAPI
560 KeAlertThread(
561 IN PKTHREAD Thread,
562 IN KPROCESSOR_MODE AlertMode
563 );
564
565 ULONG
566 NTAPI
567 KeAlertResumeThread(
568 IN PKTHREAD Thread
569 );
570
571 ULONG
572 NTAPI
573 KeResumeThread(
574 IN PKTHREAD Thread
575 );
576
577 PVOID
578 NTAPI
579 KeSwitchKernelStack(
580 IN PVOID StackBase,
581 IN PVOID StackLimit
582 );
583
584 VOID
585 NTAPI
586 KeRundownThread(VOID);
587
588 NTSTATUS
589 NTAPI
590 KeReleaseThread(PKTHREAD Thread);
591
592 VOID
593 NTAPI
594 KiSuspendRundown(
595 IN PKAPC Apc
596 );
597
598 VOID
599 NTAPI
600 KiSuspendNop(
601 IN PKAPC Apc,
602 IN PKNORMAL_ROUTINE *NormalRoutine,
603 IN PVOID *NormalContext,
604 IN PVOID *SystemArgument1,
605 IN PVOID *SystemArgument2
606 );
607
608 VOID
609 NTAPI
610 KiSuspendThread(
611 IN PVOID NormalContext,
612 IN PVOID SystemArgument1,
613 IN PVOID SystemArgument2
614 );
615
616 LONG
617 NTAPI
618 KeQueryBasePriorityThread(IN PKTHREAD Thread);
619
620 VOID
621 FASTCALL
622 KiSetPriorityThread(
623 IN PKTHREAD Thread,
624 IN KPRIORITY Priority
625 );
626
627 VOID
628 FASTCALL
629 KiUnlinkThread(
630 IN PKTHREAD Thread,
631 IN NTSTATUS WaitStatus
632 );
633
634 VOID
635 NTAPI
636 KeDumpStackFrames(PULONG Frame);
637
638 BOOLEAN
639 NTAPI
640 KiTestAlert(VOID);
641
642 VOID
643 FASTCALL
644 KiUnwaitThread(
645 IN PKTHREAD Thread,
646 IN LONG_PTR WaitStatus,
647 IN KPRIORITY Increment
648 );
649
650 VOID
651 NTAPI
652 KeInitializeProcess(
653 struct _KPROCESS *Process,
654 KPRIORITY Priority,
655 KAFFINITY Affinity,
656 PULONG DirectoryTableBase,
657 IN BOOLEAN Enable
658 );
659
660 VOID
661 NTAPI
662 KeSetQuantumProcess(
663 IN PKPROCESS Process,
664 IN UCHAR Quantum
665 );
666
667 KPRIORITY
668 NTAPI
669 KeSetPriorityAndQuantumProcess(
670 IN PKPROCESS Process,
671 IN KPRIORITY Priority,
672 IN UCHAR Quantum OPTIONAL
673 );
674
675 ULONG
676 NTAPI
677 KeForceResumeThread(IN PKTHREAD Thread);
678
679 VOID
680 NTAPI
681 KeThawAllThreads(
682 VOID
683 );
684
685 VOID
686 NTAPI
687 KeFreezeAllThreads(
688 VOID
689 );
690
691 BOOLEAN
692 NTAPI
693 KeDisableThreadApcQueueing(IN PKTHREAD Thread);
694
695 VOID
696 FASTCALL
697 KiWaitTest(
698 PVOID Object,
699 KPRIORITY Increment
700 );
701
702 VOID
703 NTAPI
704 KeContextToTrapFrame(
705 PCONTEXT Context,
706 PKEXCEPTION_FRAME ExeptionFrame,
707 PKTRAP_FRAME TrapFrame,
708 ULONG ContextFlags,
709 KPROCESSOR_MODE PreviousMode
710 );
711
712 VOID
713 NTAPI
714 KiCheckForKernelApcDelivery(VOID);
715
716 LONG
717 NTAPI
718 KiInsertQueue(
719 IN PKQUEUE Queue,
720 IN PLIST_ENTRY Entry,
721 BOOLEAN Head
722 );
723
724 VOID
725 NTAPI
726 KiTimerExpiration(
727 IN PKDPC Dpc,
728 IN PVOID DeferredContext,
729 IN PVOID SystemArgument1,
730 IN PVOID SystemArgument2
731 );
732
733 ULONG
734 NTAPI
735 KeSetProcess(
736 struct _KPROCESS* Process,
737 KPRIORITY Increment,
738 BOOLEAN InWait
739 );
740
741 VOID
742 NTAPI
743 KeInitializeEventPair(PKEVENT_PAIR EventPair);
744
745 VOID
746 NTAPI
747 KiInitializeUserApc(
748 IN PKEXCEPTION_FRAME Reserved,
749 IN PKTRAP_FRAME TrapFrame,
750 IN PKNORMAL_ROUTINE NormalRoutine,
751 IN PVOID NormalContext,
752 IN PVOID SystemArgument1,
753 IN PVOID SystemArgument2
754 );
755
756 PLIST_ENTRY
757 NTAPI
758 KeFlushQueueApc(
759 IN PKTHREAD Thread,
760 IN KPROCESSOR_MODE PreviousMode
761 );
762
763 VOID
764 NTAPI
765 KiAttachProcess(
766 struct _KTHREAD *Thread,
767 struct _KPROCESS *Process,
768 PKLOCK_QUEUE_HANDLE ApcLock,
769 struct _KAPC_STATE *SavedApcState
770 );
771
772 VOID
773 NTAPI
774 KiSwapProcess(
775 struct _KPROCESS *NewProcess,
776 struct _KPROCESS *OldProcess
777 );
778
779 BOOLEAN
780 NTAPI
781 KeTestAlertThread(IN KPROCESSOR_MODE AlertMode);
782
783 BOOLEAN
784 NTAPI
785 KeRemoveQueueApc(PKAPC Apc);
786
787 VOID
788 FASTCALL
789 KiActivateWaiterQueue(IN PKQUEUE Queue);
790
791 ULONG
792 NTAPI
793 KeQueryRuntimeProcess(IN PKPROCESS Process,
794 OUT PULONG UserTime);
795
796 /* INITIALIZATION FUNCTIONS *************************************************/
797
798 BOOLEAN
799 NTAPI
800 KeInitSystem(VOID);
801
802 VOID
803 NTAPI
804 KeInitExceptions(VOID);
805
806 VOID
807 NTAPI
808 KeInitInterrupts(VOID);
809
810 VOID
811 NTAPI
812 KiInitializeBugCheck(VOID);
813
814 VOID
815 NTAPI
816 KiSystemStartup(
817 IN PLOADER_PARAMETER_BLOCK LoaderBlock
818 );
819
820 BOOLEAN
821 NTAPI
822 KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
823
824 VOID
825 NTAPI
826 KiMoveApcState(
827 PKAPC_STATE OldState,
828 PKAPC_STATE NewState
829 );
830
831 VOID
832 NTAPI
833 KiAddProfileEvent(
834 KPROFILE_SOURCE Source,
835 ULONG Pc
836 );
837
838 VOID
839 NTAPI
840 KiDispatchException(
841 PEXCEPTION_RECORD ExceptionRecord,
842 PKEXCEPTION_FRAME ExceptionFrame,
843 PKTRAP_FRAME Tf,
844 KPROCESSOR_MODE PreviousMode,
845 BOOLEAN SearchFrames
846 );
847
848 VOID
849 NTAPI
850 KeTrapFrameToContext(
851 IN PKTRAP_FRAME TrapFrame,
852 IN PKEXCEPTION_FRAME ExceptionFrame,
853 IN OUT PCONTEXT Context
854 );
855
856 DECLSPEC_NORETURN
857 VOID
858 NTAPI
859 KeBugCheckWithTf(
860 ULONG BugCheckCode,
861 ULONG_PTR BugCheckParameter1,
862 ULONG_PTR BugCheckParameter2,
863 ULONG_PTR BugCheckParameter3,
864 ULONG_PTR BugCheckParameter4,
865 PKTRAP_FRAME Tf
866 );
867
868 BOOLEAN
869 NTAPI
870 KiHandleNmi(VOID);
871
872 VOID
873 NTAPI
874 KeFlushCurrentTb(VOID);
875
876 BOOLEAN
877 NTAPI
878 KeInvalidateAllCaches(VOID);
879
880 VOID
881 FASTCALL
882 KeZeroPages(IN PVOID Address,
883 IN ULONG Size);
884
885 BOOLEAN
886 FASTCALL
887 KeInvalidAccessAllowed(IN PVOID TrapInformation OPTIONAL);
888
889 VOID
890 NTAPI
891 KeRosDumpStackFrames(
892 PULONG_PTR Frame,
893 ULONG FrameCount
894 );
895
896 VOID
897 NTAPI
898 KeSetSystemTime(
899 IN PLARGE_INTEGER NewSystemTime,
900 OUT PLARGE_INTEGER OldSystemTime,
901 IN BOOLEAN FixInterruptTime,
902 IN PLARGE_INTEGER HalTime
903 );
904
905 ULONG
906 NTAPI
907 KeV86Exception(
908 ULONG ExceptionNr,
909 PKTRAP_FRAME Tf,
910 ULONG address
911 );
912
913 VOID
914 NTAPI
915 KiStartUnexpectedRange(
916 VOID
917 );
918
919 VOID
920 NTAPI
921 KiEndUnexpectedRange(
922 VOID
923 );
924
925 NTSTATUS
926 NTAPI
927 KiRaiseException(
928 IN PEXCEPTION_RECORD ExceptionRecord,
929 IN PCONTEXT Context,
930 IN PKEXCEPTION_FRAME ExceptionFrame,
931 IN PKTRAP_FRAME TrapFrame,
932 IN BOOLEAN SearchFrames
933 );
934
935 NTSTATUS
936 NTAPI
937 KiContinue(
938 IN PCONTEXT Context,
939 IN PKEXCEPTION_FRAME ExceptionFrame,
940 IN PKTRAP_FRAME TrapFrame
941 );
942
943 VOID
944 FASTCALL
945 KiServiceExit(
946 IN PKTRAP_FRAME TrapFrame,
947 IN NTSTATUS Status
948 );
949
950 VOID
951 FASTCALL
952 KiServiceExit2(
953 IN PKTRAP_FRAME TrapFrame
954 );
955
956 VOID
957 FASTCALL
958 KiInterruptDispatch(
959 IN PKTRAP_FRAME TrapFrame,
960 IN PKINTERRUPT Interrupt
961 );
962
963 VOID
964 FASTCALL
965 KiChainedDispatch(
966 IN PKTRAP_FRAME TrapFrame,
967 IN PKINTERRUPT Interrupt
968 );
969
970 VOID
971 NTAPI
972 KiInitializeMachineType(
973 VOID
974 );
975
976 VOID
977 NTAPI
978 KiSetupStackAndInitializeKernel(
979 IN PKPROCESS InitProcess,
980 IN PKTHREAD InitThread,
981 IN PVOID IdleStack,
982 IN PKPRCB Prcb,
983 IN CCHAR Number,
984 IN PLOADER_PARAMETER_BLOCK LoaderBlock
985 );
986
987 VOID
988 NTAPI
989 KiInitSpinLocks(
990 IN PKPRCB Prcb,
991 IN CCHAR Number
992 );
993
994 LARGE_INTEGER
995 NTAPI
996 KiComputeReciprocal(
997 IN LONG Divisor,
998 OUT PUCHAR Shift
999 );
1000
1001 VOID
1002 NTAPI
1003 KiInitSystem(
1004 VOID
1005 );
1006
1007 VOID
1008 FASTCALL
1009 KiInsertQueueApc(
1010 IN PKAPC Apc,
1011 IN KPRIORITY PriorityBoost
1012 );
1013
1014 NTSTATUS
1015 NTAPI
1016 KiCallUserMode(
1017 IN PVOID *OutputBuffer,
1018 IN PULONG OutputLength
1019 );
1020
1021 PULONG
1022 NTAPI
1023 KiGetUserModeStackAddress(
1024 VOID
1025 );
1026
1027 VOID
1028 NTAPI
1029 KiInitMachineDependent(VOID);
1030
1031 BOOLEAN
1032 NTAPI
1033 KeFreezeExecution(IN PKTRAP_FRAME TrapFrame,
1034 IN PKEXCEPTION_FRAME ExceptionFrame);
1035
1036 VOID
1037 NTAPI
1038 KeThawExecution(IN BOOLEAN Enable);
1039
1040 BOOLEAN
1041 NTAPI
1042 KeDisableInterrupts(
1043 VOID
1044 );
1045
1046 VOID
1047 FASTCALL
1048 KeAcquireQueuedSpinLockAtDpcLevel(
1049 IN OUT PKSPIN_LOCK_QUEUE LockQueue
1050 );
1051
1052 VOID
1053 FASTCALL
1054 KeReleaseQueuedSpinLockFromDpcLevel(
1055 IN OUT PKSPIN_LOCK_QUEUE LockQueue
1056 );
1057
1058 VOID
1059 NTAPI
1060 KiRestoreProcessorControlState(
1061 IN PKPROCESSOR_STATE ProcessorState
1062 );
1063
1064 VOID
1065 NTAPI
1066 KiSaveProcessorControlState(
1067 OUT PKPROCESSOR_STATE ProcessorState
1068 );
1069
1070 VOID
1071 NTAPI
1072 KiSaveProcessorState(
1073 IN PKTRAP_FRAME TrapFrame,
1074 IN PKEXCEPTION_FRAME ExceptionFrame
1075 );
1076
1077 VOID
1078 FASTCALL
1079 KiRetireDpcList(
1080 IN PKPRCB Prcb
1081 );
1082
1083 VOID
1084 NTAPI
1085 KiQuantumEnd(
1086 VOID
1087 );
1088
1089 VOID
1090 FASTCALL
1091 KiIdleLoop(
1092 VOID
1093 );
1094
1095 DECLSPEC_NORETURN
1096 VOID
1097 FASTCALL
1098 KiSystemFatalException(
1099 IN ULONG ExceptionCode,
1100 IN PKTRAP_FRAME TrapFrame
1101 );
1102
1103 PVOID
1104 NTAPI
1105 KiPcToFileHeader(IN PVOID Eip,
1106 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry,
1107 IN BOOLEAN DriversOnly,
1108 OUT PBOOLEAN InKernel);
1109
1110 PVOID
1111 NTAPI
1112 KiRosPcToUserFileHeader(IN PVOID Eip,
1113 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
1114
1115 #include "ke_x.h"