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 _PROCESS_VALUES 40 { 41 LARGE_INTEGER TotalKernelTime; 42 LARGE_INTEGER TotalUserTime; 43 IO_COUNTERS IoInfo; 44 } PROCESS_VALUES, *PPROCESS_VALUES; 45 46 typedef struct _DEFERRED_REVERSE_BARRIER 47 { 48 ULONG Barrier; 49 ULONG TotalProcessors; 50 } DEFERRED_REVERSE_BARRIER, *PDEFERRED_REVERSE_BARRIER; 51 52 typedef struct _KI_SAMPLE_MAP 53 { 54 LARGE_INTEGER PerfStart; 55 LARGE_INTEGER PerfEnd; 56 LONGLONG PerfDelta; 57 LARGE_INTEGER PerfFreq; 58 LONGLONG TSCStart; 59 LONGLONG TSCEnd; 60 LONGLONG TSCDelta; 61 ULONG MHz; 62 } KI_SAMPLE_MAP, *PKI_SAMPLE_MAP; 63 64 #define MAX_TIMER_DPCS 16 65 66 typedef struct _DPC_QUEUE_ENTRY 67 { 68 PKDPC Dpc; 69 PKDEFERRED_ROUTINE Routine; 70 PVOID Context; 71 } DPC_QUEUE_ENTRY, *PDPC_QUEUE_ENTRY; 72 73 typedef struct _KNMI_HANDLER_CALLBACK 74 { 75 struct _KNMI_HANDLER_CALLBACK* Next; 76 PNMI_CALLBACK Callback; 77 PVOID Context; 78 PVOID Handle; 79 } KNMI_HANDLER_CALLBACK, *PKNMI_HANDLER_CALLBACK; 80 81 typedef PCHAR 82 (NTAPI *PKE_BUGCHECK_UNICODE_TO_ANSI)( 83 IN PUNICODE_STRING Unicode, 84 IN PCHAR Ansi, 85 IN ULONG Length 86 ); 87 88 extern KAFFINITY KeActiveProcessors; 89 extern PKNMI_HANDLER_CALLBACK KiNmiCallbackListHead; 90 extern KSPIN_LOCK KiNmiCallbackListLock; 91 extern PVOID KeUserApcDispatcher; 92 extern PVOID KeUserCallbackDispatcher; 93 extern PVOID KeUserExceptionDispatcher; 94 extern PVOID KeRaiseUserExceptionDispatcher; 95 extern LARGE_INTEGER KeBootTime; 96 extern ULONGLONG KeBootTimeBias; 97 extern BOOLEAN ExCmosClockIsSane; 98 extern USHORT KeProcessorArchitecture; 99 extern USHORT KeProcessorLevel; 100 extern USHORT KeProcessorRevision; 101 extern ULONG KeFeatureBits; 102 extern KNODE KiNode0; 103 extern PKNODE KeNodeBlock[1]; 104 extern UCHAR KeNumberNodes; 105 extern UCHAR KeProcessNodeSeed; 106 extern ETHREAD KiInitialThread; 107 extern EPROCESS KiInitialProcess; 108 extern PULONG KiInterruptTemplateObject; 109 extern PULONG KiInterruptTemplateDispatch; 110 extern PULONG KiInterruptTemplate2ndDispatch; 111 extern ULONG KiUnexpectedEntrySize; 112 extern ULONG_PTR KiDoubleFaultStack; 113 extern EX_PUSH_LOCK KernelAddressSpaceLock; 114 extern ULONG KiMaximumDpcQueueDepth; 115 extern ULONG KiMinimumDpcRate; 116 extern ULONG KiAdjustDpcThreshold; 117 extern ULONG KiIdealDpcRate; 118 extern BOOLEAN KeThreadDpcEnable; 119 extern LARGE_INTEGER KiTimeIncrementReciprocal; 120 extern UCHAR KiTimeIncrementShiftCount; 121 extern ULONG KiTimeLimitIsrMicroseconds; 122 extern ULONG KiServiceLimit; 123 extern LIST_ENTRY KeBugcheckCallbackListHead, KeBugcheckReasonCallbackListHead; 124 extern KSPIN_LOCK BugCheckCallbackLock; 125 extern KDPC KiTimerExpireDpc; 126 extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE]; 127 extern FAST_MUTEX KiGenericCallDpcMutex; 128 extern LIST_ENTRY KiProfileListHead, KiProfileSourceListHead; 129 extern KSPIN_LOCK KiProfileLock; 130 extern LIST_ENTRY KiProcessListHead; 131 extern LIST_ENTRY KiProcessInSwapListHead, KiProcessOutSwapListHead; 132 extern LIST_ENTRY KiStackInSwapListHead; 133 extern KEVENT KiSwapEvent; 134 extern PKPRCB KiProcessorBlock[]; 135 extern ULONG KiMask32Array[MAXIMUM_PRIORITY]; 136 extern ULONG_PTR KiIdleSummary; 137 extern PVOID KeUserApcDispatcher; 138 extern PVOID KeUserCallbackDispatcher; 139 extern PVOID KeUserExceptionDispatcher; 140 extern PVOID KeRaiseUserExceptionDispatcher; 141 extern ULONG KeTimeIncrement; 142 extern ULONG KeTimeAdjustment; 143 extern BOOLEAN KiTimeAdjustmentEnabled; 144 extern LONG KiTickOffset; 145 extern ULONG_PTR KiBugCheckData[5]; 146 extern ULONG KiFreezeFlag; 147 extern ULONG KiDPCTimeout; 148 extern PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch; 149 extern ULONGLONG BootCycles, BootCyclesEnd; 150 extern ULONG ProcessCount; 151 extern VOID __cdecl KiInterruptTemplate(VOID); 152 153 /* MACROS *************************************************************************/ 154 155 #define AFFINITY_MASK(Id) KiMask32Array[Id] 156 #define PRIORITY_MASK(Id) KiMask32Array[Id] 157 158 /* Tells us if the Timer or Event is a Syncronization or Notification Object */ 159 #define TIMER_OR_EVENT_TYPE 0x7L 160 161 /* One of the Reserved Wait Blocks, this one is for the Thread's Timer */ 162 #define TIMER_WAIT_BLOCK 0x3L 163 164 /* INTERNAL KERNEL FUNCTIONS ************************************************/ 165 166 /* Finds a new thread to run */ 167 LONG_PTR 168 FASTCALL 169 KiSwapThread( 170 IN PKTHREAD Thread, 171 IN PKPRCB Prcb 172 ); 173 174 VOID 175 NTAPI 176 KeReadyThread( 177 IN PKTHREAD Thread 178 ); 179 180 BOOLEAN 181 NTAPI 182 KeSetDisableBoostThread( 183 IN OUT PKTHREAD Thread, 184 IN BOOLEAN Disable 185 ); 186 187 BOOLEAN 188 NTAPI 189 KeSetDisableBoostProcess( 190 IN PKPROCESS Process, 191 IN BOOLEAN Disable 192 ); 193 194 BOOLEAN 195 NTAPI 196 KeSetAutoAlignmentProcess( 197 IN PKPROCESS Process, 198 IN BOOLEAN Enable 199 ); 200 201 KAFFINITY 202 NTAPI 203 KeSetAffinityProcess( 204 IN PKPROCESS Process, 205 IN KAFFINITY Affinity 206 ); 207 208 VOID 209 NTAPI 210 KeBoostPriorityThread( 211 IN PKTHREAD Thread, 212 IN KPRIORITY Increment 213 ); 214 215 VOID 216 NTAPI 217 KeBalanceSetManager(IN PVOID Context); 218 219 VOID 220 NTAPI 221 KiReadyThread(IN PKTHREAD Thread); 222 223 ULONG 224 NTAPI 225 KeSuspendThread(PKTHREAD Thread); 226 227 BOOLEAN 228 NTAPI 229 KeReadStateThread(IN PKTHREAD Thread); 230 231 BOOLEAN 232 FASTCALL 233 KiSwapContext( 234 IN KIRQL WaitIrql, 235 IN PKTHREAD CurrentThread 236 ); 237 238 VOID 239 NTAPI 240 KiAdjustQuantumThread(IN PKTHREAD Thread); 241 242 VOID 243 FASTCALL 244 KiExitDispatcher(KIRQL OldIrql); 245 246 VOID 247 FASTCALL 248 KiDeferredReadyThread(IN PKTHREAD Thread); 249 250 PKTHREAD 251 FASTCALL 252 KiIdleSchedule( 253 IN PKPRCB Prcb 254 ); 255 256 VOID 257 FASTCALL 258 KiProcessDeferredReadyList( 259 IN PKPRCB Prcb 260 ); 261 262 KAFFINITY 263 FASTCALL 264 KiSetAffinityThread( 265 IN PKTHREAD Thread, 266 IN KAFFINITY Affinity 267 ); 268 269 PKTHREAD 270 FASTCALL 271 KiSelectNextThread( 272 IN PKPRCB Prcb 273 ); 274 275 BOOLEAN 276 FASTCALL 277 KiInsertTimerTable( 278 IN PKTIMER Timer, 279 IN ULONG Hand 280 ); 281 282 VOID 283 FASTCALL 284 KiTimerListExpire( 285 IN PLIST_ENTRY ExpiredListHead, 286 IN KIRQL OldIrql 287 ); 288 289 BOOLEAN 290 FASTCALL 291 KiInsertTreeTimer( 292 IN PKTIMER Timer, 293 IN LARGE_INTEGER Interval 294 ); 295 296 VOID 297 FASTCALL 298 KiCompleteTimer( 299 IN PKTIMER Timer, 300 IN PKSPIN_LOCK_QUEUE LockQueue 301 ); 302 303 /* gmutex.c ********************************************************************/ 304 305 VOID 306 FASTCALL 307 KiAcquireGuardedMutex( 308 IN OUT PKGUARDED_MUTEX GuardedMutex 309 ); 310 311 VOID 312 FASTCALL 313 KiAcquireFastMutex( 314 IN PFAST_MUTEX FastMutex 315 ); 316 317 /* gate.c **********************************************************************/ 318 319 VOID 320 FASTCALL 321 KeInitializeGate(PKGATE Gate); 322 323 VOID 324 FASTCALL 325 KeSignalGateBoostPriority(PKGATE Gate); 326 327 VOID 328 FASTCALL 329 KeWaitForGate( 330 PKGATE Gate, 331 KWAIT_REASON WaitReason, 332 KPROCESSOR_MODE WaitMode 333 ); 334 335 /* ipi.c ********************************************************************/ 336 337 VOID 338 FASTCALL 339 KiIpiSend( 340 KAFFINITY TargetSet, 341 ULONG IpiRequest 342 ); 343 344 VOID 345 NTAPI 346 KiIpiSendPacket( 347 IN KAFFINITY TargetProcessors, 348 IN PKIPI_WORKER WorkerFunction, 349 IN PKIPI_BROADCAST_WORKER BroadcastFunction, 350 IN ULONG_PTR Context, 351 IN PULONG Count 352 ); 353 354 VOID 355 FASTCALL 356 KiIpiSignalPacketDone( 357 IN PKIPI_CONTEXT PacketContext 358 ); 359 360 VOID 361 FASTCALL 362 KiIpiSignalPacketDoneAndStall( 363 IN PKIPI_CONTEXT PacketContext, 364 IN volatile PULONG ReverseStall 365 ); 366 367 /* next file ***************************************************************/ 368 369 UCHAR 370 NTAPI 371 KeFindNextRightSetAffinity( 372 IN UCHAR Number, 373 IN ULONG Set 374 ); 375 376 VOID 377 NTAPI 378 DbgBreakPointNoBugCheck(VOID); 379 380 VOID 381 NTAPI 382 KeInitializeProfile( 383 struct _KPROFILE* Profile, 384 struct _KPROCESS* Process, 385 PVOID ImageBase, 386 SIZE_T ImageSize, 387 ULONG BucketSize, 388 KPROFILE_SOURCE ProfileSource, 389 KAFFINITY Affinity 390 ); 391 392 BOOLEAN 393 NTAPI 394 KeStartProfile( 395 struct _KPROFILE* Profile, 396 PVOID Buffer 397 ); 398 399 BOOLEAN 400 NTAPI 401 KeStopProfile(struct _KPROFILE* Profile); 402 403 ULONG 404 NTAPI 405 KeQueryIntervalProfile(KPROFILE_SOURCE ProfileSource); 406 407 VOID 408 NTAPI 409 KeSetIntervalProfile( 410 ULONG Interval, 411 KPROFILE_SOURCE ProfileSource 412 ); 413 414 VOID 415 NTAPI 416 KeUpdateRunTime( 417 PKTRAP_FRAME TrapFrame, 418 KIRQL Irql 419 ); 420 421 VOID 422 NTAPI 423 KiExpireTimers( 424 PKDPC Dpc, 425 PVOID DeferredContext, 426 PVOID SystemArgument1, 427 PVOID SystemArgument2 428 ); 429 430 VOID 431 NTAPI 432 KeInitializeThread( 433 IN PKPROCESS Process, 434 IN OUT PKTHREAD Thread, 435 IN PKSYSTEM_ROUTINE SystemRoutine, 436 IN PKSTART_ROUTINE StartRoutine, 437 IN PVOID StartContext, 438 IN PCONTEXT Context, 439 IN PVOID Teb, 440 IN PVOID KernelStack 441 ); 442 443 VOID 444 NTAPI 445 KeUninitThread( 446 IN PKTHREAD Thread 447 ); 448 449 NTSTATUS 450 NTAPI 451 KeInitThread( 452 IN OUT PKTHREAD Thread, 453 IN PVOID KernelStack, 454 IN PKSYSTEM_ROUTINE SystemRoutine, 455 IN PKSTART_ROUTINE StartRoutine, 456 IN PVOID StartContext, 457 IN PCONTEXT Context, 458 IN PVOID Teb, 459 IN PKPROCESS Process 460 ); 461 462 VOID 463 NTAPI 464 KiInitializeContextThread( 465 PKTHREAD Thread, 466 PKSYSTEM_ROUTINE SystemRoutine, 467 PKSTART_ROUTINE StartRoutine, 468 PVOID StartContext, 469 PCONTEXT Context 470 ); 471 472 VOID 473 NTAPI 474 KeStartThread( 475 IN OUT PKTHREAD Thread 476 ); 477 478 BOOLEAN 479 NTAPI 480 KeAlertThread( 481 IN PKTHREAD Thread, 482 IN KPROCESSOR_MODE AlertMode 483 ); 484 485 ULONG 486 NTAPI 487 KeAlertResumeThread( 488 IN PKTHREAD Thread 489 ); 490 491 ULONG 492 NTAPI 493 KeResumeThread( 494 IN PKTHREAD Thread 495 ); 496 497 PVOID 498 NTAPI 499 KeSwitchKernelStack( 500 IN PVOID StackBase, 501 IN PVOID StackLimit 502 ); 503 504 VOID 505 NTAPI 506 KeRundownThread(VOID); 507 508 NTSTATUS 509 NTAPI 510 KeReleaseThread(PKTHREAD Thread); 511 512 VOID 513 NTAPI 514 KiSuspendRundown( 515 IN PKAPC Apc 516 ); 517 518 VOID 519 NTAPI 520 KiSuspendNop( 521 IN PKAPC Apc, 522 IN PKNORMAL_ROUTINE *NormalRoutine, 523 IN PVOID *NormalContext, 524 IN PVOID *SystemArgument1, 525 IN PVOID *SystemArgument2 526 ); 527 528 VOID 529 NTAPI 530 KiSuspendThread( 531 IN PVOID NormalContext, 532 IN PVOID SystemArgument1, 533 IN PVOID SystemArgument2 534 ); 535 536 LONG 537 NTAPI 538 KeQueryBasePriorityThread(IN PKTHREAD Thread); 539 540 VOID 541 FASTCALL 542 KiSetPriorityThread( 543 IN PKTHREAD Thread, 544 IN KPRIORITY Priority 545 ); 546 547 VOID 548 FASTCALL 549 KiUnlinkThread( 550 IN PKTHREAD Thread, 551 IN LONG_PTR WaitStatus 552 ); 553 554 VOID 555 NTAPI 556 KeDumpStackFrames(PULONG Frame); 557 558 BOOLEAN 559 NTAPI 560 KiTestAlert(VOID); 561 562 VOID 563 FASTCALL 564 KiUnwaitThread( 565 IN PKTHREAD Thread, 566 IN LONG_PTR WaitStatus, 567 IN KPRIORITY Increment 568 ); 569 570 VOID 571 NTAPI 572 KeInitializeProcess( 573 struct _KPROCESS *Process, 574 KPRIORITY Priority, 575 KAFFINITY Affinity, 576 PULONG_PTR DirectoryTableBase, 577 IN BOOLEAN Enable 578 ); 579 580 VOID 581 NTAPI 582 KeSetQuantumProcess( 583 IN PKPROCESS Process, 584 IN UCHAR Quantum 585 ); 586 587 KPRIORITY 588 NTAPI 589 KeSetPriorityAndQuantumProcess( 590 IN PKPROCESS Process, 591 IN KPRIORITY Priority, 592 IN UCHAR Quantum OPTIONAL 593 ); 594 595 ULONG 596 NTAPI 597 KeForceResumeThread(IN PKTHREAD Thread); 598 599 VOID 600 NTAPI 601 KeThawAllThreads( 602 VOID 603 ); 604 605 VOID 606 NTAPI 607 KeFreezeAllThreads( 608 VOID 609 ); 610 611 BOOLEAN 612 NTAPI 613 KeDisableThreadApcQueueing(IN PKTHREAD Thread); 614 615 VOID 616 FASTCALL 617 KiWaitTest( 618 PVOID Object, 619 KPRIORITY Increment 620 ); 621 622 VOID 623 NTAPI 624 KeContextToTrapFrame( 625 PCONTEXT Context, 626 PKEXCEPTION_FRAME ExeptionFrame, 627 PKTRAP_FRAME TrapFrame, 628 ULONG ContextFlags, 629 KPROCESSOR_MODE PreviousMode 630 ); 631 632 VOID 633 NTAPI 634 Ke386SetIOPL(VOID); 635 636 VOID 637 NTAPI 638 KiCheckForKernelApcDelivery(VOID); 639 640 LONG 641 NTAPI 642 KiInsertQueue( 643 IN PKQUEUE Queue, 644 IN PLIST_ENTRY Entry, 645 BOOLEAN Head 646 ); 647 648 VOID 649 NTAPI 650 KiTimerExpiration( 651 IN PKDPC Dpc, 652 IN PVOID DeferredContext, 653 IN PVOID SystemArgument1, 654 IN PVOID SystemArgument2 655 ); 656 657 ULONG 658 NTAPI 659 KeSetProcess( 660 struct _KPROCESS* Process, 661 KPRIORITY Increment, 662 BOOLEAN InWait 663 ); 664 665 VOID 666 NTAPI 667 KeInitializeEventPair(PKEVENT_PAIR EventPair); 668 669 VOID 670 NTAPI 671 KiInitializeUserApc( 672 IN PKEXCEPTION_FRAME Reserved, 673 IN PKTRAP_FRAME TrapFrame, 674 IN PKNORMAL_ROUTINE NormalRoutine, 675 IN PVOID NormalContext, 676 IN PVOID SystemArgument1, 677 IN PVOID SystemArgument2 678 ); 679 680 PLIST_ENTRY 681 NTAPI 682 KeFlushQueueApc( 683 IN PKTHREAD Thread, 684 IN KPROCESSOR_MODE PreviousMode 685 ); 686 687 VOID 688 NTAPI 689 KiAttachProcess( 690 struct _KTHREAD *Thread, 691 struct _KPROCESS *Process, 692 PKLOCK_QUEUE_HANDLE ApcLock, 693 struct _KAPC_STATE *SavedApcState 694 ); 695 696 VOID 697 NTAPI 698 KiSwapProcess( 699 struct _KPROCESS *NewProcess, 700 struct _KPROCESS *OldProcess 701 ); 702 703 BOOLEAN 704 NTAPI 705 KeTestAlertThread(IN KPROCESSOR_MODE AlertMode); 706 707 BOOLEAN 708 NTAPI 709 KeRemoveQueueApc(PKAPC Apc); 710 711 VOID 712 FASTCALL 713 KiActivateWaiterQueue(IN PKQUEUE Queue); 714 715 ULONG 716 NTAPI 717 KeQueryRuntimeProcess(IN PKPROCESS Process, 718 OUT PULONG UserTime); 719 720 VOID 721 NTAPI 722 KeQueryValuesProcess(IN PKPROCESS Process, 723 PPROCESS_VALUES Values); 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" 1053