[CPU] `ResolveFunction()` Fix declaration mismatch

This commit is contained in:
Joel Linn 2021-05-21 01:28:39 +02:00 committed by Rick Gibbed
parent 6d548f51b3
commit fa7f292432
2 changed files with 5 additions and 6 deletions

View File

@ -519,7 +519,7 @@ GuestToHostThunk X64ThunkEmitter::EmitGuestToHostThunk() {
} }
// X64Emitter handles actually resolving functions. // X64Emitter handles actually resolving functions.
extern "C" uint64_t ResolveFunction(void* raw_context, uint32_t target_address); uint64_t ResolveFunction(void* raw_context, uint64_t target_address);
ResolveFunctionThunk X64ThunkEmitter::EmitResolveFunctionThunk() { ResolveFunctionThunk X64ThunkEmitter::EmitResolveFunctionThunk() {
// ebx = target PPC address // ebx = target PPC address
@ -548,7 +548,7 @@ ResolveFunctionThunk X64ThunkEmitter::EmitResolveFunctionThunk() {
mov(rcx, rsi); // context mov(rcx, rsi); // context
mov(rdx, rbx); mov(rdx, rbx);
mov(rax, uint64_t(&ResolveFunction)); mov(rax, reinterpret_cast<uint64_t>(&ResolveFunction));
call(rax); call(rax);
EmitLoadVolatileRegs(); EmitLoadVolatileRegs();

View File

@ -382,15 +382,14 @@ void X64Emitter::UnimplementedInstr(const hir::Instr* i) {
} }
// This is used by the X64ThunkEmitter's ResolveFunctionThunk. // This is used by the X64ThunkEmitter's ResolveFunctionThunk.
extern "C" uint64_t ResolveFunction(void* raw_context, uint64_t ResolveFunction(void* raw_context, uint64_t target_address) {
uint64_t target_address) {
auto thread_state = *reinterpret_cast<ThreadState**>(raw_context); auto thread_state = *reinterpret_cast<ThreadState**>(raw_context);
// TODO(benvanik): required? // TODO(benvanik): required?
assert_not_zero(target_address); assert_not_zero(target_address);
auto fn = auto fn = thread_state->processor()->ResolveFunction(
thread_state->processor()->ResolveFunction((uint32_t)target_address); static_cast<uint32_t>(target_address));
assert_not_null(fn); assert_not_null(fn);
auto x64_fn = static_cast<X64Function*>(fn); auto x64_fn = static_cast<X64Function*>(fn);
uint64_t addr = reinterpret_cast<uint64_t>(x64_fn->machine_code()); uint64_t addr = reinterpret_cast<uint64_t>(x64_fn->machine_code());