- Implemented KiIpiSendRequest for simple requests.
[reactos.git] / reactos / 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/ntifs.h>
27 #include <stdarg.h>
28 #endif /* not __ASM__ */
29
30 #include "arch/ke.h"
31
32 /* INTERNAL KERNEL FUNCTIONS ************************************************/
33
34 #ifdef __USE_W32API
35 struct _KPROCESS* KeGetCurrentProcess(VOID);
36 VOID KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2);
37 #endif
38
39 #ifndef __ASM__
40
41 struct _KTHREAD;
42 struct _KIRQ_TRAPFRAME;
43 struct _KPCR;
44 struct _KEXCEPTION_FRAME;
45
46 #define IPI_REQUEST_FUNCTIONCALL 1
47 #define IPI_REQUEST_APC 2
48 #define IPI_REQUEST_DPC 4
49
50 /* ipi.c ********************************************************************/
51
52 BOOLEAN STDCALL
53 KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
54 IN struct _KEXCEPTION_FRAME* ExceptionFrame);
55
56 VOID
57 KiIpiSendRequest(ULONG TargetSet,
58 ULONG IpiRequest);
59
60 VOID
61 KeIpiGenericCall(VOID STDCALL (*WorkerRoutine)(PVOID),
62 PVOID Argument);
63
64 /* next file ***************************************************************/
65
66
67
68 VOID STDCALL
69 DbgBreakPointNoBugCheck(VOID);
70
71 VOID
72 STDCALL
73 KeProfileInterrupt(
74 PKTRAP_FRAME TrapFrame
75 );
76
77 VOID
78 STDCALL
79 KeProfileInterruptWithSource(
80 IN PKTRAP_FRAME TrapFrame,
81 IN KPROFILE_SOURCE Source
82 );
83
84 VOID STDCALL KeUpdateSystemTime(PKTRAP_FRAME TrapFrame, KIRQL Irql);
85 VOID STDCALL KeUpdateRunTime(PKTRAP_FRAME TrapFrame, KIRQL Irql);
86
87 KIRQL KeAcquireDispatcherDatabaseLock(VOID);
88 VOID KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID);
89 VOID KeReleaseDispatcherDatabaseLock(KIRQL Irql);
90 VOID KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID);
91
92 BOOLEAN KiDispatcherObjectWake(DISPATCHER_HEADER* hdr);
93 VOID STDCALL KeExpireTimers(PKDPC Apc,
94 PVOID Arg1,
95 PVOID Arg2,
96 PVOID Arg3);
97 VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type,
98 ULONG Size, ULONG SignalState);
99 VOID KeDumpStackFrames(PULONG Frame);
100 BOOLEAN KiTestAlert(VOID);
101
102 BOOLEAN KiAbortWaitThread(struct _KTHREAD* Thread, NTSTATUS WaitStatus);
103
104 PULONG KeGetStackTopThread(struct _ETHREAD* Thread);
105 VOID KeContextToTrapFrame(PCONTEXT Context, PKTRAP_FRAME TrapFrame);
106 VOID STDCALL KiDeliverApc(KPROCESSOR_MODE PreviousMode,
107 PVOID Reserved,
108 PKTRAP_FRAME TrapFrame);
109
110 VOID KiInitializeUserApc(IN PVOID Reserved,
111 IN PKTRAP_FRAME TrapFrame,
112 IN PKNORMAL_ROUTINE NormalRoutine,
113 IN PVOID NormalContext,
114 IN PVOID SystemArgument1,
115 IN PVOID SystemArgument2);
116
117 VOID STDCALL KiAttachProcess(struct _KTHREAD *Thread, struct _KPROCESS *Process, KIRQL ApcLock, struct _KAPC_STATE *SavedApcState);
118
119 VOID STDCALL KiSwapProcess(struct _KPROCESS *NewProcess, struct _KPROCESS *OldProcess);
120
121 BOOLEAN
122 STDCALL
123 KeTestAlertThread(IN KPROCESSOR_MODE AlertMode);
124
125 BOOLEAN STDCALL KeRemoveQueueApc (PKAPC Apc);
126 PLIST_ENTRY STDCALL KeRundownQueue(IN PKQUEUE Queue);
127
128 extern LARGE_INTEGER SystemBootTime;
129
130 /* INITIALIZATION FUNCTIONS *************************************************/
131
132 VOID KeInitExceptions(VOID);
133 VOID KeInitInterrupts(VOID);
134 VOID KeInitTimer(VOID);
135 VOID KeInitDpc(struct _KPCR* Pcr);
136 VOID KeInitDispatcher(VOID);
137 VOID KeInitializeDispatcher(VOID);
138 VOID KeInitializeTimerImpl(VOID);
139 VOID KeInitializeBugCheck(VOID);
140 VOID Phase1Initialization(PVOID Context);
141
142 VOID KeInit1(PCHAR CommandLine, PULONG LastKernelAddress);
143 VOID KeInit2(VOID);
144
145 BOOLEAN KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
146
147 VOID
148 STDCALL
149 KiMoveApcState (PKAPC_STATE OldState,
150 PKAPC_STATE NewState);
151
152 VOID
153 KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Pc);
154 VOID
155 KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
156 PCONTEXT Context,
157 PKTRAP_FRAME Tf,
158 KPROCESSOR_MODE PreviousMode,
159 BOOLEAN SearchFrames);
160 VOID KeTrapFrameToContext(PKTRAP_FRAME TrapFrame,
161 PCONTEXT Context);
162 VOID
163 KeApplicationProcessorInit(VOID);
164 VOID
165 KePrepareForApplicationProcessorInit(ULONG id);
166 ULONG
167 KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
168 VOID STDCALL
169 KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack);
170 VOID STDCALL
171 KeStackSwitchAndRet(PVOID NewStack);
172 VOID STDCALL
173 KeBugCheckWithTf(ULONG BugCheckCode,
174 ULONG BugCheckParameter1,
175 ULONG BugCheckParameter2,
176 ULONG BugCheckParameter3,
177 ULONG BugCheckParameter4,
178 PKTRAP_FRAME Tf);
179 #define KEBUGCHECKWITHTF(a,b,c,d,e,f) DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f)
180 VOID
181 KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2);
182
183 VOID
184 STDCALL
185 KeFlushCurrentTb(VOID);
186
187 #endif /* not __ASM__ */
188
189 #define MAXIMUM_PROCESSORS 32
190
191 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */