mirror of
https://github.com/bitdefender/bddisasm.git
synced 2025-01-03 03:40:54 +00:00
Make sure all flags are set for CMPXCHG (this was left intentionally incomplete).
Make sure we clear upper bits of the 256/512 bit SSE register.
This commit is contained in:
parent
6dda2c122c
commit
bf81c647e3
@ -1145,7 +1145,7 @@ ShemuGetOperandValue(
|
|||||||
|
|
||||||
case ND_REG_SSE:
|
case ND_REG_SSE:
|
||||||
shemu_memcpy(Value->Value.Bytes,
|
shemu_memcpy(Value->Value.Bytes,
|
||||||
&Context->SseRegisters[op->Info.Register.Reg * ND_MAX_REGISTER_SIZE],
|
&Context->SseRegisters[op->Info.Register.Reg],
|
||||||
op->Size);
|
op->Size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1335,7 +1335,10 @@ ShemuSetOperandValue(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ND_REG_SSE:
|
case ND_REG_SSE:
|
||||||
shemu_memcpy(&Context->SseRegisters[op->Info.Register.Reg * ND_MAX_REGISTER_SIZE],
|
// Zero the register first.
|
||||||
|
nd_memzero(&Context->SseRegisters[op->Info.Register.Reg], ND_MAX_REGISTER_SIZE);
|
||||||
|
// Copy the value.
|
||||||
|
shemu_memcpy(&Context->SseRegisters[op->Info.Register.Reg],
|
||||||
Value->Value.Bytes,
|
Value->Value.Bytes,
|
||||||
op->Size);
|
op->Size);
|
||||||
// Only log these when they're written.
|
// Only log these when they're written.
|
||||||
@ -1935,16 +1938,21 @@ ShemuEmulate(
|
|||||||
case ND_INS_CMPXCHG:
|
case ND_INS_CMPXCHG:
|
||||||
GET_OP(Context, 2, &src);
|
GET_OP(Context, 2, &src);
|
||||||
GET_OP(Context, 0, &dst);
|
GET_OP(Context, 0, &dst);
|
||||||
|
|
||||||
|
res.Size = src.Size;
|
||||||
|
// Note: The accumulator is compared with the destination, not the other way around.
|
||||||
|
res.Value.Qwords[0] = src.Value.Qwords[0] - dst.Value.Qwords[0];
|
||||||
|
|
||||||
|
SET_FLAGS(Context, res, src, dst, FM_SUB);
|
||||||
|
|
||||||
if (src.Value.Qwords[0] == dst.Value.Qwords[0])
|
if (src.Value.Qwords[0] == dst.Value.Qwords[0])
|
||||||
{
|
{
|
||||||
GET_OP(Context, 1, &src);
|
GET_OP(Context, 1, &src);
|
||||||
SET_OP(Context, 0, &src);
|
SET_OP(Context, 0, &src);
|
||||||
SET_FLAG(Context, NDR_RFLAG_ZF, 1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SET_OP(Context, 2, &dst);
|
SET_OP(Context, 2, &dst);
|
||||||
SET_FLAG(Context, NDR_RFLAG_ZF, 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Binary file not shown.
@ -12,7 +12,7 @@ from setuptools import find_packages, setup, Command, Extension, Distribution
|
|||||||
from codecs import open
|
from codecs import open
|
||||||
|
|
||||||
VERSION = (0, 1, 3)
|
VERSION = (0, 1, 3)
|
||||||
LIBRARY_VERSION = (1, 34, 16)
|
LIBRARY_VERSION = (1, 34, 17)
|
||||||
LIBRARY_INSTRUX_SIZE = 856
|
LIBRARY_INSTRUX_SIZE = 856
|
||||||
|
|
||||||
packages = ['pybddisasm']
|
packages = ['pybddisasm']
|
||||||
|
@ -129,7 +129,7 @@ typedef struct _SHEMU_CONTEXT
|
|||||||
ND_UINT64 MmxRegisters[ND_MAX_MMX_REGS];
|
ND_UINT64 MmxRegisters[ND_MAX_MMX_REGS];
|
||||||
|
|
||||||
// SSE registers state. 32 x 64 bytes = 2048 bytes for the SSE registers. Can be provided on input, if needed.
|
// SSE registers state. 32 x 64 bytes = 2048 bytes for the SSE registers. Can be provided on input, if needed.
|
||||||
ND_UINT8 SseRegisters[ND_MAX_SSE_REGS * ND_MAX_REGISTER_SIZE];
|
ND_UINT8 SseRegisters[ND_MAX_SSE_REGS][ND_MAX_REGISTER_SIZE];
|
||||||
|
|
||||||
// General purpose registers write bitmap. After the first write, a register will be marked dirty in here.
|
// General purpose registers write bitmap. After the first write, a register will be marked dirty in here.
|
||||||
// Should be 0 on input.
|
// Should be 0 on input.
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
#define DISASM_VERSION_MAJOR 1
|
#define DISASM_VERSION_MAJOR 1
|
||||||
#define DISASM_VERSION_MINOR 34
|
#define DISASM_VERSION_MINOR 34
|
||||||
#define DISASM_VERSION_REVISION 16
|
#define DISASM_VERSION_REVISION 17
|
||||||
|
|
||||||
#endif // DISASM_VER_H
|
#endif // DISASM_VER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user