From db209a75d00e0c3a49bbc1c3c1007ef0baa2203a Mon Sep 17 00:00:00 2001 From: scop Date: Sat, 30 Apr 2005 11:27:47 +0000 Subject: Fix cpuid on AMD64 (Jon Burgess, newer ffmpeg). --- HISTORY | 3 ++- dxr3cpu.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 8345ef6..d734f5e 100644 --- a/HISTORY +++ b/HISTORY @@ -276,7 +276,8 @@ NOTE: I havent found time to include all of the languages, will be done in pre2 refreshed too often, see FLUSHRATE in Makefile (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ä) +- fix PIC and AMD64 problems in the cpuid code, kudos to ffmpeg + (Ville Skyttä, Jon Burgess) - eliminate some compiler warnings (Ville Skyttä) - fix OSD going pink after returning from the MPlayer plugin; while at it, remove dxr3palettemanager.* and use VDR's cPalette diff --git a/dxr3cpu.c b/dxr3cpu.c index d991e2d..a937b25 100644 --- a/dxr3cpu.c +++ b/dxr3cpu.c @@ -128,10 +128,19 @@ bool cDxr3CPU::Cpuid(unsigned long function, unsigned long& out_eax, 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)); -- cgit v1.2.3