mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-21 20:29:29 +08:00
23 lines
631 B
C++
23 lines
631 B
C++
|
|
#include "dobby/dobby_internal.h"
|
||
|
|
#include "InterceptRouting/Routing/FunctionInlineHook/FunctionInlineHookRouting.h"
|
||
|
|
|
||
|
|
void FunctionInlineHookRouting::BuildRouting() {
|
||
|
|
SetTrampolineTarget((addr_t)replace_func);
|
||
|
|
|
||
|
|
// generate trampoline buffer, run before GenerateRelocatedCode
|
||
|
|
addr_t from = entry_->patched_addr;
|
||
|
|
#if defined(TARGET_ARCH_ARM)
|
||
|
|
if (entry_->thumb_mode)
|
||
|
|
from += 1;
|
||
|
|
#endif
|
||
|
|
addr_t to = GetTrampolineTarget();
|
||
|
|
GenerateTrampolineBuffer(from, to);
|
||
|
|
}
|
||
|
|
|
||
|
|
void FunctionInlineHookRouting::DispatchRouting() {
|
||
|
|
BuildRouting();
|
||
|
|
|
||
|
|
// generate relocated code which size == trampoline size
|
||
|
|
GenerateRelocatedCode();
|
||
|
|
}
|