Broken, incomplete, but need to move forward with rewrite.

This commit is contained in:
Ben Vanik
2013-04-21 12:34:20 -07:00
parent 4987147055
commit b018b6fe56
51 changed files with 3455 additions and 2397 deletions

View File

@@ -13,68 +13,46 @@
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/cpu/function_table.h>
#include <xenia/cpu/sdb.h>
#include <xenia/kernel/export.h>
#include <xenia/kernel/xex2.h>
namespace llvm {
class ExecutionEngine;
class Function;
class LLVMContext;
class Module;
}
namespace xe {
namespace cpu {
namespace codegen {
class ModuleGenerator;
}
}
}
namespace xe {
namespace cpu {
typedef std::tr1::unordered_map<uint32_t, llvm::Function*> FunctionMap;
class ExecModule {
public:
ExecModule(
xe_memory_ref memory, shared_ptr<kernel::ExportResolver> export_resolver,
const char* module_name, const char* module_path,
shared_ptr<llvm::ExecutionEngine>& engine);
FunctionTable* fn_table,
const char* module_name, const char* module_path);
~ExecModule();
int PrepareXex(xe_xex2_ref xex);
int PrepareRawBinary(uint32_t start_address, uint32_t end_address);
sdb::SymbolDatabase* sdb();
void AddFunctionsToMap(FunctionMap& map);
int PrepareRawBinary(uint32_t start_address, uint32_t end_address);
int PrepareXexModule(xe_xex2_ref xex);
sdb::FunctionSymbol* FindFunctionSymbol(uint32_t address);
void Dump();
private:
int Prepare();
int InjectGlobals();
int Init();
int Uninit();
xe_memory_ref memory_;
shared_ptr<kernel::ExportResolver> export_resolver_;
FunctionTable* fn_table_;
char* module_name_;
char* module_path_;
shared_ptr<llvm::ExecutionEngine> engine_;
shared_ptr<sdb::SymbolDatabase> sdb_;
shared_ptr<llvm::LLVMContext> context_;
shared_ptr<llvm::Module> gen_module_;
auto_ptr<codegen::ModuleGenerator> codegen_;
shared_ptr<sdb::SymbolDatabase> sdb_;
uint32_t code_addr_low_;
uint32_t code_addr_high_;
FunctionMap fns_;
};