]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/x86emu/lib/src/x86emu/debug.h
update
[l4.git] / l4 / pkg / x86emu / lib / src / x86emu / debug.h
index cba60b86438ef82d8c40c7dd24e6236dde78dced..385b804dd710ad3c1fd6cdfa6fb3e2a96d7b2172 100644 (file)
 
 #define CHECK_IP_FETCH_F                0x1
 #define CHECK_SP_ACCESS_F               0x2
-#define CHECK_MEM_ACCESS_F              0x4 /*using regular linear pointer */
-#define CHECK_DATA_ACCESS_F             0x8 /*using segment:offset*/
+#define CHECK_MEM_ACCESS_F              0x4     /*using regular linear pointer */
+#define CHECK_DATA_ACCESS_F             0x8     /*using segment:offset */
 
 #ifdef DEBUG
-# define CHECK_IP_FETCH()                      (M.x86.check & CHECK_IP_FETCH_F)
-# define CHECK_SP_ACCESS()                     (M.x86.check & CHECK_SP_ACCESS_F)
-# define CHECK_MEM_ACCESS()                    (M.x86.check & CHECK_MEM_ACCESS_F)
-# define CHECK_DATA_ACCESS()                   (M.x86.check & CHECK_DATA_ACCESS_F)
+#define CHECK_IP_FETCH()               (M.x86.check & CHECK_IP_FETCH_F)
+#define CHECK_SP_ACCESS()              (M.x86.check & CHECK_SP_ACCESS_F)
+#define CHECK_MEM_ACCESS()             (M.x86.check & CHECK_MEM_ACCESS_F)
+#define CHECK_DATA_ACCESS()            (M.x86.check & CHECK_DATA_ACCESS_F)
 #else
-# define CHECK_IP_FETCH()
-# define CHECK_SP_ACCESS()
-# define CHECK_MEM_ACCESS()
-# define CHECK_DATA_ACCESS()
+#define CHECK_IP_FETCH()
+#define CHECK_SP_ACCESS()
+#define CHECK_MEM_ACCESS()
+#define CHECK_DATA_ACCESS()
 #endif
 
 #ifdef DEBUG
-# define DEBUG_INSTRUMENT()            (M.x86.debug & DEBUG_INSTRUMENT_F)
-# define DEBUG_DECODE()                (M.x86.debug & DEBUG_DECODE_F)
-# define DEBUG_TRACE()                 (M.x86.debug & DEBUG_TRACE_F)
-# define DEBUG_STEP()                  (M.x86.debug & DEBUG_STEP_F)
-# define DEBUG_DISASSEMBLE()           (M.x86.debug & DEBUG_DISASSEMBLE_F)
-# define DEBUG_BREAK()                 (M.x86.debug & DEBUG_BREAK_F)
-# define DEBUG_SVC()                   (M.x86.debug & DEBUG_SVC_F)
-# define DEBUG_SAVE_IP_CS()     (M.x86.debug & DEBUG_SAVE_IP_CS_F)
-
-# define DEBUG_FS()                    (M.x86.debug & DEBUG_FS_F)
-# define DEBUG_PROC()                  (M.x86.debug & DEBUG_PROC_F)
-# define DEBUG_SYSINT()                (M.x86.debug & DEBUG_SYSINT_F)
-# define DEBUG_TRACECALL()             (M.x86.debug & DEBUG_TRACECALL_F)
-# define DEBUG_TRACECALLREGS()         (M.x86.debug & DEBUG_TRACECALL_REGS_F)
-# define DEBUG_SYS()                   (M.x86.debug & DEBUG_SYS_F)
-# define DEBUG_MEM_TRACE()             (M.x86.debug & DEBUG_MEM_TRACE_F)
-# define DEBUG_IO_TRACE()              (M.x86.debug & DEBUG_IO_TRACE_F)
-# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
+#define DEBUG_INSTRUMENT()     (M.x86.debug & DEBUG_INSTRUMENT_F)
+#define DEBUG_DECODE()         (M.x86.debug & DEBUG_DECODE_F)
+#define DEBUG_TRACE()          (M.x86.debug & DEBUG_TRACE_F)
+#define DEBUG_STEP()           (M.x86.debug & DEBUG_STEP_F)
+#define DEBUG_DISASSEMBLE()    (M.x86.debug & DEBUG_DISASSEMBLE_F)
+#define DEBUG_BREAK()          (M.x86.debug & DEBUG_BREAK_F)
+#define DEBUG_SVC()            (M.x86.debug & DEBUG_SVC_F)
+#define DEBUG_SAVE_IP_CS()     (M.x86.debug & DEBUG_SAVE_IP_CS_F)
+
+#define DEBUG_FS()             (M.x86.debug & DEBUG_FS_F)
+#define DEBUG_PROC()           (M.x86.debug & DEBUG_PROC_F)
+#define DEBUG_SYSINT()         (M.x86.debug & DEBUG_SYSINT_F)
+#define DEBUG_TRACECALL()      (M.x86.debug & DEBUG_TRACECALL_F)
+#define DEBUG_TRACECALLREGS()  (M.x86.debug & DEBUG_TRACECALL_REGS_F)
+#define DEBUG_SYS()            (M.x86.debug & DEBUG_SYS_F)
+#define DEBUG_MEM_TRACE()      (M.x86.debug & DEBUG_MEM_TRACE_F)
+#define DEBUG_IO_TRACE()       (M.x86.debug & DEBUG_IO_TRACE_F)
+#define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
 #else
