C99 64 bit printf

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2018 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2006-06-25 18:15:32 +00:00
parent 3b42c9794c
commit 26a76461f2
25 changed files with 67 additions and 64 deletions

View File

@ -997,7 +997,7 @@ static int audio_get_avail (SWVoiceIn *sw)
} }
ldebug ( ldebug (
"%s: get_avail live %d ret %lld\n", "%s: get_avail live %d ret %" PRId64 "\n",
SW_NAME (sw), SW_NAME (sw),
live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift
); );
@ -1023,7 +1023,7 @@ static int audio_get_free (SWVoiceOut *sw)
dead = sw->hw->samples - live; dead = sw->hw->samples - live;
#ifdef DEBUG_OUT #ifdef DEBUG_OUT
dolog ("%s: get_free live %d dead %d ret %lld\n", dolog ("%s: get_free live %d dead %d ret %" PRId64 "\n",
SW_NAME (sw), SW_NAME (sw),
live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift); live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift);
#endif #endif

View File

@ -542,7 +542,7 @@ uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts)
cur_ts = sw->hw->ts_helper; cur_ts = sw->hw->ts_helper;
old_ts = ts->old_ts; old_ts = ts->old_ts;
/* dolog ("cur %lld old %lld\n", cur_ts, old_ts); */ /* dolog ("cur %" PRId64 " old %" PRId64 "\n", cur_ts, old_ts); */
if (cur_ts >= old_ts) { if (cur_ts >= old_ts) {
delta = cur_ts - old_ts; delta = cur_ts - old_ts;

View File

@ -163,7 +163,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
bitmap_offset = 512 * s->pagetable[pagetable_index]; bitmap_offset = 512 * s->pagetable[pagetable_index];
block_offset = bitmap_offset + 512 + (512 * pageentry_index); block_offset = bitmap_offset + 512 + (512 * pageentry_index);
// printf("sector: %llx, index: %x, offset: %x, bioff: %llx, bloff: %llx\n", // printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n",
// sector_num, pagetable_index, pageentry_index, // sector_num, pagetable_index, pageentry_index,
// bitmap_offset, block_offset); // bitmap_offset, block_offset);

View File

@ -47,7 +47,7 @@ typedef uint32_t target_ulong;
#elif TARGET_LONG_SIZE == 8 #elif TARGET_LONG_SIZE == 8
typedef int64_t target_long; typedef int64_t target_long;
typedef uint64_t target_ulong; typedef uint64_t target_ulong;
#define TARGET_FMT_lx "%016llx" #define TARGET_FMT_lx "%016" PRIx64
#else #else
#error TARGET_LONG_SIZE undefined #error TARGET_LONG_SIZE undefined
#endif #endif

View File

@ -58,7 +58,7 @@ perror_memory (status, memaddr, info)
/* Actually, address between memaddr and memaddr + len was /* Actually, address between memaddr and memaddr + len was
out of bounds. */ out of bounds. */
(*info->fprintf_func) (info->stream, (*info->fprintf_func) (info->stream,
"Address 0x%llx is out of bounds.\n", memaddr); "Address 0x%" PRIx64 " is out of bounds.\n", memaddr);
} }
/* This could be in a separate file, to save miniscule amounts of space /* This could be in a separate file, to save miniscule amounts of space
@ -73,7 +73,7 @@ generic_print_address (addr, info)
bfd_vma addr; bfd_vma addr;
struct disassemble_info *info; struct disassemble_info *info;
{ {
(*info->fprintf_func) (info->stream, "0x%llx", addr); (*info->fprintf_func) (info->stream, "0x%" PRIx64, addr);
} }
/* Just return the given address. */ /* Just return the given address. */

View File

