summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-08-09 18:10:15 +0000
committerSean Callanan <scallanan@apple.com>2011-08-09 18:10:15 +0000
commit677f2a263add9da15611f6d643f946260dc2f6aa (patch)
treef2da0094a6519b9f58e80edcea5b68b98fe9ac0f
parent4b1e8399c22e8dae4345a3ee6b0df1eb1c720493 (diff)
downloadbcm5719-llvm-677f2a263add9da15611f6d643f946260dc2f6aa.tar.gz
bcm5719-llvm-677f2a263add9da15611f6d643f946260dc2f6aa.zip
Fixed a problem where the HasAVX() code in
debugserver did not back up %ebx/%rbx, even though it was being clobbered by the CPUID instruction. llvm-svn: 137131
-rw-r--r--lldb/tools/debugserver/source/MacOSX/HasAVX.s22
-rw-r--r--lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h7
-rw-r--r--lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h7
3 files changed, 20 insertions, 16 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/HasAVX.s b/lldb/tools/debugserver/source/MacOSX/HasAVX.s
index 630051ebf49..a704bed67eb 100644
--- a/lldb/tools/debugserver/source/MacOSX/HasAVX.s
+++ b/lldb/tools/debugserver/source/MacOSX/HasAVX.s
@@ -12,8 +12,17 @@
.globl _HasAVX
_HasAVX:
+#if defined (__x86_64__)
+ pushq %rbp
+ movq %rsp, %rbp
+ pushq %rbx
+#else
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+#endif
mov $1, %eax
- cpuid
+ cpuid // clobbers ebx
and $0x018000000, %ecx
cmp $0x018000000, %ecx
jne not_supported
@@ -27,6 +36,15 @@ _HasAVX:
not_supported:
mov $0, %eax
done:
- ret
+#if defined (__x86_64__)
+ popq %rbx
+ movq %rbp, %rsp
+ popq %rbp
+#else
+ popl %ebx
+ movl %ebp, %esp
+ popl %ebp
+#endif
+ ret // return
#endif \ No newline at end of file
diff --git a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
index 5c1b571f706..dd1b22a3241 100644
--- a/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
+++ b/lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
@@ -202,17 +202,10 @@ protected:
static bool
CPUHasAVX()
{
-#if 0
if (s_has_avx == kAVXUnknown)
s_has_avx = (::HasAVX() ? kAVXPresent : kAVXNotPresent);
return (s_has_avx == kAVXPresent);
-#else
- // ::HasAVX() will cause this code to crash because the
- // assembly function doesn't backup and restore the registers
- // it uses. Until this is fixed, AVX will be disabled.
- return 0;
-#endif
}
MachThread *m_thread;
diff --git a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
index 8f136bd9068..0d96b02297f 100644
--- a/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
+++ b/lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
@@ -209,17 +209,10 @@ protected:
static bool
CPUHasAVX()
{
-#if 0
if (s_has_avx == kAVXUnknown)
s_has_avx = (::HasAVX() ? kAVXPresent : kAVXNotPresent);
return (s_has_avx == kAVXPresent);
-#else
- // ::HasAVX() will cause this code to crash because the
- // assembly function doesn't backup and restore the registers
- // it uses. Until this is fixed, AVX will be disabled.
- return 0;
-#endif
}
MachThread *m_thread;
OpenPOWER on IntegriCloud