From 05f68565cc5513223937eae620d9c7d676eff854 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 31 Dec 2009 17:53:10 +0000 Subject: asm fixes for FPU::FPU() back ported from 3.0 git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6421 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/fpu.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/pbd/fpu.cc b/libs/pbd/fpu.cc index ffb88714f6..a55166b139 100644 --- a/libs/pbd/fpu.cc +++ b/libs/pbd/fpu.cc @@ -21,6 +21,12 @@ FPU::FPU () #else + /* asm notes: although we explicitly save&restore ebx/rbx (stack pointer), we must tell + gcc that ebx,rbx is clobbered so that it doesn't try to use it as an intermediate + register when storing edx/rdx. gcc 4.3 didn't make this "mistake", but gcc 4.4 + does, at least on x86_64. + */ + #ifndef USE_X86_64_ASM asm volatile ( "mov $1, %%eax\n" @@ -30,7 +36,7 @@ FPU::FPU () "popl %%ebx\n" : "=r" (cpuflags) : - : "%eax", "%ecx", "%edx", "memory" + : "%eax", "%ebx", "%ecx", "%edx" ); #else @@ -43,7 +49,7 @@ FPU::FPU () "popq %%rbx\n" : "=r" (cpuflags) : - : "%rax", "%rcx", "%rdx", "memory" + : "%rax", "%rbx", "%rcx", "%rdx" ); #endif /* USE_X86_64_ASM */ @@ -69,6 +75,8 @@ FPU::FPU () error << _("cannot allocate 16 byte aligned buffer for h/w feature detection") << endmsg; } else { + memset (fxbuf, 0, 512); + asm volatile ( "fxsave (%0)" : -- cgit v1.2.3