diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2003-06-09 15:29:55 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2003-06-09 15:29:55 +0000 |
commit | a95c67907cce5b03269581b77f014ec51b98da36 (patch) | |
tree | 9420cb5a39a8c683db1e6ecf13b704cfdc5e7e6d /cpu-i386.h | |
parent | 0f533160c7f7ccd1ae421d5bce3850a1a5400bc1 (diff) | |
download | qemu-a95c67907cce5b03269581b77f014ec51b98da36.zip qemu-a95c67907cce5b03269581b77f014ec51b98da36.tar.gz qemu-a95c67907cce5b03269581b77f014ec51b98da36.tar.bz2 |
arm support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@221 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-i386.h')
-rw-r--r-- | cpu-i386.h | 46 |
1 files changed, 38 insertions, 8 deletions
@@ -238,7 +238,10 @@ static inline void stb(void *ptr, int v) *(uint8_t *)ptr = v; } -#ifdef WORDS_BIGENDIAN +/* NOTE: on arm, putting 2 in /proc/sys/debug/alignment so that the + kernel handles unaligned load/stores may give better results, but + it is a system wide setting : bad */ +#if defined(WORDS_BIGENDIAN) || defined(__arm__) /* conservative code for little endian unaligned accesses */ static inline int lduw(void *ptr) @@ -329,24 +332,50 @@ static inline float ldfl(void *ptr) return u.f; } +static inline void stfl(void *ptr, float v) +{ + union { + float f; + uint32_t i; + } u; + u.f = v; + stl(ptr, u.i); +} + +#if defined(__arm__) && !defined(WORDS_BIGENDIAN) + +/* NOTE: arm is horrible as double 32 bit words are stored in big endian ! */ static inline double ldfq(void *ptr) { union { double d; - uint64_t i; + uint32_t tab[2]; } u; - u.i = ldq(ptr); + u.tab[1] = ldl(ptr); + u.tab[0] = ldl(ptr + 4); return u.d; } -static inline void stfl(void *ptr, float v) +static inline void stfq(void *ptr, double v) { union { - float f; - uint32_t i; + double d; + uint32_t tab[2]; } u; - u.f = v; - stl(ptr, u.i); + u.d = v; + stl(ptr, u.tab[1]); + stl(ptr + 4, u.tab[0]); +} + +#else +static inline double ldfq(void *ptr) +{ + union { + double d; + uint64_t i; + } u; + u.i = ldq(ptr); + return u.d; } static inline void stfq(void *ptr, double v) @@ -358,6 +387,7 @@ static inline void stfq(void *ptr, double v) u.d = v; stq(ptr, u.i); } +#endif #else |