Fix some Rtl Prototype inconsistencies, more are in ntifs/winddk but i have fixed...
[reactos.git] / reactos / boot / freeldr / freeldr / include / debug.h
1 /*
2 * FreeLoader
3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
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
21 #ifndef __DEBUG_H
22 #define __DEBUG_H
23
24 #ifdef DEBUG
25
26 #define DPRINT_NONE 0x00000000 // No debug print
27 #define DPRINT_WARNING 0x00000001 // OR this with DebugPrintMask to enable debugger messages and other misc stuff
28 #define DPRINT_MEMORY 0x00000002 // OR this with DebugPrintMask to enable memory management messages
29 #define DPRINT_FILESYSTEM 0x00000004 // OR this with DebugPrintMask to enable file system messages
30 #define DPRINT_INIFILE 0x00000008 // OR this with DebugPrintMask to enable .ini file messages
31 #define DPRINT_UI 0x00000010 // OR this with DebugPrintMask to enable user interface messages
32 #define DPRINT_DISK 0x00000020 // OR this with DebugPrintMask to enable disk messages
33 #define DPRINT_CACHE 0x00000040 // OR this with DebugPrintMask to enable cache messages
34 #define DPRINT_REGISTRY 0x00000080 // OR this with DebugPrintMask to enable registry messages
35 #define DPRINT_REACTOS 0x00000100 // OR this with DebugPrintMask to enable ReactOS messages
36 #define DPRINT_LINUX 0x00000200 // OR this with DebugPrintMask to enable Linux messages
37 #define DPRINT_HWDETECT 0x00000400 // OR this with DebugPrintMask to enable hardware detection messages
38
39 VOID DebugInit(VOID);
40 VOID DebugPrint(U32 Mask, char *format, ...);
41 VOID DebugPrint1(char *format, ...);
42 VOID DebugDumpBuffer(U32 Mask, PVOID Buffer, U32 Length);
43
44 #define DbgPrint(_x_) DebugPrint _x_ ;
45 #define DPRINT1 DebugPrint1
46 #define BugCheck(_x_) { DebugPrint(DPRINT_WARNING, "Fatal Error: %s:%d(%s)\n", __FILE__, __LINE__, __FUNCTION__); DebugPrint _x_ ; for (;;); }
47 #define DbgDumpBuffer(_x_, _y_, _z_) DebugDumpBuffer(_x_, _y_, _z_)
48
49 #ifdef __i386__
50
51 // Debugging support functions:
52 //
53 // BREAKPOINT() - Inserts an "int 3" instruction
54 // INSTRUCTION_BREAKPOINTX(x) - Enters exception handler right before instruction at address "x" is executed
55 // MEMORY_READWRITE_BREAKPOINTX(x) - Enters exception handler when a read or write occurs at address "x"
56 // MEMORY_WRITE_BREAKPOINTX(x) - Enters exception handler when a write occurs at address "x"
57 //
58 // You may have as many BREAKPOINT()'s as you like but you may only
59 // have up to four of any of the others.
60 #define BREAKPOINT() __asm__ ("int $3");
61 void INSTRUCTION_BREAKPOINT1(unsigned long addr);
62 void MEMORY_READWRITE_BREAKPOINT1(unsigned long addr);
63 void MEMORY_WRITE_BREAKPOINT1(unsigned long addr);
64 void INSTRUCTION_BREAKPOINT2(unsigned long addr);
65 void MEMORY_READWRITE_BREAKPOINT2(unsigned long addr);
66 void MEMORY_WRITE_BREAKPOINT2(unsigned long addr);
67 void INSTRUCTION_BREAKPOINT3(unsigned long addr);
68 void MEMORY_READWRITE_BREAKPOINT3(unsigned long addr);
69 void MEMORY_WRITE_BREAKPOINT3(unsigned long addr);
70 void INSTRUCTION_BREAKPOINT4(unsigned long addr);
71 void MEMORY_READWRITE_BREAKPOINT4(unsigned long addr);
72 void MEMORY_WRITE_BREAKPOINT4(unsigned long addr);
73
74 #endif // defined __i386__
75
76 #else
77
78 #define DebugInit()
79 #define DbgPrint(_x_)
80 #define DPRINT1(_x_)
81 #define BugCheck(_x_)
82 #define DbgDumpBuffer(_x_, _y_, _z_)
83
84 #endif // defined DEBUG
85
86 #define UNIMPLEMENTED() BugCheck((DPRINT_WARNING, "This function is unimplemented!\n"))
87
88 #endif // defined __DEBUG_H