summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--dxr3cpu.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/HISTORY b/HISTORY
index c311e11..fa597ed 100644
--- a/HISTORY
+++ b/HISTORY
@@ -266,3 +266,4 @@ NOTE: I havent found time to include all of the languages, will be done in pre2
refreshed too often (Luca Olivetti, Ville Skyttä)
- borrow better OSD scaling routines from the Xine plugin (Luca Olivetti)
- improve original OSD scaler for small resolutions (#1014339, Luca Olivetti)
+- fix compilation with -fPIC, kudos to ffmpeg (Ville Skyttä)
diff --git a/dxr3cpu.c b/dxr3cpu.c
index 4cd0a7a..3881480 100644
--- a/dxr3cpu.c
+++ b/dxr3cpu.c
@@ -125,6 +125,13 @@ bool cDxr3CPU::CheckCPUIDPresence()
//! cpuid function
bool cDxr3CPU::Cpuid(unsigned long function, unsigned long& out_eax, unsigned long& out_ebx, unsigned long& out_ecx, unsigned long& out_edx)
{
- asm("cpuid": "=a" (out_eax), "=b" (out_ebx), "=c" (out_ecx), "=d" (out_edx) : "a" (function));
+ // This works with PIC/non-PIC, from ffmpeg (libavcodec/i386/cputest.c)
+ __asm __volatile \
+ ("movl %%ebx, %%esi\n\t" \
+ "cpuid\n\t" \
+ "xchgl %%ebx, %%esi" \
+ : "=a" (out_eax), "=S" (out_ebx), \
+ "=c" (out_ecx), "=d" (out_edx) \
+ : "0" (function));
return true;
}