@ -239,7 +239,7 @@ void cpu_set_apic_base(CPUState *env, uint64_t val)
{ {
APICState *s = env->apic_state; APICState *s = env->apic_state;
#ifdef DEBUG_APIC #ifdef DEBUG_APIC
printf("cpu_set_apic_base: %016llx\n", val); printf("cpu_set_apic_base: %016" PRIx64 "\n", val);
#endif #endif
s->apicbase = (val & 0xfffff000) | s->apicbase = (val & 0xfffff000) |
(s->apicbase & (MSR_IA32_APICBASE_BSP | MSR_IA32_APICBASE_ENABLE)); (s->apicbase & (MSR_IA32_APICBASE_BSP | MSR_IA32_APICBASE_ENABLE));
@ -255,7 +255,7 @@ uint64_t cpu_get_apic_base(CPUState *env)
{ {
APICState *s = env->apic_state; APICState *s = env->apic_state;
#ifdef DEBUG_APIC #ifdef DEBUG_APIC
printf("cpu_get_apic_base: %016llx\n", (uint64_t)s->apicbase); printf("cpu_get_apic_base: %016" PRIx64 "\n", (uint64_t)s->apicbase);
#endif #endif
return s->apicbase; return s->apicbase;
} }

View File

@ -209,7 +209,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time)
} }
#if 0 #if 0
#ifdef DEBUG_CUDA #ifdef DEBUG_CUDA
printf("latch=%d counter=%lld delta_next=%lld\n", printf("latch=%d counter=%" PRId64 " delta_next=%" PRId64 "\n",
s->latch, d, next_time - d); s->latch, d, next_time - d);
#endif #endif
#endif #endif

View File

@ -531,7 +531,7 @@ void irq_info(void)
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
count = irq_count[i]; count = irq_count[i];
if (count > 0) if (count > 0)
term_printf("%2d: %lld\n", i, count); term_printf("%2d: %" PRId64 "\n", i, count);
} }
#endif #endif
} }

View File

@ -60,7 +60,7 @@ static void cpu_mips_update_count (CPUState *env, uint32_t count,
next++; next++;
#if 0 #if 0
if (logfile) { if (logfile) {
fprintf(logfile, "%s: 0x%08llx %08x %08x => 0x%08llx\n", fprintf(logfile, "%s: 0x%08" PRIx64 " %08x %08x => 0x%08" PRIx64 "\n",
__func__, now, count, compare, next - now); __func__, now, count, compare, next - now);
} }
#endif #endif

View File

@ -765,7 +765,7 @@ static void complete (SB16State *s)
); );
} }
} }
ldebug ("mix silence %d %d %lld\n", samples, bytes, ticks); ldebug ("mix silence %d %d %" PRId64 "\n", samples, bytes, ticks);
} }
break; break;

View File

@ -124,7 +124,7 @@ static void start_timer0(SH7750State * s)
s->periph_freq); s->periph_freq);
if (next == now) if (next == now)
next = now + 1; next = now + 1;
fprintf(stderr, "now=%016llx, next=%016llx\n", now, next); fprintf(stderr, "now=%016" PRIx64 ", next=%016" PRIx64 "\n", now, next);
fprintf(stderr, "timer will underflow in %f seconds\n", fprintf(stderr, "timer will underflow in %f seconds\n",
(float) (next - now) / (float) ticks_per_sec); (float) (next - now) / (float) ticks_per_sec);

View File

@ -203,7 +203,7 @@ void slavio_irq_info(void *opaque)
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
count = s->irq_count[i]; count = s->irq_count[i];
if (count > 0) if (count > 0)
term_printf("%2d: %lld\n", i, count); term_printf("%2d: %" PRId64 "\n", i, count);
} }
#endif #endif
} }

View File

@ -100,7 +100,7 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s)
// Convert remaining counter ticks to CPU ticks // Convert remaining counter ticks to CPU ticks
s->expire_time = ticks + muldiv64(limit - count, ticks_per_sec, CNT_FREQ); s->expire_time = ticks + muldiv64(limit - count, ticks_per_sec, CNT_FREQ);
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); 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);
if (s->mode != 1) if (s->mode != 1)
pic_set_irq_cpu(s->irq, out, s->cpu); pic_set_irq_cpu(s->irq, out, s->cpu);

