Revert incorrect part of r4574 to avoid unaligned traps with i386 target

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5209 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
blueswir1 2008-09-14 13:56:10 +00:00
parent f48f3ede71
commit f4efd16603

View File

@ -233,15 +233,6 @@ static inline int lduw_le_p(void *ptr)
int val; int val;
__asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (ptr)); __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (ptr));
return val; return val;
#elif defined(__sparc__)
#ifndef ASI_PRIMARY_LITTLE
#define ASI_PRIMARY_LITTLE 0x88
#endif
int val;
__asm__ __volatile__ ("lduha [%1] %2, %0" : "=r" (val) : "r" (ptr),
"i" (ASI_PRIMARY_LITTLE));
return val;
#else #else
uint8_t *p = ptr; uint8_t *p = ptr;
return p[0] | (p[1] << 8); return p[0] | (p[1] << 8);
@ -254,11 +245,6 @@ static inline int ldsw_le_p(void *ptr)
int val; int val;
__asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (ptr)); __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (ptr));
return (int16_t)val; return (int16_t)val;
#elif defined(__sparc__)
int val;
__asm__ __volatile__ ("ldsha [%1] %2, %0" : "=r" (val) : "r" (ptr),
"i" (ASI_PRIMARY_LITTLE));
return val;
#else #else
uint8_t *p = ptr; uint8_t *p = ptr;
return (int16_t)(p[0] | (p[1] << 8)); return (int16_t)(p[0] | (p[1] << 8));
@ -271,11 +257,6 @@ static inline int ldl_le_p(void *ptr)
int val; int val;
__asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (ptr)); __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (ptr));
return val; return val;
#elif defined(__sparc__)
int val;
__asm__ __volatile__ ("lduwa [%1] %2, %0" : "=r" (val) : "r" (ptr),
"i" (ASI_PRIMARY_LITTLE));
return val;
#else #else
uint8_t *p = ptr; uint8_t *p = ptr;
return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
@ -284,27 +265,17 @@ static inline int ldl_le_p(void *ptr)
static inline uint64_t ldq_le_p(void *ptr) static inline uint64_t ldq_le_p(void *ptr)
{ {
#if defined(__sparc__)
uint64_t val;
__asm__ __volatile__ ("ldxa [%1] %2, %0" : "=r" (val) : "r" (ptr),
"i" (ASI_PRIMARY_LITTLE));
return val;
#else
uint8_t *p = ptr; uint8_t *p = ptr;
uint32_t v1, v2; uint32_t v1, v2;
v1 = ldl_le_p(p); v1 = ldl_le_p(p);
v2 = ldl_le_p(p + 4); v2 = ldl_le_p(p + 4);
return v1 | ((uint64_t)v2 << 32); return v1 | ((uint64_t)v2 << 32);
#endif
} }
static inline void stw_le_p(void *ptr, int v) static inline void stw_le_p(void *ptr, int v)
{ {
#ifdef __powerpc__ #ifdef __powerpc__
__asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*(uint16_t *)ptr) : "r" (v), "r" (ptr)); __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*(uint16_t *)ptr) : "r" (v), "r" (ptr));
#elif defined(__sparc__)
__asm__ __volatile__ ("stha %1, [%2] %3" : "=m" (*(uint16_t *)ptr) : "r" (v),
"r" (ptr), "i" (ASI_PRIMARY_LITTLE));
#else #else
uint8_t *p = ptr; uint8_t *p = ptr;
p[0] = v; p[0] = v;
@ -316,9 +287,6 @@ static inline void stl_le_p(void *ptr, int v)
{ {
#ifdef __powerpc__ #ifdef __powerpc__
__asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" (v), "r" (ptr)); __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" (v), "r" (ptr));
#elif defined(__sparc__)
__asm__ __volatile__ ("stwa %1, [%2] %3" : "=m" (*(uint32_t *)ptr) : "r" (v),
"r" (ptr), "i" (ASI_PRIMARY_LITTLE));
#else #else
uint8_t *p = ptr; uint8_t *p = ptr;
p[0] = v; p[0] = v;
@ -330,15 +298,9 @@ static inline void stl_le_p(void *ptr, int v)
static inline void stq_le_p(void *ptr, uint64_t v) static inline void stq_le_p(void *ptr, uint64_t v)
{ {
#if defined(__sparc__)
__asm__ __volatile__ ("stxa %1, [%2] %3" : "=m" (*(uint64_t *)ptr) : "r" (v),
"r" (ptr), "i" (ASI_PRIMARY_LITTLE));
#undef ASI_PRIMARY_LITTLE
#else
uint8_t *p = ptr; uint8_t *p = ptr;
stl_le_p(p, (uint32_t)v); stl_le_p(p, (uint32_t)v);
stl_le_p(p + 4, v >> 32); stl_le_p(p + 4, v >> 32);
#endif
} }
/* float access */ /* float access */