[NTOS:MM] Quick fix: use SIZE_T instead of ULONG, because ULONG is 32-bit and on...
[reactos.git] / ntoskrnl / ke / freeze.c
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 */
19 KIRQL KiOldIrql;
20 ULONG KiFreezeFlag;
21
22 /* FUNCTIONS ******************************************************************/
23
24 BOOLEAN
25 NTAPI
26 KeFreezeExecution(IN PKTRAP_FRAME TrapFrame,
27 IN PKEXCEPTION_FRAME ExceptionFrame)
28 {
29 BOOLEAN Enable;
30
31 /* Disable interrupts and get previous state */
32 Enable = KeDisableInterrupts();
33
34 /* Save freeze flag */
35 KiFreezeFlag = 4;
36
37 /* Save the old IRQL */
38 KiOldIrql = KeGetCurrentIrql();
39
40 /* Return whether interrupts were enabled */
41 return Enable;
42 }
43
44 VOID
45 NTAPI
46 KeThawExecution(IN BOOLEAN Enable)
47 {
48 /* Cleanup CPU caches */
49 KeFlushCurrentTb();
50
51 /* Re-enable interrupts */
52 if (Enable) _enable();
53 }