20 #ifndef __X86EMU_DEBUG_H 21 #define __X86EMU_DEBUG_H 27 #define CHECK_IP_FETCH_F 0x1 28 #define CHECK_SP_ACCESS_F 0x2 29 #define CHECK_MEM_ACCESS_F 0x4 30 #define CHECK_DATA_ACCESS_F 0x8 33 #define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F) 34 #define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F) 35 #define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F) 36 #define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F) 38 #define CHECK_IP_FETCH() 39 #define CHECK_SP_ACCESS() 40 #define CHECK_MEM_ACCESS() 41 #define CHECK_DATA_ACCESS() 45 #define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F) 46 #define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F) 47 #define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F) 48 #define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F) 49 #define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F) 50 #define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F) 51 #define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F) 52 #define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F) 54 #define DEBUG_FS() (M.x86.debug & DEBUG_FS_F) 55 #define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F) 56 #define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F) 57 #define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F) 58 #define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F) 59 #define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F) 60 #define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F) 61 #define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F) 62 #define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F) 64 #define DEBUG_INSTRUMENT() 0 65 #define DEBUG_DECODE() 0 66 #define DEBUG_TRACE() 0 67 #define DEBUG_STEP() 0 68 #define DEBUG_DISASSEMBLE() 0 69 #define DEBUG_BREAK() 0 71 #define DEBUG_SAVE_IP_CS() 0 73 #define DEBUG_PROC() 0 74 #define DEBUG_SYSINT() 0 75 #define DEBUG_TRACECALL() 0 76 #define DEBUG_TRACECALLREGS() 0 78 #define DEBUG_MEM_TRACE() 0 79 #define DEBUG_IO_TRACE() 0 80 #define DEBUG_DECODE_NOPRINT() 0 85 #define DECODE_PRINTF(x) \ 87 x86emu_decode_printf(x) 88 #define DECODE_PRINTF2(x, y) \ 90 x86emu_decode_printf2(x, y) 98 #define INC_DECODED_INST_LEN(x) \ 100 x86emu_inc_decoded_inst_len(x) 102 #define SAVE_IP_CS(x, y) \ 103 if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() | \ 104 DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) \ 106 M.x86.saved_cs = x; \ 107 M.x86.saved_ip = y; \ 110 #define INC_DECODED_INST_LEN(x) 111 #define DECODE_PRINTF(x) 112 #define DECODE_PRINTF2(x, y) 113 #define SAVE_IP_CS(x, y) 117 #define TRACE_REGS() \ 118 if (DEBUG_DISASSEMBLE()) \ 120 x86emu_just_disassemble(); \ 121 goto EndOfTheInstructionProcedure; \ 123 if (DEBUG_TRACE() || DEBUG_DECODE()) \ 130 #define SINGLE_STEP() \ 134 #define SINGLE_STEP() 137 #define TRACE_AND_STEP() \ 142 #define START_OF_INSTR() 143 #define END_OF_INSTR() \ 144 EndOfTheInstructionProcedure: \ 146 #define END_OF_INSTR_NO_TRACE() x86emu_end_instr(); 148 #define START_OF_INSTR() 149 #define END_OF_INSTR() 150 #define END_OF_INSTR_NO_TRACE() 154 #define CALL_TRACE(u, v, w, x, s) \ 155 if (DEBUG_TRACECALLREGS()) \ 156 x86emu_dump_regs(); \ 157 if (DEBUG_TRACECALL()) \ 158 printk("%04x:%04x: CALL %s%04x:%04x\n", u, v, s, w, x); 159 #define RETURN_TRACE(n, u, v) \ 160 if (DEBUG_TRACECALLREGS()) \ 161 x86emu_dump_regs(); \ 162 if (DEBUG_TRACECALL()) \ 163 printk("%04x:%04x: %s\n", u, v, n); 165 #define CALL_TRACE(u, v, w, x, s) 166 #define RETURN_TRACE(n, u, v) 181 extern void x86emu_inc_decoded_inst_len(
int x);
182 extern void x86emu_decode_printf(
char *x);
183 extern void x86emu_decode_printf2(
char *x,
int y);
184 extern void x86emu_just_disassemble(
void);
185 extern void x86emu_single_step(
void);
186 extern void x86emu_end_instr(
void);
187 extern void x86emu_dump_regs(
void);
188 extern void x86emu_dump_xregs(
void);
189 extern void x86emu_print_int_vect(u16 iv);
190 extern void x86emu_instrument_instruction(
void);
191 extern void x86emu_check_ip_access(
void);
192 extern void x86emu_check_sp_access(
void);
193 extern void x86emu_check_mem_access(u32 p);
194 extern void x86emu_check_data_access(uint s, uint o);