dxr3plugin fix for AMD64 cpuid segv
Commit Message
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
Comments
On Sat, 2005-04-30 at 02:02 +0100, Jon Burgess wrote:
> 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.
Applied, thanks.
> I have not had the chance to test it on a regular 32 bit x86 system.
Still works fine here.
(On the other hand, as far as I'm concerned, the whole optimized memcpy
and related stuff is on its way out: it is being used in only one place
in the whole plugin and I'm told that the performance of memcpy doesn't
really matter even there. If someone has something against it being
removed, now would be a good time to yell... :)
> (On the other hand, as far as I'm concerned, the whole optimized memcpy
> and related stuff is on its way out: it is being used in only one place
> in the whole plugin and I'm told that the performance of memcpy doesn't
> really matter even there. If someone has something against it being
> removed, now would be a good time to yell... :)
Interesting that you mention that now. Over the last days I have
experimented with dxr3 on my via eden board with a c3 processor.
memcpy_mmx makes the plugin segfault any time you start it with "unknown
machine code". This is caused by the assembler code in dxr3memcpy.c in
function mmx_memcpy. I removed the function from
cDxr3MemCpyBench::cDxr3MemCpyBench and it worked. Strange thing is, that
I remember it working before ...
Jan
@@ -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));