update for HEAD-2003091401
[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/ntifs.h>
27 #include <stdarg.h>
28 #endif /* not __ASM__ */
29
30 #include "arch/ke.h"
31
32 /* INTERNAL KERNEL FUNCTIONS ************************************************/
33
34 #ifndef __ASM__
35
36 struct _KTHREAD;
37
38 VOID STDCALL KeRescheduleThread();
39
40 VOID KiUpdateSystemTime (KIRQL oldIrql, ULONG Eip);
41
42 VOID KeAcquireDispatcherDatabaseLock(BOOLEAN Wait);
43 VOID KeReleaseDispatcherDatabaseLock(BOOLEAN Wait);
44 BOOLEAN KeDispatcherObjectWake(DISPATCHER_HEADER* hdr);
45 VOID STDCALL KeExpireTimers(PKDPC Apc,
46                             PVOID Arg1,
47                             PVOID Arg2,
48                             PVOID Arg3);
49 VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type,
50                                   ULONG Size, ULONG SignalState);
51 VOID KeDumpStackFrames(PULONG Frame);
52 BOOLEAN KiTestAlert(VOID);
53 VOID KeRemoveAllWaitsThread(struct _ETHREAD* Thread, NTSTATUS WaitStatus, BOOL Unblock);
54 PULONG KeGetStackTopThread(struct _ETHREAD* Thread);
55 VOID KeContextToTrapFrame(PCONTEXT Context,
56                           PKTRAP_FRAME TrapFrame);
57 VOID KeReleaseDispatcherDatabaseLockAtDpcLevel(BOOLEAN Wait);
58 VOID
59 KiDeliverNormalApc(VOID);
60
61 BOOLEAN STDCALL KeRemoveQueueApc (PKAPC Apc);
62 PLIST_ENTRY STDCALL KeRundownQueue(IN PKQUEUE Queue);
63
64 VOID STDCALL
65 KeRaiseUserException(NTSTATUS ExceptionCode);
66
67
68 /* INITIALIZATION FUNCTIONS *************************************************/
69
70 VOID KeInitExceptions(VOID);
71 VOID KeInitInterrupts(VOID);
72 VOID KeInitTimer(VOID);
73 VOID KeInitDpc(VOID);
74 VOID KeInitDispatcher(VOID);
75 VOID KeInitializeDispatcher(VOID);
76 VOID KeInitializeTimerImpl(VOID);
77 VOID KeInitializeBugCheck(VOID);
78 VOID Phase1Initialization(PVOID Context);
79
80 VOID KeInit1(VOID);
81 VOID KeInit2(VOID);
82
83 BOOLEAN KiDeliverUserApc(PKTRAP_FRAME TrapFrame);
84 VOID
85 KiAddProfileEvent(KPROFILE_SOURCE Source, ULONG Pc);
86 VOID 
87 KiDispatchException(PEXCEPTION_RECORD ExceptionRecord,
88                     PCONTEXT Context,
89                     PKTRAP_FRAME Tf,
90                     KPROCESSOR_MODE PreviousMode,
91                     BOOLEAN SearchFrames);
92 VOID KeTrapFrameToContext(PKTRAP_FRAME TrapFrame,
93                           PCONTEXT Context);
94 VOID
95 KeApplicationProcessorInit(VOID);
96 VOID
97 KePrepareForApplicationProcessorInit(ULONG id);
98 ULONG
99 KiUserTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
100 VOID STDCALL
101 KePushAndStackSwitchAndSysRet(ULONG Push, PVOID NewStack);
102 VOID STDCALL
103 KeStackSwitchAndRet(PVOID NewStack);
104 VOID STDCALL
105 KeBugCheckWithTf(ULONG BugCheckCode,
106                  ULONG BugCheckParameter1,
107                  ULONG BugCheckParameter2,
108                  ULONG BugCheckParameter3,
109                  ULONG BugCheckParameter4,
110                  PKTRAP_FRAME Tf);
111 #define KEBUGCHECKWITHTF(a,b,c,d,e,f) DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f)
112 VOID
113 KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2);
114
115 #endif /* not __ASM__ */
116
117 #define MAXIMUM_PROCESSORS      32
118
119 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */