aboutsummaryrefslogtreecommitdiff
path: root/op-i386.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-03 15:02:29 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-03 15:02:29 +0000
commit586314f2aa62990dead8144e780c4c8c498eece6 (patch)
tree59e8e588860b7430214833f82da84c762612c9b4 /op-i386.c
parent0ecfa9930c7615503ba629a61f7b94a0c3305af5 (diff)
better debug support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@18 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'op-i386.c')
-rw-r--r--op-i386.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/op-i386.c b/op-i386.c
index 451318af72..849e508e20 100644
--- a/op-i386.c
+++ b/op-i386.c
@@ -1,3 +1,5 @@
+#define DEBUG_EXEC
+
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
@@ -10,6 +12,11 @@ typedef signed long long int64_t;
#define NULL 0
+typedef struct FILE FILE;
+extern FILE *logfile;
+extern int loglevel;
+extern int fprintf(FILE *, const char *, ...);
+
#ifdef __i386__
register int T0 asm("esi");
register int T1 asm("ebx");
@@ -1636,6 +1643,32 @@ void OPPROTO op_fcos(void)
/* main execution loop */
uint8_t code_gen_buffer[65536];
+#ifdef DEBUG_EXEC
+static const char *cc_op_str[] = {
+ "DYNAMIC",
+ "EFLAGS",
+ "MUL",
+ "ADDB",
+ "ADDW",
+ "ADDL",
+ "SUBB",
+ "SUBW",
+ "SUBL",
+ "LOGICB",
+ "LOGICW",
+ "LOGICL",
+ "INCB",
+ "INCW",
+ "INCL",
+ "DECB",
+ "DECW",
+ "DECL",
+ "SHLB",
+ "SHLW",
+ "SHLL",
+};
+#endif
+
int cpu_x86_exec(CPUX86State *env1)
{
int saved_T0, saved_T1, saved_A0;
@@ -1653,6 +1686,17 @@ int cpu_x86_exec(CPUX86State *env1)
/* prepare setjmp context for exception handling */
if (setjmp(env->jmp_env) == 0) {
for(;;) {
+#ifdef DEBUG_EXEC
+ if (loglevel) {
+ fprintf(logfile,
+ "EAX=%08x EBX=%08X ECX=%08x EDX=%08x\n"
+ "ESI=%08x ESI=%08X EBP=%08x ESP=%08x\n"
+ "CCS=%08x CCD=%08x CCOP=%s\n",
+ env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX], env->regs[R_EDX],
+ env->regs[R_ESI], env->regs[R_EDI], env->regs[R_EBP], env->regs[R_ESP],
+ env->cc_src, env->cc_dst, cc_op_str[env->cc_op]);
+ }
+#endif
cpu_x86_gen_code(code_gen_buffer, &code_gen_size, (uint8_t *)env->pc);
/* execute the generated code */
gen_func = (void *)code_gen_buffer;