[Lldb-commits] [lldb] r137131 - in /lldb/trunk/tools/debugserver/source/MacOSX: HasAVX.s i386/DNBArchImplI386.h x86_64/DNBArchImplX86_64.h

Sean Callanan scallanan at apple.com
Tue Aug 9 11:10:15 PDT 2011


Author: spyffe
Date: Tue Aug  9 13:10:15 2011
New Revision: 137131

URL: http://llvm.org/viewvc/llvm-project?rev=137131&view=rev
Log:
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.

Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s
    lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
    lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h

Modified: lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s?rev=137131&r1=137130&r2=137131&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/HasAVX.s Tue Aug  9 13:10:15 2011
@@ -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 @@
 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

Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h?rev=137131&r1=137130&r2=137131&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h Tue Aug  9 13:10:15 2011
@@ -202,17 +202,10 @@
     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;

Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h?rev=137131&r1=137130&r2=137131&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h Tue Aug  9 13:10:15 2011
@@ -209,17 +209,10 @@
     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;





More information about the lldb-commits mailing list