Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / clients / net-snk / app / biosemu / debug.h
1 /******************************************************************************
2  * Copyright (c) 2004, 2008 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12 #ifndef _BIOSEMU_DEBUG_H_
13 #define _BIOSEMU_DEBUG_H_
14
15 #include <stdio.h>
16 #include <stdint.h>
17
18 extern uint32_t debug_flags;
19 // from x86emu...needed for debugging
20 extern void x86emu_dump_xregs(void);
21
22 #define DEBUG_IO 0x1
23 #define DEBUG_MEM 0x2
24 // set this to print messages for certain virtual memory accesses (Interrupt Vectors, ...)
25 #define DEBUG_CHECK_VMEM_ACCESS 0x4
26 #define DEBUG_INTR 0x8
27 #define DEBUG_PRINT_INT10 0x10  // set to have the INT10 routine print characters
28 #define DEBUG_VBE 0x20
29 #define DEBUG_PMM 0x40
30 #define DEBUG_DISK 0x80
31 #define DEBUG_PNP 0x100
32
33 #define DEBUG_TRACE_X86EMU 0x1000
34 // set to enable tracing of JMPs in x86emu
35 #define DEBUG_JMP 0x2000
36
37 //#define DEBUG
38 #ifdef DEBUG
39
40 #define CHECK_DBG(_flag) if (debug_flags & _flag)
41
42 #define DEBUG_PRINTF(_x...) printf(_x);
43 // prints the CS:IP before the printout, NOTE: actually its CS:IP of the _next_ instruction
44 // to be executed, since the x86emu advances CS:IP _before_ actually executing an instruction
45 #define DEBUG_PRINTF_CS_IP(_x...) DEBUG_PRINTF("%x:%x ", M.x86.R_CS, M.x86.R_IP); DEBUG_PRINTF(_x);
46
47 #define DEBUG_PRINTF_IO(_x...) CHECK_DBG(DEBUG_IO) { DEBUG_PRINTF_CS_IP(_x) }
48 #define DEBUG_PRINTF_MEM(_x...) CHECK_DBG(DEBUG_MEM) { DEBUG_PRINTF_CS_IP(_x) }
49 #define DEBUG_PRINTF_INTR(_x...) CHECK_DBG(DEBUG_INTR) { DEBUG_PRINTF_CS_IP(_x) }
50 #define DEBUG_PRINTF_VBE(_x...) CHECK_DBG(DEBUG_VBE) { DEBUG_PRINTF_CS_IP(_x) }
51 #define DEBUG_PRINTF_PMM(_x...) CHECK_DBG(DEBUG_PMM) { DEBUG_PRINTF_CS_IP(_x) }
52 #define DEBUG_PRINTF_DISK(_x...) CHECK_DBG(DEBUG_DISK) { DEBUG_PRINTF_CS_IP(_x) }
53 #define DEBUG_PRINTF_PNP(_x...) CHECK_DBG(DEBUG_PNP) { DEBUG_PRINTF_CS_IP(_x) }
54
55 #else
56
57 #define CHECK_DBG(_flag) if (0)
58
59 #define DEBUG_PRINTF(_x...)
60 #define DEBUG_PRINTF_CS_IP(_x...)
61
62 #define DEBUG_PRINTF_IO(_x...)
63 #define DEBUG_PRINTF_MEM(_x...)
64 #define DEBUG_PRINTF_INTR(_x...)
65 #define DEBUG_PRINTF_VBE(_x...)
66 #define DEBUG_PRINTF_PMM(_x...)
67 #define DEBUG_PRINTF_DISK(_x...)
68 #define DEBUG_PRINTF_PNP(_x...)
69
70 #endif                          //DEBUG
71
72 void dump(uint8_t * addr, uint32_t len);
73
74 #endif