Fix SSE4 MOVNTDQA instruction - memory access must be always aligned

This commit is contained in:
Stanislav Shwartsman 2007-10-20 17:03:33 +00:00
parent 5445de19d1
commit 28a5c6741c
2 changed files with 28 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.338 2007-10-19 12:40:18 sshwarts Exp $
// $Id: cpu.h,v 1.339 2007-10-20 17:03:33 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2269,6 +2269,7 @@ public: // for now...
BX_SMF void DPPS_VpsWpsIb(bxInstruction_c *i);
BX_SMF void DPPD_VpdWpdIb(bxInstruction_c *i);
BX_SMF void MPSADBW_VdqWdqIb(bxInstruction_c *i);
BX_SMF void MOVNTDQA_VdqMdq(bxInstruction_c *i);
/* SSE4.1 */
/* SSE4.2 */
@ -2313,7 +2314,6 @@ public: // for now...
BX_SMF void MOVHPD_MqVsd(bxInstruction_c *);
BX_SMF void MOVNTPD_MdqVpd(bxInstruction_c *);
BX_SMF void MOVNTDQ_MdqVdq(bxInstruction_c *);
BX_SMF void MOVNTDQA_VdqMdq(bxInstruction_c *i);
#else
#if BX_SUPPORT_SSE >= 2
@ -2322,12 +2322,6 @@ public: // for now...
#define SSE2_ALIAS(i) BxError
#endif
#if BX_SUPPORT_SSE >= 4
#define SSE4_ALIAS(i) i
#else
#define SSE4_ALIAS(i) BxError
#endif
#define MOVUPD_VpdWpd /* 66 0f 10 */ SSE2_ALIAS(MOVUPS_VpsWps) /* 0f 10 */
#define MOVUPD_WpdVpd /* 66 0f 11 */ SSE2_ALIAS(MOVUPS_WpsVps) /* 0f 11 */
#define MOVAPD_VpdWpd /* 66 0f 28 */ SSE2_ALIAS(MOVAPS_VpsWps) /* 0f 28 */
@ -2361,8 +2355,6 @@ public: // for now...
#define UNPCKLPD_VpdWdq /* 66 0f 14 */ PUNPCKLQDQ_VdqWdq /* 66 0f 6c */
#define UNPCKHPD_VpdWdq /* 66 0f 15 */ PUNPCKHQDQ_VdqWdq /* 66 0f 6d */
#define MOVNTDQA_VdqMdq /* 66 0f 38 2a */ SSE4_ALIAS(LDDQU_VdqMdq) /* f2 0f f0 */
#endif // #ifdef STAND_ALONE_DECODER
BX_SMF void CMPXCHG_XBTS(bxInstruction_c *);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_move.cc,v 1.62 2007-10-11 18:12:00 sshwarts Exp $
// $Id: sse_move.cc,v 1.63 2007-10-20 17:03:33 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -1354,6 +1354,31 @@ void BX_CPU_C::PMOVSXDQ_VdqWq(bxInstruction_c *i)
#endif
}
/* 66 0F 38 2A */
void BX_CPU_C::MOVNTDQA_VdqMdq(bxInstruction_c *i)
{
#if BX_SUPPORT_SSE >= 4
/* source must be memory reference */
if (i->modC0()) {
BX_INFO(("MOVNTDQA_VdqMdq: must be memory reference"));
UndefinedOpcode(i);
}
BX_CPU_THIS_PTR prepareSSE();
BxPackedXmmRegister op;
read_virtual_dqword_aligned(i->seg(), RMAddr(i), (Bit8u *) &op);
/* now write result back to destination */
BX_WRITE_XMM_REG(i->nnn(), op);
#else
BX_INFO(("MOVNTDQA_VdqMdq: required SSE4, use --enable-sse option"));
UndefinedOpcode(i);
#endif
}
/* 66 0F 38 30 */
void BX_CPU_C::PMOVZXBW_VdqWq(bxInstruction_c *i)
{