xenia-cpu-ppc-tests is now building on linux

This commit is contained in:
DrChat
2017-02-10 23:54:10 -06:00
parent 11ae05155d
commit d43e2c7ff8
21 changed files with 471 additions and 51 deletions

View File

@@ -15,14 +15,13 @@ namespace xe {
namespace cpu {
namespace backend {
Backend::Backend(Processor* processor)
: processor_(processor), code_cache_(nullptr) {
std::memset(&machine_info_, 0, sizeof(machine_info_));
}
Backend::Backend() { std::memset(&machine_info_, 0, sizeof(machine_info_)); }
Backend::~Backend() = default;
bool Backend::Initialize() { return true; }
bool Backend::Initialize(Processor* processor) {
processor_ = processor;
return true;
}
void* Backend::AllocThreadData() { return nullptr; }

View File

@@ -34,14 +34,14 @@ class CodeCache;
class Backend {
public:
explicit Backend(Processor* processor);
explicit Backend();
virtual ~Backend();
Processor* processor() const { return processor_; }
const MachineInfo* machine_info() const { return &machine_info_; }
CodeCache* code_cache() const { return code_cache_; }
virtual bool Initialize();
virtual bool Initialize(Processor* processor);
virtual void* AllocThreadData();
virtual void FreeThreadData(void* thread_data);
@@ -65,9 +65,9 @@ class Backend {
virtual void UninstallBreakpoint(Breakpoint* breakpoint) {}
protected:
Processor* processor_;
Processor* processor_ = nullptr;
MachineInfo machine_info_;
CodeCache* code_cache_;
CodeCache* code_cache_ = nullptr;
};
} // namespace backend

View File

@@ -42,8 +42,7 @@ class X64ThunkEmitter : public X64Emitter {
ResolveFunctionThunk EmitResolveFunctionThunk();
};
X64Backend::X64Backend(Processor* processor)
: Backend(processor), code_cache_(nullptr) {
X64Backend::X64Backend() : Backend(), code_cache_(nullptr) {
if (cs_open(CS_ARCH_X86, CS_MODE_64, &capstone_handle_) != CS_ERR_OK) {
assert_always("Failed to initialize capstone");
}
@@ -61,8 +60,8 @@ X64Backend::~X64Backend() {
ExceptionHandler::Uninstall(&ExceptionCallbackThunk, this);
}
bool X64Backend::Initialize() {
if (!Backend::Initialize()) {
bool X64Backend::Initialize(Processor* processor) {
if (!Backend::Initialize(processor)) {
return false;
}

View File

@@ -38,7 +38,7 @@ class X64Backend : public Backend {
public:
static const uint32_t kForceReturnAddress = 0x9FFF0000u;
explicit X64Backend(Processor* processor);
explicit X64Backend();
~X64Backend() override;
X64CodeCache* code_cache() const { return code_cache_.get(); }
@@ -53,7 +53,7 @@ class X64Backend : public Backend {
return resolve_function_thunk_;
}
bool Initialize() override;
bool Initialize(Processor* processor) override;
void CommitExecutableRange(uint32_t guest_low, uint32_t guest_high) override;

View File

@@ -0,0 +1,51 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2017 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/cpu/backend/x64/x64_code_cache.h"
namespace xe {
namespace cpu {
namespace backend {
namespace x64 {
class PosixX64CodeCache : public X64CodeCache {
public:
PosixX64CodeCache();
~PosixX64CodeCache() override;
bool Initialize() override;
void* LookupUnwindInfo(uint64_t host_pc) override { return nullptr; }
private:
/*
UnwindReservation RequestUnwindReservation(uint8_t* entry_address) override;
void PlaceCode(uint32_t guest_address, void* machine_code, size_t code_size,
size_t stack_size, void* code_address,
UnwindReservation unwind_reservation) override;
void InitializeUnwindEntry(uint8_t* unwind_entry_address,
size_t unwind_table_slot, void* code_address,
size_t code_size, size_t stack_size);
*/
};
std::unique_ptr<X64CodeCache> X64CodeCache::Create() {
return std::make_unique<PosixX64CodeCache>();
}
PosixX64CodeCache::PosixX64CodeCache() = default;
PosixX64CodeCache::~PosixX64CodeCache() = default;
bool PosixX64CodeCache::Initialize() { return X64CodeCache::Initialize(); }
} // namespace x64
} // namespace backend
} // namespace cpu
} // namespace xe