diff options
Diffstat (limited to 'target-arm/nwfpe')
-rw-r--r-- | target-arm/nwfpe/double_cpdo.c | 8 | ||||
-rw-r--r-- | target-arm/nwfpe/fpa11.h | 9 | ||||
-rw-r--r-- | target-arm/nwfpe/fpa11_cpdt.c | 10 |
3 files changed, 25 insertions, 2 deletions
diff --git a/target-arm/nwfpe/double_cpdo.c b/target-arm/nwfpe/double_cpdo.c index f1738eac0d..c44d3fc58e 100644 --- a/target-arm/nwfpe/double_cpdo.c +++ b/target-arm/nwfpe/double_cpdo.c @@ -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; diff --git a/target-arm/nwfpe/fpa11.h b/target-arm/nwfpe/fpa11.h index 95ad119367..389c02986b 100644 --- a/target-arm/nwfpe/fpa11.h +++ b/target-arm/nwfpe/fpa11.h @@ -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 diff --git a/target-arm/nwfpe/fpa11_cpdt.c b/target-arm/nwfpe/fpa11_cpdt.c index 283e34673c..c1d5615547 100644 --- a/target-arm/nwfpe/fpa11_cpdt.c +++ b/target-arm/nwfpe/fpa11_cpdt.c @@ -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 |