Commit 88238e33 authored by Tomasz Buchert's avatar Tomasz Buchert

New upstream version 2.2

parent 061254f8
......@@ -480,6 +480,121 @@ static void x86emuOp2_sysexit(x86emu_t *emu, u8 op2)
}
/****************************************************************************
REMARKS:
Handles opcode 0x0f,0x40-0x4f
****************************************************************************/
static void x86emuOp2_conditional_move(x86emu_t *emu, u8 op2)
{
int mod, rl, rh, noop = 0;
u16 *src16, *dst16;
u32 *src32, *dst32, addr;
OP_DECODE("cmov");
fetch_decode_modrm(emu, &mod, &rh, &rl);
switch(op2 & 0xf) {
case 0:
OP_DECODE("o ");
noop = !ACCESS_FLAG(F_OF);
break;
case 1:
OP_DECODE("no ");
noop = ACCESS_FLAG(F_OF);
break;
case 2:
OP_DECODE("c ");
noop = !ACCESS_FLAG(F_CF);
break;
case 3:
OP_DECODE("nc ");
noop = ACCESS_FLAG(F_CF);
break;
case 4:
OP_DECODE("z ");
noop = !ACCESS_FLAG(F_ZF);
break;
case 5:
OP_DECODE("nz ");
noop = ACCESS_FLAG(F_ZF);
break;
case 6:
OP_DECODE("be ");
noop = !ACCESS_FLAG(F_CF) && !ACCESS_FLAG(F_ZF);
break;
case 7:
OP_DECODE("nbe ");
noop = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
break;
case 8:
OP_DECODE("s ");
noop = !ACCESS_FLAG(F_SF);
break;
case 9:
OP_DECODE("ns ");
noop = ACCESS_FLAG(F_SF);
break;
case 0xa:
OP_DECODE("p ");
noop = !ACCESS_FLAG(F_PF);
break;
case 0xb:
OP_DECODE("np ");
noop = ACCESS_FLAG(F_PF);
break;
case 0xc:
OP_DECODE("l ");
noop = ACCESS_FLAG(F_SF) == ACCESS_FLAG(F_OF);
break;
case 0xd:
OP_DECODE("nl ");
noop = ACCESS_FLAG(F_SF) != ACCESS_FLAG(F_OF);
break;
case 0xe:
OP_DECODE("le ");
noop = !ACCESS_FLAG(F_ZF) && (ACCESS_FLAG(F_SF) == ACCESS_FLAG(F_OF));
break;
case 0xf:
OP_DECODE("nle ");
noop = ACCESS_FLAG(F_ZF) || (ACCESS_FLAG(F_SF) != ACCESS_FLAG(F_OF));
break;
}
if(mod == 3) {
if(MODE_DATA32) {
dst32 = decode_rm_long_register(emu, rh);
OP_DECODE(",");
src32 = decode_rm_long_register(emu, rl);
if(!noop)
*dst32 = *src32;
}
else {
dst16 = decode_rm_word_register(emu, rh);
OP_DECODE(",");
src16 = decode_rm_word_register(emu, rl);
if(!noop)
*dst16 = *src16;
}
}
else {
if(MODE_DATA32) {
dst32 = decode_rm_long_register(emu, rh);
OP_DECODE(",");
addr = decode_rm_address(emu, mod, rl);
if(!noop)
*dst32 = fetch_data_long(emu, addr);
}
else {
dst16 = decode_rm_word_register(emu, rh);
OP_DECODE(",");
addr = decode_rm_address(emu, mod, rl);
if(!noop)
*dst16 = fetch_data_word(emu, addr);
}
}
}
/****************************************************************************
REMARKS:
Handles opcode 0x0f,0x80-0x8F
......@@ -1619,6 +1734,31 @@ static void x86emuOp2_movsx_word_R_RM(x86emu_t *emu, u8 op2)
}
/****************************************************************************
REMARKS:
Handles opcode 0x0f,0xc8-0xcf
****************************************************************************/
static void x86emuOp2_bswap(x86emu_t *emu, u8 op2)
{
u32 *reg32, tmp;
OP_DECODE("bswap ");
if(MODE_DATA32) {
reg32 = decode_rm_long_register(emu, op2 & 0x7);
tmp = 0;
tmp |= (*reg32 >> 24) & 0x000000ff;
tmp |= (*reg32 >> 8) & 0x0000ff00;
tmp |= (*reg32 << 8) & 0x00ff0000;
tmp |= (*reg32 << 24) & 0xff000000;
*reg32 = tmp;
}
else {
/* undefined. Do nothing */
}
}
/***************************************************************************
* Double byte operation code table:
**************************************************************************/
......@@ -1692,22 +1832,22 @@ void (*x86emu_optab2[256])(x86emu_t *emu, u8) =
/* 0x3e */ x86emuOp2_illegal_op,
/* 0x3f */ x86emuOp2_illegal_op,
/* 0x40 */ x86emuOp2_illegal_op,
/* 0x41 */ x86emuOp2_illegal_op,
/* 0x42 */ x86emuOp2_illegal_op,
/* 0x43 */ x86emuOp2_illegal_op,
/* 0x44 */ x86emuOp2_illegal_op,
/* 0x45 */ x86emuOp2_illegal_op,
/* 0x46 */ x86emuOp2_illegal_op,
/* 0x47 */ x86emuOp2_illegal_op,
/* 0x48 */ x86emuOp2_illegal_op,
/* 0x49 */ x86emuOp2_illegal_op,
/* 0x4a */ x86emuOp2_illegal_op,
/* 0x4b */ x86emuOp2_illegal_op,
/* 0x4c */ x86emuOp2_illegal_op,
/* 0x4d */ x86emuOp2_illegal_op,
/* 0x4e */ x86emuOp2_illegal_op,
/* 0x4f */ x86emuOp2_illegal_op,
/* 0x40 */ x86emuOp2_conditional_move,
/* 0x41 */ x86emuOp2_conditional_move,
/* 0x42 */ x86emuOp2_conditional_move,
/* 0x43 */ x86emuOp2_conditional_move,
/* 0x44 */ x86emuOp2_conditional_move,
/* 0x45 */ x86emuOp2_conditional_move,
/* 0x46 */ x86emuOp2_conditional_move,
/* 0x47 */ x86emuOp2_conditional_move,
/* 0x48 */ x86emuOp2_conditional_move,
/* 0x49 */ x86emuOp2_conditional_move,
/* 0x4a */ x86emuOp2_conditional_move,
/* 0x4b */ x86emuOp2_conditional_move,
/* 0x4c */ x86emuOp2_conditional_move,
/* 0x4d */ x86emuOp2_conditional_move,
/* 0x4e */ x86emuOp2_conditional_move,
/* 0x4f */ x86emuOp2_conditional_move,
/* 0x50 */ x86emuOp2_illegal_op,
/* 0x51 */ x86emuOp2_illegal_op,
......@@ -1836,14 +1976,14 @@ void (*x86emu_optab2[256])(x86emu_t *emu, u8) =
/* 0xc5 */ x86emuOp2_illegal_op,
/* 0xc6 */ x86emuOp2_illegal_op,
/* 0xc7 */ x86emuOp2_illegal_op,
/* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */
/* 0xc8 */ x86emuOp2_bswap,
/* 0xc9 */ x86emuOp2_bswap,
/* 0xca */ x86emuOp2_bswap,
/* 0xcb */ x86emuOp2_bswap,
/* 0xcc */ x86emuOp2_bswap,
/* 0xcd */ x86emuOp2_bswap,
/* 0xce */ x86emuOp2_bswap,
/* 0xcf */ x86emuOp2_bswap,
/* 0xd0 */ x86emuOp2_illegal_op,
/* 0xd1 */ x86emuOp2_illegal_op,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment