mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-19 03:27:00 +02:00
skip exception handler register on PS4 and use xbyak::inner:getpagesize
This commit is contained in:
parent
676417849e
commit
8f34f3064c
3 changed files with 12 additions and 9 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dynarmic/backend/x64/block_of_code.h"
|
#include "dynarmic/backend/x64/block_of_code.h"
|
||||||
|
#include "xbyak/xbyak.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
|
@ -83,13 +84,12 @@ public:
|
||||||
|
|
||||||
bool useProtect() const override { return false; }
|
bool useProtect() const override { return false; }
|
||||||
#else
|
#else
|
||||||
static constexpr size_t DYNARMIC_PAGE_SIZE = 4096;
|
|
||||||
|
|
||||||
// Can't subclass Xbyak::MmapAllocator because it is not a pure interface
|
// Can't subclass Xbyak::MmapAllocator because it is not a pure interface
|
||||||
// and doesn't expose its construtor
|
// and doesn't expose its construtor
|
||||||
uint8_t* alloc(size_t size) override {
|
uint8_t* alloc(size_t size) override {
|
||||||
|
auto const page_size = Xbyak::inner::getPageSize();
|
||||||
// Waste a page to store the size
|
// Waste a page to store the size
|
||||||
size += DYNARMIC_PAGE_SIZE;
|
size += page_size;
|
||||||
|
|
||||||
int mode = MAP_PRIVATE;
|
int mode = MAP_PRIVATE;
|
||||||
#if defined(MAP_ANONYMOUS)
|
#if defined(MAP_ANONYMOUS)
|
||||||
|
|
@ -118,13 +118,14 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
std::memcpy(p, &size, sizeof(size_t));
|
std::memcpy(p, &size, sizeof(size_t));
|
||||||
return static_cast<uint8_t*>(p) + DYNARMIC_PAGE_SIZE;
|
return static_cast<uint8_t*>(p) + page_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free(uint8_t* p) override {
|
void free(uint8_t* p) override {
|
||||||
|
auto const page_size = Xbyak::inner::getPageSize();
|
||||||
size_t size;
|
size_t size;
|
||||||
std::memcpy(&size, p - DYNARMIC_PAGE_SIZE, sizeof(size_t));
|
std::memcpy(&size, p - page_size, sizeof(size_t));
|
||||||
munmap(p - DYNARMIC_PAGE_SIZE, size);
|
munmap(p - page_size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
# ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,10 @@ EmitContext::EmitContext(RegAlloc& reg_alloc, IR::Block& block, boost::container
|
||||||
|
|
||||||
EmitContext::~EmitContext() = default;
|
EmitContext::~EmitContext() = default;
|
||||||
|
|
||||||
EmitX64::EmitX64(BlockOfCode& code)
|
EmitX64::EmitX64(BlockOfCode& code) : code(code) {
|
||||||
: code(code) {
|
#ifndef __OPENORBIS__
|
||||||
exception_handler.Register(code);
|
exception_handler.Register(code);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitX64::~EmitX64() = default;
|
EmitX64::~EmitX64() = default;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "dynarmic/backend/x64/abi.h"
|
#include "dynarmic/backend/x64/abi.h"
|
||||||
#include "dynarmic/backend/x64/hostloc.h"
|
#include "dynarmic/backend/x64/hostloc.h"
|
||||||
#include "dynarmic/common/spin_lock.h"
|
#include "dynarmic/common/spin_lock.h"
|
||||||
|
#include "xbyak/xbyak.h"
|
||||||
|
|
||||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
||||||
static const auto default_cg_mode = Xbyak::DontSetProtectRWE;
|
static const auto default_cg_mode = Xbyak::DontSetProtectRWE;
|
||||||
|
|
@ -70,7 +71,7 @@ namespace {
|
||||||
struct SpinLockImpl {
|
struct SpinLockImpl {
|
||||||
void Initialize() noexcept;
|
void Initialize() noexcept;
|
||||||
static void GlobalInitialize() noexcept;
|
static void GlobalInitialize() noexcept;
|
||||||
Xbyak::CodeGenerator code = Xbyak::CodeGenerator(4096, default_cg_mode);
|
Xbyak::CodeGenerator code = Xbyak::CodeGenerator(Xbyak::inner::getPageSize(), default_cg_mode);
|
||||||
void (*lock)(volatile int*) = nullptr;
|
void (*lock)(volatile int*) = nullptr;
|
||||||
void (*unlock)(volatile int*) = nullptr;
|
void (*unlock)(volatile int*) = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue