Browse Source

force ankerl + fixup for OO with prelude commits

eden-orbis-ps4
lizzie 4 weeks ago
parent
commit
e8f76fb018
  1. 21
      .patch/xbyak/0001-macro-stl.patch
  2. 21
      .patch/xbyak_sun/0001-macro-stl.patch
  3. 2
      src/core/arm/dynarmic/arm_dynarmic_32.cpp
  4. 2
      src/core/arm/dynarmic/arm_dynarmic_64.cpp
  5. 29
      src/dynarmic/src/dynarmic/backend/x64/block_of_code.cpp

21
.patch/xbyak/0001-macro-stl.patch

@ -0,0 +1,21 @@
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h
index ed7706a..51b520d 100644
--- a/xbyak/xbyak.h
+++ b/xbyak/xbyak.h
@@ -37,6 +37,7 @@
#define XBYAK_GNUC_PREREQ(major, minor) 0
#endif
+#if !defined(XBYAK_STD_UNORDERED_SET)
// This covers -std=(gnu|c)++(0x|11|1y), -stdlib=libc++, and modern Microsoft.
#if ((defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_LIBCPP_VERSION) ||\
((__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)))
@@ -71,6 +72,8 @@
#define XBYAK_STD_UNORDERED_MAP std::map
#define XBYAK_STD_UNORDERED_MULTIMAP std::multimap
#endif
+#endif
+
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN

21
.patch/xbyak_sun/0001-macro-stl.patch

@ -0,0 +1,21 @@
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h
index ed7706a..51b520d 100644
--- a/xbyak/xbyak.h
+++ b/xbyak/xbyak.h
@@ -37,6 +37,7 @@
#define XBYAK_GNUC_PREREQ(major, minor) 0
#endif
+#if !defined(XBYAK_STD_UNORDERED_SET)
// This covers -std=(gnu|c)++(0x|11|1y), -stdlib=libc++, and modern Microsoft.
#if ((defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_LIBCPP_VERSION) ||\
((__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)))
@@ -71,6 +72,8 @@
#define XBYAK_STD_UNORDERED_MAP std::map
#define XBYAK_STD_UNORDERED_MULTIMAP std::multimap
#endif
+#endif
+
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN

2
src/core/arm/dynarmic/arm_dynarmic_32.cpp

@ -203,7 +203,7 @@ void ArmDynarmic32::MakeJit(Common::PageTable* page_table) {
// Code cache size
#if defined(__OPENORBIS__)
config.code_cache_size = std::uint32_t(8_MiB);
config.code_cache_size = std::uint32_t(32_MiB);
#elif defined(ARCHITECTURE_arm64) || defined(__sun__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
config.code_cache_size = std::uint32_t(128_MiB);
#else

2
src/core/arm/dynarmic/arm_dynarmic_64.cpp

@ -255,7 +255,7 @@ void ArmDynarmic64::MakeJit(Common::PageTable* page_table, std::size_t address_s
// Code cache size
#if defined(__OPENORBIS__)
config.code_cache_size = std::uint32_t(8_MiB);
config.code_cache_size = std::uint32_t(32_MiB);
#elif defined(ARCHITECTURE_arm64) || defined(__sun__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
config.code_cache_size = std::uint32_t(128_MiB);
#else

29
src/dynarmic/src/dynarmic/backend/x64/block_of_code.cpp

@ -58,8 +58,13 @@ const std::array<Xbyak::Reg64, ABI_PARAM_COUNT> BlockOfCode::ABI_PARAMS = {Block
namespace {
#ifdef __OPENORBIS__
constexpr size_t CONSTANT_POOL_SIZE = 8 * 4096;
constexpr size_t PRELUDE_COMMIT_SIZE = 8 * 4096;
#else
constexpr size_t CONSTANT_POOL_SIZE = 2 * 1024 * 1024;
constexpr size_t PRELUDE_COMMIT_SIZE = 16 * 1024 * 1024;
#endif
class CustomXbyakAllocator : public Xbyak::Allocator {
public:
@ -67,8 +72,12 @@ public:
uint8_t* alloc(size_t size) override {
void* p = VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
if (p == nullptr) {
#ifndef XBYAK_NO_EXCEPTION
using Xbyak::Error;
XBYAK_THROW(Xbyak::ERR_CANT_ALLOC);
#else
std::abort();
#endif
}
return static_cast<uint8_t*>(p);
}
@ -106,8 +115,12 @@ public:
#endif
void* p = mmap(nullptr, size, prot, mode, -1, 0);
if (p == MAP_FAILED) {
#ifndef XBYAK_NO_EXCEPTION
using Xbyak::Error;
XBYAK_THROW(Xbyak::ERR_CANT_ALLOC);
#else
std::abort();
#endif
}
std::memcpy(p, &size, sizeof(size_t));
return static_cast<uint8_t*>(p) + DYNARMIC_PAGE_SIZE;
@ -233,14 +246,14 @@ bool IsUnderRosetta() {
} // anonymous namespace
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
static const auto default_cg_mode = Xbyak::DontSetProtectRWE;
BlockOfCode::BlockOfCode(RunCodeCallbacks cb, JitStateInfo jsi, size_t total_code_size, std::function<void(BlockOfCode&)> rcp) noexcept
#ifdef __OPENORBIS__
: Xbyak::CodeGenerator(total_code_size, Xbyak::AutoGrow, &s_allocator)
#elif defined(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT)
: Xbyak::CodeGenerator(total_code_size, Xbyak::DontSetProtectRWE, &s_allocator)
#else
static const auto default_cg_mode = nullptr; //Allow RWE
: Xbyak::CodeGenerator(total_code_size, nullptr, &s_allocator)
#endif
BlockOfCode::BlockOfCode(RunCodeCallbacks cb, JitStateInfo jsi, size_t total_code_size, std::function<void(BlockOfCode&)> rcp) noexcept
: Xbyak::CodeGenerator(total_code_size, default_cg_mode, &s_allocator)
, cb(std::move(cb))
, jsi(jsi)
, constant_pool(*this, CONSTANT_POOL_SIZE)
@ -533,8 +546,12 @@ size_t BlockOfCode::GetTotalCodeSize() const {
void* BlockOfCode::AllocateFromCodeSpace(size_t alloc_size) {
if (size_ + alloc_size >= maxSize_) {
#ifndef XBYAK_NO_EXCEPTION
using Xbyak::Error;
XBYAK_THROW(Xbyak::ERR_CODE_IS_TOO_BIG);
#else
std::abort();
#endif
}
EnsureMemoryCommitted(alloc_size);

Loading…
Cancel
Save