mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 05:29:53 +00:00
x86: recognize xrelease lock
This commit is contained in:
parent
a1796341cb
commit
f3ca9a28b9
2
MCInst.c
2
MCInst.c
@ -33,7 +33,7 @@ void MCInst_Init(MCInst *inst)
|
||||
inst->popcode_adjust = 0;
|
||||
inst->assembly[0] = '\0';
|
||||
inst->wasm_data.type = WASM_OP_INVALID;
|
||||
inst->xAcquireRelease = false;
|
||||
inst->xAcquireRelease = 0;
|
||||
}
|
||||
|
||||
void MCInst_clear(MCInst *inst)
|
||||
|
2
MCInst.h
2
MCInst.h
@ -116,7 +116,7 @@ struct MCInst {
|
||||
unsigned char evm_data[32]; // for EVM PUSH operand
|
||||
cs_wasm_op wasm_data; // for WASM operand
|
||||
MCRegisterInfo *MRI;
|
||||
bool xAcquireRelease; // X86 xacquire/xrelease
|
||||
uint8_t xAcquireRelease; // X86 xacquire/xrelease
|
||||
};
|
||||
|
||||
void MCInst_Init(MCInst *inst);
|
||||
|
@ -470,10 +470,11 @@ static int readPrefixes(struct InternalInstruction* insn)
|
||||
*/
|
||||
if (((nextByte == 0xf0) ||
|
||||
((nextByte & 0xfe) == 0x86 || (nextByte & 0xf8) == 0x90))) {
|
||||
insn->xAcquireRelease = true;
|
||||
insn->xAcquireRelease = byte;
|
||||
|
||||
if (!(byte == 0xf3 && nextByte == 0x90) && // PAUSE instruction support
|
||||
!(byte == 0xf2 && nextByte == 0xf0))
|
||||
!(byte == 0xf2 && nextByte == 0xf0) && // xacquire
|
||||
!(byte == 0xf3 && nextByte == 0xf0)) // xrelease
|
||||
break;
|
||||
}
|
||||
|
||||
@ -485,7 +486,8 @@ static int readPrefixes(struct InternalInstruction* insn)
|
||||
*/
|
||||
if (byte == 0xf3 && (nextByte == 0x88 || nextByte == 0x89 ||
|
||||
nextByte == 0xc6 || nextByte == 0xc7)) {
|
||||
insn->xAcquireRelease = true;
|
||||
insn->xAcquireRelease = byte;
|
||||
|
||||
if (nextByte != 0x90) // PAUSE instruction support
|
||||
break;
|
||||
}
|
||||
|
@ -586,8 +586,8 @@ typedef struct InternalInstruction {
|
||||
uint8_t RC;
|
||||
|
||||
uint8_t numImmediatesConsumed;
|
||||
/* true if the prefix byte, 0xf2 or 0xf3 is xacquire or xrelease */
|
||||
bool xAcquireRelease;
|
||||
/* 0xf2 or 0xf3 is xacquire or xrelease */
|
||||
uint8_t xAcquireRelease;
|
||||
|
||||
// Address-size override
|
||||
bool hasAdSize;
|
||||
|
@ -1835,8 +1835,10 @@ bool X86_lockrep(MCInst *MI, SStream *O)
|
||||
break;
|
||||
case 0xf0:
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (MI->xAcquireRelease)
|
||||
if (MI->xAcquireRelease == 0xf2)
|
||||
SStream_concat(O, "xacquire|lock|");
|
||||
else if (MI->xAcquireRelease == 0xf3)
|
||||
SStream_concat(O, "xrelease|lock|");
|
||||
else
|
||||
SStream_concat(O, "lock|");
|
||||
#endif
|
||||
|
@ -1,3 +1,7 @@
|
||||
!# issue X86 xrelease
|
||||
!# CS_ARCH_X86, CS_MODE_64, None
|
||||
0xf3,0xf0,0x31,0x1f == xrelease lock xor dword ptr [rdi], ebx
|
||||
|
||||
!# issue 1477 X86 xacquire
|
||||
!# CS_ARCH_X86, CS_MODE_64, None
|
||||
0xf2,0xf0,0x31,0x1f == xacquire lock xor dword ptr [rdi], ebx
|
||||
|
Loading…
Reference in New Issue
Block a user