Commit 9b605b9eaee7845353f32aed23e8b9085bfa44ee

Authored by pbrook
1 parent 493ae1f0

Fix ppc32 register dumps on 64-bit hosts.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3723 c046a42c-6fe2-441c-8c8c-71466251a162
hw/ppc_oldworld.c
... ... @@ -93,7 +93,8 @@ static int vga_osi_call (CPUState *env)
93 93 /* R6 = x, R7 = y, R8 = visible, R9 = data */
94 94 break;
95 95 default:
96   - fprintf(stderr, "unsupported OSI call R5=" REGX "\n", env->gpr[5]);
  96 + fprintf(stderr, "unsupported OSI call R5=" REGX "\n",
  97 + (target_ulong)env->gpr[5]);
97 98 break;
98 99 }
99 100  
... ...
target-ppc/cpu.h
... ... @@ -30,7 +30,6 @@
30 30 typedef uint64_t ppc_gpr_t;
31 31 #define TARGET_GPR_BITS 64
32 32 #define TARGET_LONG_BITS 64
33   -#define REGX "%016" PRIx64
34 33 #define TARGET_PAGE_BITS 12
35 34  
36 35 #else /* defined (TARGET_PPC64) */
... ... @@ -43,11 +42,9 @@ typedef uint64_t ppc_gpr_t;
43 42 */
44 43 typedef uint64_t ppc_gpr_t;
45 44 #define TARGET_GPR_BITS 64
46   -#define REGX "%08" PRIx64
47 45 #else /* (HOST_LONG_BITS >= 64) */
48 46 typedef uint32_t ppc_gpr_t;
49 47 #define TARGET_GPR_BITS 32
50   -#define REGX "%08" PRIx32
51 48 #endif /* (HOST_LONG_BITS >= 64) */
52 49  
53 50 #define TARGET_LONG_BITS 32
... ... @@ -72,6 +69,10 @@ typedef uint32_t ppc_gpr_t;
72 69  
73 70 #endif /* defined (TARGET_PPC64) */
74 71  
  72 +/* A ppc_gpr_t should not be printed directly as the high bits may be
  73 + garbage. It should always be cast to a target_ulong first. */
  74 +#define REGX TARGET_FMT_lx
  75 +
75 76 #include "cpu-defs.h"
76 77  
77 78 #define ADDRX TARGET_FMT_lx
... ...
target-ppc/helper.c
... ... @@ -2169,8 +2169,9 @@ static always_inline void dump_syscall (CPUState *env)
2169 2169 {
2170 2170 fprintf(logfile, "syscall r0=0x" REGX " r3=0x" REGX " r4=0x" REGX
2171 2171 " r5=0x" REGX " r6=0x" REGX " nip=0x" ADDRX "\n",
2172   - env->gpr[0], env->gpr[3], env->gpr[4],
2173   - env->gpr[5], env->gpr[6], env->nip);
  2172 + (target_ulong)env->gpr[0], (target_ulong)env->gpr[3],
  2173 + (target_ulong)env->gpr[4], (target_ulong)env->gpr[5],
  2174 + (target_ulong)env->gpr[6], env->nip);
2174 2175 }
2175 2176  
2176 2177 /* Note that this function should be greatly optimized
... ...
target-ppc/op_helper.c
... ... @@ -2920,7 +2920,8 @@ void do_4xx_tlbwe_hi (void)
2920 2920  
2921 2921 #if defined (DEBUG_SOFTWARE_TLB)
2922 2922 if (loglevel != 0) {
2923   - fprintf(logfile, "%s T0 " REGX " T1 " REGX "\n", __func__, T0, T1);
  2923 + fprintf(logfile, "%s T0 " REGX " T1 " REGX "\n", __func__,
  2924 + (target_ulong)T0, (target_ulong)T1);
2924 2925 }
2925 2926 #endif
2926 2927 T0 &= 0x3F;
... ... @@ -2989,7 +2990,8 @@ void do_4xx_tlbwe_lo (void)
2989 2990  
2990 2991 #if defined (DEBUG_SOFTWARE_TLB)
2991 2992 if (loglevel != 0) {
2992   - fprintf(logfile, "%s T0 " REGX " T1 " REGX "\n", __func__, T0, T1);
  2993 + fprintf(logfile, "%s T0 " REGX " T1 " REGX "\n", __func__,
  2994 + (targt_ulong)T0, (target_ulong)T1);
2993 2995 }
2994 2996 #endif
2995 2997 T0 &= 0x3F;
... ... @@ -3023,7 +3025,7 @@ void do_440_tlbwe (int word)
3023 3025 #if defined (DEBUG_SOFTWARE_TLB)
3024 3026 if (loglevel != 0) {
3025 3027 fprintf(logfile, "%s word %d T0 " REGX " T1 " REGX "\n",
3026   - __func__, word, T0, T1);
  3028 + __func__, word, (target_ulong)T0, (target_ulong)T1);
3027 3029 }
3028 3030 #endif
3029 3031 do_flush_tlbs = 0;
... ...