summaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-02-07 12:43:57 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-02-07 12:43:57 +0000
commita8d3431ae931aa44ee6228ffecf6277714389de7 (patch)
tree23a49bfa7b8189e0c72669bde4800fefe1857424 /target-arm
parent7ff4d2180b27b3356379ca66738da10ad8b2f73a (diff)
downloadqemu-a8d3431ae931aa44ee6228ffecf6277714389de7.tar.gz
endianness fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1268 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/nwfpe/double_cpdo.c8
-rw-r--r--target-arm/nwfpe/fpa11.h9
-rw-r--r--target-arm/nwfpe/fpa11_cpdt.c10
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