Commit 577759ea authored by swift_gan's avatar swift_gan Committed by swift_gan

fix BR

parent 45832ece
...@@ -5,6 +5,7 @@ import android.app.Application; ...@@ -5,6 +5,7 @@ import android.app.Application;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
import com.swift.sandhook.nativehook.NativeHook;
import com.swift.sandhook.test.TestClass; import com.swift.sandhook.test.TestClass;
import com.swift.sandhook.testHookers.ActivityHooker; import com.swift.sandhook.testHookers.ActivityHooker;
import com.swift.sandhook.testHookers.CtrHook; import com.swift.sandhook.testHookers.CtrHook;
...@@ -29,6 +30,8 @@ public class MyApp extends Application { ...@@ -29,6 +30,8 @@ public class MyApp extends Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
NativeHook.test();
SandHookConfig.DEBUG = BuildConfig.DEBUG; SandHookConfig.DEBUG = BuildConfig.DEBUG;
if (testAndroidQ) { if (testAndroidQ) {
......
...@@ -309,12 +309,12 @@ A64_LDR_LIT::A64_LDR_LIT(A64_LDR_LIT::OP op, RegisterA64 &rt, Label& label) : op ...@@ -309,12 +309,12 @@ A64_LDR_LIT::A64_LDR_LIT(A64_LDR_LIT::OP op, RegisterA64 &rt, Label& label) : op
} }
Off A64_LDR_LIT::getImmPCOffset() { Off A64_LDR_LIT::getImmPCOffset() {
return signExtend64(19 + 2, COMBINE(get()->imm19, 0b00, 2)); return DECODE_OFFSET(19, 2);
} }
void A64_LDR_LIT::onOffsetApply(Off offset) { void A64_LDR_LIT::onOffsetApply(Off offset) {
this->offset = offset; this->offset = offset;
get()->imm19 = TruncateToUint19(offset >> 2); ENCODE_OFFSET(19, 2);
} }
void A64_LDR_LIT::decode(STRUCT_A64(LDR_LIT) *inst) { void A64_LDR_LIT::decode(STRUCT_A64(LDR_LIT) *inst) {
...@@ -331,7 +331,7 @@ void A64_LDR_LIT::assembler() { ...@@ -331,7 +331,7 @@ void A64_LDR_LIT::assembler() {
SET_OPCODE(LDR_LIT); SET_OPCODE(LDR_LIT);
get()->rt = rt->getCode(); get()->rt = rt->getCode();
get()->op = op; get()->op = op;
get()->imm19 = TruncateToUint19(offset >> 2); ENCODE_OFFSET(19, 2);
} }
...@@ -352,6 +352,7 @@ void A64_BR_BLR_RET::decode(A64_STRUCT_BR_BLR_RET *inst) { ...@@ -352,6 +352,7 @@ void A64_BR_BLR_RET::decode(A64_STRUCT_BR_BLR_RET *inst) {
void A64_BR_BLR_RET::assembler() { void A64_BR_BLR_RET::assembler() {
SET_OPCODE_MULTI(BR_BLR_RET, 1); SET_OPCODE_MULTI(BR_BLR_RET, 1);
SET_OPCODE_MULTI(BR_BLR_RET, 2); SET_OPCODE_MULTI(BR_BLR_RET, 2);
SET_OPCODE_MULTI(BR_BLR_RET, 3);
ENCODE_RN; ENCODE_RN;
ENCODE_OP; ENCODE_OP;
} }
......
package com.swift.sandhook.nativehook;
/**
* @author Swift Gan
* Create: 2019/5/10
* Desc:
*/
public class NativeHook {
static {
System.loadLibrary("sandhook-native");
}
public static void dosth() {}
public static native void test();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment