Patchwork [06/14] target-i386: Use fprintf_function and fix dump of DR registers

login
register
mail settings
Submitter Stefan Weil
Date March 29, 2010, 7:16 p.m.
Message ID <1269890225-13639-7-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/48892/
State New
Headers show

Comments

Stefan Weil - March 29, 2010, 7:16 p.m.
The dump was wrong for 32 bit hosts with 64 bit target.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 target-i386/cpu.h    |    3 +--
 target-i386/cpuid.c  |    3 +--
 target-i386/helper.c |   12 +++++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

Patch

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 548ab80..dabf084 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -723,8 +723,7 @@  typedef struct CPUX86State {
 CPUX86State *cpu_x86_init(const char *cpu_model);
 int cpu_x86_exec(CPUX86State *s);
 void cpu_x86_close(CPUX86State *s);
-void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
-                   const char *optarg);
+void x86_cpu_list (FILE *f, fprintf_function cpu_fprintf, const char *optarg);
 void x86_cpudef_setup(void);
 
 int cpu_get_pic_interrupt(CPUX86State *s);
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 56938e2..9229665 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -709,8 +709,7 @@  static void listflags(char *buf, int bufsize, uint32_t fbits,
  * -?dump    output all model (x86_def_t) data
  * -?cpuid   list all recognized cpuid flag names
  */
-void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
-                  const char *optarg)
+void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
 {
     unsigned char model = !strcmp("?model", optarg);
     unsigned char dump = !strcmp("?dump", optarg);
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 35ab720..136ca8d 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -169,7 +169,7 @@  static const char *cc_op_str[] = {
 
 static void
 cpu_x86_dump_seg_cache(CPUState *env, FILE *f,
-                       int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+                       fprintf_function cpu_fprintf,
                        const char *name, struct SegmentCache *sc)
 {
 #ifdef TARGET_X86_64
@@ -223,7 +223,7 @@  done:
 }
 
 void cpu_dump_state(CPUState *env, FILE *f,
-                    int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+                    fprintf_function cpu_fprintf,
                     int flags)
 {
     int eflags, i, nb;
@@ -333,9 +333,11 @@  void cpu_dump_state(CPUState *env, FILE *f,
                     (uint32_t)env->cr[2],
                     (uint32_t)env->cr[3],
                     (uint32_t)env->cr[4]);
-        for(i = 0; i < 4; i++)
-            cpu_fprintf(f, "DR%d=%08x ", i, env->dr[i]);
-        cpu_fprintf(f, "\nDR6=%08x DR7=%08x\n", env->dr[6], env->dr[7]);
+        for(i = 0; i < 4; i++) {
+            cpu_fprintf(f, "DR%d=%08x ", i, (uint32_t)env->dr[i]);
+        }
+        cpu_fprintf(f, "\nDR6=%08x DR7=%08x\n",
+                    (uint32_t)env->dr[6], (uint32_t)env->dr[7]);
     }
     if (flags & X86_DUMP_CCOP) {
         if ((unsigned)env->cc_op < CC_OP_NB)