Adjusting stack padding on executes.

This commit is contained in:
Ben Vanik 2015-05-17 13:35:12 -07:00
parent b44a7a7730
commit 3f7da258fc
2 changed files with 6 additions and 6 deletions

View File

@ -331,16 +331,20 @@ bool Processor::Execute(ThreadState* thread_state, uint32_t address) {
PPCContext* context = thread_state->context(); PPCContext* context = thread_state->context();
// Setup registers. // Pad out stack a bit, as some games seem to overwrite the caller by about
uint64_t previous_lr = context->lr; // 16 to 32b.
context->r[1] -= 64 + 112;
// This could be set to anything to give us a unique identifier to track // This could be set to anything to give us a unique identifier to track
// re-entrancy/etc. // re-entrancy/etc.
uint64_t previous_lr = context->lr;
context->lr = 0xBEBEBEBE; context->lr = 0xBEBEBEBE;
// Execute the function. // Execute the function.
auto result = fn->Call(thread_state, uint32_t(context->lr)); auto result = fn->Call(thread_state, uint32_t(context->lr));
context->lr = previous_lr; context->lr = previous_lr;
context->r[1] += 64 + 112;
return result; return result;
} }

View File

@ -103,10 +103,6 @@ ThreadState::ThreadState(Processor* processor, uint32_t thread_id,
context_->r[1] = stack_base_; context_->r[1] = stack_base_;
context_->r[13] = pcr_address_; context_->r[13] = pcr_address_;
// Pad out stack a bit, as some games seem to overwrite the caller by about
// 16 to 32b.
context_->r[1] -= 64;
processor_->debugger()->OnThreadCreated(this); processor_->debugger()->OnThreadCreated(this);
} }