Fix POPCNT decode tables

This commit is contained in:
Stanislav Shwartsman 2010-01-29 10:16:28 +00:00
parent a060d16845
commit dc02d836ce
4 changed files with 30 additions and 56 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.635 2010-01-19 14:43:46 sshwarts Exp $
// $Id: cpu.h,v 1.636 2010-01-29 10:16:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -3888,10 +3888,10 @@ enum {
#define BxGroupN 0x0010 // Group encoding: 0001
#define BxPrefixSSE 0x0020 // Group encoding: 0010
#define BxPrefixSSE66 0x0030 // Group encoding: 0011
#define BxFPEscape 0x0040 // Group encoding: 0100
#define Bx3ByteOp 0x0050 // Group encoding: 0101
#define BxOSizeGrp 0x0060 // Group encoding: 0110
// 0x0070 // Group encoding: 0111
#define BxPrefixSSEF3 0x0040 // Group encoding: 0100
#define BxFPEscape 0x0050 // Group encoding: 0101
#define Bx3ByteOp 0x0060 // Group encoding: 0110
#define BxOSizeGrp 0x0070 // Group encoding: 0111
#define BxLockable 0x0100 // bit 8
#define BxArithDstRM 0x0200 // bit 9

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.cc,v 1.240 2010-01-09 15:11:31 sshwarts Exp $
// $Id: fetchdecode.cc,v 1.241 2010-01-29 10:16:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -680,7 +680,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32R[512*2] = {
/* 0F B5 /wr */ { 0, BX_IA_ERROR }, // LGS
/* 0F B6 /wr */ { 0, BX_IA_MOVZX_GwEbR },
/* 0F B7 /wr */ { 0, BX_IA_MOV_GwEwR }, // MOVZX_GwEw
/* 0F B8 /wr */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8wR },
/* 0F B8 /wr */ { BxPrefixSSEF3, BX_IA_POPCNT_GwEwR, BxOpcodeGroupSSE_ERR },
/* 0F B9 /wr */ { 0, BX_IA_UD2B },
/* 0F BA /wr */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EwIbR },
/* 0F BB /wr */ { 0, BX_IA_BTC_EwGwR },
@ -1243,7 +1243,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32R[512*2] = {
/* 0F B5 /dr */ { 0, BX_IA_ERROR }, // LGS
/* 0F B6 /dr */ { 0, BX_IA_MOVZX_GdEbR },
/* 0F B7 /dr */ { 0, BX_IA_MOVZX_GdEwR },
/* 0F B8 /dr */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8dR },
/* 0F B8 /dr */ { BxPrefixSSEF3, BX_IA_POPCNT_GdEdR, BxOpcodeGroupSSE_ERR },
/* 0F B9 /dr */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /dr */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EdIbR },
/* 0F BB /dr */ { 0, BX_IA_BTC_EdGdR },
@ -1813,7 +1813,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32M[512*2] = {
/* 0F B5 /wm */ { 0, BX_IA_LGS_GwMp },
/* 0F B6 /wm */ { 0, BX_IA_MOVZX_GwEbM },
/* 0F B7 /wm */ { 0, BX_IA_MOV_GwEwM }, // MOVZX_GwEw
/* 0F B8 /wm */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8wM },
/* 0F B8 /wm */ { BxPrefixSSEF3, BX_IA_POPCNT_GwEwM, BxOpcodeGroupSSE_ERR },
/* 0F B9 /wm */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /wm */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EwIbM },
/* 0F BB /wm */ { BxLockable, BX_IA_BTC_EwGwM },
@ -2376,7 +2376,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo32M[512*2] = {
/* 0F B5 /dm */ { 0, BX_IA_LGS_GdMp },
/* 0F B6 /dm */ { 0, BX_IA_MOVZX_GdEbM },
/* 0F B7 /dm */ { 0, BX_IA_MOVZX_GdEwM },
/* 0F B8 /dm */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8dM },
/* 0F B8 /dm */ { BxPrefixSSEF3, BX_IA_POPCNT_GdEdM, BxOpcodeGroupSSE_ERR },
/* 0F B9 /dm */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /dm */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EdIbM },
/* 0F BB /dm */ { BxLockable, BX_IA_BTC_EdGdM },
@ -2775,6 +2775,12 @@ modrm_done:
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[0]); // BX_IA_ERROR
}
continue;
case BxPrefixSSEF3:
/* For SSE opcodes with prefix F3 only */
if (sse_prefix != SSE_PREFIX_F3) {
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[0]); // BX_IA_ERROR
}
continue;
case BxFPEscape:
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[b2 & 0x3f]);
break;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.h,v 1.94 2009-12-20 09:00:40 sshwarts Exp $
// $Id: fetchdecode.h,v 1.95 2010-01-29 10:16:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2005-2009 Stanislav Shwartsman
@ -1411,44 +1411,6 @@ static const BxOpcodeInfo_t BxOpcodeGroupSSE_0f7fM[3] = {
/* F3 */ { 0, BX_IA_MOVDQU_WdqVdqM }
};
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fb8wR[3] = {
/* 66 */ { 0, BX_IA_ERROR },
/* F2 */ { 0, BX_IA_ERROR },
/* F3 */ { 0, BX_IA_POPCNT_GwEwR }
};
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fb8wM[3] = {
/* 66 */ { 0, BX_IA_ERROR },
/* F2 */ { 0, BX_IA_ERROR },
/* F3 */ { 0, BX_IA_POPCNT_GwEwM }
};
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fb8dR[3] = {
/* 66 */ { 0, BX_IA_ERROR },
/* F2 */ { 0, BX_IA_ERROR },
/* F3 */ { 0, BX_IA_POPCNT_GdEdR }
};
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fb8dM[3] = {
/* 66 */ { 0, BX_IA_ERROR },
/* F2 */ { 0, BX_IA_ERROR },
/* F3 */ { 0, BX_IA_POPCNT_GdEdM }
};
#if BX_SUPPORT_X86_64
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fb8qR[3] = {
/* 66 */ { 0, BX_IA_ERROR },
/* F2 */ { 0, BX_IA_ERROR },
/* F3 */ { 0, BX_IA_POPCNT_GqEqR }
};
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fb8qM[3] = {
/* 66 */ { 0, BX_IA_ERROR },
/* F2 */ { 0, BX_IA_ERROR },
/* F3 */ { 0, BX_IA_POPCNT_GqEqM }
};
#endif
static const BxOpcodeInfo_t BxOpcodeGroupSSE_0fc2[3] = {
/* 66 */ { 0, BX_IA_CMPPD_VpdWpdIb },
/* F2 */ { 0, BX_IA_CMPSD_VsdWsdIb },

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode64.cc,v 1.242 2010-01-09 15:11:32 sshwarts Exp $
// $Id: fetchdecode64.cc,v 1.243 2010-01-29 10:16:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -628,7 +628,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64R[512*3] = {
/* 0F B5 /wr */ { 0, BX_IA_ERROR }, // LGS
/* 0F B6 /wr */ { 0, BX_IA_MOVZX_GwEbR },
/* 0F B7 /wr */ { 0, BX_IA_MOV_GwEwR }, // MOVZX_GwEw
/* 0F B8 /wr */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8wR },
/* 0F B8 /wr */ { BxPrefixSSEF3, BX_IA_POPCNT_GwEwR, BxOpcodeGroupSSE_ERR },
/* 0F B9 /wr */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /wr */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EwIbR },
/* 0F BB /wr */ { 0, BX_IA_BTC_EwGwR },
@ -1155,7 +1155,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64R[512*3] = {
/* 0F B5 /dr */ { 0, BX_IA_ERROR }, // LFS
/* 0F B6 /dr */ { 0, BX_IA_MOVZX_GdEbR },
/* 0F B7 /dr */ { 0, BX_IA_MOVZX_GdEwR },
/* 0F B8 /dr */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8dR },
/* 0F B8 /dr */ { BxPrefixSSEF3, BX_IA_POPCNT_GdEdR, BxOpcodeGroupSSE_ERR },
/* 0F B9 /dr */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /dr */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EdIbR },
/* 0F BB /dr */ { 0, BX_IA_BTC_EdGdR },
@ -1682,7 +1682,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64R[512*3] = {
/* 0F B5 /qr */ { 0, BX_IA_ERROR }, // LGS
/* 0F B6 /qr */ { 0, BX_IA_MOVZX_GqEbR },
/* 0F B7 /qr */ { 0, BX_IA_MOVZX_GqEwR },
/* 0F B8 /qr */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8qR },
/* 0F B8 /qr */ { BxPrefixSSEF3, BX_IA_POPCNT_GqEqR, BxOpcodeGroupSSE_ERR },
/* 0F B9 /qr */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /qr */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfo64G8EqIbR },
/* 0F BB /qr */ { 0, BX_IA_BTC_EqGqR },
@ -2215,7 +2215,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64M[512*3] = {
/* 0F B5 /wm */ { 0, BX_IA_LGS_GwMp },
/* 0F B6 /wm */ { 0, BX_IA_MOVZX_GwEbM },
/* 0F B7 /wm */ { 0, BX_IA_MOV_GwEwM }, // MOVZX_GwEw
/* 0F B8 /wm */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8wM },
/* 0F B8 /wm */ { BxPrefixSSEF3, BX_IA_POPCNT_GwEwM, BxOpcodeGroupSSE_ERR },
/* 0F B9 /wm */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /wm */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EwIbM },
/* 0F BB /wm */ { BxLockable, BX_IA_BTC_EwGwM },
@ -2742,7 +2742,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64M[512*3] = {
/* 0F B5 /dm */ { 0, BX_IA_LGS_GdMp },
/* 0F B6 /dm */ { 0, BX_IA_MOVZX_GdEbM },
/* 0F B7 /dm */ { 0, BX_IA_MOVZX_GdEwM },
/* 0F B8 /dm */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8dM },
/* 0F B8 /dm */ { BxPrefixSSEF3, BX_IA_POPCNT_GdEdM, BxOpcodeGroupSSE_ERR },
/* 0F B9 /dm */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /dm */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfoG8EdIbM },
/* 0F BB /dm */ { BxLockable, BX_IA_BTC_EdGdM },
@ -3269,7 +3269,7 @@ static const BxOpcodeInfo_t BxOpcodeInfo64M[512*3] = {
/* 0F B5 /qm */ { 0, BX_IA_LGS_GqMp }, // TODO: LGS_GdMp for AMD CPU
/* 0F B6 /qm */ { 0, BX_IA_MOVZX_GqEbM },
/* 0F B7 /qm */ { 0, BX_IA_MOVZX_GqEwM },
/* 0F B8 /qm */ { BxPrefixSSE, BX_IA_ERROR, BxOpcodeGroupSSE_0fb8qM },
/* 0F B8 /qm */ { BxPrefixSSEF3, BX_IA_POPCNT_GqEqM, BxOpcodeGroupSSE_ERR },
/* 0F B9 /qm */ { BxTraceEnd, BX_IA_UD2B },
/* 0F BA /qm */ { BxGroup8, BX_IA_ERROR, BxOpcodeInfo64G8EqIbM },
/* 0F BB /qm */ { BxLockable, BX_IA_BTC_EqGqM },
@ -3690,6 +3690,12 @@ modrm_done:
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[0]); // BX_IA_ERROR
}
continue;
case BxPrefixSSEF3:
/* For SSE opcodes with prefix F3 only */
if (sse_prefix != SSE_PREFIX_F3) {
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[0]); // BX_IA_ERROR
}
continue;
case BxFPEscape:
OpcodeInfoPtr = &(OpcodeInfoPtr->AnotherArray[b2 & 0x3f]);
break;