diff --git a/Frameworks/Dumb/dumb/src/helpers/resampler.c b/Frameworks/Dumb/dumb/src/helpers/resampler.c index 475c30d8e..90b01a4ef 100644 --- a/Frameworks/Dumb/dumb/src/helpers/resampler.c +++ b/Frameworks/Dumb/dumb/src/helpers/resampler.c @@ -49,12 +49,28 @@ static float sinc(float x) static inline void __cpuid(int *data, int selector) { +#if defined(__PIC__) && defined(__i386__) + asm("xchgl %%ebx, %%esi; cpuid; xchgl %%ebx, %%esi" + : "=a" (data[0]), + "=S" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "0" (selector)); +#elif defined(__PIC__) && defined(__amd64__) + asm("xchg{q} {%%}rbx, %q1; cpuid; xchg{q} {%%}rbx, %q1" + : "=a" (data[0]), + "=&r" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "0" (selector)); +#else asm("cpuid" : "=a" (data[0]), "=b" (data[1]), "=c" (data[2]), "=d" (data[3]) - : "a"(selector)); + : "0" (selector)); +#endif } #else #define __cpuid(a,b) memset((a), 0, sizeof(int) * 4) diff --git a/Frameworks/modplay/modplay/resampler.c b/Frameworks/modplay/modplay/resampler.c index 368d91d18..2d5e9884c 100644 --- a/Frameworks/modplay/modplay/resampler.c +++ b/Frameworks/modplay/modplay/resampler.c @@ -49,12 +49,28 @@ static float sinc(float x) static inline void __cpuid(int *data, int selector) { +#if defined(__PIC__) && defined(__i386__) + asm("xchgl %%ebx, %%esi; cpuid; xchgl %%ebx, %%esi" + : "=a" (data[0]), + "=S" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "0" (selector)); +#elif defined(__PIC__) && defined(__amd64__) + asm("xchg{q} {%%}rbx, %q1; cpuid; xchg{q} {%%}rbx, %q1" + : "=a" (data[0]), + "=&r" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "0" (selector)); +#else asm("cpuid" : "=a" (data[0]), "=b" (data[1]), "=c" (data[2]), "=d" (data[3]) - : "a"(selector)); + : "0" (selector)); +#endif } #else #define __cpuid(a,b) memset((a), 0, sizeof(int) * 4) diff --git a/Frameworks/vio2sf/vio2sf/src/vio2sf/desmume/resampler.c b/Frameworks/vio2sf/vio2sf/src/vio2sf/desmume/resampler.c index d383e80fd..6a828caeb 100644 --- a/Frameworks/vio2sf/vio2sf/src/vio2sf/desmume/resampler.c +++ b/Frameworks/vio2sf/vio2sf/src/vio2sf/desmume/resampler.c @@ -49,12 +49,28 @@ static float sinc(float x) static inline void __cpuid(int *data, int selector) { +#if defined(__PIC__) && defined(__i386__) + asm("xchgl %%ebx, %%esi; cpuid; xchgl %%ebx, %%esi" + : "=a" (data[0]), + "=S" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "0" (selector)); +#elif defined(__PIC__) && defined(__amd64__) + asm("xchg{q} {%%}rbx, %q1; cpuid; xchg{q} {%%}rbx, %q1" + : "=a" (data[0]), + "=&r" (data[1]), + "=c" (data[2]), + "=d" (data[3]) + : "0" (selector)); +#else asm("cpuid" : "=a" (data[0]), "=b" (data[1]), "=c" (data[2]), "=d" (data[3]) - : "a"(selector)); + : "0" (selector)); +#endif } #else #define __cpuid(a,b) memset((a), 0, sizeof(int) * 4)