32 #include "codegen.hpp"
34 #define DEBUG_NAME "Patcher"
38 LOG2(
"Patcher ctor" <<
nl);
42 LOG2(
"Patcher dtor" <<
nl);
46 return "UnknownPatcher";
53 OS <<
" pc:0x" << (
void*)
get_mpc();
55 #if 0 && defined(ENABLE_DISASSEMBLER)
91 uint32_t mcode = *((uint32_t*)
pr.
mpc);
93 #if PATCHER_CALL_SIZE == 4
95 #elif PATCHER_CALL_SIZE == 2
96 if ((uint16_t) mcode != (uint16_t)
pr.
mcode) {
98 #error Unknown PATCHER_CALL_SIZE
124 #ifdef ENABLE_VERIFIER
139 { NULL,
"-UNKNOWN PATCHER FUNCTION-" }
147 for (l = patcher_function_list; l->
patcher != NULL; l++)
152 return "UnknownLegacyPatcher(NoDebugBuild)";
159 #if PATCHER_CALL_SIZE == 4
160 OS <<
" mcode:" << (uint32_t)
pr.
mcode;
162 OS <<
" mcode:" << (uint16_t)
pr.
mcode;
164 # error Unknown PATCHER_CALL_SIZE
166 OS <<
" datap:" << (
void*)
pr.
datap;
167 OS <<
" ref:0x" << (uintptr_t)
pr.
ref;
#define PATCHER_resolve_classref_to_flags
#define PATCHER_invokeinterface
u1 * disassinstr(u1 *code)
virtual bool patch_impl()
This function performs the patching.
#define PATCHER_resolve_classref_to_vftbl
virtual const char * get_name() const
print patcher information
virtual OStream & print(OStream &OS) const
print patcher information
#define PATCHER_CALL_SIZE
#define PATCHER_get_putfield
#define PATCHER_resolve_class
#define PATCHER_breakpoint
virtual void emit()
Generates the code for the patcher traps.
#define PATCHER_get_putstatic
virtual uintptr_t get_mpc() const =0
get the absolute position in code segment
void(* functionptr)(void)
virtual bool check_is_patched() const
struct patcher_function_list_t patcher_function_list_t
patcher_function_list
#define PATCHER_instanceof_interface
#define PATCHER_resolve_native_function
Simple stream class for formatted output.
virtual OStream & print(OStream &OS) const
print patcher information
void emit_trap(codegendata *cd, u1 Xd, int type)
virtual const char * get_name() const
print patcher information
bool initialize_class(classinfo *c)
#define PATCHER_checkcast_interface
#define PATCHER_invokestatic_special
bool is_patched() const
Check already patched.
#define PATCHER_invokevirtual
virtual bool check_is_patched() const
Check if the patcher is already patched.
#define PATCHER_initialize_class
#define PATCHER_resolve_classref_to_classinfo
static patcher_function_list_t patcher_function_list[]