diff options
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/helper.c | 89 | ||||
-rw-r--r-- | target-i386/translate-copy.c | 2 | ||||
-rw-r--r-- | target-i386/translate.c | 14 |
3 files changed, 43 insertions, 62 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c index 6fc136763a..d08de8a8b4 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -290,7 +290,7 @@ static void switch_tss(int tss_selector, type = (e2 >> DESC_TYPE_SHIFT) & 0xf; #ifdef DEBUG_PCALL - if (loglevel) + if (loglevel & CPU_LOG_PCALL) fprintf(logfile, "switch_tss: sel=0x%04x type=%d src=%d\n", tss_selector, type, source); #endif @@ -858,68 +858,43 @@ void do_interrupt_user(int intno, int is_int, int error_code, } /* - * Begin excution of an interruption. is_int is TRUE if coming from + * Begin execution of an interruption. is_int is TRUE if coming from * the int instruction. next_eip is the EIP value AFTER the interrupt * instruction. It is only relevant if is_int is TRUE. */ void do_interrupt(int intno, int is_int, int error_code, unsigned int next_eip, int is_hw) { -#if 0 - { - extern FILE *stdout; - static int count; - if (env->cr[0] & CR0_PE_MASK) { - fprintf(stdout, "%d: v=%02x e=%04x i=%d CPL=%d CS:EIP=%04x:%08x SS:ESP=%04x:%08x", +#ifdef DEBUG_PCALL + if (loglevel & (CPU_LOG_PCALL | CPU_LOG_INT)) { + if ((env->cr[0] & CR0_PE_MASK)) { + static int count; + fprintf(logfile, "%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:%08x SP=%04x:%08x", count, intno, error_code, is_int, env->hflags & HF_CPL_MASK, env->segs[R_CS].selector, EIP, env->segs[R_SS].selector, ESP); if (intno == 0x0e) { - fprintf(stdout, " CR2=%08x", env->cr[2]); + fprintf(logfile, " CR2=%08x", env->cr[2]); } else { - fprintf(stdout, " EAX=%08x", env->regs[R_EAX]); + fprintf(logfile, " EAX=%08x", env->regs[R_EAX]); } - fprintf(stdout, "\n"); - - if (0) { - cpu_x86_dump_state(env, stdout, X86_DUMP_CCOP); + fprintf(logfile, "\n"); #if 0 - { - int i; - uint8_t *ptr; - fprintf(stdout, " code="); - ptr = env->segs[R_CS].base + env->eip; - for(i = 0; i < 16; i++) { - fprintf(stdout, " %02x", ldub(ptr + i)); - } - fprintf(stdout, "\n"); + cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); + { + int i; + uint8_t *ptr; + fprintf(logfile, " code="); + ptr = env->segs[R_CS].base + env->eip; + for(i = 0; i < 16; i++) { + fprintf(logfile, " %02x", ldub(ptr + i)); } -#endif + fprintf(logfile, "\n"); } - count++; - } - } #endif -#ifdef DEBUG_PCALL - if (loglevel) { - static int count; - fprintf(logfile, "%d: interrupt: vector=%02x error_code=%04x int=%d\n", - count, intno, error_code, is_int); - cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); -#if 0 - { - int i; - uint8_t *ptr; - fprintf(logfile, " code="); - ptr = env->segs[R_CS].base + env->eip; - for(i = 0; i < 16; i++) { - fprintf(logfile, " %02x", ldub(ptr + i)); - } - fprintf(logfile, "\n"); + count++; } -#endif - count++; } #endif if (env->cr[0] & CR0_PE_MASK) { @@ -1365,9 +1340,9 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip) new_cs = T0; new_eip = T1; #ifdef DEBUG_PCALL - if (loglevel) { - fprintf(logfile, "lcall %04x:%08x\n", - new_cs, new_eip); + if (loglevel & CPU_LOG_PCALL) { + fprintf(logfile, "lcall %04x:%08x s=%d\n", + new_cs, new_eip, shift); cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); } #endif @@ -1377,7 +1352,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip) raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc); cpl = env->hflags & HF_CPL_MASK; #ifdef DEBUG_PCALL - if (loglevel) { + if (loglevel & CPU_LOG_PCALL) { fprintf(logfile, "desc=%08x:%08x\n", e1, e2); } #endif @@ -1466,8 +1441,8 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip) /* to inner priviledge */ get_ss_esp_from_tss(&ss, &sp, dpl); #ifdef DEBUG_PCALL - if (loglevel) - fprintf(logfile, "ss=%04x sp=%04x param_count=%d ESP=%x\n", + if (loglevel & CPU_LOG_PCALL) + fprintf(logfile, "new ss:esp=%04x:%08x param_count=%d ESP=%x\n", ss, sp, param_count, ESP); #endif if ((ss & 0xfffc) == 0) @@ -1626,9 +1601,9 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend) POPW(ssp, sp, sp_mask, new_eflags); } #ifdef DEBUG_PCALL - if (loglevel) { - fprintf(logfile, "lret new %04x:%08x addend=0x%x\n", - new_cs, new_eip, addend); + if (loglevel & CPU_LOG_PCALL) { + fprintf(logfile, "lret new %04x:%08x s=%d addend=0x%x\n", + new_cs, new_eip, shift, addend); cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); } #endif @@ -1673,6 +1648,12 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend) POPW(ssp, sp, sp_mask, new_esp); POPW(ssp, sp, sp_mask, new_ss); } +#ifdef DEBUG_PCALL + if (loglevel & CPU_LOG_PCALL) { + fprintf(logfile, "new ss:esp=%04x:%08x\n", + new_ss, new_esp); + } +#endif if ((new_ss & 3) != rpl) raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc); diff --git a/target-i386/translate-copy.c b/target-i386/translate-copy.c index 08775e618d..fb0bcaa3cf 100644 --- a/target-i386/translate-copy.c +++ b/target-i386/translate-copy.c @@ -1237,7 +1237,7 @@ static inline int gen_intermediate_code_internal(CPUState *env, } #ifdef DEBUG_DISAS - if (loglevel) { + if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "----------------\n"); fprintf(logfile, "IN: COPY: %s fpu=%d\n", lookup_symbol(pc_start), diff --git a/target-i386/translate.c b/target-i386/translate.c index f9823a49d1..12a74435ff 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -4595,16 +4595,16 @@ static inline int gen_intermediate_code_internal(CPUState *env, } #ifdef DEBUG_DISAS - if (loglevel) { + if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "----------------\n"); fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start)); disas(logfile, pc_start, pc_ptr - pc_start, 0, !dc->code32); fprintf(logfile, "\n"); -#if 0 - fprintf(logfile, "OP:\n"); - dump_ops(gen_opc_buf, gen_opparam_buf); - fprintf(logfile, "\n"); -#endif + if (loglevel & CPU_LOG_TB_OP) { + fprintf(logfile, "OP:\n"); + dump_ops(gen_opc_buf, gen_opparam_buf); + fprintf(logfile, "\n"); + } } #endif @@ -4612,7 +4612,7 @@ static inline int gen_intermediate_code_internal(CPUState *env, optimize_flags(gen_opc_buf, gen_opc_ptr - gen_opc_buf); #ifdef DEBUG_DISAS - if (loglevel) { + if (loglevel & CPU_LOG_TB_OP_OPT) { fprintf(logfile, "AFTER FLAGS OPT:\n"); dump_ops(gen_opc_buf, gen_opparam_buf); fprintf(logfile, "\n"); |