decode: Fix LOCK handling for MOV CR/DR
This commit is contained in:
4
decode.c
4
decode.c
@@ -334,7 +334,7 @@ prefix_end:
|
|||||||
op_modrm->type = FD_OT_REG;
|
op_modrm->type = FD_OT_REG;
|
||||||
op_modrm->reg = modrm | (prefix_rex & PREFIX_REXB ? 8 : 0);
|
op_modrm->reg = modrm | (prefix_rex & PREFIX_REXB ? 8 : 0);
|
||||||
op_modrm->misc = FD_RT_GPL;
|
op_modrm->misc = FD_RT_GPL;
|
||||||
goto op_sizes;
|
goto skip_modrm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNLIKELY(DESC_HAS_IMPLICIT(desc)))
|
if (UNLIKELY(DESC_HAS_IMPLICIT(desc)))
|
||||||
@@ -425,6 +425,7 @@ prefix_end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
skip_modrm:
|
||||||
|
|
||||||
if (UNLIKELY(DESC_HAS_VEXREG(desc)))
|
if (UNLIKELY(DESC_HAS_VEXREG(desc)))
|
||||||
{
|
{
|
||||||
@@ -564,7 +565,6 @@ prefix_end:
|
|||||||
instr->flags |= FD_FLAG_LOCK;
|
instr->flags |= FD_FLAG_LOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
op_sizes:;
|
|
||||||
uint8_t operand_sizes[4] = {
|
uint8_t operand_sizes[4] = {
|
||||||
1 << DESC_SIZE_FIX1(desc) >> 1, 1 << DESC_SIZE_FIX2(desc), op_size, vec_size
|
1 << DESC_SIZE_FIX1(desc) >> 1, 1 << DESC_SIZE_FIX2(desc), op_size, vec_size
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ main(int argc, char** argv)
|
|||||||
TEST64("\x48\x0f\x20\xd0", "mov rax, cr2"); // cr2 + REX.W
|
TEST64("\x48\x0f\x20\xd0", "mov rax, cr2"); // cr2 + REX.W
|
||||||
TEST64("\x44\x0f\x20\x08", "UD"); // cr9
|
TEST64("\x44\x0f\x20\x08", "UD"); // cr9
|
||||||
TEST64("\x44\x0f\x21\x00", "UD"); // dr8
|
TEST64("\x44\x0f\x21\x00", "UD"); // dr8
|
||||||
|
TEST32("\xf0\x0f\x20\x00", "UD"); // LOCK
|
||||||
TEST("\x8c\xc0", "mov ax, es");
|
TEST("\x8c\xc0", "mov ax, es");
|
||||||
TEST64("\x44\x8c\xc0", "mov ax, es");
|
TEST64("\x44\x8c\xc0", "mov ax, es");
|
||||||
TEST64("\x44\x8c\xf0", "UD"); // no segment register 6
|
TEST64("\x44\x8c\xf0", "UD"); // no segment register 6
|
||||||
|
|||||||
Reference in New Issue
Block a user