From 0348c801bdcd6a35cdd4576bbc43fb66de7782d7 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Mon, 9 Dec 2013 20:22:43 +0000 Subject: Add MMX detection when getting registers in Linux. For CPUs that don't support the MMX instruction set, such pre-Pentium III or industrial x86 embedded PCs, the minidump fails when it tries to retrieve MMX specific registers. This patch adds MMX detection for that call. Tested on Ubuntu 12.04 with i686, and on a custom Linux distro on a Vortex86DX microcontroller. Original review: https://breakpad.appspot.com/455002/ A=aras.vaichas BUG=495 Review URL: https://breakpad.appspot.com/864002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1248 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/minidump_writer/linux_ptrace_dumper.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/client/linux/minidump_writer') diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc index 3256f532..0a537a8b 100644 --- a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +++ b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -191,8 +192,16 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { } #if defined(__i386) - if (sys_ptrace(PTRACE_GETFPXREGS, tid, NULL, &info->fpxregs) == -1) - return false; + // Detect if the CPU supports the MMX instructions + int eax,ebx,ecx,edx; + __cpuid(1,eax,ebx,ecx,edx); + if (edx & bit_MMX) { + if (sys_ptrace(PTRACE_GETFPXREGS, tid, NULL, &info->fpxregs) == -1) { + return false; + } + } else { + memset( &info->fpxregs, 0, sizeof(info->fpxregs) ); + } #endif #if defined(__i386) || defined(__x86_64) -- cgit v1.2.1