Make filter check for SSE4a
This commit is contained in:
parent
96afa3d8ee
commit
4f6fe82936
|
@ -5,6 +5,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <Zydis/Zydis.h>
|
#include <Zydis/Zydis.h>
|
||||||
#include <xbyak/xbyak.h>
|
#include <xbyak/xbyak.h>
|
||||||
|
#include <xbyak/xbyak_util.h>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/tls.h"
|
#include "core/tls.h"
|
||||||
|
@ -289,9 +290,9 @@ static bool FilterTcbAccess(const ZydisDecodedOperand* operands) {
|
||||||
dst_op.reg.value <= ZYDIS_REGISTER_R15;
|
dst_op.reg.value <= ZYDIS_REGISTER_R15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For instructions that always need to be patched
|
static bool FilterNoSSE4a(const ZydisDecodedOperand*) {
|
||||||
static bool FilterAlwaysTrue(const ZydisDecodedOperand*) {
|
Xbyak::util::Cpu cpu;
|
||||||
return true;
|
return !cpu.has(Xbyak::util::Cpu::tSSE4a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GenerateTcbAccess(const ZydisDecodedOperand* operands, Xbyak::CodeGenerator& c) {
|
static void GenerateTcbAccess(const ZydisDecodedOperand* operands, Xbyak::CodeGenerator& c) {
|
||||||
|
@ -483,7 +484,7 @@ static const std::unordered_map<ZydisMnemonic, PatchInfo> Patches = {
|
||||||
{ZYDIS_MNEMONIC_MOV, {FilterTcbAccess, GenerateTcbAccess, false}},
|
{ZYDIS_MNEMONIC_MOV, {FilterTcbAccess, GenerateTcbAccess, false}},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ZYDIS_MNEMONIC_INSERTQ, {FilterAlwaysTrue, GenerateINSERTQ, true}},
|
{ZYDIS_MNEMONIC_INSERTQ, {FilterNoSSE4a, GenerateINSERTQ, true}},
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// BMI1 instructions that are not supported by Rosetta 2 on Apple Silicon.
|
// BMI1 instructions that are not supported by Rosetta 2 on Apple Silicon.
|
||||||
|
|
Loading…
Reference in New Issue