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
This commit is contained in:
thestig@chromium.org 2013-12-09 20:22:43 +00:00
parent cca536ba9d
commit 0348c801bd

View File

@ -40,6 +40,7 @@
#include <asm/ptrace.h>
#include <assert.h>
#include <cpuid.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@ -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)