Fixed code duplication during prefix decoding

This commit is contained in:
Stanislav Shwartsman 2008-06-11 20:58:29 +00:00
parent 288b086e20
commit 7f82a536b3
2 changed files with 22 additions and 68 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.cc,v 1.190 2008-06-09 19:35:59 sshwarts Exp $
// $Id: fetchdecode.cc,v 1.191 2008-06-11 20:58:28 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2513,59 +2513,28 @@ fetch_b1:
}
return(0);
case 0xf2: // REPNE/REPNZ
BX_INSTR_PREFIX(BX_CPU_ID, b1);
sse_prefix = SSE_PREFIX_F2;
i->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0xf3: // REP/REPE/REPZ
BX_INSTR_PREFIX(BX_CPU_ID, b1);
sse_prefix = SSE_PREFIX_F3;
sse_prefix = b1 & 0xf;
i->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x2e: // CS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
i->setSeg(BX_SEG_REG_CS);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x26: // ES:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
i->setSeg(BX_SEG_REG_ES);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x2e: // CS:
case 0x36: // SS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
i->setSeg(BX_SEG_REG_SS);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x3e: // DS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
i->setSeg(BX_SEG_REG_DS);
i->setSeg((b1 >> 3) & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x64: // FS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
i->setSeg(BX_SEG_REG_FS);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x65: // GS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
i->setSeg(BX_SEG_REG_GS);
i->setSeg(b1 & 0xf);
if (ilen < remain) {
goto fetch_b1;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode64.cc,v 1.199 2008-06-09 19:35:59 sshwarts Exp $
// $Id: fetchdecode64.cc,v 1.200 2008-06-11 20:58:29 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -3407,19 +3407,31 @@ fetch_b1:
}
return(0);
case 0xf2: // REPNE/REPNZ
case 0xf3: // REP/REPE/REPZ
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
sse_prefix = SSE_PREFIX_F2;
sse_prefix = b1 & 0xf;
i->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0xf3: // REP/REPE/REPZ
case 0x2e: // CS:
case 0x26: // ES:
case 0x36: // SS:
case 0x3e: // DS:
/* ignore segment override prefix */
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
sse_prefix = SSE_PREFIX_F3;
i->setRepUsed(b1 & 3);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x64: // FS:
case 0x65: // GS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
i->setSeg(b1 & 0xf);
if (ilen < remain) {
goto fetch_b1;
}
@ -3442,33 +3454,6 @@ fetch_b1:
goto fetch_b1;
}
return(0);
case 0x2e: // CS:
case 0x26: // ES:
case 0x36: // SS:
case 0x3e: // DS:
/* ignore segment override prefix */
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x64: // FS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
i->setSeg(BX_SEG_REG_FS);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x65: // GS:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
i->setSeg(BX_SEG_REG_GS);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0xf0: // LOCK:
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;