|
From: <sv...@va...> - 2015-06-17 21:33:26
|
Author: philippe
Date: Wed Jun 17 22:33:19 2015
New Revision: 3153
Log:
A SSE2 only CPU was reported to the guest as a SSE3 CPU.
The guest code might then select functions calling invalid
instructions.
E.G. giving:
vex x86->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xF
==13094== valgrind: Unrecognised instruction at address 0x496d4d3.
==13094== at 0x496D4D3: __mempcpy_ssse3 (memcpy-ssse3.S:771)
==13094== by 0x125E0B: ??? (in /bin/dash)
as the host hw cap is not SSE3 enabled, while the guest believes
SSE3 can be used.
So, change CPUID so as to report an SSE3 if the hw is SSE3,
and otherwise SSE1 or lower.
(an SSE2 cpu might be added later on)
Modified:
trunk/priv/guest_x86_defs.h
trunk/priv/guest_x86_helpers.c
trunk/priv/guest_x86_toIR.c
Modified: trunk/priv/guest_x86_defs.h
==============================================================================
--- trunk/priv/guest_x86_defs.h (original)
+++ trunk/priv/guest_x86_defs.h Wed Jun 17 22:33:19 2015
@@ -147,7 +147,7 @@
extern void x86g_dirtyhelper_CPUID_sse0 ( VexGuestX86State* );
extern void x86g_dirtyhelper_CPUID_mmxext ( VexGuestX86State* );
extern void x86g_dirtyhelper_CPUID_sse1 ( VexGuestX86State* );
-extern void x86g_dirtyhelper_CPUID_sse2 ( VexGuestX86State* );
+extern void x86g_dirtyhelper_CPUID_sse3 ( VexGuestX86State* );
extern void x86g_dirtyhelper_FINIT ( VexGuestX86State* );
Modified: trunk/priv/guest_x86_helpers.c
==============================================================================
--- trunk/priv/guest_x86_helpers.c (original)
+++ trunk/priv/guest_x86_helpers.c Wed Jun 17 22:33:19 2015
@@ -2324,7 +2324,7 @@
address sizes : 36 bits physical, 48 bits virtual
power management:
*/
-void x86g_dirtyhelper_CPUID_sse2 ( VexGuestX86State* st )
+void x86g_dirtyhelper_CPUID_sse3 ( VexGuestX86State* st )
{
# define SET_ABCD(_a,_b,_c,_d) \
do { st->guest_EAX = (UInt)(_a); \
Modified: trunk/priv/guest_x86_toIR.c
==============================================================================
--- trunk/priv/guest_x86_toIR.c (original)
+++ trunk/priv/guest_x86_toIR.c Wed Jun 17 22:33:19 2015
@@ -14842,9 +14842,9 @@
IRDirty* d = NULL;
void* fAddr = NULL;
const HChar* fName = NULL;
- if (archinfo->hwcaps & VEX_HWCAPS_X86_SSE2) {
- fName = "x86g_dirtyhelper_CPUID_sse2";
- fAddr = &x86g_dirtyhelper_CPUID_sse2;
+ if (archinfo->hwcaps & VEX_HWCAPS_X86_SSE3) {
+ fName = "x86g_dirtyhelper_CPUID_sse3";
+ fAddr = &x86g_dirtyhelper_CPUID_sse3;
}
else
if (archinfo->hwcaps & VEX_HWCAPS_X86_SSE1) {
|