Merge pull request #123 from Sonicadvance1/fix_interlockedbittestandresetset

Fixes interlockedbittestandreset/set in intrin_x86.h
This commit is contained in:
Pseudonym 2014-07-29 14:20:13 +01:00
commit 28227ea4c4
2 changed files with 4 additions and 5 deletions

View File

@ -435,14 +435,14 @@ static __inline__ __attribute__((always_inline)) long _InterlockedIncrement(vola
static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset(volatile long * a, const long b) static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset(volatile long * a, const long b)
{ {
unsigned char retval; unsigned char retval;
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "=m" (a) : [b] "Ir" (b) : "memory"); __asm__("lock; btrl %k[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval; return retval;
} }
static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandset(volatile long * a, const long b) static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandset(volatile long * a, const long b)
{ {
unsigned char retval; unsigned char retval;
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "=m" (a) : [b] "Ir" (b) : "memory"); __asm__("lock; btsl %k[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval; return retval;
} }

View File

@ -371,7 +371,6 @@ struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_fr
#endif #endif
// http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup // http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup
// - the other intrin_x86.h of pcsx2 is not up to date, its _interlockedbittestandreset simply does not work.
__forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask) __forceinline unsigned char _BitScanForward(unsigned long* const Index, const unsigned long Mask)
{ {
@ -384,7 +383,7 @@ struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_fr
{ {
unsigned char retval; unsigned char retval;
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory"); __asm__("lock; btrl %k[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval; return retval;
} }
@ -393,7 +392,7 @@ struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_fr
{ {
unsigned char retval; unsigned char retval;
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory"); __asm__("lock; btsl %k[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
return retval; return retval;
} }