Commit e04ea3dc1a6997aa0d2eb8b21170b81f9151d37d
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
Showing
2 changed files
with
19 additions
and
7 deletions
target-sh4/cpu.h
@@ -80,7 +80,7 @@ typedef struct tlb_t { | @@ -80,7 +80,7 @@ typedef struct tlb_t { | ||
80 | typedef struct CPUSH4State { | 80 | typedef struct CPUSH4State { |
81 | uint32_t flags; /* general execution flags */ | 81 | uint32_t flags; /* general execution flags */ |
82 | uint32_t gregs[24]; /* general registers */ | 82 | uint32_t gregs[24]; /* general registers */ |
83 | - uint32_t fregs[32]; /* floating point registers */ | 83 | + float32 fregs[32]; /* floating point registers */ |
84 | uint32_t sr; /* status register */ | 84 | uint32_t sr; /* status register */ |
85 | uint32_t ssr; /* saved status register */ | 85 | uint32_t ssr; /* saved status register */ |
86 | uint32_t spc; /* saved program counter */ | 86 | uint32_t spc; /* saved program counter */ |
target-sh4/op.c
@@ -698,37 +698,49 @@ void OPPROTO op_movl_imm_rN(void) | @@ -698,37 +698,49 @@ void OPPROTO op_movl_imm_rN(void) | ||
698 | 698 | ||
699 | void OPPROTO op_fmov_frN_FT0(void) | 699 | void OPPROTO op_fmov_frN_FT0(void) |
700 | { | 700 | { |
701 | - FT0 = *(float32 *)&env->fregs[PARAM1]; | 701 | + FT0 = env->fregs[PARAM1]; |
702 | RETURN(); | 702 | RETURN(); |
703 | } | 703 | } |
704 | 704 | ||
705 | void OPPROTO op_fmov_drN_DT0(void) | 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 | RETURN(); | 712 | RETURN(); |
709 | } | 713 | } |
710 | 714 | ||
711 | void OPPROTO op_fmov_frN_FT1(void) | 715 | void OPPROTO op_fmov_frN_FT1(void) |
712 | { | 716 | { |
713 | - FT1 = *(float32 *)&env->fregs[PARAM1]; | 717 | + FT1 = env->fregs[PARAM1]; |
714 | RETURN(); | 718 | RETURN(); |
715 | } | 719 | } |
716 | 720 | ||
717 | void OPPROTO op_fmov_drN_DT1(void) | 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 | RETURN(); | 728 | RETURN(); |
721 | } | 729 | } |
722 | 730 | ||
723 | void OPPROTO op_fmov_FT0_frN(void) | 731 | void OPPROTO op_fmov_FT0_frN(void) |
724 | { | 732 | { |
725 | - *(float32 *)&env->fregs[PARAM1] = FT0; | 733 | + env->fregs[PARAM1] = FT0; |
726 | RETURN(); | 734 | RETURN(); |
727 | } | 735 | } |
728 | 736 | ||
729 | void OPPROTO op_fmov_DT0_drN(void) | 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 | RETURN(); | 744 | RETURN(); |
733 | } | 745 | } |
734 | 746 |