ReactOS  0.4.15-dev-4927-gfe8f806
freeze.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: ntoskrnl/ke/freeze.c
5  * PURPOSE: Routines for freezing and unfreezing processors for
6  * kernel debugger synchronization.
7  * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
8  */
9 
10 /* INCLUDES *******************************************************************/
11 
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* GLOBALS ********************************************************************/
17 
18 /* Freeze data */
21 
22 /* FUNCTIONS ******************************************************************/
23 
24 BOOLEAN
25 NTAPI
27  IN PKEXCEPTION_FRAME ExceptionFrame)
28 {
30  KIRQL OldIrql;
31 
32 #ifndef CONFIG_SMP
33  UNREFERENCED_PARAMETER(TrapFrame);
34  UNREFERENCED_PARAMETER(ExceptionFrame);
35 #endif
36 
37  /* Disable interrupts, get previous state and set the freeze flag */
39  KiFreezeFlag = 4;
40 
41 #ifndef CONFIG_SMP
42  /* Raise IRQL if we have to */
44  if (OldIrql < DISPATCH_LEVEL)
46 #else
47  /* Raise IRQL to HIGH_LEVEL */
49 #endif
50 
51 #ifdef CONFIG_SMP
52  // TODO: Add SMP support.
53 #endif
54 
55  /* Save the old IRQL to be restored on unfreeze */
57 
58  /* Return whether interrupts were enabled */
59  return Enable;
60 }
61 
62 VOID
63 NTAPI
65 {
66 #ifdef CONFIG_SMP
67  // TODO: Add SMP support.
68 #endif
69 
70  /* Clear the freeze flag */
71  KiFreezeFlag = 0;
72 
73  /* Cleanup CPU caches */
75 
76  /* Restore the old IRQL */
77 #ifndef CONFIG_SMP
79 #endif
81 
82  /* Re-enable interrupts */
84 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define IN
Definition: typedefs.h:39
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment KeRaiseIrqlToDpcLevel
Definition: CrNtStubs.h:67
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned char BOOLEAN
FORCEINLINE BOOLEAN KeDisableInterrupts(VOID)
Definition: ke.h:235
KIRQL KiOldIrql
Definition: freeze.c:19
BOOLEAN NTAPI KeFreezeExecution(IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
Definition: freeze.c:26
VOID NTAPI KeThawExecution(IN BOOLEAN Enable)
Definition: freeze.c:64
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
FORCEINLINE VOID KeRestoreInterrupts(BOOLEAN WereEnabled)
Definition: ke.h:250
VOID NTAPI KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql)
Definition: spinlock.c:27
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI KeLowerIrql(KIRQL NewIrql)
Definition: spinlock.c:39
VOID NTAPI KeFlushCurrentTb(VOID)
Definition: cpu.c:347
ULONG KiFreezeFlag
Definition: freeze.c:20