summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-31 17:53:10 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-31 17:53:10 +0000
commit05f68565cc5513223937eae620d9c7d676eff854 (patch)
tree16646751cd656a669324a55a726fd6b41b826ca6
parent7269bab49c433f00665a34350de71f39a32bb2fb (diff)
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
-rw-r--r--libs/pbd/fpu.cc12
1 files changed, 10 insertions, 2 deletions
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)"
: