Decoding : F2 and F2 prefix could override prefix 66 when determine SSE opcode

This commit is contained in:
Stanislav Shwartsman 2007-10-20 10:56:44 +00:00
parent 0a621e6c43
commit 5445de19d1
3 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.cc,v 1.111 2007-10-11 22:44:17 sshwarts Exp $
// $Id: fetchdecode.cc,v 1.112 2007-10-20 10:56:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1543,7 +1543,7 @@ BX_CPU_C::fetchDecode32(Bit8u *iptr, bxInstruction_c *instruction, unsigned rema
#define SSE_PREFIX_NONE 0
#define SSE_PREFIX_66 1
#define SSE_PREFIX_F2 2
#define SSE_PREFIX_F3 3 /* only one SSE prefix could be used */
#define SSE_PREFIX_F3 3
unsigned sse_prefix = SSE_PREFIX_NONE;
os_32 = is_32 =
@ -1580,14 +1580,14 @@ fetch_b1:
}
return(0);
case 0xf2: // REPNE/REPNZ
if(!sse_prefix) sse_prefix = SSE_PREFIX_F2;
sse_prefix = SSE_PREFIX_F2;
instruction->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0xf3: // REP/REPE/REPZ
if(!sse_prefix) sse_prefix = SSE_PREFIX_F3;
sse_prefix = SSE_PREFIX_F3;
instruction->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode64.cc,v 1.116 2007-10-11 22:44:17 sshwarts Exp $
// $Id: fetchdecode64.cc,v 1.117 2007-10-20 10:56:44 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2157,7 +2157,7 @@ BX_CPU_C::fetchDecode64(Bit8u *iptr, bxInstruction_c *instruction, unsigned rema
#define SSE_PREFIX_NONE 0
#define SSE_PREFIX_66 1
#define SSE_PREFIX_F2 2
#define SSE_PREFIX_F3 3 /* only one SSE prefix could be used */
#define SSE_PREFIX_F3 3
unsigned sse_prefix = SSE_PREFIX_NONE;
unsigned rex_prefix = 0;
@ -2216,14 +2216,14 @@ fetch_b1:
}
return(0);
case 0xf2: // REPNE/REPNZ
if(!sse_prefix) sse_prefix = SSE_PREFIX_F2;
sse_prefix = SSE_PREFIX_F2;
instruction->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0xf3: // REP/REPE/REPZ
if(!sse_prefix) sse_prefix = SSE_PREFIX_F3;
sse_prefix = SSE_PREFIX_F3;
instruction->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dis_decode.cc,v 1.40 2007-09-19 19:38:10 sshwarts Exp $
// $Id: dis_decode.cc,v 1.41 2007-10-20 10:56:44 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#include <stdio.h>
@ -152,12 +152,12 @@ x86_insn disassembler::decode(bx_bool is_32, bx_bool is_64, bx_address base, bx_
continue;
case 0xf2: // repne
if (!sse_prefix) sse_prefix = SSE_PREFIX_F2;
sse_prefix = SSE_PREFIX_F2;
rex_prefix = 0;
continue;
case 0xf3: // rep
if (!sse_prefix) sse_prefix = SSE_PREFIX_F3;
sse_prefix = SSE_PREFIX_F3;
rex_prefix = 0;
continue;