-# define DEBUG_INSTRUMENT()            0
-# define DEBUG_DECODE()                0
-# define DEBUG_TRACE()                 0
-# define DEBUG_STEP()                  0
-# define DEBUG_DISASSEMBLE()           0
-# define DEBUG_BREAK()                 0
-# define DEBUG_SVC()                   0
-# define DEBUG_SAVE_IP_CS()     0
-# define DEBUG_FS()                    0
-# define DEBUG_PROC()                  0
-# define DEBUG_SYSINT()                0
-# define DEBUG_TRACECALL()             0
-# define DEBUG_TRACECALLREGS()         0
-# define DEBUG_SYS()                   0
-# define DEBUG_MEM_TRACE()             0
-# define DEBUG_IO_TRACE()              0
-# define DEBUG_DECODE_NOPRINT() 0
+#define DEBUG_INSTRUMENT()     0
+#define DEBUG_DECODE()         0
+#define DEBUG_TRACE()          0
+#define DEBUG_STEP()           0
+#define DEBUG_DISASSEMBLE()    0
+#define DEBUG_BREAK()          0
+#define DEBUG_SVC()            0
+#define DEBUG_SAVE_IP_CS()     0
+#define DEBUG_FS()             0
+#define DEBUG_PROC()           0
+#define DEBUG_SYSINT()         0
+#define DEBUG_TRACECALL()      0
+#define DEBUG_TRACECALLREGS()  0
+#define DEBUG_SYS()            0
+#define DEBUG_MEM_TRACE()      0
+#define DEBUG_IO_TRACE()       0
+#define DEBUG_DECODE_NOPRINT() 0
 #endif
 
 #ifdef DEBUG
 
-# define DECODE_PRINTF(x)      if (DEBUG_DECODE()) \
+#define DECODE_PRINTF(x)       if (DEBUG_DECODE()) \
                                                                        x86emu_decode_printf(x)
-# define DECODE_PRINTF2(x,y)   if (DEBUG_DECODE()) \
+#define DECODE_PRINTF2(x,y)    if (DEBUG_DECODE()) \
                                                                        x86emu_decode_printf2(x,y)
 
 /*
                M.x86.saved_ip = y;                                             \
        }
 #else
-# define INC_DECODED_INST_LEN(x)
-# define DECODE_PRINTF(x)
-# define DECODE_PRINTF2(x,y)
-# define SAVE_IP_CS(x,y)
+#define INC_DECODED_INST_LEN(x)
+#define DECODE_PRINTF(x)
+#define DECODE_PRINTF2(x,y)
+#define SAVE_IP_CS(x,y)
 #endif
 
 #ifdef DEBUG
        }                                                       \
        if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
 #else
-# define TRACE_REGS()
+#define TRACE_REGS()
 #endif
 
 #ifdef DEBUG
-# define SINGLE_STEP()         /*if (DEBUG_STEP()) x86emu_single_step()*/
+#define SINGLE_STEP()          if (DEBUG_STEP()) x86emu_single_step()
 #else
