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