2013-01-20 09:13:59 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* 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. *
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef XENIA_CPU_PROCESSOR_H_
|
|
|
|
#define XENIA_CPU_PROCESSOR_H_
|
|
|
|
|
|
|
|
#include <xenia/core.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2013-04-21 19:34:20 +00:00
|
|
|
#include <xenia/cpu/backend.h>
|
2013-01-20 09:13:59 +00:00
|
|
|
#include <xenia/cpu/exec_module.h>
|
2013-01-28 01:49:32 +00:00
|
|
|
#include <xenia/cpu/thread_state.h>
|
2013-05-21 22:36:58 +00:00
|
|
|
#include <xenia/cpu/sdb/symbol_table.h>
|
2013-01-20 09:13:59 +00:00
|
|
|
#include <xenia/kernel/export.h>
|
2013-01-31 06:44:32 +00:00
|
|
|
#include <xenia/kernel/xex2.h>
|
2013-01-20 09:13:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace xe {
|
|
|
|
namespace cpu {
|
|
|
|
|
2013-04-21 19:34:20 +00:00
|
|
|
class JIT;
|
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
|
|
|
|
class Processor {
|
|
|
|
public:
|
2013-04-21 19:34:20 +00:00
|
|
|
Processor(xe_memory_ref memory, shared_ptr<Backend> backend);
|
2013-01-20 09:13:59 +00:00
|
|
|
~Processor();
|
|
|
|
|
|
|
|
xe_memory_ref memory();
|
2013-04-21 19:34:20 +00:00
|
|
|
shared_ptr<kernel::ExportResolver> export_resolver();
|
|
|
|
void set_export_resolver(shared_ptr<kernel::ExportResolver> export_resolver);
|
2013-01-20 09:13:59 +00:00
|
|
|
|
|
|
|
int Setup();
|
|
|
|
|
2013-04-21 19:34:20 +00:00
|
|
|
int LoadRawBinary(const xechar_t* path, uint32_t start_address);
|
|
|
|
int LoadXexModule(const char* name, const char* path, xe_xex2_ref xex);
|
2013-01-20 09:13:59 +00:00
|
|
|
|
|
|
|
uint32_t CreateCallback(void (*callback)(void* data), void* data);
|
|
|
|
|
2013-01-31 06:44:32 +00:00
|
|
|
ThreadState* AllocThread(uint32_t stack_size, uint32_t thread_state_address);
|
2013-01-28 01:49:32 +00:00
|
|
|
void DeallocThread(ThreadState* thread_state);
|
|
|
|
int Execute(ThreadState* thread_state, uint32_t address);
|
2013-01-31 06:44:32 +00:00
|
|
|
uint64_t Execute(ThreadState* thread_state, uint32_t address, uint64_t arg0);
|
2013-05-26 03:32:58 +00:00
|
|
|
sdb::FunctionSymbol* GetFunction(uint32_t address);
|
|
|
|
void* GetFunctionPointer(uint32_t address);
|
2013-01-28 01:49:32 +00:00
|
|
|
|
2013-01-20 09:13:59 +00:00
|
|
|
private:
|
2013-04-21 19:34:20 +00:00
|
|
|
xe_memory_ref memory_;
|
|
|
|
shared_ptr<Backend> backend_;
|
|
|
|
shared_ptr<kernel::ExportResolver> export_resolver_;
|
2013-01-21 22:31:59 +00:00
|
|
|
|
2013-05-21 22:36:58 +00:00
|
|
|
sdb::SymbolTable* sym_table_;
|
|
|
|
JIT* jit_;
|
2013-01-20 09:13:59 +00:00
|
|
|
std::vector<ExecModule*> modules_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace cpu
|
|
|
|
} // namespace xe
|
|
|
|
|
|
|
|
|
|
|
|
#endif // XENIA_CPU_PROCESSOR_H_
|