Properly using XapiThreadStartup routines, if present.
This commit is contained in:
parent
8d5e877a03
commit
39ef8d8263
|
@ -234,6 +234,17 @@ uint64_t Processor::Execute(ThreadState* thread_state, uint32_t address,
|
||||||
return ppc_state->r[3];
|
return ppc_state->r[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t Processor::Execute(ThreadState* thread_state, uint32_t address,
|
||||||
|
uint64_t arg0, uint64_t arg1) {
|
||||||
|
xe_ppc_state_t* ppc_state = thread_state->ppc_state();
|
||||||
|
ppc_state->r[3] = arg0;
|
||||||
|
ppc_state->r[4] = arg1;
|
||||||
|
if (Execute(thread_state, address)) {
|
||||||
|
return 0xDEADBABE;
|
||||||
|
}
|
||||||
|
return ppc_state->r[3];
|
||||||
|
}
|
||||||
|
|
||||||
FunctionSymbol* Processor::GetFunction(uint32_t address) {
|
FunctionSymbol* Processor::GetFunction(uint32_t address) {
|
||||||
// Attempt to grab the function symbol from the global lookup table.
|
// Attempt to grab the function symbol from the global lookup table.
|
||||||
FunctionSymbol* fn_symbol = sym_table_->GetFunction(address);
|
FunctionSymbol* fn_symbol = sym_table_->GetFunction(address);
|
||||||
|
|
|
@ -58,6 +58,8 @@ public:
|
||||||
void DeallocThread(ThreadState* thread_state);
|
void DeallocThread(ThreadState* thread_state);
|
||||||
int Execute(ThreadState* thread_state, uint32_t address);
|
int Execute(ThreadState* thread_state, uint32_t address);
|
||||||
uint64_t Execute(ThreadState* thread_state, uint32_t address, uint64_t arg0);
|
uint64_t Execute(ThreadState* thread_state, uint32_t address, uint64_t arg0);
|
||||||
|
uint64_t Execute(ThreadState* thread_state, uint32_t address,
|
||||||
|
uint64_t arg0, uint64_t arg1);
|
||||||
sdb::FunctionSymbol* GetFunction(uint32_t address);
|
sdb::FunctionSymbol* GetFunction(uint32_t address);
|
||||||
void* GetFunctionPointer(uint32_t address);
|
void* GetFunctionPointer(uint32_t address);
|
||||||
|
|
||||||
|
|
|
@ -254,17 +254,20 @@ X_STATUS XThread::PlatformExit(int exit_code) {
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
void XThread::Execute() {
|
void XThread::Execute() {
|
||||||
// Run XapiThreadStartup first, if present.
|
// If a XapiThreadStartup value is present, we use that as a trampoline.
|
||||||
|
// Otherwise, we are a raw thread.
|
||||||
if (creation_params_.xapi_thread_startup) {
|
if (creation_params_.xapi_thread_startup) {
|
||||||
XELOGE("xapi_thread_startup not implemented");
|
kernel_state()->processor()->Execute(
|
||||||
}
|
thread_state_,
|
||||||
|
creation_params_.xapi_thread_startup,
|
||||||
|
creation_params_.start_address, creation_params_.start_context);
|
||||||
|
} else {
|
||||||
// Run user code.
|
// Run user code.
|
||||||
int exit_code = (int)kernel_state()->processor()->Execute(
|
int exit_code = (int)kernel_state()->processor()->Execute(
|
||||||
thread_state_,
|
thread_state_,
|
||||||
creation_params_.start_address, creation_params_.start_context);
|
creation_params_.start_address, creation_params_.start_context);
|
||||||
|
|
||||||
// If we got here it means the execute completed without an exit being called.
|
// If we got here it means the execute completed without an exit being called.
|
||||||
// Treat the return code as an implicit exit code.
|
// Treat the return code as an implicit exit code.
|
||||||
Exit(exit_code);
|
Exit(exit_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue