Skip to content

Commit

Permalink
C99 64 bit printf
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2018 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
bellard committed Jun 25, 2006
1 parent 3b42c97 commit 26a7646
Show file tree
Hide file tree
Showing 25 changed files with 67 additions and 64 deletions.
4 changes: 2 additions & 2 deletions audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ static int audio_get_avail (SWVoiceIn *sw)
}

ldebug (
"%s: get_avail live %d ret %lld\n",
"%s: get_avail live %d ret %" PRId64 "\n",
SW_NAME (sw),
live, (((int64_t) live << 32) / sw->ratio) << sw->info.shift
);
Expand All @@ -1023,7 +1023,7 @@ static int audio_get_free (SWVoiceOut *sw)
dead = sw->hw->samples - live;

#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),
live, dead, (((int64_t) dead << 32) / sw->ratio) << sw->info.shift);
#endif
Expand Down
2 changes: 1 addition & 1 deletion audio/audio_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts)

cur_ts = sw->hw->ts_helper;
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) {
delta = cur_ts - old_ts;
Expand Down
2 changes: 1 addition & 1 deletion block-vpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
bitmap_offset = 512 * s->pagetable[pagetable_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,
// bitmap_offset, block_offset);

Expand Down
2 changes: 1 addition & 1 deletion cpu-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef uint32_t target_ulong;
#elif TARGET_LONG_SIZE == 8
typedef int64_t target_long;
typedef uint64_t target_ulong;
#define TARGET_FMT_lx "%016llx"
#define TARGET_FMT_lx "%016" PRIx64
#else
#error TARGET_LONG_SIZE undefined
#endif
Expand Down
4 changes: 2 additions & 2 deletions disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ perror_memory (status, memaddr, info)
/* Actually, address between memaddr and memaddr + len was
out of bounds. */
(*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
Expand All @@ -73,7 +73,7 @@ generic_print_address (addr, info)
bfd_vma addr;
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. */
Expand Down
4 changes: 2 additions & 2 deletions hw/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void cpu_set_apic_base(CPUState *env, uint64_t val)
{
APICState *s = env->apic_state;
#ifdef DEBUG_APIC
printf("cpu_set_apic_base: %016llx\n", val);
printf("cpu_set_apic_base: %016" PRIx64 "\n", val);
#endif
s->apicbase = (val & 0xfffff000) |
(s->apicbase & (MSR_IA32_APICBASE_BSP | MSR_IA32_APICBASE_ENABLE));
Expand All @@ -255,7 +255,7 @@ uint64_t cpu_get_apic_base(CPUState *env)
{
APICState *s = env->apic_state;
#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
return s->apicbase;
}
Expand Down
2 changes: 1 addition & 1 deletion hw/cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time)
}
#if 0
#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);
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion hw/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ void irq_info(void)
for (i = 0; i < 16; i++) {
count = irq_count[i];
if (count > 0)
term_printf("%2d: %lld\n", i, count);
term_printf("%2d: %" PRId64 "\n", i, count);
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion hw/mips_r4k.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void cpu_mips_update_count (CPUState *env, uint32_t count,
next++;
#if 0
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);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion hw/sb16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion hw/sh7750.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void start_timer0(SH7750State * s)
s->periph_freq);
if (next == now)
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",
(float) (next - now) / (float) ticks_per_sec);

Expand Down
2 changes: 1 addition & 1 deletion hw/slavio_intctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void slavio_irq_info(void *opaque)
for (i = 0; i < 32; i++) {
count = s->irq_count[i];
if (count > 0)
term_printf("%2d: %lld\n", i, count);
term_printf("%2d: %" PRId64 "\n", i, count);
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion hw/slavio_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void slavio_timer_get_out(SLAVIO_TIMERState *s)
// Convert remaining counter ticks to CPU ticks
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)
pic_set_irq_cpu(s->irq, out, s->cpu);
Expand Down
4 changes: 2 additions & 2 deletions kqemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,12 @@ void kqemu_record_dump(void)
perror("/tmp/kqemu.stats");
exit(1);
}
fprintf(f, "total: %lld\n", total);
fprintf(f, "total: %" PRId64 "\n", total);
sum = 0;
for(i = 0; i < nb_pc_records; i++) {
r = pr[i];
sum += r->count;
fprintf(f, "%08lx: %lld %0.2f%% %0.2f%%\n",
fprintf(f, "%08lx: %" PRId64 " %0.2f%% %0.2f%%\n",
r->pc,
r->count,
(double)r->count / (double)total * 100.0,
Expand Down
22 changes: 11 additions & 11 deletions monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,16 +533,16 @@ static void memory_dump(int count, int format, int wsize,
term_printf(" ");
switch(format) {
case 'o':
term_printf("%#*llo", max_digits, v);
term_printf("%#*" PRIo64, max_digits, v);
break;
case 'x':
term_printf("0x%0*llx", max_digits, v);
term_printf("0x%0*" PRIx64, max_digits, v);
break;
case 'u':
term_printf("%*llu", max_digits, v);
term_printf("%*" PRIu64, max_digits, v);
break;
case 'd':
term_printf("%*lld", max_digits, v);
term_printf("%*" PRId64, max_digits, v);
break;
case 'c':
term_printc(v);
Expand Down Expand Up @@ -602,17 +602,17 @@ static void do_print(int count, int format, int size, unsigned int valh, unsigne
#else
switch(format) {
case 'o':
term_printf("%#llo", val);
term_printf("%#" PRIo64, val);
break;
case 'x':
term_printf("%#llx", val);
term_printf("%#" PRIx64, val);
break;
case 'u':
term_printf("%llu", val);
term_printf("%" PRIu64, val);
break;
default:
case 'd':
term_printf("%lld", val);
term_printf("%" PRId64, val);
break;
case 'c':
term_printc(val);
Expand Down Expand Up @@ -1026,11 +1026,11 @@ static void do_info_profile(void)
total = qemu_time;
if (total == 0)
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);
term_printf("qemu time %lld (%0.3f)\n",
term_printf("qemu time %" PRId64 " (%0.3f)\n",
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 / (double)total * 100.0,
kqemu_exec_count,
Expand Down
2 changes: 1 addition & 1 deletion target-arm/nwfpe/fpa11_cprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ unsigned int PerformFIX(const unsigned int opcode)

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),
float64_to_int32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status));
}
Expand Down
4 changes: 2 additions & 2 deletions target-i386/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
*phigh += v;
#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);
#endif
}
Expand Down Expand Up @@ -3308,7 +3308,7 @@ static int div64(uint64_t *plow, uint64_t *phigh, uint64_t b)
a0 = (a0 << 1) | qb;
}
#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);
#endif
*plow = a0;
Expand Down
28 changes: 14 additions & 14 deletions target-i386/helper2.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ void cpu_dump_state(CPUState *env, FILE *f,
#ifdef TARGET_X86_64
if (env->hflags & HF_CS64_MASK) {
cpu_fprintf(f,
"RAX=%016llx RBX=%016llx RCX=%016llx RDX=%016llx\n"
"RSI=%016llx RDI=%016llx RBP=%016llx RSP=%016llx\n"
"R8 =%016llx R9 =%016llx R10=%016llx R11=%016llx\n"
"R12=%016llx R13=%016llx R14=%016llx R15=%016llx\n"
"RIP=%016llx RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d HLT=%d\n",
"RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
"RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
"R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
"R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\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_EBX],
env->regs[R_ECX],
Expand Down Expand Up @@ -329,28 +329,28 @@ void cpu_dump_state(CPUState *env, FILE *f,
if (env->hflags & HF_LMA_MASK) {
for(i = 0; i < 6; 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],
sc->selector,
sc->base,
sc->limit,
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.base,
env->ldt.limit,
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.base,
env->tr.limit,
env->tr.flags);
cpu_fprintf(f, "GDT= %016llx %08x\n",
cpu_fprintf(f, "GDT= %016" PRIx64 " %08x\n",
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);
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],
env->cr[2],
env->cr[3],
Expand Down Expand Up @@ -394,7 +394,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
#ifdef TARGET_X86_64
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,
cc_op_name);
} else
Expand Down Expand Up @@ -427,10 +427,10 @@ void cpu_dump_state(CPUState *env, FILE *f,
} l;
} tmp;
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);
#else
cpu_fprintf(f, "FPR%d=%016llx",
cpu_fprintf(f, "FPR%d=%016" PRIx64,
i, env->fpregs[i].mmx.q);
#endif
if ((i & 1) == 1)
Expand Down
6 changes: 3 additions & 3 deletions target-ppc/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2443,12 +2443,12 @@ void cpu_dump_state(CPUState *env, FILE *f,
{
#if defined(TARGET_PPC64) || 1
#define FILL ""
#define REGX "%016llx"
#define REGX "%016" PRIx64
#define RGPL 4
#define RFPL 4
#else
#define FILL " "
#define REGX "%08llx"
#define REGX "%08" PRIx64
#define RGPL 8
#define RFPL 4
#endif
Expand Down Expand Up @@ -2485,7 +2485,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
for (i = 0; i < 32; i++) {
if ((i & (RFPL - 1)) == 0)
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))
cpu_fprintf(f, "\n");
}
Expand Down
2 changes: 1 addition & 1 deletion target-ppc/translate_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static inline void spr_register (CPUPPCState *env, int num,
exit(1);
}
#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);
#endif
spr->name = name;
Expand Down
Loading

0 comments on commit 26a7646

Please sign in to comment.