summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY3
-rw-r--r--dxr3cpu.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/HISTORY b/HISTORY
index 08dc461..aea8b73 100644
--- a/HISTORY
+++ b/HISTORY
@@ -286,7 +286,8 @@ NOTE: I havent found time to include all of the languages, will be done in pre2
- avoid hang in pause mode with VDR >= 1.3.18 (Luca Olivetti)
- avoid high CPU usage in pause mode (Luca Olivetti, Klaus Schmidinger)
- improved GetSTC(): fixes DVB subtitles sync problems (Mikko Tuumanen)
-- fix compilation with -fPIC, kudos to ffmpeg (Ville Skyttä)
+- fix PIC and AMD64 problems in the cpuid code, kudos to ffmpeg
+ (Ville Skyttä, Jon Burgess)
- eliminate some compiler warnings (Ville Skyttä)
- set aspect ratio and audio mode to unknown when releasing devices, fixes
the setup eg. after returning from the MPlayer plugin
diff --git a/dxr3cpu.c b/dxr3cpu.c
index 41f2435..e4035ef 100644
--- a/dxr3cpu.c
+++ b/dxr3cpu.c
@@ -126,10 +126,19 @@ bool cDxr3CPU::CheckCPUIDPresence()
bool cDxr3CPU::Cpuid(unsigned long function, unsigned long& out_eax, unsigned long& out_ebx, unsigned long& out_ecx, unsigned long& out_edx)
{
// This works with PIC/non-PIC, from ffmpeg (libavcodec/i386/cputest.c)
+
+#ifdef __x86_64__
+# define REG_b "rbx"
+# define REG_S "rsi"
+#else
+# define REG_b "ebx"
+# define REG_S "esi"
+#endif
+
__asm __volatile \
- ("movl %%ebx, %%esi\n\t" \
+ ("mov %%"REG_b", %%"REG_S"\n\t" \
"cpuid\n\t" \
- "xchgl %%ebx, %%esi" \
+ "xchg %%"REG_b", %%"REG_S \
: "=a" (out_eax), "=S" (out_ebx), \
"=c" (out_ecx), "=d" (out_edx) \
: "0" (function));