mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-31 18:46:08 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f8ccdb00f2 | |||
| 050af0bc51 | |||
| e322e34148 | |||
| 804c1dcfaf | |||
| 5edb9d37ef | |||
| d918efbea5 | |||
| 2e9d97aa82 | |||
| 403cc0ab66 |
@@ -25,13 +25,14 @@
|
||||
#include "common/container/unordered_map.h"
|
||||
#include "common/container/unordered_set.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
#define XBYAK_NO_EXCEPTION 1
|
||||
#define XBYAK_STD_UNORDERED_SET ::Common::unordered_set
|
||||
#define XBYAK_STD_UNORDERED_MAP ::Common::unordered_map
|
||||
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
|
||||
#include <xbyak/xbyak.h>
|
||||
#include <xbyak/xbyak_util.h>
|
||||
|
||||
#include <xbyak/xbyak.h>
|
||||
|
||||
namespace Common::X64 {
|
||||
|
||||
constexpr size_t RegToIndex(const Xbyak::Reg& reg) {
|
||||
|
||||
@@ -95,6 +95,7 @@ else()
|
||||
-pedantic
|
||||
-Wno-missing-braces
|
||||
-fno-rtti
|
||||
#-fno-exceptions
|
||||
)
|
||||
if (CXX_GCC)
|
||||
# GCC produces bogus -Warray-bounds warnings from xbyak headers for code paths that are not
|
||||
@@ -112,11 +113,6 @@ else()
|
||||
# Clang mistakenly blames CMake for using unused arguments during compilation
|
||||
list(APPEND DYNARMIC_CXX_FLAGS -Wno-unused-command-line-argument)
|
||||
endif()
|
||||
# TODO: oaknut exceptions
|
||||
# TODO: fix chromeOS
|
||||
if ("x86_64" IN_LIST ARCHITECTURE AND NOT ANDROID)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS -fno-exceptions)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT Boost_FOUND)
|
||||
|
||||
@@ -76,57 +76,34 @@ void ProtectMemory(const void* base, size_t size, bool is_executable) {
|
||||
}
|
||||
#endif
|
||||
|
||||
HostFeature GetHostFeatures() {
|
||||
HostFeature features = {};
|
||||
static const HostFeature features = []() {
|
||||
HostFeature f{};
|
||||
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
||||
using Cpu = Xbyak::util::Cpu;
|
||||
Xbyak::util::Cpu cpu_info{};
|
||||
if (cpu_info.has(Cpu::tSSSE3))
|
||||
features |= HostFeature::SSSE3;
|
||||
if (cpu_info.has(Cpu::tSSE41))
|
||||
features |= HostFeature::SSE41;
|
||||
if (cpu_info.has(Cpu::tSSE42))
|
||||
features |= HostFeature::SSE42;
|
||||
if (cpu_info.has(Cpu::tAVX))
|
||||
features |= HostFeature::AVX;
|
||||
if (cpu_info.has(Cpu::tAVX2))
|
||||
features |= HostFeature::AVX2;
|
||||
if (cpu_info.has(Cpu::tAVX512F))
|
||||
features |= HostFeature::AVX512F;
|
||||
if (cpu_info.has(Cpu::tAVX512CD))
|
||||
features |= HostFeature::AVX512CD;
|
||||
if (cpu_info.has(Cpu::tAVX512VL))
|
||||
features |= HostFeature::AVX512VL;
|
||||
if (cpu_info.has(Cpu::tAVX512BW))
|
||||
features |= HostFeature::AVX512BW;
|
||||
if (cpu_info.has(Cpu::tAVX512DQ))
|
||||
features |= HostFeature::AVX512DQ;
|
||||
if (cpu_info.has(Cpu::tAVX512_BITALG))
|
||||
features |= HostFeature::AVX512BITALG;
|
||||
if (cpu_info.has(Cpu::tAVX512VBMI))
|
||||
features |= HostFeature::AVX512VBMI;
|
||||
if (cpu_info.has(Cpu::tPCLMULQDQ))
|
||||
features |= HostFeature::PCLMULQDQ;
|
||||
if (cpu_info.has(Cpu::tF16C))
|
||||
features |= HostFeature::F16C;
|
||||
if (cpu_info.has(Cpu::tFMA))
|
||||
features |= HostFeature::FMA;
|
||||
if (cpu_info.has(Cpu::tAESNI))
|
||||
features |= HostFeature::AES;
|
||||
if (cpu_info.has(Cpu::tSHA))
|
||||
features |= HostFeature::SHA;
|
||||
if (cpu_info.has(Cpu::tPOPCNT))
|
||||
features |= HostFeature::POPCNT;
|
||||
if (cpu_info.has(Cpu::tBMI1))
|
||||
features |= HostFeature::BMI1;
|
||||
if (cpu_info.has(Cpu::tBMI2))
|
||||
features |= HostFeature::BMI2;
|
||||
if (cpu_info.has(Cpu::tLZCNT))
|
||||
features |= HostFeature::LZCNT;
|
||||
if (cpu_info.has(Cpu::tGFNI))
|
||||
features |= HostFeature::GFNI;
|
||||
if (cpu_info.has(Cpu::tWAITPKG))
|
||||
features |= HostFeature::WAITPKG;
|
||||
if (cpu_info.has(Cpu::tSSSE3)) f |= HostFeature::SSSE3;
|
||||
if (cpu_info.has(Cpu::tSSE41)) f |= HostFeature::SSE41;
|
||||
if (cpu_info.has(Cpu::tSSE42)) f |= HostFeature::SSE42;
|
||||
if (cpu_info.has(Cpu::tAVX)) f |= HostFeature::AVX;
|
||||
if (cpu_info.has(Cpu::tAVX2)) f |= HostFeature::AVX2;
|
||||
if (cpu_info.has(Cpu::tAVX512F)) f |= HostFeature::AVX512F;
|
||||
if (cpu_info.has(Cpu::tAVX512CD)) f |= HostFeature::AVX512CD;
|
||||
if (cpu_info.has(Cpu::tAVX512VL)) f |= HostFeature::AVX512VL;
|
||||
if (cpu_info.has(Cpu::tAVX512BW)) f |= HostFeature::AVX512BW;
|
||||
if (cpu_info.has(Cpu::tAVX512DQ)) f |= HostFeature::AVX512DQ;
|
||||
if (cpu_info.has(Cpu::tAVX512_BITALG)) f |= HostFeature::AVX512BITALG;
|
||||
if (cpu_info.has(Cpu::tAVX512VBMI)) f |= HostFeature::AVX512VBMI;
|
||||
if (cpu_info.has(Cpu::tPCLMULQDQ)) f |= HostFeature::PCLMULQDQ;
|
||||
if (cpu_info.has(Cpu::tF16C)) f |= HostFeature::F16C;
|
||||
if (cpu_info.has(Cpu::tFMA)) f |= HostFeature::FMA;
|
||||
if (cpu_info.has(Cpu::tAESNI)) f |= HostFeature::AES;
|
||||
if (cpu_info.has(Cpu::tSHA)) f |= HostFeature::SHA;
|
||||
if (cpu_info.has(Cpu::tPOPCNT)) f |= HostFeature::POPCNT;
|
||||
if (cpu_info.has(Cpu::tBMI1)) f |= HostFeature::BMI1;
|
||||
if (cpu_info.has(Cpu::tBMI2)) f |= HostFeature::BMI2;
|
||||
if (cpu_info.has(Cpu::tLZCNT)) f |= HostFeature::LZCNT;
|
||||
if (cpu_info.has(Cpu::tGFNI)) f |= HostFeature::GFNI;
|
||||
if (cpu_info.has(Cpu::tWAITPKG)) f |= HostFeature::WAITPKG;
|
||||
if (cpu_info.has(Cpu::tBMI2)) {
|
||||
// BMI2 instructions such as pdep and pext have been very slow up until Zen 3.
|
||||
// Check for Zen 3 or newer by its family (0x19).
|
||||
@@ -138,12 +115,15 @@ HostFeature GetHostFeatures() {
|
||||
const u32 family_extended = mcl::bit::get_bits<20, 27>(data[0]);
|
||||
const u32 family = family_base + family_extended;
|
||||
if (family >= 0x19)
|
||||
features |= HostFeature::FastBMI2;
|
||||
f |= HostFeature::FastBMI2;
|
||||
} else {
|
||||
features |= HostFeature::FastBMI2;
|
||||
f |= HostFeature::FastBMI2;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
#endif
|
||||
}();
|
||||
HostFeature GetHostFeatures() {
|
||||
return features;
|
||||
}
|
||||
|
||||
@@ -465,8 +445,13 @@ size_t BlockOfCode::GetTotalCodeSize() const {
|
||||
}
|
||||
|
||||
void* BlockOfCode::AllocateFromCodeSpace(size_t alloc_size) {
|
||||
ASSERT(size_ + alloc_size < maxSize_);
|
||||
if (size_ + alloc_size >= maxSize_) {
|
||||
using Xbyak::Error;
|
||||
XBYAK_THROW(Xbyak::ERR_CODE_IS_TOO_BIG);
|
||||
}
|
||||
|
||||
EnsureMemoryCommitted(alloc_size);
|
||||
|
||||
void* ret = getCurr<void*>();
|
||||
size_ += alloc_size;
|
||||
memset(ret, 0, alloc_size);
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "common/container/unordered_map.h"
|
||||
#include "common/container/unordered_set.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
#define XBYAK_NO_EXCEPTION 1
|
||||
#define XBYAK_STD_UNORDERED_SET ::Common::unordered_set
|
||||
#define XBYAK_STD_UNORDERED_MAP ::Common::unordered_map
|
||||
#define XBYAK_STD_UNORDERED_MULTIMAP boost::unordered_multimap
|
||||
|
||||
Reference in New Issue
Block a user