Moving alloy/ into xenia/cpu/ to start simplifying things.
This commit is contained in:
52
src/xenia/cpu/backend/x64/x64_function.cc
Normal file
52
src/xenia/cpu/backend/x64/x64_function.cc
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/runtime/runtime.h"
|
||||
#include "xenia/cpu/runtime/thread_state.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
using xe::cpu::runtime::Breakpoint;
|
||||
using xe::cpu::runtime::Function;
|
||||
using xe::cpu::runtime::FunctionInfo;
|
||||
using xe::cpu::runtime::ThreadState;
|
||||
|
||||
X64Function::X64Function(FunctionInfo* symbol_info)
|
||||
: Function(symbol_info), machine_code_(nullptr), code_size_(0) {}
|
||||
|
||||
X64Function::~X64Function() {
|
||||
// machine_code_ is freed by code cache.
|
||||
}
|
||||
|
||||
void X64Function::Setup(void* machine_code, size_t code_size) {
|
||||
machine_code_ = machine_code;
|
||||
code_size_ = code_size;
|
||||
}
|
||||
|
||||
int X64Function::AddBreakpointImpl(Breakpoint* breakpoint) { return 0; }
|
||||
|
||||
int X64Function::RemoveBreakpointImpl(Breakpoint* breakpoint) { return 0; }
|
||||
|
||||
int X64Function::CallImpl(ThreadState* thread_state, uint64_t return_address) {
|
||||
auto backend = (X64Backend*)thread_state->runtime()->backend();
|
||||
auto thunk = backend->host_to_guest_thunk();
|
||||
thunk(machine_code_, thread_state->raw_context(), (void*)return_address);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace x64
|
||||
} // namespace backend
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
Reference in New Issue
Block a user