Skip to content

Commit

Permalink
Disable mvex instruction encoding, nobody uses this
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Jun 18, 2024
1 parent b38d9f2 commit bb4faf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 0 additions & 8 deletions zasm/include/zasm/x86/emitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2086,14 +2086,6 @@ namespace zasm::x86
{
return emit(x86::Mnemonic::Jecxz, a);
}
inline Error jknzd(const Mask& a, const Imm& b)
{
return emit(x86::Mnemonic::Jknzd, a, b);
}
inline Error jkzd(const Mask& a, const Imm& b)
{
return emit(x86::Mnemonic::Jkzd, a, b);
}
inline Error jl(const Imm& a)
{
return emit(x86::Mnemonic::Jl, a);
Expand Down
9 changes: 9 additions & 0 deletions zasm/src/zasm/src/encoder/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ namespace zasm

static constexpr std::int32_t kHintRequiresSize = -1;

static constexpr auto kAllowedEncodingX86 = static_cast<ZydisEncodableEncoding>(
ZYDIS_ENCODABLE_ENCODING_LEGACY | ZYDIS_ENCODABLE_ENCODING_3DNOW);

static constexpr auto kAllowedEncodingX64 = static_cast<ZydisEncodableEncoding>(
ZYDIS_ENCODABLE_ENCODING_LEGACY | ZYDIS_ENCODABLE_ENCODING_3DNOW | ZYDIS_ENCODABLE_ENCODING_XOP
| ZYDIS_ENCODABLE_ENCODING_VEX | ZYDIS_ENCODABLE_ENCODING_EVEX);

struct EncodeVariantsInfo
{
bool isControlFlow{};
Expand Down Expand Up @@ -532,10 +539,12 @@ namespace zasm
if (mode == MachineMode::AMD64)
{
req.machine_mode = ZYDIS_MACHINE_MODE_LONG_64;
req.allowed_encodings = kAllowedEncodingX64;
}
else if (mode == MachineMode::I386)
{
req.machine_mode = ZYDIS_MACHINE_MODE_LONG_COMPAT_32;
req.allowed_encodings = kAllowedEncodingX86;
}
req.mnemonic = static_cast<ZydisMnemonic>(mnemonic.value());
req.prefixes = getAttribs(attribs);
Expand Down

0 comments on commit bb4faf9

Please sign in to comment.