Commit e04ea3dc1a6997aa0d2eb8b21170b81f9151d37d

Authored by ths
1 parent 0ae045ae

Handle endianness of double floats, by Magnus Damm.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3020 c046a42c-6fe2-441c-8c8c-71466251a162
target-sh4/cpu.h
... ... @@ -80,7 +80,7 @@ typedef struct tlb_t {
80 80 typedef struct CPUSH4State {
81 81 uint32_t flags; /* general execution flags */
82 82 uint32_t gregs[24]; /* general registers */
83   - uint32_t fregs[32]; /* floating point registers */
  83 + float32 fregs[32]; /* floating point registers */
84 84 uint32_t sr; /* status register */
85 85 uint32_t ssr; /* saved status register */
86 86 uint32_t spc; /* saved program counter */
... ...
target-sh4/op.c
... ... @@ -698,37 +698,49 @@ void OPPROTO op_movl_imm_rN(void)
698 698  
699 699 void OPPROTO op_fmov_frN_FT0(void)
700 700 {
701   - FT0 = *(float32 *)&env->fregs[PARAM1];
  701 + FT0 = env->fregs[PARAM1];
702 702 RETURN();
703 703 }
704 704  
705 705 void OPPROTO op_fmov_drN_DT0(void)
706 706 {
707   - DT0 = *(float64 *)&env->fregs[PARAM1];
  707 + CPU_DoubleU d;
  708 +
  709 + d.l.upper = *(uint32_t *)&env->fregs[PARAM1];
  710 + d.l.lower = *(uint32_t *)&env->fregs[PARAM1 + 1];
  711 + DT0 = d.d;
708 712 RETURN();
709 713 }
710 714  
711 715 void OPPROTO op_fmov_frN_FT1(void)
712 716 {
713   - FT1 = *(float32 *)&env->fregs[PARAM1];
  717 + FT1 = env->fregs[PARAM1];
714 718 RETURN();
715 719 }
716 720  
717 721 void OPPROTO op_fmov_drN_DT1(void)
718 722 {
719   - DT1 = *(float64 *)&env->fregs[PARAM1];
  723 + CPU_DoubleU d;
  724 +
  725 + d.l.upper = *(uint32_t *)&env->fregs[PARAM1];
  726 + d.l.lower = *(uint32_t *)&env->fregs[PARAM1 + 1];
  727 + DT1 = d.d;
720 728 RETURN();
721 729 }
722 730  
723 731 void OPPROTO op_fmov_FT0_frN(void)
724 732 {
725   - *(float32 *)&env->fregs[PARAM1] = FT0;
  733 + env->fregs[PARAM1] = FT0;
726 734 RETURN();
727 735 }
728 736  
729 737 void OPPROTO op_fmov_DT0_drN(void)
730 738 {
731   - *(float64 *)&env->fregs[PARAM1] = DT0;
  739 + CPU_DoubleU d;
  740 +
  741 + d.d = DT0;
  742 + *(uint32_t *)&env->fregs[PARAM1] = d.l.upper;
  743 + *(uint32_t *)&env->fregs[PARAM1 + 1] = d.l.lower;
732 744 RETURN();
733 745 }
734 746  
... ...