Commit 26a76461f259031f2c30cd5843a5ca91e056cf03

Authored by bellard
1 parent 3b42c979

C99 64 bit printf


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2018 c046a42c-6fe2-441c-8c8c-71466251a162
audio/audio.c
@@ -997,7 +997,7 @@ static int audio_get_avail (SWVoiceIn *sw) @@ -997,7 +997,7 @@ static int audio_get_avail (SWVoiceIn *sw)
997 } 997 }
998 998
999 ldebug ( 999 ldebug (
1000 - "%s: get_avail live %d ret %lld\n", 1000 + "%s: get_avail live %d ret %" PRId64 "\n",
1001 SW_NAME (sw), 1001 SW_NAME (sw),
1002 live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift 1002 live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift
1003 ); 1003 );
@@ -1023,7 +1023,7 @@ static int audio_get_free (SWVoiceOut *sw) @@ -1023,7 +1023,7 @@ static int audio_get_free (SWVoiceOut *sw)
1023 dead = sw->hw->samples - live; 1023 dead = sw->hw->samples - live;
1024 1024
1025 #ifdef DEBUG_OUT 1025 #ifdef DEBUG_OUT
1026 - dolog ("%s: get_free live %d dead %d ret %lld\n", 1026 + dolog ("%s: get_free live %d dead %d ret %" PRId64 "\n",
1027 SW_NAME (sw), 1027 SW_NAME (sw),
1028 live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift); 1028 live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift);
1029 #endif 1029 #endif
audio/audio_template.h
@@ -542,7 +542,7 @@ uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts) @@ -542,7 +542,7 @@ uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts)
542 542
543 cur_ts = sw->hw->ts_helper; 543 cur_ts = sw->hw->ts_helper;
544 old_ts = ts->old_ts; 544 old_ts = ts->old_ts;
545 - /* dolog ("cur %lld old %lld\n", cur_ts, old_ts); */ 545 + /* dolog ("cur %" PRId64 " old %" PRId64 "\n", cur_ts, old_ts); */
546 546
547 if (cur_ts >= old_ts) { 547 if (cur_ts >= old_ts) {
548 delta = cur_ts - old_ts; 548 delta = cur_ts - old_ts;
block-vpc.c
@@ -163,7 +163,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) @@ -163,7 +163,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
163 bitmap_offset = 512 * s->pagetable[pagetable_index]; 163 bitmap_offset = 512 * s->pagetable[pagetable_index];
164 block_offset = bitmap_offset + 512 + (512 * pageentry_index); 164 block_offset = bitmap_offset + 512 + (512 * pageentry_index);
165 165
166 -// printf("sector: %llx, index: %x, offset: %x, bioff: %llx, bloff: %llx\n", 166 +// printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n",
167 // sector_num, pagetable_index, pageentry_index, 167 // sector_num, pagetable_index, pageentry_index,
168 // bitmap_offset, block_offset); 168 // bitmap_offset, block_offset);
169 169
cpu-defs.h
@@ -47,7 +47,7 @@ typedef uint32_t target_ulong; @@ -47,7 +47,7 @@ typedef uint32_t target_ulong;
47 #elif TARGET_LONG_SIZE == 8 47 #elif TARGET_LONG_SIZE == 8
48 typedef int64_t target_long; 48 typedef int64_t target_long;
49 typedef uint64_t target_ulong; 49 typedef uint64_t target_ulong;
50 -#define TARGET_FMT_lx "%016llx" 50 +#define TARGET_FMT_lx "%016" PRIx64
51 #else 51 #else
52 #error TARGET_LONG_SIZE undefined 52 #error TARGET_LONG_SIZE undefined
53 #endif 53 #endif
@@ -58,7 +58,7 @@ perror_memory (status, memaddr, info) @@ -58,7 +58,7 @@ perror_memory (status, memaddr, info)
58 /* Actually, address between memaddr and memaddr + len was 58 /* Actually, address between memaddr and memaddr + len was
59 out of bounds. */ 59 out of bounds. */
60 (*info->fprintf_func) (info->stream, 60 (*info->fprintf_func) (info->stream,
61 - "Address 0x%llx is out of bounds.\n", memaddr); 61 + "Address 0x%" PRIx64 " is out of bounds.\n", memaddr);
62 } 62 }
63 63
64 /* This could be in a separate file, to save miniscule amounts of space 64 /* This could be in a separate file, to save miniscule amounts of space
@@ -73,7 +73,7 @@ generic_print_address (addr, info) @@ -73,7 +73,7 @@ generic_print_address (addr, info)
73 bfd_vma addr; 73 bfd_vma addr;
74 struct disassemble_info *info; 74 struct disassemble_info *info;
75 { 75 {
76 - (*info->fprintf_func) (info->stream, "0x%llx", addr); 76 + (*info->fprintf_func) (info->stream, "0x%" PRIx64, addr);
77 } 77 }
78 78
79 /* Just return the given address. */ 79 /* Just return the given address. */
hw/apic.c
@@ -239,7 +239,7 @@ void cpu_set_apic_base(CPUState *env, uint64_t val) @@ -239,7 +239,7 @@ void cpu_set_apic_base(CPUState *env, uint64_t val)
239 { 239 {
240 APICState *s = env->apic_state; 240 APICState *s = env->apic_state;
241 #ifdef DEBUG_APIC 241 #ifdef DEBUG_APIC
242 - printf("cpu_set_apic_base: %016llx\n", val); 242 + printf("cpu_set_apic_base: %016" PRIx64 "\n", val);
243 #endif 243 #endif
244 s->apicbase = (val & 0xfffff000) | 244 s->apicbase = (val & 0xfffff000) |
245 (s->apicbase & (MSR_IA32_APICBASE_BSP | MSR_IA32_APICBASE_ENABLE)); 245 (s->apicbase & (MSR_IA32_APICBASE_BSP | MSR_IA32_APICBASE_ENABLE));
@@ -255,7 +255,7 @@ uint64_t cpu_get_apic_base(CPUState *env) @@ -255,7 +255,7 @@ uint64_t cpu_get_apic_base(CPUState *env)
255 { 255 {
256 APICState *s = env->apic_state; 256 APICState *s = env->apic_state;
257 #ifdef DEBUG_APIC 257 #ifdef DEBUG_APIC
258 - printf("cpu_get_apic_base: %016llx\n", (uint64_t)s->apicbase); 258 + printf("cpu_get_apic_base: %016" PRIx64 "\n", (uint64_t)s->apicbase);
259 #endif 259 #endif
260 return s->apicbase; 260 return s->apicbase;
261 } 261 }
hw/cuda.c
@@ -209,7 +209,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time) @@ -209,7 +209,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time)
209 } 209 }
210 #if 0 210 #if 0
211 #ifdef DEBUG_CUDA 211 #ifdef DEBUG_CUDA
212 - printf("latch=%d counter=%lld delta_next=%lld\n", 212 + printf("latch=%d counter=%" PRId64 " delta_next=%" PRId64 "\n",
213 s->latch, d, next_time - d); 213 s->latch, d, next_time - d);
214 #endif 214 #endif
215 #endif 215 #endif
hw/i8259.c
@@ -531,7 +531,7 @@ void irq_info(void) @@ -531,7 +531,7 @@ void irq_info(void)
531 for (i = 0; i < 16; i++) { 531 for (i = 0; i < 16; i++) {
532 count = irq_count[i]; 532 count = irq_count[i];
533 if (count > 0) 533 if (count > 0)
534 - term_printf("%2d: %lld\n", i, count); 534 + term_printf("%2d: %" PRId64 "\n", i, count);
535 } 535 }
536 #endif 536 #endif
537 } 537 }
hw/mips_r4k.c
@@ -60,7 +60,7 @@ static void cpu_mips_update_count (CPUState *env, uint32_t count, @@ -60,7 +60,7 @@ static void cpu_mips_update_count (CPUState *env, uint32_t count,
60 next++; 60 next++;
61 #if 0 61 #if 0
62 if (logfile) { 62 if (logfile) {
63 - fprintf(logfile, "%s: 0x%08llx %08x %08x => 0x%08llx\n", 63 + fprintf(logfile, "%s: 0x%08" PRIx64 " %08x %08x => 0x%08" PRIx64 "\n",
64 __func__, now, count, compare, next - now); 64 __func__, now, count, compare, next - now);
65 } 65 }
66 #endif 66 #endif
hw/sb16.c
@@ -765,7 +765,7 @@ static void complete (SB16State *s) @@ -765,7 +765,7 @@ static void complete (SB16State *s)
765 ); 765 );
766 } 766 }
767 } 767 }
768 - ldebug ("mix silence %d %d %lld\n", samples, bytes, ticks); 768 + ldebug ("mix silence %d %d %" PRId64 "\n", samples, bytes, ticks);
769 } 769 }
770 break; 770 break;
771 771
hw/sh7750.c
@@ -124,7 +124,7 @@ static void start_timer0(SH7750State * s) @@ -124,7 +124,7 @@ static void start_timer0(SH7750State * s)
124 s->periph_freq); 124 s->periph_freq);
125 if (next == now) 125 if (next == now)
126 next = now + 1; 126 next = now + 1;
127 - fprintf(stderr, "now=%016llx, next=%016llx\n", now, next); 127 + fprintf(stderr, "now=%016" PRIx64 ", next=%016" PRIx64 "\n", now, next);
128 fprintf(stderr, "timer will underflow in %f seconds\n", 128 fprintf(stderr, "timer will underflow in %f seconds\n",
129 (float) (next - now) / (float) ticks_per_sec); 129 (float) (next - now) / (float) ticks_per_sec);
130 130
hw/slavio_intctl.c
@@ -203,7 +203,7 @@ void slavio_irq_info(void *opaque) @@ -203,7 +203,7 @@ void slavio_irq_info(void *opaque)
203 for (i = 0; i < 32; i++) { 203 for (i = 0; i < 32; i++) {
204 count = s->irq_count[i]; 204 count = s->irq_count[i];
205 if (count > 0) 205 if (count > 0)
206 - term_printf("%2d: %lld\n", i, count); 206 + term_printf("%2d: %" PRId64 "\n", i, count);
207 } 207 }
208 #endif 208 #endif
209 } 209 }
hw/slavio_timer.c
@@ -100,7 +100,7 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s) @@ -100,7 +100,7 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s)
100 // Convert remaining counter ticks to CPU ticks 100 // Convert remaining counter ticks to CPU ticks
101 s->expire_time = ticks + muldiv64(limit - count, ticks_per_sec, CNT_FREQ); 101 s->expire_time = ticks + muldiv64(limit - count, ticks_per_sec, CNT_FREQ);
102 102
103 - DPRINTF("irq %d limit %d reached %d d %lld count %d s->c %x diff %lld stopped %d mode %d\n", s->irq, limit, s->reached?1:0, (ticks-s->count_load_time), count, s->count, s->expire_time - ticks, s->stopped, s->mode); 103 + DPRINTF("irq %d limit %d reached %d d %" PRId64 " count %d s->c %x diff %" PRId64 " stopped %d mode %d\n", s->irq, limit, s->reached?1:0, (ticks-s->count_load_time), count, s->count, s->expire_time - ticks, s->stopped, s->mode);
104 104
105 if (s->mode != 1) 105 if (s->mode != 1)
106 pic_set_irq_cpu(s->irq, out, s->cpu); 106 pic_set_irq_cpu(s->irq, out, s->cpu);
@@ -598,12 +598,12 @@ void kqemu_record_dump(void) @@ -598,12 +598,12 @@ void kqemu_record_dump(void)
598 perror("/tmp/kqemu.stats"); 598 perror("/tmp/kqemu.stats");
599 exit(1); 599 exit(1);
600 } 600 }
601 - fprintf(f, "total: %lld\n", total); 601 + fprintf(f, "total: %" PRId64 "\n", total);
602 sum = 0; 602 sum = 0;
603 for(i = 0; i < nb_pc_records; i++) { 603 for(i = 0; i < nb_pc_records; i++) {
604 r = pr[i]; 604 r = pr[i];
605 sum += r->count; 605 sum += r->count;
606 - fprintf(f, "%08lx: %lld %0.2f%% %0.2f%%\n", 606 + fprintf(f, "%08lx: %" PRId64 " %0.2f%% %0.2f%%\n",
607 r->pc, 607 r->pc,
608 r->count, 608 r->count,
609 (double)r->count / (double)total * 100.0, 609 (double)r->count / (double)total * 100.0,
monitor.c
@@ -533,16 +533,16 @@ static void memory_dump(int count, int format, int wsize, @@ -533,16 +533,16 @@ static void memory_dump(int count, int format, int wsize,
533 term_printf(" "); 533 term_printf(" ");
534 switch(format) { 534 switch(format) {
535 case 'o': 535 case 'o':
536 - term_printf("%#*llo", max_digits, v); 536 + term_printf("%#*" PRIo64, max_digits, v);
537 break; 537 break;
538 case 'x': 538 case 'x':
539 - term_printf("0x%0*llx", max_digits, v); 539 + term_printf("0x%0*" PRIx64, max_digits, v);
540 break; 540 break;
541 case 'u': 541 case 'u':
542 - term_printf("%*llu", max_digits, v); 542 + term_printf("%*" PRIu64, max_digits, v);
543 break; 543 break;
544 case 'd': 544 case 'd':
545 - term_printf("%*lld", max_digits, v); 545 + term_printf("%*" PRId64, max_digits, v);
546 break; 546 break;
547 case 'c': 547 case 'c':
548 term_printc(v); 548 term_printc(v);
@@ -602,17 +602,17 @@ static void do_print(int count, int format, int size, unsigned int valh, unsigne @@ -602,17 +602,17 @@ static void do_print(int count, int format, int size, unsigned int valh, unsigne
602 #else 602 #else
603 switch(format) { 603 switch(format) {
604 case 'o': 604 case 'o':
605 - term_printf("%#llo", val); 605 + term_printf("%#" PRIo64, val);
606 break; 606 break;
607 case 'x': 607 case 'x':
608 - term_printf("%#llx", val); 608 + term_printf("%#" PRIx64, val);
609 break; 609 break;
610 case 'u': 610 case 'u':
611 - term_printf("%llu", val); 611 + term_printf("%" PRIu64, val);
612 break; 612 break;
613 default: 613 default:
614 case 'd': 614 case 'd':
615 - term_printf("%lld", val); 615 + term_printf("%" PRId64, val);
616 break; 616 break;
617 case 'c': 617 case 'c':
618 term_printc(val); 618 term_printc(val);
@@ -1026,11 +1026,11 @@ static void do_info_profile(void) @@ -1026,11 +1026,11 @@ static void do_info_profile(void)
1026 total = qemu_time; 1026 total = qemu_time;
1027 if (total == 0) 1027 if (total == 0)
1028 total = 1; 1028 total = 1;
1029 - term_printf("async time %lld (%0.3f)\n", 1029 + term_printf("async time %" PRId64 " (%0.3f)\n",
1030 dev_time, dev_time / (double)ticks_per_sec); 1030 dev_time, dev_time / (double)ticks_per_sec);
1031 - term_printf("qemu time %lld (%0.3f)\n", 1031 + term_printf("qemu time %" PRId64 " (%0.3f)\n",
1032 qemu_time, qemu_time / (double)ticks_per_sec); 1032 qemu_time, qemu_time / (double)ticks_per_sec);
1033 - term_printf("kqemu time %lld (%0.3f %0.1f%%) count=%lld int=%lld excp=%lld intr=%lld\n", 1033 + term_printf("kqemu time %" PRId64 " (%0.3f %0.1f%%) count=%" PRId64 " int=%" PRId64 " excp=%" PRId64 " intr=%" PRId64 "\n",
1034 kqemu_time, kqemu_time / (double)ticks_per_sec, 1034 kqemu_time, kqemu_time / (double)ticks_per_sec,
1035 kqemu_time / (double)total * 100.0, 1035 kqemu_time / (double)total * 100.0,
1036 kqemu_exec_count, 1036 kqemu_exec_count,
target-arm/nwfpe/fpa11_cprt.c
@@ -133,7 +133,7 @@ unsigned int PerformFIX(const unsigned int opcode) @@ -133,7 +133,7 @@ unsigned int PerformFIX(const unsigned int opcode)
133 133
134 case typeDouble: 134 case typeDouble:
135 { 135 {
136 - //printf("F%d is 0x%llx\n",Fn,fpa11->fpreg[Fn].fDouble); 136 + //printf("F%d is 0x%" PRIx64 "\n",Fn,fpa11->fpreg[Fn].fDouble);
137 writeRegister(getRd(opcode), 137 writeRegister(getRd(opcode),
138 float64_to_int32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status)); 138 float64_to_int32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status));
139 } 139 }
target-i386/helper.c
@@ -3259,7 +3259,7 @@ static void mul64(uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b) @@ -3259,7 +3259,7 @@ static void mul64(uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
3259 v = (uint64_t)a1 * (uint64_t)b1; 3259 v = (uint64_t)a1 * (uint64_t)b1;
3260 *phigh += v; 3260 *phigh += v;
3261 #ifdef DEBUG_MULDIV 3261 #ifdef DEBUG_MULDIV
3262 - printf("mul: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n", 3262 + printf("mul: 0x%016" PRIx64 " * 0x%016" PRIx64 " = 0x%016" PRIx64 "%016" PRIx64 "\n",
3263 a, b, *phigh, *plow); 3263 a, b, *phigh, *plow);
3264 #endif 3264 #endif
3265 } 3265 }
@@ -3308,7 +3308,7 @@ static int div64(uint64_t *plow, uint64_t *phigh, uint64_t b) @@ -3308,7 +3308,7 @@ static int div64(uint64_t *plow, uint64_t *phigh, uint64_t b)
3308 a0 = (a0 << 1) | qb; 3308 a0 = (a0 << 1) | qb;
3309 } 3309 }
3310 #if defined(DEBUG_MULDIV) 3310 #if defined(DEBUG_MULDIV)
3311 - printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n", 3311 + printf("div: 0x%016" PRIx64 "%016" PRIx64 " / 0x%016" PRIx64 ": q=0x%016" PRIx64 " r=0x%016" PRIx64 "\n",
3312 *phigh, *plow, b, a0, a1); 3312 *phigh, *plow, b, a0, a1);
3313 #endif 3313 #endif
3314 *plow = a0; 3314 *plow = a0;
target-i386/helper2.c
@@ -264,11 +264,11 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -264,11 +264,11 @@ void cpu_dump_state(CPUState *env, FILE *f,
264 #ifdef TARGET_X86_64 264 #ifdef TARGET_X86_64
265 if (env->hflags & HF_CS64_MASK) { 265 if (env->hflags & HF_CS64_MASK) {
266 cpu_fprintf(f, 266 cpu_fprintf(f,
267 - "RAX=%016llx RBX=%016llx RCX=%016llx RDX=%016llx\n"  
268 - "RSI=%016llx RDI=%016llx RBP=%016llx RSP=%016llx\n"  
269 - "R8 =%016llx R9 =%016llx R10=%016llx R11=%016llx\n"  
270 - "R12=%016llx R13=%016llx R14=%016llx R15=%016llx\n"  
271 - "RIP=%016llx RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d HLT=%d\n", 267 + "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
  268 + "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
  269 + "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
  270 + "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
  271 + "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d HLT=%d\n",
272 env->regs[R_EAX], 272 env->regs[R_EAX],
273 env->regs[R_EBX], 273 env->regs[R_EBX],
274 env->regs[R_ECX], 274 env->regs[R_ECX],
@@ -329,28 +329,28 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -329,28 +329,28 @@ void cpu_dump_state(CPUState *env, FILE *f,
329 if (env->hflags & HF_LMA_MASK) { 329 if (env->hflags & HF_LMA_MASK) {
330 for(i = 0; i < 6; i++) { 330 for(i = 0; i < 6; i++) {
331 SegmentCache *sc = &env->segs[i]; 331 SegmentCache *sc = &env->segs[i];
332 - cpu_fprintf(f, "%s =%04x %016llx %08x %08x\n", 332 + cpu_fprintf(f, "%s =%04x %016" PRIx64 " %08x %08x\n",
333 seg_name[i], 333 seg_name[i],
334 sc->selector, 334 sc->selector,
335 sc->base, 335 sc->base,
336 sc->limit, 336 sc->limit,
337 sc->flags); 337 sc->flags);
338 } 338 }
339 - cpu_fprintf(f, "LDT=%04x %016llx %08x %08x\n", 339 + cpu_fprintf(f, "LDT=%04x %016" PRIx64 " %08x %08x\n",
340 env->ldt.selector, 340 env->ldt.selector,
341 env->ldt.base, 341 env->ldt.base,
342 env->ldt.limit, 342 env->ldt.limit,
343 env->ldt.flags); 343 env->ldt.flags);
344 - cpu_fprintf(f, "TR =%04x %016llx %08x %08x\n", 344 + cpu_fprintf(f, "TR =%04x %016" PRIx64 " %08x %08x\n",
345 env->tr.selector, 345 env->tr.selector,
346 env->tr.base, 346 env->tr.base,
347 env->tr.limit, 347 env->tr.limit,
348 env->tr.flags); 348 env->tr.flags);
349 - cpu_fprintf(f, "GDT= %016llx %08x\n", 349 + cpu_fprintf(f, "GDT= %016" PRIx64 " %08x\n",
350 env->gdt.base, env->gdt.limit); 350 env->gdt.base, env->gdt.limit);
351 - cpu_fprintf(f, "IDT= %016llx %08x\n", 351 + cpu_fprintf(f, "IDT= %016" PRIx64 " %08x\n",
352 env->idt.base, env->idt.limit); 352 env->idt.base, env->idt.limit);
353 - cpu_fprintf(f, "CR0=%08x CR2=%016llx CR3=%016llx CR4=%08x\n", 353 + cpu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
354 (uint32_t)env->cr[0], 354 (uint32_t)env->cr[0],
355 env->cr[2], 355 env->cr[2],
356 env->cr[3], 356 env->cr[3],
@@ -394,7 +394,7 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -394,7 +394,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
394 snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op); 394 snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
395 #ifdef TARGET_X86_64 395 #ifdef TARGET_X86_64
396 if (env->hflags & HF_CS64_MASK) { 396 if (env->hflags & HF_CS64_MASK) {
397 - cpu_fprintf(f, "CCS=%016llx CCD=%016llx CCO=%-8s\n", 397 + cpu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
398 env->cc_src, env->cc_dst, 398 env->cc_src, env->cc_dst,
399 cc_op_name); 399 cc_op_name);
400 } else 400 } else
@@ -427,10 +427,10 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -427,10 +427,10 @@ void cpu_dump_state(CPUState *env, FILE *f,
427 } l; 427 } l;
428 } tmp; 428 } tmp;
429 tmp.d = env->fpregs[i].d; 429 tmp.d = env->fpregs[i].d;
430 - cpu_fprintf(f, "FPR%d=%016llx %04x", 430 + cpu_fprintf(f, "FPR%d=%016" PRIx64 " %04x",
431 i, tmp.l.lower, tmp.l.upper); 431 i, tmp.l.lower, tmp.l.upper);
432 #else 432 #else
433 - cpu_fprintf(f, "FPR%d=%016llx", 433 + cpu_fprintf(f, "FPR%d=%016" PRIx64,
434 i, env->fpregs[i].mmx.q); 434 i, env->fpregs[i].mmx.q);
435 #endif 435 #endif
436 if ((i & 1) == 1) 436 if ((i & 1) == 1)
target-ppc/translate.c
@@ -2443,12 +2443,12 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -2443,12 +2443,12 @@ void cpu_dump_state(CPUState *env, FILE *f,
2443 { 2443 {
2444 #if defined(TARGET_PPC64) || 1 2444 #if defined(TARGET_PPC64) || 1
2445 #define FILL "" 2445 #define FILL ""
2446 -#define REGX "%016llx" 2446 +#define REGX "%016" PRIx64
2447 #define RGPL 4 2447 #define RGPL 4
2448 #define RFPL 4 2448 #define RFPL 4
2449 #else 2449 #else
2450 #define FILL " " 2450 #define FILL " "
2451 -#define REGX "%08llx" 2451 +#define REGX "%08" PRIx64
2452 #define RGPL 8 2452 #define RGPL 8
2453 #define RFPL 4 2453 #define RFPL 4
2454 #endif 2454 #endif
@@ -2485,7 +2485,7 @@ void cpu_dump_state(CPUState *env, FILE *f, @@ -2485,7 +2485,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
2485 for (i = 0; i < 32; i++) { 2485 for (i = 0; i < 32; i++) {
2486 if ((i & (RFPL - 1)) == 0) 2486 if ((i & (RFPL - 1)) == 0)
2487 cpu_fprintf(f, "FPR%02d", i); 2487 cpu_fprintf(f, "FPR%02d", i);
2488 - cpu_fprintf(f, " %016llx", *((uint64_t *)&env->fpr[i])); 2488 + cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i]));
2489 if ((i & (RFPL - 1)) == (RFPL - 1)) 2489 if ((i & (RFPL - 1)) == (RFPL - 1))
2490 cpu_fprintf(f, "\n"); 2490 cpu_fprintf(f, "\n");
2491 } 2491 }
target-ppc/translate_init.c
@@ -252,7 +252,7 @@ static inline void spr_register (CPUPPCState *env, int num, @@ -252,7 +252,7 @@ static inline void spr_register (CPUPPCState *env, int num,
252 exit(1); 252 exit(1);
253 } 253 }
254 #if defined(PPC_DEBUG_SPR) 254 #if defined(PPC_DEBUG_SPR)
255 - printf("*** register spr %d (%03x) %s val %08llx\n", num, num, name, 255 + printf("*** register spr %d (%03x) %s val %08" PRIx64 "\n", num, num, name,
256 (unsigned long long)initial_value); 256 (unsigned long long)initial_value);
257 #endif 257 #endif
258 spr->name = name; 258 spr->name = name;
target-sparc/helper.c
@@ -394,7 +394,7 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical @@ -394,7 +394,7 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
394 env->dmmuregs[4] = address; /* Fault address register */ 394 env->dmmuregs[4] = address; /* Fault address register */
395 env->exception_index = TT_DFAULT; 395 env->exception_index = TT_DFAULT;
396 #ifdef DEBUG_MMU 396 #ifdef DEBUG_MMU
397 - printf("DFAULT at 0x%llx\n", address); 397 + printf("DFAULT at 0x%" PRIx64 "\n", address);
398 #endif 398 #endif
399 return 1; 399 return 1;
400 } 400 }
@@ -406,7 +406,7 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical @@ -406,7 +406,7 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
406 } 406 }
407 } 407 }
408 #ifdef DEBUG_MMU 408 #ifdef DEBUG_MMU
409 - printf("DMISS at 0x%llx\n", address); 409 + printf("DMISS at 0x%" PRIx64 "\n", address);
410 #endif 410 #endif
411 env->exception_index = TT_DMISS; 411 env->exception_index = TT_DMISS;
412 return 1; 412 return 1;
@@ -452,7 +452,7 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical @@ -452,7 +452,7 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical
452 env->immuregs[3] |= (is_user << 3) | 1; 452 env->immuregs[3] |= (is_user << 3) | 1;
453 env->exception_index = TT_TFAULT; 453 env->exception_index = TT_TFAULT;
454 #ifdef DEBUG_MMU 454 #ifdef DEBUG_MMU
455 - printf("TFAULT at 0x%llx\n", address); 455 + printf("TFAULT at 0x%" PRIx64 "\n", address);
456 #endif 456 #endif
457 return 1; 457 return 1;
458 } 458 }
@@ -462,7 +462,7 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical @@ -462,7 +462,7 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical
462 } 462 }
463 } 463 }
464 #ifdef DEBUG_MMU 464 #ifdef DEBUG_MMU
465 - printf("TMISS at 0x%llx\n", address); 465 + printf("TMISS at 0x%" PRIx64 "\n", address);
466 #endif 466 #endif
467 env->exception_index = TT_TMISS; 467 env->exception_index = TT_TMISS;
468 return 1; 468 return 1;
@@ -491,7 +491,7 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, @@ -491,7 +491,7 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
491 virt_addr = address & TARGET_PAGE_MASK; 491 virt_addr = address & TARGET_PAGE_MASK;
492 vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1)); 492 vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1));
493 #ifdef DEBUG_MMU 493 #ifdef DEBUG_MMU
494 - printf("Translate at 0x%llx -> 0x%llx, vaddr 0x%llx\n", address, paddr, vaddr); 494 + printf("Translate at 0x%" PRIx64 " -> 0x%" PRIx64 ", vaddr 0x%" PRIx64 "\n", address, paddr, vaddr);
495 #endif 495 #endif
496 ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu); 496 ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu);
497 return ret; 497 return ret;
@@ -506,7 +506,7 @@ void dump_mmu(CPUState *env) @@ -506,7 +506,7 @@ void dump_mmu(CPUState *env)
506 unsigned int i; 506 unsigned int i;
507 const char *mask; 507 const char *mask;
508 508
509 - printf("MMU contexts: Primary: %lld, Secondary: %lld\n", env->dmmuregs[1], env->dmmuregs[2]); 509 + printf("MMU contexts: Primary: %" PRId64 ", Secondary: %" PRId64 "\n", env->dmmuregs[1], env->dmmuregs[2]);
510 if ((env->lsu & DMMU_E) == 0) { 510 if ((env->lsu & DMMU_E) == 0) {
511 printf("DMMU disabled\n"); 511 printf("DMMU disabled\n");
512 } else { 512 } else {
@@ -528,7 +528,7 @@ void dump_mmu(CPUState *env) @@ -528,7 +528,7 @@ void dump_mmu(CPUState *env)
528 break; 528 break;
529 } 529 }
530 if ((env->dtlb_tte[i] & 0x8000000000000000ULL) != 0) { 530 if ((env->dtlb_tte[i] & 0x8000000000000000ULL) != 0) {
531 - printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, %s, ctx %lld\n", 531 + printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, %s, ctx %" PRId64 "\n",
532 env->dtlb_tag[i] & ~0x1fffULL, 532 env->dtlb_tag[i] & ~0x1fffULL,
533 env->dtlb_tte[i] & 0x1ffffffe000ULL, 533 env->dtlb_tte[i] & 0x1ffffffe000ULL,
534 mask, 534 mask,
@@ -560,7 +560,7 @@ void dump_mmu(CPUState *env) @@ -560,7 +560,7 @@ void dump_mmu(CPUState *env)
560 break; 560 break;
561 } 561 }
562 if ((env->itlb_tte[i] & 0x8000000000000000ULL) != 0) { 562 if ((env->itlb_tte[i] & 0x8000000000000000ULL) != 0) {
563 - printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, ctx %lld\n", 563 + printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, ctx %" PRId64 "\n",
564 env->itlb_tag[i] & ~0x1fffULL, 564 env->itlb_tag[i] & ~0x1fffULL,
565 env->itlb_tte[i] & 0x1ffffffe000ULL, 565 env->itlb_tte[i] & 0x1ffffffe000ULL,
566 mask, 566 mask,
target-sparc/op_helper.c
@@ -446,7 +446,7 @@ void helper_st_asi(int asi, int size, int sign) @@ -446,7 +446,7 @@ void helper_st_asi(int asi, int size, int sign)
446 // invalid in normal mode 446 // invalid in normal mode
447 if (oldreg != env->lsu) { 447 if (oldreg != env->lsu) {
448 #ifdef DEBUG_MMU 448 #ifdef DEBUG_MMU
449 - printf("LSU change: 0x%llx -> 0x%llx\n", oldreg, env->lsu); 449 + printf("LSU change: 0x%" PRIx64 " -> 0x%" PRIx64 "\n", oldreg, env->lsu);
450 dump_mmu(env); 450 dump_mmu(env);
451 #endif 451 #endif
452 tlb_flush(env, 1); 452 tlb_flush(env, 1);
@@ -480,7 +480,7 @@ void helper_st_asi(int asi, int size, int sign) @@ -480,7 +480,7 @@ void helper_st_asi(int asi, int size, int sign)
480 env->immuregs[reg] = T1; 480 env->immuregs[reg] = T1;
481 #ifdef DEBUG_MMU 481 #ifdef DEBUG_MMU
482 if (oldreg != env->immuregs[reg]) { 482 if (oldreg != env->immuregs[reg]) {
483 - printf("mmu change reg[%d]: 0x%08llx -> 0x%08llx\n", reg, oldreg, env->immuregs[reg]); 483 + printf("mmu change reg[%d]: 0x%08" PRIx64 " -> 0x%08" PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
484 } 484 }
485 dump_mmu(env); 485 dump_mmu(env);
486 #endif 486 #endif
@@ -549,7 +549,7 @@ void helper_st_asi(int asi, int size, int sign) @@ -549,7 +549,7 @@ void helper_st_asi(int asi, int size, int sign)
549 env->dmmuregs[reg] = T1; 549 env->dmmuregs[reg] = T1;
550 #ifdef DEBUG_MMU 550 #ifdef DEBUG_MMU
551 if (oldreg != env->dmmuregs[reg]) { 551 if (oldreg != env->dmmuregs[reg]) {
552 - printf("mmu change reg[%d]: 0x%08llx -> 0x%08llx\n", reg, oldreg, env->dmmuregs[reg]); 552 + printf("mmu change reg[%d]: 0x%08" PRIx64 " -> 0x%08" PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]);
553 } 553 }
554 dump_mmu(env); 554 dump_mmu(env);
555 #endif 555 #endif
@@ -769,7 +769,7 @@ void do_interrupt(int intno) @@ -769,7 +769,7 @@ void do_interrupt(int intno)
769 #ifdef DEBUG_PCALL 769 #ifdef DEBUG_PCALL
770 if (loglevel & CPU_LOG_INT) { 770 if (loglevel & CPU_LOG_INT) {
771 static int count; 771 static int count;
772 - fprintf(logfile, "%6d: v=%04x pc=%016llx npc=%016llx SP=%016llx\n", 772 + fprintf(logfile, "%6d: v=%04x pc=%016" PRIx64 " npc=%016" PRIx64 " SP=%016" PRIx64 "\n",
773 count, intno, 773 count, intno,
774 env->pc, 774 env->pc,
775 env->npc, env->regwptr[6]); 775 env->npc, env->regwptr[6]);
tests/test-i386.c
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 #define FMTLX "%016lx" 50 #define FMTLX "%016lx"
51 #define X86_64_ONLY(x) x 51 #define X86_64_ONLY(x) x
52 #else 52 #else
53 -#define FMT64X "%016llx" 53 +#define FMT64X "%016" PRIx64
54 #define FMTLX "%08lx" 54 #define FMTLX "%08lx"
55 #define X86_64_ONLY(x) 55 #define X86_64_ONLY(x)
56 #endif 56 #endif
@@ -912,7 +912,7 @@ static void host_alarm_handler(int host_signum) @@ -912,7 +912,7 @@ static void host_alarm_handler(int host_signum)
912 delta_max = delta; 912 delta_max = delta;
913 delta_cum += delta; 913 delta_cum += delta;
914 if (++count == DISP_FREQ) { 914 if (++count == DISP_FREQ) {
915 - printf("timer: min=%lld us max=%lld us avg=%lld us avg_freq=%0.3f Hz\n", 915 + printf("timer: min=%" PRId64 " us max=%" PRId64 " us avg=%" PRId64 " us avg_freq=%0.3f Hz\n",
916 muldiv64(delta_min, 1000000, ticks_per_sec), 916 muldiv64(delta_min, 1000000, ticks_per_sec),
917 muldiv64(delta_max, 1000000, ticks_per_sec), 917 muldiv64(delta_max, 1000000, ticks_per_sec),
918 muldiv64(delta_cum, 1000000 / DISP_FREQ, ticks_per_sec), 918 muldiv64(delta_cum, 1000000 / DISP_FREQ, ticks_per_sec),
@@ -61,6 +61,9 @@ static inline char *realpath(const char *path, char *resolved_path) @@ -61,6 +61,9 @@ static inline char *realpath(const char *path, char *resolved_path)
61 } 61 }
62 62
63 #define PRId64 "I64d" 63 #define PRId64 "I64d"
  64 +#define PRIx64 "I64x"
  65 +#define PRIu64 "I64u"
  66 +#define PRIo64 "I64o"
64 #endif 67 #endif
65 68
66 #ifdef QEMU_TOOL 69 #ifdef QEMU_TOOL