View File

@ -598,12 +598,12 @@ void kqemu_record_dump(void)
perror("/tmp/kqemu.stats"); perror("/tmp/kqemu.stats");
exit(1); exit(1);
} }
fprintf(f, "total: %lld\n", total); fprintf(f, "total: %" PRId64 "\n", total);
sum = 0; sum = 0;
for(i = 0; i < nb_pc_records; i++) { for(i = 0; i < nb_pc_records; i++) {
r = pr[i]; r = pr[i];
sum += r->count; sum += r->count;
fprintf(f, "%08lx: %lld %0.2f%% %0.2f%%\n", fprintf(f, "%08lx: %" PRId64 " %0.2f%% %0.2f%%\n",
r->pc, r->pc,
r->count, r->count,
(double)r->count / (double)total * 100.0, (double)r->count / (double)total * 100.0,

View File

@ -533,16 +533,16 @@ static void memory_dump(int count, int format, int wsize,
term_printf(" "); term_printf(" ");
switch(format) { switch(format) {
case 'o': case 'o':
term_printf("%#*llo", max_digits, v); term_printf("%#*" PRIo64, max_digits, v);
break; break;
case 'x': case 'x':
term_printf("0x%0*llx", max_digits, v); term_printf("0x%0*" PRIx64, max_digits, v);
break; break;
case 'u': case 'u':
term_printf("%*llu", max_digits, v); term_printf("%*" PRIu64, max_digits, v);
break; break;
case 'd': case 'd':
term_printf("%*lld", max_digits, v); term_printf("%*" PRId64, max_digits, v);
break; break;
case 'c': case 'c':
term_printc(v); term_printc(v);
@ -602,17 +602,17 @@ static void do_print(int count, int format, int size, unsigned int valh, unsigne
#else #else
switch(format) { switch(format) {
case 'o': case 'o':
term_printf("%#llo", val); term_printf("%#" PRIo64, val);
break; break;
case 'x': case 'x':
term_printf("%#llx", val); term_printf("%#" PRIx64, val);
break; break;
case 'u': case 'u':
term_printf("%llu", val); term_printf("%" PRIu64, val);
break; break;
default: default:
case 'd': case 'd':
term_printf("%lld", val); term_printf("%" PRId64, val);
break; break;
case 'c': case 'c':
term_printc(val); term_printc(val);
@ -1026,11 +1026,11 @@ static void do_info_profile(void)
total = qemu_time; total = qemu_time;
if (total == 0) if (total == 0)
total = 1; total = 1;
term_printf("async time %lld (%0.3f)\n", term_printf("async time %" PRId64 " (%0.3f)\n",
dev_time, dev_time / (double)ticks_per_sec); dev_time, dev_time / (double)ticks_per_sec);
term_printf("qemu time %lld (%0.3f)\n", term_printf("qemu time %" PRId64 " (%0.3f)\n",
qemu_time, qemu_time / (double)ticks_per_sec); qemu_time, qemu_time / (double)ticks_per_sec);
term_printf("kqemu time %lld (%0.3f %0.1f%%) count=%lld int=%lld excp=%lld intr=%lld\n", term_printf("kqemu time %" PRId64 " (%0.3f %0.1f%%) count=%" PRId64 " int=%" PRId64 " excp=%" PRId64 " intr=%" PRId64 "\n",
kqemu_time, kqemu_time / (double)ticks_per_sec, kqemu_time, kqemu_time / (double)ticks_per_sec,
kqemu_time / (double)total * 100.0, kqemu_time / (double)total * 100.0,
kqemu_exec_count, kqemu_exec_count,

View File

@ -133,7 +133,7 @@ unsigned int PerformFIX(const unsigned int opcode)
case typeDouble: case typeDouble:
{ {
//printf("F%d is 0x%llx\n",Fn,fpa11->fpreg[Fn].fDouble); //printf("F%d is 0x%" PRIx64 "\n",Fn,fpa11->fpreg[Fn].fDouble);
writeRegister(getRd(opcode), writeRegister(getRd(opcode),
float64_to_int32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status)); float64_to_int32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status));
} }

View File

@ -3259,7 +3259,7 @@ static void mul64(uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
v = (uint64_t)a1 * (uint64_t)b1; v = (uint64_t)a1 * (uint64_t)b1;
*phigh += v; *phigh += v;
#ifdef DEBUG_MULDIV #ifdef DEBUG_MULDIV
printf("mul: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n", printf("mul: 0x%016" PRIx64 " * 0x%016" PRIx64 " = 0x%016" PRIx64 "%016" PRIx64 "\n",
a, b, *phigh, *plow); a, b, *phigh, *plow);
#endif #endif
} }
@ -3308,7 +3308,7 @@ static int div64(uint64_t *plow, uint64_t *phigh, uint64_t b)
a0 = (a0 << 1) | qb; a0 = (a0 << 1) | qb;
} }
#if defined(DEBUG_MULDIV) #if defined(DEBUG_MULDIV)
printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n", printf("div: 0x%016" PRIx64 "%016" PRIx64 " / 0x%016" PRIx64 ": q=0x%016" PRIx64 " r=0x%016" PRIx64 "\n",
*phigh, *plow, b, a0, a1); *phigh, *plow, b, a0, a1);
#endif #endif
*plow = a0; *plow = a0;

View File

@ -264,11 +264,11 @@ void cpu_dump_state(CPUState *env, FILE *f,
#ifdef TARGET_X86_64 #ifdef TARGET_X86_64
if (env->hflags & HF_CS64_MASK) { if (env->hflags & HF_CS64_MASK) {
cpu_fprintf(f, cpu_fprintf(f,
"RAX=%016llx RBX=%016llx RCX=%016llx RDX=%016llx\n" "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
"RSI=%016llx RDI=%016llx RBP=%016llx RSP=%016llx\n" "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
"R8 =%016llx R9 =%016llx R10=%016llx R11=%016llx\n" "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
"R12=%016llx R13=%016llx R14=%016llx R15=%016llx\n" "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
"RIP=%016llx RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d HLT=%d\n", "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d HLT=%d\n",
env->regs[R_EAX], env->regs[R_EAX],
env->regs[R_EBX], env->regs[R_EBX],
env->regs[R_ECX], env->regs[R_ECX],
@ -329,28 +329,28 @@ void cpu_dump_state(CPUState *env, FILE *f,
if (env->hflags & HF_LMA_MASK) { if (env->hflags & HF_LMA_MASK) {
for(i = 0; i < 6; i++) { for(i = 0; i < 6; i++) {
SegmentCache *sc = &env->segs[i]; SegmentCache *sc = &env->segs[i];
cpu_fprintf(f, "%s =%04x %016llx %08x %08x\n", cpu_fprintf(f, "%s =%04x %016" PRIx64 " %08x %08x\n",
seg_name[i], seg_name[i],
sc->selector, sc->selector,
sc->base, sc->base,
sc->limit, sc->limit,
sc->flags); sc->flags);
} }
cpu_fprintf(f, "LDT=%04x %016llx %08x %08x\n", cpu_fprintf(f, "LDT=%04x %016" PRIx64 " %08x %08x\n",
env->ldt.selector, env->ldt.selector,
env->ldt.base, env->ldt.base,
env->ldt.limit, env->ldt.limit,
env->ldt.flags); env->ldt.flags);
cpu_fprintf(f, "TR =%04x %016llx %08x %08x\n", cpu_fprintf(f, "TR =%04x %016" PRIx64 " %08x %08x\n",
env->tr.selector, env->tr.selector,
env->tr.base, env->tr.base,
env->tr.limit, env->tr.limit,
env->tr.flags); env->tr.flags);
cpu_fprintf(f, "GDT= %016llx %08x\n", cpu_fprintf(f, "GDT= %016" PRIx64 " %08x\n",
env->gdt.base, env->gdt.limit); env->gdt.base, env->gdt.limit);
cpu_fprintf(f, "IDT= %016llx %08x\n", cpu_fprintf(f, "IDT= %016" PRIx64 " %08x\n",
env->idt.base, env->idt.limit); env->idt.base, env->idt.limit);
cpu_fprintf(f, "CR0=%08x CR2=%016llx CR3=%016llx CR4=%08x\n", cpu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
(uint32_t)env->cr[0], (uint32_t)env->cr[0],
env->cr[2], env->cr[2],
env->cr[3], env->cr[3],
@ -394,7 +394,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op); snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
#ifdef TARGET_X86_64 #ifdef TARGET_X86_64
if (env->hflags & HF_CS64_MASK) { if (env->hflags & HF_CS64_MASK) {
cpu_fprintf(f, "CCS=%016llx CCD=%016llx CCO=%-8s\n", cpu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
env->cc_src, env->cc_dst, env->cc_src, env->cc_dst,
cc_op_name); cc_op_name);
} else } else
@ -427,10 +427,10 @@ void cpu_dump_state(CPUState *env, FILE *f,
} l; } l;
} tmp; } tmp;
tmp.d = env->fpregs[i].d; tmp.d = env->fpregs[i].d;
cpu_fprintf(f, "FPR%d=%016llx %04x", cpu_fprintf(f, "FPR%d=%016" PRIx64 " %04x",
i, tmp.l.lower, tmp.l.upper); i, tmp.l.lower, tmp.l.upper);
#else #else
cpu_fprintf(f, "FPR%d=%016llx", cpu_fprintf(f, "FPR%d=%016" PRIx64,
i, env->fpregs[i].mmx.q); i, env->fpregs[i].mmx.q);
#endif #endif
if ((i & 1) == 1) if ((i & 1) == 1)

View File

@ -2443,12 +2443,12 @@ void cpu_dump_state(CPUState *env, FILE *f,
{ {
#if defined(TARGET_PPC64) || 1 #if defined(TARGET_PPC64) || 1
#define FILL "" #define FILL ""
#define REGX "%016llx" #define REGX "%016" PRIx64
#define RGPL 4 #define RGPL 4
#define RFPL 4 #define RFPL 4
#else #else
#define FILL " " #define FILL " "
#define REGX "%08llx" #define REGX "%08" PRIx64
#define RGPL 8 #define RGPL 8
#define RFPL 4 #define RFPL 4
#endif #endif
@ -2485,7 +2485,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if ((i & (RFPL - 1)) == 0) if ((i & (RFPL - 1)) == 0)
cpu_fprintf(f, "FPR%02d", i); cpu_fprintf(f, "FPR%02d", i);
cpu_fprintf(f, " %016llx", *((uint64_t *)&env->fpr[i])); cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i]));
if ((i & (RFPL - 1)) == (RFPL - 1)) if ((i & (RFPL - 1)) == (RFPL - 1))
cpu_fprintf(f, "\n"); cpu_fprintf(f, "\n");
} }

View File

@ -252,7 +252,7 @@ static inline void spr_register (CPUPPCState *env, int num,
exit(1); exit(1);
} }
#if defined(PPC_DEBUG_SPR) #if defined(PPC_DEBUG_SPR)
printf("*** register spr %d (%03x) %s val %08llx\n", num, num, name, printf("*** register spr %d (%03x) %s val %08" PRIx64 "\n", num, num, name,
(unsigned long long)initial_value); (unsigned long long)initial_value);
#endif #endif
spr->name = name; spr->name = name;

View File

@ -394,7 +394,7 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
env->dmmuregs[4] = address; /* Fault address register */ env->dmmuregs[4] = address; /* Fault address register */
env->exception_index = TT_DFAULT; env->exception_index = TT_DFAULT;
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
printf("DFAULT at 0x%llx\n", address); printf("DFAULT at 0x%" PRIx64 "\n", address);
#endif #endif
return 1; return 1;
} }
@ -406,7 +406,7 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
} }
} }
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
printf("DMISS at 0x%llx\n", address); printf("DMISS at 0x%" PRIx64 "\n", address);
#endif #endif
env->exception_index = TT_DMISS; env->exception_index = TT_DMISS;
return 1; return 1;
@ -452,7 +452,7 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical
env->immuregs[3] |= (is_user << 3) | 1; env->immuregs[3] |= (is_user << 3) | 1;
env->exception_index = TT_TFAULT; env->exception_index = TT_TFAULT;
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
printf("TFAULT at 0x%llx\n", address); printf("TFAULT at 0x%" PRIx64 "\n", address);
#endif #endif
return 1; return 1;
} }
@ -462,7 +462,7 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical
} }
} }
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
printf("TMISS at 0x%llx\n", address); printf("TMISS at 0x%" PRIx64 "\n", address);
#endif #endif
env->exception_index = TT_TMISS; env->exception_index = TT_TMISS;
return 1; return 1;
@ -491,7 +491,7 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
virt_addr = address & TARGET_PAGE_MASK; virt_addr = address & TARGET_PAGE_MASK;
vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1)); vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1));
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
printf("Translate at 0x%llx -> 0x%llx, vaddr 0x%llx\n", address, paddr, vaddr); printf("Translate at 0x%" PRIx64 " -> 0x%" PRIx64 ", vaddr 0x%" PRIx64 "\n", address, paddr, vaddr);
#endif #endif
ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu); ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu);
return ret; return ret;
@ -506,7 +506,7 @@ void dump_mmu(CPUState *env)
unsigned int i; unsigned int i;
const char *mask; const char *mask;
printf("MMU contexts: Primary: %lld, Secondary: %lld\n", env->dmmuregs[1], env->dmmuregs[2]); printf("MMU contexts: Primary: %" PRId64 ", Secondary: %" PRId64 "\n", env->dmmuregs[1], env->dmmuregs[2]);
if ((env->lsu & DMMU_E) == 0) { if ((env->lsu & DMMU_E) == 0) {
printf("DMMU disabled\n"); printf("DMMU disabled\n");
} else { } else {
@ -528,7 +528,7 @@ void dump_mmu(CPUState *env)
break; break;
} }
if ((env->dtlb_tte[i] & 0x8000000000000000ULL) != 0) { if ((env->dtlb_tte[i] & 0x8000000000000000ULL) != 0) {
printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, %s, ctx %lld\n", printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, %s, ctx %" PRId64 "\n",
env->dtlb_tag[i] & ~0x1fffULL, env->dtlb_tag[i] & ~0x1fffULL,
env->dtlb_tte[i] & 0x1ffffffe000ULL, env->dtlb_tte[i] & 0x1ffffffe000ULL,
mask, mask,
@ -560,7 +560,7 @@ void dump_mmu(CPUState *env)
break; break;
} }
if ((env->itlb_tte[i] & 0x8000000000000000ULL) != 0) { if ((env->itlb_tte[i] & 0x8000000000000000ULL) != 0) {
printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, ctx %lld\n", printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_lx ", %s, %s, %s, ctx %" PRId64 "\n",
env->itlb_tag[i] & ~0x1fffULL, env->itlb_tag[i] & ~0x1fffULL,
env->itlb_tte[i] & 0x1ffffffe000ULL, env->itlb_tte[i] & 0x1ffffffe000ULL,
mask, mask,

View File

@ -446,7 +446,7 @@ void helper_st_asi(int asi, int size, int sign)
// invalid in normal mode // invalid in normal mode
if (oldreg != env->lsu) { if (oldreg != env->lsu) {
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
printf("LSU change: 0x%llx -> 0x%llx\n", oldreg, env->lsu); printf("LSU change: 0x%" PRIx64 " -> 0x%" PRIx64 "\n", oldreg, env->lsu);
dump_mmu(env); dump_mmu(env);
#endif #endif
tlb_flush(env, 1); tlb_flush(env, 1);
@ -480,7 +480,7 @@ void helper_st_asi(int asi, int size, int sign)
env->immuregs[reg] = T1; env->immuregs[reg] = T1;
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
if (oldreg != env->immuregs[reg]) { if (oldreg != env->immuregs[reg]) {
printf("mmu change reg[%d]: 0x%08llx -> 0x%08llx\n", reg, oldreg, env->immuregs[reg]); printf("mmu change reg[%d]: 0x%08" PRIx64 " -> 0x%08" PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
} }
dump_mmu(env); dump_mmu(env);
#endif #endif
@ -549,7 +549,7 @@ void helper_st_asi(int asi, int size, int sign)
env->dmmuregs[reg] = T1; env->dmmuregs[reg] = T1;
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
if (oldreg != env->dmmuregs[reg]) { if (oldreg != env->dmmuregs[reg]) {
printf("mmu change reg[%d]: 0x%08llx -> 0x%08llx\n", reg, oldreg, env->dmmuregs[reg]); printf("mmu change reg[%d]: 0x%08" PRIx64 " -> 0x%08" PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]);
} }
dump_mmu(env); dump_mmu(env);
#endif #endif
@ -769,7 +769,7 @@ void do_interrupt(int intno)
#ifdef DEBUG_PCALL #ifdef DEBUG_PCALL
if (loglevel & CPU_LOG_INT) { if (loglevel & CPU_LOG_INT) {
static int count; static int count;
fprintf(logfile, "%6d: v=%04x pc=%016llx npc=%016llx SP=%016llx\n", fprintf(logfile, "%6d: v=%04x pc=%016" PRIx64 " npc=%016" PRIx64 " SP=%016" PRIx64 "\n",
count, intno, count, intno,
env->pc, env->pc,
env->npc, env->regwptr[6]); env->npc, env->regwptr[6]);

View File

@ -50,7 +50,7 @@
#define FMTLX "%016lx" #define FMTLX "%016lx"
#define X86_64_ONLY(x) x #define X86_64_ONLY(x) x
#else #else
#define FMT64X "%016llx" #define FMT64X "%016" PRIx64
#define FMTLX "%08lx" #define FMTLX "%08lx"
#define X86_64_ONLY(x) #define X86_64_ONLY(x)
#endif #endif

2
vl.c
View File

@ -912,7 +912,7 @@ static void host_alarm_handler(int host_signum)
delta_max = delta; delta_max = delta;
delta_cum += delta; delta_cum += delta;
if (++count == DISP_FREQ) { if (++count == DISP_FREQ) {
printf("timer: min=%lld us max=%lld us avg=%lld us avg_freq=%0.3f Hz\n", printf("timer: min=%" PRId64 " us max=%" PRId64 " us avg=%" PRId64 " us avg_freq=%0.3f Hz\n",
muldiv64(delta_min, 1000000, ticks_per_sec), muldiv64(delta_min, 1000000, ticks_per_sec),
muldiv64(delta_max, 1000000, ticks_per_sec), muldiv64(delta_max, 1000000, ticks_per_sec),
muldiv64(delta_cum, 1000000 / DISP_FREQ, ticks_per_sec), muldiv64(delta_cum, 1000000 / DISP_FREQ, ticks_per_sec),

3
vl.h
View File

@ -61,6 +61,9 @@ static inline char *realpath(const char *path, char *resolved_path)
} }
#define PRId64 "I64d" #define PRId64 "I64d"
#define PRIx64 "I64x"
#define PRIu64 "I64u"
#define PRIo64 "I64o"
#endif #endif
#ifdef QEMU_TOOL #ifdef QEMU_TOOL