Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
35ac9abc
Commit
35ac9abc
authored
Jan 22, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arm32 trampoline demo
parent
cef1dcc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
4 deletions
+33
-4
arm32.S
app/src/main/cpp/trampoline/arch/arm32.S
+29
-4
trampoline.h
app/src/main/cpp/trampoline/trampoline.h
+4
-0
No files found.
app/src/main/cpp/trampoline/arch/arm32.S
View file @
35ac9abc
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#define Reg0 r12
#define Reg0 r12
//need restore
//need restore
#define Reg1
x
11
#define Reg1
r
11
#define RegMethod r0
#define RegMethod r0
FUNCTION_START(REPLACEMENT_HOOK_TRAMPOLINE)
FUNCTION_START(REPLACEMENT_HOOK_TRAMPOLINE)
...
@@ -19,7 +19,7 @@ offset_entry_code:
...
@@ -19,7 +19,7 @@ offset_entry_code:
FUNCTION_END(REPLACEMENT_HOOK_TRAMPOLINE)
FUNCTION_END(REPLACEMENT_HOOK_TRAMPOLINE)
#define SIZE_JUMP 0x8
#define SIZE_JUMP
#
0x8
FUNCTION_START(DIRECT_JUMP_TRAMPOLINE)
FUNCTION_START(DIRECT_JUMP_TRAMPOLINE)
ldr pc, addr_target
ldr pc, addr_target
addr_target:
addr_target:
...
@@ -29,13 +29,38 @@ FUNCTION_END(DIRECT_JUMP_TRAMPOLINE)
...
@@ -29,13 +29,38 @@ FUNCTION_END(DIRECT_JUMP_TRAMPOLINE)
FUNCTION_START(INLINE_HOOK_TRAMPOLINE)
FUNCTION_START(INLINE_HOOK_TRAMPOLINE)
ldr Reg0, addr_origin_art_method
cmp RegMethod, Reg0
bne origin_code
ldr RegMethod, addr_hook_art_method
ldr Reg0, offset_entry_code2
add Reg0, RegMethod, Reg0
ldr pc, [Reg0]
origin_code:
.long 0
.long 0
ldr Reg0, addr_origin_art_method
ldr Reg1, offset_entry_code2
add Reg1, Reg0, Reg1
ldr Reg1, [Reg1]
add pc, Reg1, SIZE_JUMP
addr_origin_art_method:
.long 0
offset_entry_code2:
.long 0
addr_hook_art_method:
.long 0
FUNCTION_END(INLINE_HOOK_TRAMPOLINE)
FUNCTION_END(INLINE_HOOK_TRAMPOLINE)
FUNCTION_START(CALL_ORIGIN_TRAMPOLINE)
FUNCTION_START(CALL_ORIGIN_TRAMPOLINE)
ldr RegMethod, origin_art_method
ldr pc, addr_origin
origin_art_method:
.long 0
addr_origin:
.long 0
FUNCTION_END(CALL_ORIGIN_TRAMPOLINE)
FUNCTION_END(CALL_ORIGIN_TRAMPOLINE)
#endif
#endif
\ No newline at end of file
app/src/main/cpp/trampoline/trampoline.h
View file @
35ac9abc
...
@@ -53,6 +53,10 @@
...
@@ -53,6 +53,10 @@
#define OFFSET_INLINE_ORIGIN_CODE 4 * 12
#define OFFSET_INLINE_ORIGIN_CODE 4 * 12
#define OFFSET_INLINE_OFFSET_ENTRY_CODE 4 * 20
#define OFFSET_INLINE_OFFSET_ENTRY_CODE 4 * 20
#define OFFSET_INLINE_ADDR_HOOK_METHOD 4 * 22
#define OFFSET_INLINE_ADDR_HOOK_METHOD 4 * 22
#define SIZE_CALL_ORIGIN_TRAMPOLINE 4 * 7
#define OFFSET_CALL_ORIGIN_ART_METHOD 4 * 3
#define OFFSET_CALL_ORIGIN_JUMP_ADDR 4 * 5
#elif defined(__aarch64__)
#elif defined(__aarch64__)
#define SIZE_REPLACEMENT_HOOK_TRAMPOLINE 4 * 9
#define SIZE_REPLACEMENT_HOOK_TRAMPOLINE 4 * 9
#define OFFSET_REPLACEMENT_ADDR_ART_METHOD 4 * 5
#define OFFSET_REPLACEMENT_ADDR_ART_METHOD 4 * 5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment