From patchwork Sat Apr 30 01:02:46 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Burgess X-Patchwork-Id: 11862 Received: from mail3.uklinux.net ([80.84.72.33]) by www.linuxtv.org with esmtp (Exim 4.34) id 1DRgRD-0000SJ-Pe for vdr@linuxtv.org; Sat, 30 Apr 2005 03:06:31 +0200 Received: from [192.168.1.247] (bts-0774.dialup.zetnet.co.uk [194.247.51.6]) by mail3.uklinux.net (Postfix) with ESMTP id F0BD6409FB9 for ; Sat, 30 Apr 2005 01:06:03 +0000 (UTC) Message-ID: <4272D936.6020606@uklinux.net> Date: Sat, 30 Apr 2005 02:02:46 +0100 From: Jon Burgess User-Agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: vdr@linuxtv.org Subject: [vdr] [PATCH] dxr3plugin fix for AMD64 cpuid segv X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 01:06:31 -0000 Status: O X-Status: X-Keywords: X-UID: 1874 The current vdr-dxr3-0-2 branch of dxr3plugin segv's when run on an AMD64 system due to a problem with the cpuid code. The patch attached syncs the code with a recent ffmpeg/libavcodec/i386/cputest.c and it works for me. I have not had the chance to test it on a regular 32 bit x86 system. Jon --- dxr3/dxr3cpu.c.~1.1.2.9.~ 2005-04-19 19:19:37.000000000 +0100 +++ dxr3/dxr3cpu.c 2005-04-30 01:29:39.000000000 +0100 @@ -128,10 +128,19 @@ 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));