aboutsummaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/cpu.h1
-rw-r--r--target-i386/helper.c6
-rw-r--r--target-i386/helper2.c24
-rw-r--r--target-i386/translate.c2
4 files changed, 17 insertions, 16 deletions
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 14e7943dab..2b189ec8be 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -454,7 +454,6 @@ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0);
/* used to debug */
#define X86_DUMP_FPU 0x0001 /* dump FPU state too */
#define X86_DUMP_CCOP 0x0002 /* dump qemu flag cache */
-void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags);
#define TARGET_PAGE_BITS 12
#include "cpu-all.h"
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 3a6568e05b..7035e1cb9f 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -872,7 +872,7 @@ void do_interrupt(int intno, int is_int, int error_code,
}
fprintf(logfile, "\n");
#if 0
- cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
+ cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
{
int i;
uint8_t *ptr;
@@ -1334,7 +1334,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_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);
+ cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
}
#endif
if ((new_cs & 0xfffc) == 0)
@@ -1596,7 +1596,7 @@ static inline void helper_ret_protected(int shift, int is_iret, int 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);
+ cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
}
#endif
if ((new_cs & 0xfffc) == 0)
diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index 0d5f439d1b..76401d4480 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -168,14 +168,16 @@ static const char *cc_op_str[] = {
"SARL",
};
-void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags)
+void cpu_dump_state(CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
{
int eflags, i;
char cc_op_name[32];
static const char *seg_name[6] = { "ES", "CS", "SS", "DS", "FS", "GS" };
eflags = env->eflags;
- fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
+ cpu_fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d\n",
env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX], env->regs[R_EDX],
@@ -193,28 +195,28 @@ void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags)
(env->a20_mask >> 20) & 1);
for(i = 0; i < 6; i++) {
SegmentCache *sc = &env->segs[i];
- fprintf(f, "%s =%04x %08x %08x %08x\n",
+ cpu_fprintf(f, "%s =%04x %08x %08x %08x\n",
seg_name[i],
sc->selector,
(int)sc->base,
sc->limit,
sc->flags);
}
- fprintf(f, "LDT=%04x %08x %08x %08x\n",
+ cpu_fprintf(f, "LDT=%04x %08x %08x %08x\n",
env->ldt.selector,
(int)env->ldt.base,
env->ldt.limit,
env->ldt.flags);
- fprintf(f, "TR =%04x %08x %08x %08x\n",
+ cpu_fprintf(f, "TR =%04x %08x %08x %08x\n",
env->tr.selector,
(int)env->tr.base,
env->tr.limit,
env->tr.flags);
- fprintf(f, "GDT= %08x %08x\n",
+ cpu_fprintf(f, "GDT= %08x %08x\n",
(int)env->gdt.base, env->gdt.limit);
- fprintf(f, "IDT= %08x %08x\n",
+ cpu_fprintf(f, "IDT= %08x %08x\n",
(int)env->idt.base, env->idt.limit);
- fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
+ cpu_fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
env->cr[0], env->cr[2], env->cr[3], env->cr[4]);
if (flags & X86_DUMP_CCOP) {
@@ -222,16 +224,16 @@ void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags)
snprintf(cc_op_name, sizeof(cc_op_name), "%s", cc_op_str[env->cc_op]);
else
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
- fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
+ cpu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
env->cc_src, env->cc_dst, cc_op_name);
}
if (flags & X86_DUMP_FPU) {
- fprintf(f, "ST0=%f ST1=%f ST2=%f ST3=%f\n",
+ cpu_fprintf(f, "ST0=%f ST1=%f ST2=%f ST3=%f\n",
(double)env->fpregs[0],
(double)env->fpregs[1],
(double)env->fpregs[2],
(double)env->fpregs[3]);
- fprintf(f, "ST4=%f ST5=%f ST6=%f ST7=%f\n",
+ cpu_fprintf(f, "ST4=%f ST5=%f ST6=%f ST7=%f\n",
(double)env->fpregs[4],
(double)env->fpregs[5],
(double)env->fpregs[7],
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 111b88914e..bd2a61b0e5 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -4641,7 +4641,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
#ifdef DEBUG_DISAS
if (loglevel & CPU_LOG_TB_CPU) {
- cpu_dump_state(env, logfile, X86_DUMP_CCOP);
+ cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
}
if (loglevel & CPU_LOG_TB_IN_ASM) {
fprintf(logfile, "----------------\n");