7cc8aad47c534f6b4b3e1937a8f044da63f0c8bb
[reactos.git] / ntoskrnl / include / internal / ke.h
1 /*
2  *  ReactOS kernel
3  *  Copyright (C) 2000 David Welch <welch@cwcom.net>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_KE_H
21 #define __NTOSKRNL_INCLUDE_INTERNAL_KE_H
22
23 /* INCLUDES *****************************************************************/
24
25 #ifndef __ASM__
26 #include <ddk/ntddk.h>
27
28 #include <stdarg.h>
29 #endif /* not __ASM__ */
30
31 #include "arch/ke.h"
32
33 /* INTERNAL KERNEL FUNCTIONS ************************************************/
34
35 #ifndef __ASM__
36
37 struct _KTHREAD;
38
39 VOID STDCALL KeRescheduleThread();
40
41 VOID KiUpdateSystemTime (KIRQL oldIrql, ULONG Eip);
42
43 VOID KeAcquireDispatcherDatabaseLock(BOOLEAN Wait);
44 VOID KeReleaseDispatcherDatabaseLock(BOOLEAN Wait);
45 BOOLEAN KeDispatcherObjectWake(DISPATCHER_HEADER* hdr);
46 VOID STDCALL KeExpireTimers(PKDPC Apc,
47                             PVOID Arg1,
48                             PVOID Arg2,
49                             PVOID Arg3);
50 VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type,
51                                   ULONG Size, ULONG SignalState);
52 VOID KeDumpStackFrames(PULONG Frame);
53 BOOLEAN KiTestAlert(VOID);
54 VOID KeRemoveAllWaitsThread(struct _ETHREAD* Thread, NTSTATUS WaitStatus);
55 PULONG KeGetStackTopThread(struct _ETHREAD* Thread);
56 VOID KeContextToTrapFrame(PCONTEXT Context,
57                           PKTRAP_FRAME TrapFrame);
58 VOID KeReleaseDispatcherDatabaseLockAtDpcLevel(BOOLEAN Wait);
59 VOID
60 KiDeliverNormalApc(VOID);
61
62 BOOLEAN STDCALL KeRemoveQueueApc (PKAPC Apc);
63 PLIST_ENTRY STDCALL KeRundownQueue(IN PKQUEUE Queue);
64
65
66 /* INITIALIZATION FUNCTIONS *************************************************/
67
68 VOID KeInitExceptions(VOID);
69 VOID KeInitInterrupts(VOID);
70 VOID KeInitTimer(VOID);
71 VOID KeInitDpc(VOID);
72 VOID KeInitDispatcher(VOID);
73 VOID KeInitializeDispatcher(VOID);
74 VOID KeInitializeTimerImpl(VOID);
75 VOID KeInitializeBugCheck(VOID);
76 VOID Phase1Initialization(PVOID Context);
77
78 VOID KeInit1(VOID);
79 VOID KeInit2(VOID);
80
81 BOOLEAN KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
82 VOID
83 KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Pc);
84 VOID 
85 KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
86                     PCONTEXT Context,
87                     PKTRAP_FRAME Tf,
88                     KPROCESSOR_MODE PreviousMode,
89                     BOOLEAN SearchFrames);
90 VOID KeTrapFrameToContext(PKTRAP_FRAME TrapFrame,
91                           PCONTEXT Context);
92 VOID
93 KeApplicationProcessorInit(VOID);
94 VOID
95 KePrepareForApplicationProcessorInit(ULONG id);
96 ULONG
97 KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
98 VOID STDCALL
99 KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack);
100 VOID STDCALL
101 KeStackSwitchAndRet(PVOID NewStack);
102 VOID STDCALL
103 KeBugCheckWithTf(ULONG BugCheckCode,
104                  ULONG BugCheckParameter1,
105                  ULONG BugCheckParameter2,
106                  ULONG BugCheckParameter3,
107                  ULONG BugCheckParameter4,
108                  PKTRAP_FRAME Tf);
109 VOID
110 KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2);
111
112 #endif /* not __ASM__ */
113
114 #define MAXIMUM_PROCESSORS      32
115
116 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */