Commit 2157fa0682e3b2a1cb0b4864e6f4b86f88b1fae2

Authored by bellard
1 parent d24b15a8

better fpu state dump


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1503 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 49 additions and 11 deletions
target-i386/helper2.c
... ... @@ -250,7 +250,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
250 250 int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
251 251 int flags)
252 252 {
253   - int eflags, i;
  253 + int eflags, i, nb;
254 254 char cc_op_name[32];
255 255 static const char *seg_name[6] = { "ES", "CS", "SS", "DS", "FS", "GS" };
256 256  
... ... @@ -398,16 +398,54 @@ void cpu_dump_state(CPUState *env, FILE *f,
398 398 }
399 399 }
400 400 if (flags & X86_DUMP_FPU) {
401   - cpu_fprintf(f, "ST0=%f ST1=%f ST2=%f ST3=%f\n",
402   - (double)env->fpregs[0].d,
403   - (double)env->fpregs[1].d,
404   - (double)env->fpregs[2].d,
405   - (double)env->fpregs[3].d);
406   - cpu_fprintf(f, "ST4=%f ST5=%f ST6=%f ST7=%f\n",
407   - (double)env->fpregs[4].d,
408   - (double)env->fpregs[5].d,
409   - (double)env->fpregs[7].d,
410   - (double)env->fpregs[8].d);
  401 + int fptag;
  402 + fptag = 0;
  403 + for(i = 0; i < 8; i++) {
  404 + fptag |= ((!env->fptags[i]) << i);
  405 + }
  406 + cpu_fprintf(f, "FCW=%04x FSW=%04x [ST=%d] FTW=%02x MXCSR=%08x\n",
  407 + env->fpuc,
  408 + (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11,
  409 + env->fpstt,
  410 + fptag,
  411 + env->mxcsr);
  412 + for(i=0;i<8;i++) {
  413 +#if defined(USE_X86LDOUBLE)
  414 + union {
  415 + long double d;
  416 + struct {
  417 + uint64_t lower;
  418 + uint16_t upper;
  419 + } l;
  420 + } tmp;
  421 + tmp.d = env->fpregs[i].d;
  422 + cpu_fprintf(f, "FPR%d=%016llx %04x",
  423 + i, tmp.l.lower, tmp.l.upper);
  424 +#else
  425 + cpu_fprintf(f, "FPR%d=%016llx",
  426 + i, env->fpregs[i].mmx.q);
  427 +#endif
  428 + if ((i & 1) == 1)
  429 + cpu_fprintf(f, "\n");
  430 + else
  431 + cpu_fprintf(f, " ");
  432 + }
  433 + if (env->hflags & HF_CS64_MASK)
  434 + nb = 16;
  435 + else
  436 + nb = 8;
  437 + for(i=0;i<nb;i++) {
  438 + cpu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
  439 + i,
  440 + env->xmm_regs[i].XMM_L(3),
  441 + env->xmm_regs[i].XMM_L(2),
  442 + env->xmm_regs[i].XMM_L(1),
  443 + env->xmm_regs[i].XMM_L(0));
  444 + if ((i & 1) == 1)
  445 + cpu_fprintf(f, "\n");
  446 + else
  447 + cpu_fprintf(f, " ");
  448 + }
411 449 }
412 450 }
413 451  
... ...