Fixed 8-bit XCHG instruction on the 64-bit old recompiler when both source and destination are a high 8-bit register (AH, CH, BH, or DH), fixes the longstanding Chicago 58s bug.
This commit is contained in:
@@ -297,33 +297,26 @@ static inline void STORE_REG_TARGET_B_RELEASE(int host_reg, int guest_reg)
|
||||
addbyte(0x44);
|
||||
addbyte(0x89);
|
||||
addbyte(0xc0 | ((host_reg & 3) << 3));
|
||||
if (host_reg & 0x10)
|
||||
{
|
||||
addbyte(0x66); /*AND AX, 0xff00*/
|
||||
addbyte(0x25);
|
||||
addword(0xff00);
|
||||
}
|
||||
else
|
||||
{
|
||||
addbyte(0x66); /*SHL AX, 8*/
|
||||
addbyte(0xc1);
|
||||
addbyte(0xe0);
|
||||
addbyte(0x08);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (host_reg)
|
||||
{
|
||||
addbyte(0x66); /*MOV AX, host_reg*/
|
||||
addbyte(0x89);
|
||||
addbyte(0xc0 | ((host_reg & 3) << 3));
|
||||
}
|
||||
addbyte(0x66); /*SHL AX, 8*/
|
||||
addbyte(0xc1);
|
||||
addbyte(0xe0);
|
||||
addbyte(0x08);
|
||||
else if (host_reg & 3)
|
||||
{
|
||||
addbyte(0x66); /*MOV AX, host_reg*/
|
||||
addbyte(0x89);
|
||||
addbyte(0xc0 | ((host_reg & 3) << 3));
|
||||
}
|
||||
if (host_reg & 0x10)
|
||||
{
|
||||
addbyte(0x66); /*AND AX, 0xff00*/
|
||||
addbyte(0x25);
|
||||
addword(0xff00);
|
||||
}
|
||||
else
|
||||
{
|
||||
addbyte(0x66); /*SHL AX, 8*/
|
||||
addbyte(0xc1);
|
||||
addbyte(0xe0);
|
||||
addbyte(0x08);
|
||||
}
|
||||
addbyte(0x66); /*AND dest_reg, 0x00ff*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x81);
|
||||
|
@@ -44,9 +44,6 @@ OP_XCHG_EAX_(EBP)
|
||||
|
||||
static uint32_t ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
/* #ifdef __amd64__
|
||||
return 0;
|
||||
#else */
|
||||
int src_reg, dst_reg, temp_reg;
|
||||
|
||||
if ((fetchdat & 0xc0) != 0xc0)
|
||||
@@ -59,7 +56,6 @@ static uint32_t ropXCHG_b(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin
|
||||
STORE_REG_TARGET_B_RELEASE(temp_reg, fetchdat & 7);
|
||||
|
||||
return op_pc + 1;
|
||||
/* #endif */
|
||||
}
|
||||
static uint32_t ropXCHG_w(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
|
Reference in New Issue
Block a user