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
d714cd48
Commit
d714cd48
authored
Aug 21, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some bugs
parent
4e3ca8e8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
33 deletions
+35
-33
decoder_arm64.cpp
...ok/src/main/cpp/archs/arm/arm64/decoder/decoder_arm64.cpp
+3
-3
inst_arm64.cpp
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.cpp
+19
-19
inst_arm64.h
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.h
+1
-1
register_arm64.h
...ok/src/main/cpp/archs/arm/arm64/register/register_arm64.h
+4
-2
decoder.cpp
nativehook/src/main/cpp/decoder/decoder.cpp
+2
-2
decoder.h
nativehook/src/main/cpp/includes/decoder.h
+6
-6
No files found.
nativehook/src/main/cpp/archs/arm/arm64/decoder/decoder_arm64.cpp
View file @
d714cd48
...
...
@@ -31,6 +31,9 @@ void Arm64Decoder::Disassemble(void *codeStart, Addr codeLen, InstVisitor &visit
CASE
(
ADR_ADRP
)
if
(
onlyPcRelInst
)
goto
label_matched
;
CASE
(
BR_BLR_RET
)
CASE
(
EXCEPTION_GEN
)
CASE
(
MSR_MRS
)
CASE
(
MOV_WIDE
)
CASE
(
MOV_REG
)
CASE
(
LDR_IMM
)
...
...
@@ -39,10 +42,7 @@ void Arm64Decoder::Disassemble(void *codeStart, Addr codeLen, InstVisitor &visit
CASE
(
LDRSW_UIMM
)
CASE
(
STR_UIMM
)
CASE
(
STR_IMM
)
CASE
(
BR_BLR_RET
)
CASE
(
SUB_EXT_REG
)
CASE
(
SVC
)
CASE
(
EXCEPTION_GEN
)
CASE
(
STP_LDP
)
CASE
(
ADD_SUB_IMM
)
...
...
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.cpp
View file @
d714cd48
...
...
@@ -822,17 +822,17 @@ A64_MSR_MRS::A64_MSR_MRS(void *inst) : InstructionA64(inst) {
}
A64_MSR_MRS
::
A64_MSR_MRS
(
OP
op
,
SystemRegister
&
systemRegister
,
RegisterA64
&
rt
)
:
op
(
op
),
system_reg
(
&
systemRegister
),
rt
(
&
rt
)
{}
systemRegister
),
rt
(
&
rt
)
{}
void
A64_MSR_MRS
::
Disassemble
()
{
DECODE_OP
;
DECODE_RT
(
XReg
);
system_reg
->
value
=
static_cast
<
U16
>
(
Get
()
->
sysreg
);
system_reg
.
value
=
static_cast
<
U16
>
(
Get
()
->
sysreg
);
}
void
A64_MSR_MRS
::
Assemble
()
{
SET_OPCODE
(
MSR_MRS
);
ENCODE_OP
;
ENCODE_RT
;
Get
()
->
sysreg
=
system_reg
->
value
;
Get
()
->
sysreg
=
system_reg
.
value
;
}
nativehook/src/main/cpp/archs/arm/arm64/inst/inst_arm64.h
View file @
d714cd48
...
...
@@ -753,7 +753,7 @@ namespace SandHook {
public
:
OP
op
;
SystemRegister
*
system_reg
;
SystemRegister
system_reg
{}
;
RegisterA64
*
rt
;
};
...
...
nativehook/src/main/cpp/archs/arm/arm64/register/register_arm64.h
View file @
d714cd48
...
...
@@ -99,6 +99,8 @@ namespace SandHook {
U16
op0
:
2
;
};
SystemRegister
()
{}
SystemRegister
(
U16
value
)
:
value
(
value
)
{}
SystemRegister
(
U16
op0
,
U16
op1
,
U16
crn
,
U16
crm
,
U16
op2
)
{
...
...
@@ -115,7 +117,7 @@ namespace SandHook {
}
bool
operator
!=
(
const
SystemRegister
&
rhs
)
const
{
return
!
(
rhs
==
*
this
)
;
return
value
!=
rhs
.
value
;
}
public
:
...
...
nativehook/src/main/cpp/decoder/decoder.cpp
View file @
d714cd48
...
...
@@ -12,12 +12,12 @@
using
namespace
SandHook
::
Decoder
;
bool
DefaultVisitor
::
Visit
(
BaseUnit
*
unit
,
void
*
pc
)
{
bool
res
=
visitor
(
unit
,
pc
);
bool
res
=
visitor
_
(
reinterpret_cast
<
BaseInst
*>
(
unit
)
,
pc
);
delete
unit
;
return
res
;
}
DefaultVisitor
::
DefaultVisitor
(
bool
(
*
visitor
)(
BaseUnit
*
,
void
*
))
:
visitor
(
visitor
)
{}
DefaultVisitor
::
DefaultVisitor
(
std
::
function
<
bool
(
BaseInst
*
inst
,
void
*
pc
)
>
visitor
)
:
visitor_
(
visitor
)
{}
//do not support now
InstDecoder
*
Disassembler
::
Get
(
Arch
arch
)
{
...
...
nativehook/src/main/cpp/includes/decoder.h
View file @
d714cd48
...
...
@@ -23,21 +23,21 @@ namespace SandHook {
class
DefaultVisitor
:
public
InstVisitor
{
public
:
DefaultVisitor
(
bool
(
*
visitor
)(
BaseUnit
*
,
void
*
)
);
DefaultVisitor
(
std
::
function
<
bool
(
BaseInst
*
inst
,
void
*
pc
)
>
visitor
);
bool
Visit
(
BaseUnit
*
unit
,
void
*
pc
)
override
;
private
:
bool
(
*
visitor
)(
BaseUnit
*
,
void
*
)
;
std
::
function
<
bool
(
BaseInst
*
inst
,
void
*
pc
)
>
visitor_
;
};
class
InstDecoder
{
public
:
virtual
void
Disassemble
(
void
*
code_start
,
Addr
code_len
,
InstVisitor
&
visitor
,
bool
only_pc_rel
=
false
)
=
0
;
inline
void
Disassemble
(
void
*
code
S
tart
,
Addr
codeLen
,
bool
(
*
visitor
)(
BaseUnit
*
,
void
*
)
,
bool
only_pc_rel
=
false
)
{
Ins
tVisitor
vis
=
DefaultVisitor
(
visitor
);
Disassemble
(
code
S
tart
,
codeLen
,
vis
,
only_pc_rel
);
inline
void
Disassemble
(
void
*
code
_s
tart
,
Addr
codeLen
,
std
::
function
<
bool
(
BaseInst
*
inst
,
void
*
pc
)
>
visitor
,
bool
only_pc_rel
=
false
)
{
Defaul
tVisitor
vis
=
DefaultVisitor
(
visitor
);
Disassemble
(
code
_s
tart
,
codeLen
,
vis
,
only_pc_rel
);
};
};
...
...
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