Very basic, super slow, nasty indirection.

This commit is contained in:
Ben Vanik
2013-05-25 20:32:58 -07:00
parent 2986a0be82
commit 4073028188
11 changed files with 113 additions and 63 deletions

View File

@@ -138,23 +138,32 @@ int X64JIT::UninitModule(ExecModule* module) {
return 0;
}
int X64JIT::Execute(xe_ppc_state_t* ppc_state, FunctionSymbol* fn_symbol) {
XELOGCPU("Execute(%.8X): %s...", fn_symbol->start_address, fn_symbol->name());
void* X64JIT::GetFunctionPointer(sdb::FunctionSymbol* fn_symbol) {
// Check function.
x64_function_t fn_ptr = (x64_function_t)fn_symbol->impl_value;
if (!fn_ptr) {
// Function hasn't been prepped yet - make it now inline.
// The emitter will lock and do other fancy things, if required.
if (emitter_->PrepareFunction(fn_symbol)) {
XELOGCPU("Execute(%.8X): unable to make function %s",
fn_symbol->start_address, fn_symbol->name());
return 1;
return NULL;
}
fn_ptr = (x64_function_t)fn_symbol->impl_value;
XEASSERTNOTNULL(fn_ptr);
}
return fn_ptr;
}
int X64JIT::Execute(xe_ppc_state_t* ppc_state, FunctionSymbol* fn_symbol) {
XELOGCPU("Execute(%.8X): %s...", fn_symbol->start_address, fn_symbol->name());
x64_function_t fn_ptr = (x64_function_t)GetFunctionPointer(fn_symbol);
if (!fn_ptr) {
XELOGCPU("Execute(%.8X): unable to make function %s",
fn_symbol->start_address, fn_symbol->name());
return 1;
}
// Call into the function. This will compile it if needed.
fn_ptr(ppc_state, ppc_state->lr);