Handle endianness of double floats, by Magnus Damm.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3020 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2007-06-25 13:53:11 +00:00
parent 0ae045ae43
commit e04ea3dc1a
2 changed files with 19 additions and 7 deletions

View File

@ -80,7 +80,7 @@ typedef struct tlb_t {
typedef struct CPUSH4State { typedef struct CPUSH4State {
uint32_t flags; /* general execution flags */ uint32_t flags; /* general execution flags */
uint32_t gregs[24]; /* general registers */ uint32_t gregs[24]; /* general registers */
uint32_t fregs[32]; /* floating point registers */ float32 fregs[32]; /* floating point registers */
uint32_t sr; /* status register */ uint32_t sr; /* status register */
uint32_t ssr; /* saved status register */ uint32_t ssr; /* saved status register */
uint32_t spc; /* saved program counter */ uint32_t spc; /* saved program counter */

View File

@ -698,37 +698,49 @@ void OPPROTO op_movl_imm_rN(void)
void OPPROTO op_fmov_frN_FT0(void) void OPPROTO op_fmov_frN_FT0(void)
{ {
FT0 = *(float32 *)&env->fregs[PARAM1]; FT0 = env->fregs[PARAM1];
RETURN(); RETURN();
} }
void OPPROTO op_fmov_drN_DT0(void) void OPPROTO op_fmov_drN_DT0(void)
{ {
DT0 = *(float64 *)&env->fregs[PARAM1]; CPU_DoubleU d;
d.l.upper = *(uint32_t *)&env->fregs[PARAM1];
d.l.lower = *(uint32_t *)&env->fregs[PARAM1 + 1];
DT0 = d.d;
RETURN(); RETURN();
} }
void OPPROTO op_fmov_frN_FT1(void) void OPPROTO op_fmov_frN_FT1(void)
{ {
FT1 = *(float32 *)&env->fregs[PARAM1]; FT1 = env->fregs[PARAM1];
RETURN(); RETURN();
} }
void OPPROTO op_fmov_drN_DT1(void) void OPPROTO op_fmov_drN_DT1(void)
{ {
DT1 = *(float64 *)&env->fregs[PARAM1]; CPU_DoubleU d;
d.l.upper = *(uint32_t *)&env->fregs[PARAM1];
d.l.lower = *(uint32_t *)&env->fregs[PARAM1 + 1];
DT1 = d.d;
RETURN(); RETURN();
} }
void OPPROTO op_fmov_FT0_frN(void) void OPPROTO op_fmov_FT0_frN(void)
{ {
*(float32 *)&env->fregs[PARAM1] = FT0; env->fregs[PARAM1] = FT0;
RETURN(); RETURN();
} }
void OPPROTO op_fmov_DT0_drN(void) void OPPROTO op_fmov_DT0_drN(void)
{ {
*(float64 *)&env->fregs[PARAM1] = DT0; CPU_DoubleU d;
d.d = DT0;
*(uint32_t *)&env->fregs[PARAM1] = d.l.upper;
*(uint32_t *)&env->fregs[PARAM1 + 1] = d.l.lower;
RETURN(); RETURN();
} }