Commit 8378e71f136a021e795d41ceae64eedadcff291c

Authored by j_mayer
1 parent 05f778c8

Fix endianness bug for PowerPC stfiwx instruction.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3456 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 11 additions and 2 deletions
target-ppc/op_mem.h
... ... @@ -411,17 +411,26 @@ static always_inline void glue(stfs, MEMSUFFIX) (target_ulong EA, double d)
411 411 glue(stfl, MEMSUFFIX)(EA, float64_to_float32(d, &env->fp_status));
412 412 }
413 413  
  414 +#if defined(WORDS_BIGENDIAN)
  415 +#define WORD0 0
  416 +#define WORD1 1
  417 +#else
  418 +#define WORD0 1
  419 +#define WORD1 0
  420 +#endif
414 421 static always_inline void glue(stfiwx, MEMSUFFIX) (target_ulong EA, double d)
415 422 {
416 423 union {
417 424 double d;
418   - uint64_t u;
  425 + uint32_t u[2];
419 426 } u;
420 427  
421 428 /* Store the low order 32 bits without any conversion */
422 429 u.d = d;
423   - glue(stl, MEMSUFFIX)(EA, u.u);
  430 + glue(stl, MEMSUFFIX)(EA, u.u[WORD0]);
424 431 }
  432 +#undef WORD0
  433 +#undef WORD1
425 434  
426 435 PPC_STF_OP(fd, stfq);
427 436 PPC_STF_OP(fs, stfs);
... ...