mirror of https://github.com/xemu-project/xemu.git
endianness fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1268 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
7ff4d2180b
commit
a8d3431ae9
|
@ -150,7 +150,11 @@ unsigned int DoubleCPDO(const unsigned int opcode)
|
|||
case MNF_CODE:
|
||||
{
|
||||
unsigned int *p = (unsigned int*)&rFm;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
p[0] ^= 0x80000000;
|
||||
#else
|
||||
p[1] ^= 0x80000000;
|
||||
#endif
|
||||
fpa11->fpreg[Fd].fDouble = rFm;
|
||||
}
|
||||
break;
|
||||
|
@ -158,7 +162,11 @@ unsigned int DoubleCPDO(const unsigned int opcode)
|
|||
case ABS_CODE:
|
||||
{
|
||||
unsigned int *p = (unsigned int*)&rFm;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
p[0] &= 0x7fffffff;
|
||||
#else
|
||||
p[1] &= 0x7fffffff;
|
||||
#endif
|
||||
fpa11->fpreg[Fd].fDouble = rFm;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#ifndef __FPA11_H__
|
||||
#define __FPA11_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define GET_FPA11() (qemufpa)
|
||||
|
||||
/*
|
||||
|
@ -87,8 +91,6 @@ extern void resetFPA11(void);
|
|||
extern void SetRoundingMode(const unsigned int);
|
||||
extern void SetRoundingPrecision(const unsigned int);
|
||||
|
||||
#define get_user(x,y) ((x)=*(y))
|
||||
#define put_user(x,y) (*(y)=(x))
|
||||
static inline unsigned int readRegister(unsigned int reg)
|
||||
{
|
||||
return (user_registers[(reg)]);
|
||||
|
@ -128,4 +130,7 @@ unsigned int ZF;
|
|||
|
||||
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, unsigned int* qregs);
|
||||
|
||||
/* included only for get_user/put_user macros */
|
||||
#include "qemu.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,8 +43,13 @@ void loadDouble(const unsigned int Fn,const unsigned int *pMem)
|
|||
unsigned int *p;
|
||||
p = (unsigned int*)&fpa11->fpreg[Fn].fDouble;
|
||||
fpa11->fType[Fn] = typeDouble;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
get_user(p[0], &pMem[0]); /* sign & exponent */
|
||||
get_user(p[1], &pMem[1]);
|
||||
#else
|
||||
get_user(p[0], &pMem[1]);
|
||||
get_user(p[1], &pMem[0]); /* sign & exponent */
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
|
@ -133,8 +138,13 @@ void storeDouble(const unsigned int Fn,unsigned int *pMem)
|
|||
|
||||
default: val = fpa11->fpreg[Fn].fDouble;
|
||||
}
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
put_user(p[0], &pMem[0]); /* msw */
|
||||
put_user(p[1], &pMem[1]); /* lsw */
|
||||
#else
|
||||
put_user(p[1], &pMem[0]); /* msw */
|
||||
put_user(p[0], &pMem[1]); /* lsw */
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
|
|
Loading…
Reference in New Issue