diff options
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; |

