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
1ca0a145
Commit
1ca0a145
authored
May 25, 2019
by
swift_gan
Committed by
swift_gan
May 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NativeHook]fix LR store
parent
7012c124
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
2 deletions
+16
-2
assembler_arm32.cpp
...rc/main/cpp/archs/arm/arm32/assembler/assembler_arm32.cpp
+4
-0
assembler_arm32.h
.../src/main/cpp/archs/arm/arm32/assembler/assembler_arm32.h
+1
-0
code_relocate_arm32.cpp
...main/cpp/archs/arm/arm32/relocate/code_relocate_arm32.cpp
+6
-1
code_relocate_arm64.cpp
...main/cpp/archs/arm/arm64/relocate/code_relocate_arm64.cpp
+5
-1
No files found.
nativehook/src/main/cpp/archs/arm/arm32/assembler/assembler_arm32.cpp
View file @
1ca0a145
...
...
@@ -34,6 +34,10 @@ void AssemblerA32::Emit(U32 data32) {
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
Data32
(
data32
)));
}
void
AssemblerA32
::
Emit
(
U16
data16
)
{
Emit
(
reinterpret_cast
<
Unit
<
Base
>*>
(
new
Data16
(
data16
)));
}
void
AssemblerA32
::
Emit
(
Unit
<
Base
>
*
unit
)
{
codeContainer
.
append
(
unit
);
}
...
...
nativehook/src/main/cpp/archs/arm/arm32/assembler/assembler_arm32.h
View file @
1ca0a145
...
...
@@ -25,6 +25,7 @@ namespace SandHook {
void
*
finish
();
void
Emit
(
U32
data32
);
void
Emit
(
U16
data16
);
void
Emit
(
Unit
<
Base
>*
unit
);
...
...
nativehook/src/main/cpp/archs/arm/arm32/relocate/code_relocate_arm32.cpp
View file @
1ca0a145
...
...
@@ -213,7 +213,12 @@ IMPL_RELOCATE(T32, B32) {
if
(
inst
->
x
==
T32_B32
::
thumb
)
{
//Thumb mode
if
(
inst
->
op
==
T32_B32
::
BL
)
{
__
Mov
(
LR
,
U32
((
Addr
)
toPc
+
inst
->
size
()
+
2
*
2
));
Addr
lr
=
reinterpret_cast
<
Addr
>
(
toPc
);
lr
+=
2
*
2
;
// 2级流水线
lr
+=
2
*
4
;
// Mov + Movt 长度
lr
+=
4
;
// Ldr Lit 长度
lr
+=
4
;
// targetAddr 长度
__
Mov
(
LR
,
lr
);
}
targetAddr
=
reinterpret_cast
<
Addr
>
(
getThumbPC
(
reinterpret_cast
<
void
*>
(
targetAddr
)));
Label
*
target_label
=
new
Label
();
...
...
nativehook/src/main/cpp/archs/arm/arm64/relocate/code_relocate_arm64.cpp
View file @
1ca0a145
...
...
@@ -85,7 +85,11 @@ IMPL_RELOCATE(B_BL) {
Addr
targetAddr
=
inst
->
getImmPCOffsetTarget
();
if
(
inst
->
op
==
inst
->
BL
)
{
__
Mov
(
LR
,
(
Addr
)
inst
->
getPC
()
+
inst
->
size
());
Addr
lr
=
reinterpret_cast
<
Addr
>
(
toPc
);
lr
+=
4
*
4
;
// MovWide * 4;
lr
+=
4
*
4
;
// MovWide * 4;
lr
+=
4
;
// Br
__
Mov
(
LR
,
lr
);
}
__
Mov
(
IP1
,
targetAddr
);
__
Br
(
IP1
);
...
...
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