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
65d35307
Commit
65d35307
authored
May 23, 2019
by
swift_gan
Committed by
swift_gan
May 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NativeHook]fix some insts
parent
f6c7aa65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
decoder_arm32.cpp
...ok/src/main/cpp/archs/arm/arm32/decoder/decoder_arm32.cpp
+4
-4
inst_t16.cpp
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t16.cpp
+2
-2
decoder.h
nativehook/src/main/cpp/includes/decoder.h
+1
-0
No files found.
nativehook/src/main/cpp/archs/arm/arm32/decoder/decoder_arm32.cpp
View file @
65d35307
...
@@ -24,14 +24,15 @@ goto label_matched; \
...
@@ -24,14 +24,15 @@ goto label_matched; \
Arm32Decoder
*
Arm32Decoder
::
instant
=
new
Arm32Decoder
();
Arm32Decoder
*
Arm32Decoder
::
instant
=
new
Arm32Decoder
();
void
Arm32Decoder
::
decode
(
void
*
codeStart
,
Addr
codeLen
,
InstVisitor
&
visitor
)
{
void
Arm32Decoder
::
decode
(
void
*
codeStart
,
Addr
codeLen
,
InstVisitor
&
visitor
)
{
bool
thumb
=
isThumbCode
(
reinterpret_cast
<
Addr
>
(
codeStart
));
if
(
thumb
)
{
codeStart
=
getThumbCodeAddress
(
codeStart
);
}
void
*
pc
=
codeStart
;
void
*
pc
=
codeStart
;
Addr
endAddr
=
(
Addr
)
codeStart
+
codeLen
;
Addr
endAddr
=
(
Addr
)
codeStart
+
codeLen
;
Unit
<
Base
>*
unit
=
nullptr
;
Unit
<
Base
>*
unit
=
nullptr
;
while
((
Addr
)
pc
<
endAddr
)
{
while
((
Addr
)
pc
<
endAddr
)
{
bool
thumb
=
isThumbCode
(
reinterpret_cast
<
Addr
>
(
pc
));
bool
thumb32
=
isThumb32
(
*
reinterpret_cast
<
InstT16
*>
(
pc
));
bool
thumb32
=
isThumb32
(
*
reinterpret_cast
<
InstT16
*>
(
pc
));
if
(
thumb
&&
thumb32
)
{
if
(
thumb
&&
thumb32
)
{
CASE_T32
(
B32
)
CASE_T32
(
B32
)
CASE_T32
(
LDR_LIT
)
CASE_T32
(
LDR_LIT
)
...
@@ -63,7 +64,6 @@ void Arm32Decoder::decode(void *codeStart, Addr codeLen, InstVisitor &visitor) {
...
@@ -63,7 +64,6 @@ void Arm32Decoder::decode(void *codeStart, Addr codeLen, InstVisitor &visitor) {
unit
=
reinterpret_cast
<
Unit
<
Base
>
*>
(
new
INST_T32
(
UNKNOW
)(
*
reinterpret_cast
<
STRUCT_T32
(
UNKNOW
)
*>
(
pc
)));
unit
=
reinterpret_cast
<
Unit
<
Base
>
*>
(
new
INST_T32
(
UNKNOW
)(
*
reinterpret_cast
<
STRUCT_T32
(
UNKNOW
)
*>
(
pc
)));
}
}
label_matched
:
label_matched
:
if
(
!
visitor
.
visit
(
unit
,
pc
))
{
if
(
!
visitor
.
visit
(
unit
,
pc
))
{
break
;
break
;
...
...
nativehook/src/main/cpp/archs/arm/arm32/inst/inst_t16.cpp
View file @
65d35307
...
@@ -371,12 +371,12 @@ T16_PUSH::T16_PUSH(T16_STRUCT_PUSH *inst) : InstructionT16(inst) {
...
@@ -371,12 +371,12 @@ T16_PUSH::T16_PUSH(T16_STRUCT_PUSH *inst) : InstructionT16(inst) {
T16_PUSH
::
T16_PUSH
(
const
RegisterList
&
registerList
)
:
registerList
(
registerList
)
{}
T16_PUSH
::
T16_PUSH
(
const
RegisterList
&
registerList
)
:
registerList
(
registerList
)
{}
void
T16_PUSH
::
decode
(
T16_STRUCT_PUSH
*
inst
)
{
void
T16_PUSH
::
decode
(
T16_STRUCT_PUSH
*
inst
)
{
registerList
.
SetList
(
COMBINE
(
inst
->
M
<<
7
,
inst
->
regs
,
8
));
registerList
.
SetList
(
COMBINE
(
inst
->
M
<<
6
,
inst
->
regs
,
8
));
}
}
void
T16_PUSH
::
assembler
()
{
void
T16_PUSH
::
assembler
()
{
SET_OPCODE
(
POP
);
SET_OPCODE
(
POP
);
U16
regs
=
registerList
.
GetList
();
U16
regs
=
registerList
.
GetList
();
get
()
->
regs
=
BITS
(
regs
,
0
,
7
);
get
()
->
regs
=
BITS
(
regs
,
0
,
7
);
get
()
->
M
=
BIT
(
regs
,
1
5
);
get
()
->
M
=
BIT
(
regs
,
1
4
);
}
}
\ No newline at end of file
nativehook/src/main/cpp/includes/decoder.h
View file @
65d35307
...
@@ -26,6 +26,7 @@ namespace SandHook {
...
@@ -26,6 +26,7 @@ namespace SandHook {
class
Decoder
{
class
Decoder
{
public
:
static
InstDecoder
*
get
(
Arch
arch
);
static
InstDecoder
*
get
(
Arch
arch
);
static
InstDecoder
*
get
();
static
InstDecoder
*
get
();
};
};
...
...
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