Logging undefined extern calls.
This commit is contained in:
parent
f4d0eb03bc
commit
68b5a0979e
|
@ -103,6 +103,12 @@ void Dummy() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UndefinedCallExtern(void* raw_context, FunctionInfo* symbol_info) {
|
||||||
|
XELOGW("undefined extern call to %.8X %s",
|
||||||
|
symbol_info->address(),
|
||||||
|
symbol_info->name());
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t DynamicRegisterLoad(void* raw_context, uint32_t address) {
|
uint64_t DynamicRegisterLoad(void* raw_context, uint32_t address) {
|
||||||
auto thread_state = *((ThreadState**)raw_context);
|
auto thread_state = *((ThreadState**)raw_context);
|
||||||
auto cbs = thread_state->runtime()->access_callbacks();
|
auto cbs = thread_state->runtime()->access_callbacks();
|
||||||
|
@ -339,14 +345,18 @@ table->AddSequence(OPCODE_CALL_INDIRECT_TRUE, [](X64Emitter& e, Instr*& i) {
|
||||||
table->AddSequence(OPCODE_CALL_EXTERN, [](X64Emitter& e, Instr*& i) {
|
table->AddSequence(OPCODE_CALL_EXTERN, [](X64Emitter& e, Instr*& i) {
|
||||||
auto symbol_info = i->src1.symbol_info;
|
auto symbol_info = i->src1.symbol_info;
|
||||||
XEASSERT(symbol_info->behavior() == FunctionInfo::BEHAVIOR_EXTERN);
|
XEASSERT(symbol_info->behavior() == FunctionInfo::BEHAVIOR_EXTERN);
|
||||||
XEASSERTNOTNULL(symbol_info->extern_handler());
|
if (!symbol_info->extern_handler()) {
|
||||||
// rdx = target host function
|
e.mov(e.rdx, (uint64_t)symbol_info);
|
||||||
// r8 = arg0
|
CallNative(e, UndefinedCallExtern);
|
||||||
// r9 = arg1
|
} else {
|
||||||
e.mov(e.rdx, (uint64_t)symbol_info->extern_handler());
|
// rdx = target host function
|
||||||
e.mov(e.r8, (uint64_t)symbol_info->extern_arg0());
|
// r8 = arg0
|
||||||
e.mov(e.r9, (uint64_t)symbol_info->extern_arg1());
|
// r9 = arg1
|
||||||
TransitionToHost(e);
|
e.mov(e.rdx, (uint64_t)symbol_info->extern_handler());
|
||||||
|
e.mov(e.r8, (uint64_t)symbol_info->extern_arg0());
|
||||||
|
e.mov(e.r9, (uint64_t)symbol_info->extern_arg1());
|
||||||
|
TransitionToHost(e);
|
||||||
|
}
|
||||||
i = e.Advance(i);
|
i = e.Advance(i);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue