summaryrefslogtreecommitdiff
path: root/dxr3cpu.c
diff options
context:
space:
mode:
authorscop <scop>2005-04-30 11:28:23 +0000
committerscop <scop>2005-04-30 11:28:23 +0000
commitc4a283f663bd94cd83171a283454c42c378042ea (patch)
treed207cf12fe42a5ea39083756694a330c1b7e53a3 /dxr3cpu.c
parent736a6013a596f9163f787f5ab2ab76bd02fdd8fc (diff)
downloadvdr-plugin-dxr3-c4a283f663bd94cd83171a283454c42c378042ea.tar.gz
vdr-plugin-dxr3-c4a283f663bd94cd83171a283454c42c378042ea.tar.bz2
Fix cpuid on AMD64 (Jon Burgess, newer ffmpeg).
Diffstat (limited to 'dxr3cpu.c')
-rw-r--r--dxr3cpu.c13
1 files changed, 11 insertions, 2 deletions
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));