Increase hook cap to prevent frequent memory allocating
This commit is contained in:
parent
de1dd6cdcf
commit
b13c9ba98d
|
|
@ -9,13 +9,11 @@
|
|||
#include "HookMain.h"
|
||||
|
||||
int SDKVersion;
|
||||
static int OFFSET_entry_point_from_interpreter_in_ArtMethod;
|
||||
static int OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod;
|
||||
static int OFFSET_ArtMehod_in_Object;
|
||||
static int OFFSET_access_flags_in_ArtMethod;
|
||||
static uint32_t kAccNative = 0x0100;
|
||||
static uint32_t OFFSET_entry_point_from_interpreter_in_ArtMethod;
|
||||
static uint32_t OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod;
|
||||
static uint32_t OFFSET_ArtMehod_in_Object;
|
||||
static uint32_t OFFSET_access_flags_in_ArtMethod;
|
||||
static uint32_t kAccCompileDontBother = 0x01000000;
|
||||
static uint32_t kAccFastInterpreterToInterpreterInvoke = 0x40000000;
|
||||
|
||||
static jfieldID fieldArtMethod = NULL;
|
||||
|
||||
|
|
@ -32,7 +30,6 @@ static inline void *readAddr(void *addr) {
|
|||
}
|
||||
|
||||
void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVersion) {
|
||||
int i;
|
||||
SDKVersion = sdkVersion;
|
||||
jclass classExecutable;
|
||||
LOGI("init to SDK %d", sdkVersion);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ int doInitHookCap(unsigned int cap);
|
|||
void setupTrampoline(uint8_t offset);
|
||||
void *genTrampoline(void *toMethod, void *entrypoint);
|
||||
|
||||
#define DEFAULT_CAP 1 //size of each trampoline area would be no more than 4k Bytes(one page)
|
||||
#define DEFAULT_CAP 4 //size of each trampoline area would be no more than 4k Bytes(one page)
|
||||
|
||||
#endif //YAHFA_TAMPOLINE_H
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace art {
|
|||
CREATE_HOOK_STUB_ENTRIES(const void*, GetSavedEntryPointOfPreCompiledMethod, void *thiz,
|
||||
void *art_method) {
|
||||
if (UNLIKELY(edxp::isHooked(art_method))) {
|
||||
LOGD("Found hooked method, return entrypoint as jit entrypoint");
|
||||
LOGD("Found hooked method %p, return entrypoint as jit entrypoint", art_method);
|
||||
return getEntryPoint(art_method);
|
||||
}
|
||||
return GetSavedEntryPointOfPreCompiledMethodBackup(thiz, art_method);
|
||||
|
|
|
|||
Loading…
Reference in New Issue