diff options
author | David 'Digit' Turner <digit@google.com> | 2009-09-14 14:32:27 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2009-09-14 14:32:27 -0700 |
commit | 5d8f37ad78fc66901af50c762029a501561f3b23 (patch) | |
tree | 206790f8f21000850a98c4f9590a79e779106278 /bswap.h | |
parent | cd059b15f2c7df69f4a087bd66900eb172e41d1c (diff) | |
download | external_qemu-5d8f37ad78fc66901af50c762029a501561f3b23.zip external_qemu-5d8f37ad78fc66901af50c762029a501561f3b23.tar.gz external_qemu-5d8f37ad78fc66901af50c762029a501561f3b23.tar.bz2 |
Merge upstream QEMU 10.0.50 into the Android source tree.
This change integrates many changes from the upstream QEMU sources.
Its main purpose is to enable correct ARMv6 and ARMv7 support to the
Android emulator. Due to the nature of the upstream code base, this
unfortunately also required changes to many other parts of the source.
Note that to ensure easier integrations in the future, some source files
and directories that have heavy Android-specific customization have been
renamed with an -android suffix. The original files are still there for
easier integration tracking, but *never* compiled. For example:
net.c net-android.c
qemu-char.c qemu-char-android.c
slirp/ slirp-android/
etc...
Tested on linux-x86, darwin-x86 and windows host machines.
Diffstat (limited to 'bswap.h')
-rw-r--r-- | bswap.h | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -5,6 +5,12 @@ #include <inttypes.h> +#ifdef HAVE_MACHINE_BSWAP_H +#include <sys/endian.h> +#include <sys/types.h> +#include <machine/bswap.h> +#else + #ifdef HAVE_BYTESWAP_H #include <byteswap.h> #else @@ -58,6 +64,8 @@ static inline uint64_t bswap64(uint64_t x) return bswap_64(x); } +#endif /* ! HAVE_MACHINE_BSWAP_H */ + static inline void bswap16s(uint16_t *s) { *s = bswap16(*s); @@ -126,7 +134,7 @@ CPU_CONVERT(le, 64, uint64_t) /* unaligned versions (optimized for frequent unaligned accesses)*/ -#if defined(__i386__) || defined(__powerpc__) +#if defined(__i386__) || defined(_ARCH_PPC) #define cpu_to_le16wu(p, v) cpu_to_le16w(p, v) #define cpu_to_le32wu(p, v) cpu_to_le32w(p, v) @@ -143,7 +151,7 @@ static inline void cpu_to_le16wu(uint16_t *p, uint16_t v) { uint8_t *p1 = (uint8_t *)p; - p1[0] = v; + p1[0] = v & 0xff; p1[1] = v >> 8; } @@ -151,7 +159,7 @@ static inline void cpu_to_le32wu(uint32_t *p, uint32_t v) { uint8_t *p1 = (uint8_t *)p; - p1[0] = v; + p1[0] = v & 0xff; p1[1] = v >> 8; p1[2] = v >> 16; p1[3] = v >> 24; @@ -180,7 +188,7 @@ static inline void cpu_to_be16wu(uint16_t *p, uint16_t v) uint8_t *p1 = (uint8_t *)p; p1[0] = v >> 8; - p1[1] = v; + p1[1] = v & 0xff; } static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) @@ -190,7 +198,7 @@ static inline void cpu_to_be32wu(uint32_t *p, uint32_t v) p1[0] = v >> 24; p1[1] = v >> 16; p1[2] = v >> 8; - p1[3] = v; + p1[3] = v & 0xff; } #endif |