Commit d09bebd0 authored by swift_gan's avatar swift_gan Committed by swift_gan

[NativeHook]fix arm32 break point

parent 770e1992
......@@ -78,17 +78,13 @@ bool InlineHookArm32Android::breakPoint(void *origin, void (*callback)(REG *)) {
StaticCodeBuffer inlineBuffer = StaticCodeBuffer(reinterpret_cast<Addr>(originCode));
AssemblerA32 assemblerInline(&inlineBuffer);
CodeContainer* codeContainerInline = &assemblerInline.codeContainer;
//build backup method
CodeRelocateA32 relocate = CodeRelocateA32(assemblerBackup);
backup = relocate.relocate(origin, 4 * 2, nullptr);
#define __ assemblerBackup.
Label* origin_addr_label = new Label();
__ Ldr(PC, origin_addr_label);
__ Emit(origin_addr_label);
__ Emit((Addr) getThumbPC(reinterpret_cast<void *>((Addr)originCode + relocate.curOffset)));
__ Mov(IP ,(Addr) getThumbPC(reinterpret_cast<void *>((Addr)originCode + relocate.curOffset)));
__ Bx(IP);
__ finish();
#undef __
......
......@@ -13,7 +13,7 @@
#define DECODE_OFFSET(bits, ext) signExtend32(bits + ext, COMBINE(get()->imm##bits, 0, ext))
#define ENCODE_OFFSET(bits, ext) get()->imm##bits = TruncateToUint##bits(offset >> ext)
#define CODE_OFFSET(I) I->offset + I->instType() == A32 ? 2 * 4 : 2 * 2
#define CODE_OFFSET(I) I->offset + (I->instType() == A32 ? 2 * 4 : 2 * 2)
using namespace SandHook::RegistersA32;
......
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