summaryrefslogtreecommitdiff
path: root/libs/pbd/fpu.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-31 17:51:27 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-31 17:51:27 +0000
commit53b0b4d114b82434e99e88cd7147014c29368d02 (patch)
tree6dc0fab170b3fb91f6297e590f5f8ffa6247bcab /libs/pbd/fpu.cc
parent019100470ab662d2390ad3d10bedf7088fc87e94 (diff)
add some asm notes, some more registers back to the clobber list, and memset the fxsave area in FPU::FPU()
git-svn-id: svn://localhost/ardour2/branches/3.0@6420 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/fpu.cc')
-rw-r--r--libs/pbd/fpu.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/libs/pbd/fpu.cc b/libs/pbd/fpu.cc
index 0eab7a93cb..12400221cc 100644
--- a/libs/pbd/fpu.cc
+++ b/libs/pbd/fpu.cc
@@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 600
+#include <cstring> // for memset
#include <cstdlib>
#include <stdint.h>
@@ -19,6 +20,12 @@ FPU::FPU ()
#ifndef ARCH_X86
return;
#endif
+
+ /* 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 (
@@ -29,7 +36,7 @@ FPU::FPU ()
"popl %%ebx\n"
: "=r" (cpuflags)
:
- : "%eax", "%ebx", "%edx"
+ : "%eax", "%ebx", "%ecx", "%edx"
);
#else
@@ -42,11 +49,11 @@ FPU::FPU ()
"popq %%rbx\n"
: "=r" (cpuflags)
:
- : "%rax", "%rbx", "%rdx"
+ : "%rax", "%rbx", "%rcx", "%rdx"
);
#endif /* USE_X86_64_ASM */
-
+
if (cpuflags & (1<<25)) {
_flags = Flags (_flags | (HasSSE|HasFlushToZero));
}
@@ -68,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)"
: