[NDK]
[reactos.git] / reactos / 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 _DEFERRED_REVERSE_BARRIER
40 {
41 ULONG Barrier;
42 ULONG TotalProcessors;
43 } DEFERRED_REVERSE_BARRIER, *PDEFERRED_REVERSE_BARRIER;
44
45 typedef struct _KI_SAMPLE_MAP
46 {
47 LARGE_INTEGER PerfStart;
48 LARGE_INTEGER PerfEnd;
49 LONGLONG PerfDelta;
50 LARGE_INTEGER PerfFreq;
51 LONGLONG TSCStart;
52 LONGLONG TSCEnd;
53 LONGLONG TSCDelta;
54 ULONG MHz;
55 } KI_SAMPLE_MAP, *PKI_SAMPLE_MAP;
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 USHORT KeProcessorArchitecture;
91 extern USHORT KeProcessorLevel;
92 extern USHORT 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_PTR 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 BOOLEAN KiTimeAdjustmentEnabled;
136 extern LONG KiTickOffset;
137 extern ULONG_PTR KiBugCheckData[5];
138 extern ULONG KiFreezeFlag;
139 extern ULONG KiDPCTimeout;
140 extern PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch;
141 extern ULONGLONG BootCycles, BootCyclesEnd;
142 extern ULONG ProcessCount;
143 extern VOID __cdecl KiInterruptTemplate(VOID);
144
145 /* MACROS *************************************************************************/
146
147 #define AFFINITY_MASK(Id) KiMask32Array[Id]
148 #define PRIORITY_MASK(Id) KiMask32Array[Id]
149
150 /* Tells us if the Timer or Event is a Syncronization or Notification Object */
151 #define TIMER_OR_EVENT_TYPE 0x7L
152
153 /* One of the Reserved Wait Blocks, this one is for the Thread's Timer */
154 #define TIMER_WAIT_BLOCK 0x3L
155
156 #define KTS_SYSCALL_BIT (((KTRAP_STATE_BITS) { { .SystemCall = TRUE } }).Bits)
157 #define KTS_PM_BIT (((KTRAP_STATE_BITS) { { .PreviousMode = TRUE } }).Bits)
158 #define KTS_SEG_BIT (((KTRAP_STATE_BITS) { { .Segments = TRUE } }).Bits)
159 #define KTS_VOL_BIT (((KTRAP_STATE_BITS) { { .Volatiles = TRUE } }).Bits)
160 #define KTS_FULL_BIT (((KTRAP_STATE_BITS) { { .Full = TRUE } }).Bits)
161
162 /* INTERNAL KERNEL FUNCTIONS ************************************************/
163
164 VOID
165 NTAPI
166 CPUID(
167 IN ULONG InfoType,
168 OUT PULONG CpuInfoEax,
169 OUT PULONG CpuInfoEbx,
170 OUT PULONG CpuInfoEcx,
171 OUT PULONG CpuInfoEdx
172 );
173
174 LONGLONG
175 FASTCALL
176 RDMSR(
177 IN ULONG Register
178 );
179
180 VOID
181 NTAPI
182 WRMSR(
183 IN ULONG Register,
184 IN LONGLONG Value
185 );
186
187 /* Finds a new thread to run */
188 LONG_PTR
189 FASTCALL
190 KiSwapThread(
191 IN PKTHREAD Thread,
192 IN PKPRCB Prcb
193 );
194
195 VOID
196 NTAPI
197 KeReadyThread(
198 IN PKTHREAD Thread
199 );
200
201 BOOLEAN
202 NTAPI
203 KeSetDisableBoostThread(
204 IN OUT PKTHREAD Thread,
205 IN BOOLEAN Disable
206 );
207
208 BOOLEAN
209 NTAPI
210 KeSetDisableBoostProcess(
211 IN PKPROCESS Process,
212 IN BOOLEAN Disable
213 );
214
215 BOOLEAN
216 NTAPI
217 KeSetAutoAlignmentProcess(
218 IN PKPROCESS Process,
219 IN BOOLEAN Enable
220 );
221
222 KAFFINITY
223 NTAPI
224 KeSetAffinityProcess(
225 IN PKPROCESS Process,
226 IN KAFFINITY Affinity
227 );
228
229 VOID
230 NTAPI
231 KeBoostPriorityThread(
232 IN PKTHREAD Thread,
233 IN KPRIORITY Increment
234 );
235
236 VOID
237 NTAPI
238 KeBalanceSetManager(IN PVOID Context);
239
240 VOID
241 NTAPI
242 KiReadyThread(IN PKTHREAD Thread);
243
244 ULONG
245 NTAPI
246 KeSuspendThread(PKTHREAD Thread);
247
248 BOOLEAN
249 NTAPI
250 KeReadStateThread(IN PKTHREAD Thread);
251
252 BOOLEAN
253 FASTCALL
254 KiSwapContext(
255 IN KIRQL WaitIrql,
256 IN PKTHREAD CurrentThread
257 );
258
259 VOID
260 NTAPI
261 KiAdjustQuantumThread(IN PKTHREAD Thread);
262
263 VOID
264 FASTCALL
265 KiExitDispatcher(KIRQL OldIrql);
266
267 VOID
268 FASTCALL
269 KiDeferredReadyThread(IN PKTHREAD Thread);
270
271 PKTHREAD
272 FASTCALL
273 KiIdleSchedule(
274 IN PKPRCB Prcb
275 );
276
277 VOID
278 FASTCALL
279 KiProcessDeferredReadyList(
280 IN PKPRCB Prcb
281 );
282
283 KAFFINITY
284 FASTCALL
285 KiSetAffinityThread(
286 IN PKTHREAD Thread,
287 IN KAFFINITY Affinity
288 );
289
290 PKTHREAD
291 FASTCALL
292 KiSelectNextThread(
293 IN PKPRCB Prcb
294 );
295
296 BOOLEAN
297 FASTCALL
298 KiInsertTimerTable(
299 IN PKTIMER Timer,
300 IN ULONG Hand
301 );
302
303 VOID
304 FASTCALL
305 KiTimerListExpire(
306 IN PLIST_ENTRY ExpiredListHead,
307 IN KIRQL OldIrql
308 );
309
310 BOOLEAN
311 FASTCALL
312 KiInsertTreeTimer(
313 IN PKTIMER Timer,
314 IN LARGE_INTEGER Interval
315 );
316
317 VOID
318 FASTCALL
319 KiCompleteTimer(
320 IN PKTIMER Timer,
321 IN PKSPIN_LOCK_QUEUE LockQueue
322 );
323
324 /* gmutex.c ********************************************************************/
325
326 VOID
327 FASTCALL
328 KiAcquireGuardedMutex(
329 IN OUT PKGUARDED_MUTEX GuardedMutex
330 );
331
332 VOID
333 FASTCALL
334 KiAcquireFastMutex(
335 IN PFAST_MUTEX FastMutex
336 );
337
338 /* gate.c **********************************************************************/
339
340 VOID
341 FASTCALL
342 KeInitializeGate(PKGATE Gate);
343
344 VOID
345 FASTCALL
346 KeSignalGateBoostPriority(PKGATE Gate);
347
348 VOID
349 FASTCALL
350 KeWaitForGate(
351 PKGATE Gate,
352 KWAIT_REASON WaitReason,
353 KPROCESSOR_MODE WaitMode
354 );
355
356 /* ipi.c ********************************************************************/
357
358 VOID
359 FASTCALL
360 KiIpiSend(
361 KAFFINITY TargetSet,
362 ULONG IpiRequest
363 );
364
365 VOID
366 NTAPI
367 KiIpiSendPacket(
368 IN KAFFINITY TargetProcessors,
369 IN PKIPI_WORKER WorkerFunction,
370 IN PKIPI_BROADCAST_WORKER BroadcastFunction,
371 IN ULONG_PTR Context,
372 IN PULONG Count
373 );
374
375 VOID
376 FASTCALL
377 KiIpiSignalPacketDone(
378 IN PKIPI_CONTEXT PacketContext
379 );
380
381 VOID
382 FASTCALL
383 KiIpiSignalPacketDoneAndStall(
384 IN PKIPI_CONTEXT PacketContext,
385 IN volatile PULONG ReverseStall
386 );
387
388 /* next file ***************************************************************/
389
390 UCHAR
391 NTAPI
392 KeFindNextRightSetAffinity(
393 IN UCHAR Number,
394 IN ULONG Set
395 );
396
397 VOID
398 NTAPI
399 DbgBreakPointNoBugCheck(VOID);
400
401 VOID
402 NTAPI
403 KeInitializeProfile(
404 struct _KPROFILE* Profile,
405 struct _KPROCESS* Process,
406 PVOID ImageBase,
407 SIZE_T ImageSize,
408 ULONG BucketSize,
409 KPROFILE_SOURCE ProfileSource,
410 KAFFINITY Affinity
411 );
412
413 BOOLEAN
414 NTAPI
415 KeStartProfile(
416 struct _KPROFILE* Profile,
417 PVOID Buffer
418 );
419
420 BOOLEAN
421 NTAPI
422 KeStopProfile(struct _KPROFILE* Profile);
423
424 ULONG
425 NTAPI
426 KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource);
427
428 VOID
429 NTAPI
430 KeSetIntervalProfile(
431 KPROFILE_SOURCE ProfileSource,
432 ULONG Interval
433 );
434
435 VOID
436 NTAPI
437 KeProfileInterrupt(
438 PKTRAP_FRAME TrapFrame
439 );
440
441 VOID
442 NTAPI
443 KeProfileInterruptWithSource(
444 IN PKTRAP_FRAME TrapFrame,
445 IN KPROFILE_SOURCE Source
446 );
447
448 VOID
449 NTAPI
450 KeUpdateRunTime(
451 PKTRAP_FRAME TrapFrame,
452 KIRQL Irql
453 );
454
455 VOID
456 NTAPI
457 KiExpireTimers(
458 PKDPC Dpc,
459 PVOID DeferredContext,
460 PVOID SystemArgument1,
461 PVOID SystemArgument2
462 );
463
464 VOID
465 NTAPI
466 KeInitializeThread(
467 IN PKPROCESS Process,
468 IN OUT PKTHREAD Thread,
469 IN PKSYSTEM_ROUTINE SystemRoutine,
470 IN PKSTART_ROUTINE StartRoutine,
471 IN PVOID StartContext,
472 IN PCONTEXT Context,
473 IN PVOID Teb,
474 IN PVOID KernelStack
475 );
476
477 VOID
478 NTAPI
479 KeUninitThread(
480 IN PKTHREAD Thread
481 );
482
483 NTSTATUS
484 NTAPI
485 KeInitThread(
486 IN OUT PKTHREAD Thread,
487 IN PVOID KernelStack,
488 IN PKSYSTEM_ROUTINE SystemRoutine,
489 IN PKSTART_ROUTINE StartRoutine,
490 IN PVOID StartContext,
491 IN PCONTEXT Context,
492 IN PVOID Teb,
493 IN PKPROCESS Process
494 );
495
496 VOID
497 NTAPI
498 KiInitializeContextThread(
499 PKTHREAD Thread,
500 PKSYSTEM_ROUTINE SystemRoutine,
501 PKSTART_ROUTINE StartRoutine,
502 PVOID StartContext,
503 PCONTEXT Context
504 );
505
506 VOID
507 NTAPI
508 KeStartThread(
509 IN OUT PKTHREAD Thread
510 );
511
512 BOOLEAN
513 NTAPI
514 KeAlertThread(
515 IN PKTHREAD Thread,
516 IN KPROCESSOR_MODE AlertMode
517 );
518
519 ULONG
520 NTAPI
521 KeAlertResumeThread(
522 IN PKTHREAD Thread
523 );
524
525 ULONG
526 NTAPI
527 KeResumeThread(
528 IN PKTHREAD Thread
529 );
530
531 PVOID
532 NTAPI
533 KeSwitchKernelStack(
534 IN PVOID StackBase,
535 IN PVOID StackLimit
536 );
537
538 VOID
539 NTAPI
540 KeRundownThread(VOID);
541
542 NTSTATUS
543 NTAPI
544 KeReleaseThread(PKTHREAD Thread);
545
546 VOID
547 NTAPI
548 KiSuspendRundown(
549 IN PKAPC Apc
550 );
551
552 VOID
553 NTAPI
554 KiSuspendNop(
555 IN PKAPC Apc,
556 IN PKNORMAL_ROUTINE *NormalRoutine,
557 IN PVOID *NormalContext,
558 IN PVOID *SystemArgument1,
559 IN PVOID *SystemArgument2
560 );
561
562 VOID
563 NTAPI
564 KiSuspendThread(
565 IN PVOID NormalContext,
566 IN PVOID SystemArgument1,
567 IN PVOID SystemArgument2
568 );
569
570 LONG
571 NTAPI
572 KeQueryBasePriorityThread(IN PKTHREAD Thread);
573
574 VOID
575 FASTCALL
576 KiSetPriorityThread(
577 IN PKTHREAD Thread,
578 IN KPRIORITY Priority
579 );
580
581 VOID
582 FASTCALL
583 KiUnlinkThread(
584 IN PKTHREAD Thread,
585 IN LONG_PTR WaitStatus
586 );
587
588 VOID
589 NTAPI
590 KeDumpStackFrames(PULONG Frame);
591
592 BOOLEAN
593 NTAPI
594 KiTestAlert(VOID);
595
596 VOID
597 FASTCALL
598 KiUnwaitThread(
599 IN PKTHREAD Thread,
600 IN LONG_PTR WaitStatus,
601 IN KPRIORITY Increment
602 );
603
604 VOID
605 NTAPI
606 KeInitializeProcess(
607 struct _KPROCESS *Process,
608 KPRIORITY Priority,
609 KAFFINITY Affinity,
610 PULONG_PTR DirectoryTableBase,
611 IN BOOLEAN Enable
612 );
613
614 VOID
615 NTAPI
616 KeSetQuantumProcess(
617 IN PKPROCESS Process,
618 IN UCHAR Quantum
619 );
620
621 KPRIORITY
622 NTAPI
623 KeSetPriorityAndQuantumProcess(
624 IN PKPROCESS Process,
625 IN KPRIORITY Priority,
626 IN UCHAR Quantum OPTIONAL
627 );
628
629 ULONG
630 NTAPI
631 KeForceResumeThread(IN PKTHREAD Thread);
632
633 VOID
634 NTAPI
635 KeThawAllThreads(
636 VOID
637 );
638
639 VOID
640 NTAPI
641 KeFreezeAllThreads(
642 VOID
643 );
644
645 BOOLEAN
646 NTAPI
647 KeDisableThreadApcQueueing(IN PKTHREAD Thread);
648
649 VOID
650 FASTCALL
651 KiWaitTest(
652 PVOID Object,
653 KPRIORITY Increment
654 );
655
656 VOID
657 NTAPI
658 KeContextToTrapFrame(
659 PCONTEXT Context,
660 PKEXCEPTION_FRAME ExeptionFrame,
661 PKTRAP_FRAME TrapFrame,
662 ULONG ContextFlags,
663 KPROCESSOR_MODE PreviousMode
664 );
665
666 VOID
667 NTAPI
668 Ke386SetIOPL(VOID);
669
670 VOID
671 NTAPI
672 KiCheckForKernelApcDelivery(VOID);
673
674 LONG
675 NTAPI
676 KiInsertQueue(
677 IN PKQUEUE Queue,
678 IN PLIST_ENTRY Entry,
679 BOOLEAN Head
680 );
681
682 VOID
683 NTAPI
684 KiTimerExpiration(
685 IN PKDPC Dpc,
686 IN PVOID DeferredContext,
687 IN PVOID SystemArgument1,
688 IN PVOID SystemArgument2
689 );
690
691 ULONG
692 NTAPI
693 KeSetProcess(
694 struct _KPROCESS* Process,
695 KPRIORITY Increment,
696 BOOLEAN InWait
697 );
698
699 VOID
700 NTAPI
701 KeInitializeEventPair(PKEVENT_PAIR EventPair);
702
703 VOID
704 NTAPI
705 KiInitializeUserApc(
706 IN PKEXCEPTION_FRAME Reserved,
707 IN PKTRAP_FRAME TrapFrame,
708 IN PKNORMAL_ROUTINE NormalRoutine,
709 IN PVOID NormalContext,
710 IN PVOID SystemArgument1,
711 IN PVOID SystemArgument2
712 );
713
714 PLIST_ENTRY
715 NTAPI
716 KeFlushQueueApc(
717 IN PKTHREAD Thread,
718 IN KPROCESSOR_MODE PreviousMode
719 );
720
721 VOID
722 NTAPI
723 KiAttachProcess(
724 struct _KTHREAD *Thread,
725 struct _KPROCESS *Process,
726 PKLOCK_QUEUE_HANDLE ApcLock,
727 struct _KAPC_STATE *SavedApcState
728 );
729
730 VOID
731 NTAPI
732 KiSwapProcess(
733 struct _KPROCESS *NewProcess,
734 struct _KPROCESS *OldProcess
735 );
736
737 BOOLEAN
738 NTAPI
739 KeTestAlertThread(IN KPROCESSOR_MODE AlertMode);
740
741 BOOLEAN
742 NTAPI
743 KeRemoveQueueApc(PKAPC Apc);
744
745 VOID
746 FASTCALL
747 KiActivateWaiterQueue(IN PKQUEUE Queue);
748
749 ULONG
750 NTAPI
751 KeQueryRuntimeProcess(IN PKPROCESS Process,
752 OUT PULONG UserTime);
753
754 /* INITIALIZATION FUNCTIONS *************************************************/
755
756 BOOLEAN
757 NTAPI
758 KeInitSystem(VOID);
759
760 VOID
761 NTAPI
762 KeInitExceptions(VOID);
763
764 VOID
765 NTAPI
766 KeInitInterrupts(VOID);
767
768 VOID
769 NTAPI
770 KiInitializeBugCheck(VOID);
771
772 VOID
773 NTAPI
774 KiSystemStartup(
775 IN PLOADER_PARAMETER_BLOCK LoaderBlock
776 );
777
778 BOOLEAN
779 NTAPI
780 KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
781
782 VOID
783 NTAPI
784 KiMoveApcState(
785 PKAPC_STATE OldState,
786 PKAPC_STATE NewState
787 );
788
789 VOID
790 NTAPI
791 KiAddProfileEvent(
792 KPROFILE_SOURCE Source,
793 ULONG Pc
794 );
795
796 VOID
797 NTAPI
798 KiDispatchException(
799 PEXCEPTION_RECORD ExceptionRecord,
800 PKEXCEPTION_FRAME ExceptionFrame,
801 PKTRAP_FRAME Tf,
802 KPROCESSOR_MODE PreviousMode,
803 BOOLEAN SearchFrames
804 );
805
806 VOID
807 NTAPI
808 KeTrapFrameToContext(
809 IN PKTRAP_FRAME TrapFrame,
810 IN PKEXCEPTION_FRAME ExceptionFrame,
811 IN OUT PCONTEXT Context
812 );
813
814 DECLSPEC_NORETURN
815 VOID
816 NTAPI
817 KeBugCheckWithTf(
818 ULONG BugCheckCode,
819 ULONG_PTR BugCheckParameter1,
820 ULONG_PTR BugCheckParameter2,
821 ULONG_PTR BugCheckParameter3,
822 ULONG_PTR BugCheckParameter4,
823 PKTRAP_FRAME Tf
824 );
825
826 BOOLEAN
827 NTAPI
828 KiHandleNmi(VOID);
829
830 VOID
831 NTAPI
832 KeFlushCurrentTb(VOID);
833
834 BOOLEAN
835 NTAPI
836 KeInvalidateAllCaches(VOID);
837
838 VOID
839 FASTCALL
840 KeZeroPages(IN PVOID Address,
841 IN ULONG Size);
842
843 BOOLEAN
844 FASTCALL
845 KeInvalidAccessAllowed(IN PVOID TrapInformation OPTIONAL);
846
847 VOID
848 NTAPI
849 KeRosDumpStackFrames(
850 PULONG_PTR Frame,
851 ULONG FrameCount
852 );
853
854 VOID
855 NTAPI
856 KeSetSystemTime(
857 IN PLARGE_INTEGER NewSystemTime,
858 OUT PLARGE_INTEGER OldSystemTime,
859 IN BOOLEAN FixInterruptTime,
860 IN PLARGE_INTEGER HalTime
861 );
862
863 ULONG
864 NTAPI
865 KeV86Exception(
866 ULONG ExceptionNr,
867 PKTRAP_FRAME Tf,
868 ULONG address
869 );
870
871 VOID
872 NTAPI
873 KiStartUnexpectedRange(
874 VOID
875 );
876
877 VOID
878 NTAPI
879 KiEndUnexpectedRange(
880 VOID
881 );
882
883 NTSTATUS
884 NTAPI
885 KiRaiseException(
886 IN PEXCEPTION_RECORD ExceptionRecord,
887 IN PCONTEXT Context,
888 IN PKEXCEPTION_FRAME ExceptionFrame,
889 IN PKTRAP_FRAME TrapFrame,
890 IN BOOLEAN SearchFrames
891 );
892
893 NTSTATUS
894 NTAPI
895 KiContinue(
896 IN PCONTEXT Context,
897 IN PKEXCEPTION_FRAME ExceptionFrame,
898 IN PKTRAP_FRAME TrapFrame
899 );
900
901 DECLSPEC_NORETURN
902 VOID
903 FASTCALL
904 KiServiceExit(
905 IN PKTRAP_FRAME TrapFrame,
906 IN NTSTATUS Status
907 );
908
909 DECLSPEC_NORETURN
910 VOID
911 FASTCALL
912 KiServiceExit2(
913 IN PKTRAP_FRAME TrapFrame
914 );
915
916 #ifndef _M_AMD64
917 VOID
918 FASTCALL
919 KiInterruptDispatch(
920 IN PKTRAP_FRAME TrapFrame,
921 IN PKINTERRUPT Interrupt
922 );
923 #endif
924
925 VOID
926 FASTCALL
927 KiChainedDispatch(
928 IN PKTRAP_FRAME TrapFrame,
929 IN PKINTERRUPT Interrupt
930 );
931
932 VOID
933 NTAPI
934 KiInitializeMachineType(
935 VOID
936 );
937
938 VOID
939 NTAPI
940 KiSetupStackAndInitializeKernel(
941 IN PKPROCESS InitProcess,
942 IN PKTHREAD InitThread,
943 IN PVOID IdleStack,
944 IN PKPRCB Prcb,
945 IN CCHAR Number,
946 IN PLOADER_PARAMETER_BLOCK LoaderBlock
947 );
948
949 VOID
950 NTAPI
951 KiInitSpinLocks(
952 IN PKPRCB Prcb,
953 IN CCHAR Number
954 );
955
956 LARGE_INTEGER
957 NTAPI
958 KiComputeReciprocal(
959 IN LONG Divisor,
960 OUT PUCHAR Shift
961 );
962
963 VOID
964 NTAPI
965 KiInitSystem(
966 VOID
967 );
968
969 VOID
970 FASTCALL
971 KiInsertQueueApc(
972 IN PKAPC Apc,
973 IN KPRIORITY PriorityBoost
974 );
975
976 NTSTATUS
977 NTAPI
978 KiCallUserMode(
979 IN PVOID *OutputBuffer,
980 IN PULONG OutputLength
981 );
982
983 DECLSPEC_NORETURN
984 VOID
985 FASTCALL
986 KiCallbackReturn(
987 IN PVOID Stack,
988 IN NTSTATUS Status
989 );
990
991 VOID
992 NTAPI
993 KiInitMachineDependent(VOID);
994
995 BOOLEAN
996 NTAPI
997 KeFreezeExecution(IN PKTRAP_FRAME TrapFrame,
998 IN PKEXCEPTION_FRAME ExceptionFrame);
999
1000 VOID
1001 NTAPI
1002 KeThawExecution(IN BOOLEAN Enable);
1003
1004 VOID
1005 FASTCALL
1006 KeAcquireQueuedSpinLockAtDpcLevel(
1007 IN OUT PKSPIN_LOCK_QUEUE LockQueue
1008 );
1009
1010 VOID
1011 FASTCALL
1012 KeReleaseQueuedSpinLockFromDpcLevel(
1013 IN OUT PKSPIN_LOCK_QUEUE LockQueue
1014 );
1015
1016 VOID
1017 NTAPI
1018 KiRestoreProcessorControlState(
1019 IN PKPROCESSOR_STATE ProcessorState
1020 );
1021
1022 VOID
1023 NTAPI
1024 KiSaveProcessorControlState(
1025 OUT PKPROCESSOR_STATE ProcessorState
1026 );
1027
1028 VOID
1029 NTAPI
1030 KiSaveProcessorState(
1031 IN PKTRAP_FRAME TrapFrame,
1032 IN PKEXCEPTION_FRAME ExceptionFrame
1033 );
1034
1035 VOID
1036 FASTCALL
1037 KiRetireDpcList(
1038 IN PKPRCB Prcb
1039 );
1040
1041 VOID
1042 NTAPI
1043 KiQuantumEnd(
1044 VOID
1045 );
1046
1047 VOID
1048 FASTCALL
1049 KiIdleLoop(
1050 VOID
1051 );
1052
1053 DECLSPEC_NORETURN
1054 VOID
1055 FASTCALL
1056 KiSystemFatalException(
1057 IN ULONG ExceptionCode,
1058 IN PKTRAP_FRAME TrapFrame
1059 );
1060
1061 PVOID
1062 NTAPI
1063 KiPcToFileHeader(IN PVOID Eip,
1064 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry,
1065 IN BOOLEAN DriversOnly,
1066 OUT PBOOLEAN InKernel);
1067
1068 PVOID
1069 NTAPI
1070 KiRosPcToUserFileHeader(IN PVOID Eip,
1071 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
1072
1073 PCHAR
1074 NTAPI
1075 KeBugCheckUnicodeToAnsi(
1076 IN PUNICODE_STRING Unicode,
1077 OUT PCHAR Ansi,
1078 IN ULONG Length
1079 );
1080
1081 #include "ke_x.h"