-# define SINGLE_STEP()
+#define SINGLE_STEP()
 #endif
 
 #define TRACE_AND_STEP()       \
        SINGLE_STEP()
 
 #ifdef DEBUG
-# define START_OF_INSTR()
-# define END_OF_INSTR()                EndOfTheInstructionProcedure: x86emu_end_instr();
-# define END_OF_INSTR_NO_TRACE()       x86emu_end_instr();
+#define START_OF_INSTR()
+#define END_OF_INSTR()         EndOfTheInstructionProcedure: x86emu_end_instr();
+#define END_OF_INSTR_NO_TRACE()        x86emu_end_instr();
 #else
-# define START_OF_INSTR()
-# define END_OF_INSTR()
-# define END_OF_INSTR_NO_TRACE()
+#define START_OF_INSTR()
+#define END_OF_INSTR()
+#define END_OF_INSTR_NO_TRACE()
 #endif
 
 #ifdef DEBUG
-# define  CALL_TRACE(u,v,w,x,s)                                 \
+#define  CALL_TRACE(u,v,w,x,s)                                 \
        if (DEBUG_TRACECALLREGS())                                                                      \
                x86emu_dump_regs();                                     \
        if (DEBUG_TRACECALL())                                          \
                printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
-# define RETURN_TRACE(n,u,v)                                    \
+#define RETURN_TRACE(n,u,v)                                    \
        if (DEBUG_TRACECALLREGS())                                                                      \
                x86emu_dump_regs();                                     \
        if (DEBUG_TRACECALL())                                          \
                printk("%04x:%04x: %s\n",u,v,n);
 #else
-# define CALL_TRACE(u,v,w,x,s)
-# define RETURN_TRACE(n,u,v)
+#define CALL_TRACE(u,v,w,x,s)
+#define RETURN_TRACE(n,u,v)
 #endif
 
 #ifdef DEBUG
 /*-------------------------- Function Prototypes --------------------------*/
 
 #ifdef  __cplusplus
-extern "C" {                                   /* Use "C" linkage when in C++ mode */
+extern "C" {                    /* Use "C" linkage when in C++ mode */
 #endif
 
-extern void x86emu_inc_decoded_inst_len (int x);
-extern void x86emu_decode_printf (char *x);
-extern void x86emu_decode_printf2 (char *x, int y);
-extern void x86emu_just_disassemble (void);
-extern void x86emu_single_step (void);
-extern void x86emu_end_instr (void);
-extern void x86emu_dump_regs (void);
-extern void x86emu_dump_xregs (void);
-extern void x86emu_print_int_vect (u16 iv);
-extern void x86emu_instrument_instruction (void);
-extern void x86emu_check_ip_access (void);
-extern void x86emu_check_sp_access (void);
-extern void x86emu_check_mem_access (u32 p);
-extern void x86emu_check_data_access (uint s, uint o);
+    extern void x86emu_inc_decoded_inst_len(int x);
+    extern void x86emu_decode_printf(const char *x);
+    extern void x86emu_decode_printf2(const char *x, int y);
+    extern void x86emu_just_disassemble(void);
+    extern void x86emu_single_step(void);
+    extern void x86emu_end_instr(void);
+    extern void x86emu_dump_regs(void);
+    extern void x86emu_dump_xregs(void);
+    extern void x86emu_print_int_vect(u16 iv);
+    extern void x86emu_instrument_instruction(void);
+    extern void x86emu_check_ip_access(void);
+    extern void x86emu_check_sp_access(void);
+    extern void x86emu_check_mem_access(u32 p);
+    extern void x86emu_check_data_access(uint s, uint o);
 
 #ifdef  __cplusplus
-}                                              /* End of "C" linkage for C++           */
+}                               /* End of "C" linkage for C++           */
 #endif
-
-#endif /* __X86EMU_DEBUG_H */
+#endif                          /* __X86EMU_DEBUG_H */