fix placement of STDCALL for function declarations
[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
43 VOID STDCALL
44 DbgBreakPointNoBugCheck(VOID);
45
46 VOID STDCALL KeRescheduleThread();
47
48
49 VOID
50 STDCALL
51 KeProfileInterrupt(
52 PKTRAP_FRAME TrapFrame
53 );
54
55 VOID
56 STDCALL
57 KeProfileInterruptWithSource(
58 IN PKTRAP_FRAME TrapFrame,
59 IN KPROFILE_SOURCE Source
60 );
61
62 /*BOOLEAN
63 STDCALL
64 KiIpiServiceRoutine(
65 IN PKTRAP_FRAME TrapFrame,
66 IN PKEXCEPTION_FRAME ExceptionFrame
67 );*/
68
69 VOID
70 STDCALL
71 KeUpdateSystemTime(
72 IN PKTRAP_FRAME TrapFrame,
73 IN ULONG Increment
74 );
75
76 VOID KiUpdateSystemTime (KIRQL oldIrql, ULONG Eip);
77
78 KIRQL KeAcquireDispatcherDatabaseLock(VOID);
79 VOID KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID);
80 VOID KeReleaseDispatcherDatabaseLock(KIRQL Irql);
81 VOID KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID);
82
83 BOOLEAN KeDispatcherObjectWake(DISPATCHER_HEADER* hdr);
84 VOID STDCALL KeExpireTimers(PKDPC Apc,
85 PVOID Arg1,
86 PVOID Arg2,
87 PVOID Arg3);
88 VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type,
89 ULONG Size, ULONG SignalState);
90 VOID KeDumpStackFrames(PULONG Frame);
91 BOOLEAN KiTestAlert(VOID);
92 VOID KeRemoveAllWaitsThread(struct _ETHREAD* Thread, NTSTATUS WaitStatus, BOOL Unblock);
93 PULONG KeGetStackTopThread(struct _ETHREAD* Thread);
94 VOID KeContextToTrapFrame(PCONTEXT Context, PKTRAP_FRAME TrapFrame);
95 VOID
96 KiDeliverNormalApc(VOID);
97
98 BOOLEAN STDCALL KeRemoveQueueApc (PKAPC Apc);
99 PLIST_ENTRY STDCALL KeRundownQueue(IN PKQUEUE Queue);
100
101 extern LARGE_INTEGER SystemBootTime;
102 extern volatile ULONGLONG KiKernelTime;
103 extern volatile ULONGLONG KiUserTime;
104 extern volatile ULONGLONG KiDpcTime;
105
106
107 /* INITIALIZATION FUNCTIONS *************************************************/
108
109 VOID KeInitExceptions(VOID);
110 VOID KeInitInterrupts(VOID);
111 VOID KeInitTimer(VOID);
112 VOID KeInitDpc(VOID);
113 VOID KeInitDispatcher(VOID);
114 VOID KeInitializeDispatcher(VOID);
115 VOID KeInitializeTimerImpl(VOID);
116 VOID KeInitializeBugCheck(VOID);
117 VOID Phase1Initialization(PVOID Context);
118
119 VOID KeInit1(VOID);
120 VOID KeInit2(VOID);
121
122 BOOLEAN KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
123
124 VOID FASTCALL
125 KiSwapApcEnvironment(
126 struct _KTHREAD* Thread,
127 struct _KPROCESS* NewProcess);
128
129 VOID
130 KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Pc);
131 VOID
132 KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
133 PCONTEXT Context,
134 PKTRAP_FRAME Tf,
135 KPROCESSOR_MODE PreviousMode,
136 BOOLEAN SearchFrames);
137 VOID KeTrapFrameToContext(PKTRAP_FRAME TrapFrame,
138 PCONTEXT Context);
139 VOID
140 KeApplicationProcessorInit(VOID);
141 VOID
142 KePrepareForApplicationProcessorInit(ULONG id);
143 ULONG
144 KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
145 VOID STDCALL
146 KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack);
147 VOID STDCALL
148 KeStackSwitchAndRet(PVOID NewStack);
149 VOID STDCALL
150 KeBugCheckWithTf(ULONG BugCheckCode,
151 ULONG BugCheckParameter1,
152 ULONG BugCheckParameter2,
153 ULONG BugCheckParameter3,
154 ULONG BugCheckParameter4,
155 PKTRAP_FRAME Tf);
156 #define KEBUGCHECKWITHTF(a,b,c,d,e,f) DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f)
157 VOID
158 KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2);
159
160 VOID
161 KiUpdateProcessThreadTime(VOID);
162
163 VOID
164 STDCALL
165 KeUpdateRunTime(
166 IN PKTRAP_FRAME TrapFrame
167 );
168
169 #endif /* not __ASM__ */
170
171 #define MAXIMUM_PROCESSORS 32
172
173 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */