3 * Copyright (C) 2000 David Welch <welch@cwcom.net>
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.
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.
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.
20 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_KE_H
21 #define __NTOSKRNL_INCLUDE_INTERNAL_KE_H
23 /* INCLUDES *****************************************************************/
26 #include <ddk/ntifs.h>
28 #endif /* not __ASM__ */
32 /* INTERNAL KERNEL FUNCTIONS ************************************************/
35 struct _KPROCESS
* KeGetCurrentProcess(VOID
);
36 VOID
KeSetGdtSelector(ULONG Entry
, ULONG Value1
, ULONG Value2
);
43 VOID STDCALL
KeRescheduleThread();
45 VOID
KiUpdateSystemTime (KIRQL oldIrql
, ULONG Eip
);
47 KIRQL
KeAcquireDispatcherDatabaseLock(VOID
);
48 VOID
KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID
);
49 VOID
KeReleaseDispatcherDatabaseLock(KIRQL Irql
);
50 VOID
KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID
);
52 BOOLEAN
KeDispatcherObjectWake(DISPATCHER_HEADER
* hdr
);
53 VOID STDCALL
KeExpireTimers(PKDPC Apc
,
57 VOID
KeInitializeDispatcherHeader(DISPATCHER_HEADER
* Header
, ULONG Type
,
58 ULONG Size
, ULONG SignalState
);
59 VOID
KeDumpStackFrames(PULONG Frame
);
60 BOOLEAN
KiTestAlert(VOID
);
61 VOID
KeRemoveAllWaitsThread(struct _ETHREAD
* Thread
, NTSTATUS WaitStatus
, BOOL Unblock
);
62 PULONG
KeGetStackTopThread(struct _ETHREAD
* Thread
);
63 VOID
KeContextToTrapFrame(PCONTEXT Context
,
64 PKTRAP_FRAME TrapFrame
);
66 KiDeliverNormalApc(VOID
);
68 BOOLEAN STDCALL
KeRemoveQueueApc (PKAPC Apc
);
69 PLIST_ENTRY STDCALL
KeRundownQueue(IN PKQUEUE Queue
);
72 KeRaiseUserException(NTSTATUS ExceptionCode
);
75 /* INITIALIZATION FUNCTIONS *************************************************/
77 VOID
KeInitExceptions(VOID
);
78 VOID
KeInitInterrupts(VOID
);
79 VOID
KeInitTimer(VOID
);
81 VOID
KeInitDispatcher(VOID
);
82 VOID
KeInitializeDispatcher(VOID
);
83 VOID
KeInitializeTimerImpl(VOID
);
84 VOID
KeInitializeBugCheck(VOID
);
85 VOID
Phase1Initialization(PVOID Context
);
90 BOOLEAN
KiDeliverUserApc(PKTRAP_FRAME TrapFrame
);
92 KiAddProfileEvent(KPROFILE_SOURCE Source
, ULONG Pc
);
94 KiDispatchException(PEXCEPTION_RECORD ExceptionRecord
,
97 KPROCESSOR_MODE PreviousMode
,
98 BOOLEAN SearchFrames
);
99 VOID
KeTrapFrameToContext(PKTRAP_FRAME TrapFrame
,
102 KeApplicationProcessorInit(VOID
);
104 KePrepareForApplicationProcessorInit(ULONG id
);
106 KiUserTrapHandler(PKTRAP_FRAME Tf
, ULONG ExceptionNr
, PVOID Cr2
);
108 KePushAndStackSwitchAndSysRet(ULONG Push
, PVOID NewStack
);
110 KeStackSwitchAndRet(PVOID NewStack
);
112 KeBugCheckWithTf(ULONG BugCheckCode
,
113 ULONG BugCheckParameter1
,
114 ULONG BugCheckParameter2
,
115 ULONG BugCheckParameter3
,
116 ULONG BugCheckParameter4
,
118 #define KEBUGCHECKWITHTF(a,b,c,d,e,f) DbgPrint("KeBugCheckWithTf at %s:%i\n",__FILE__,__LINE__), KeBugCheckWithTf(a,b,c,d,e,f)
120 KiDumpTrapFrame(PKTRAP_FRAME Tf
, ULONG ExceptionNr
, ULONG cr2
);
122 #endif /* not __ASM__ */
124 #define MAXIMUM_PROCESSORS 32
126 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */