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
e8b846a7
Commit
e8b846a7
authored
May 12, 2019
by
swift_gan
Committed by
swift_gan
May 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweak inst code
parent
8a5cc3c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
37 deletions
+34
-37
inst_arm64.h
nativehook/src/main/cpp/archs/arm64/inst/inst_arm64.h
+20
-36
inst_code_arm64.h
nativehook/src/main/cpp/archs/arm64/inst/inst_code_arm64.h
+14
-1
No files found.
nativehook/src/main/cpp/archs/arm64/inst/inst_arm64.h
View file @
e8b846a7
...
...
@@ -31,6 +31,10 @@ return COND; \
#define TEST_INST_OPCODE(X, INDEX) inst_test.inst.opcode##INDEX == OPCODE_A64(X##_##INDEX)
#define DEFINE_INST_CODE(X) \
inline U32 instCode() override { \
return InstCodeA64::X; \
}
namespace
SandHook
{
...
...
@@ -160,6 +164,8 @@ namespace SandHook {
A64_UNKNOW
(
STRUCT_A64
(
UNKNOW
)
*
inst
);
A64_UNKNOW
(
STRUCT_A64
(
UNKNOW
)
&
inst
);
DEFINE_INST_CODE
(
UNKNOW
)
inline
bool
unknow
()
override
{
return
true
;
}
...
...
@@ -203,9 +209,7 @@ namespace SandHook {
DEFINE_IS
(
ADR_ADRP
)
U32
instCode
()
override
{
return
isADRP
()
?
PCRelAddressingOp
::
ADRP
:
PCRelAddressingOp
::
ADR
;
}
DEFINE_INST_CODE
(
ADR_ADRP
)
bool
isADRP
()
{
return
get
()
->
op
==
OP
::
ADRP
;
...
...
@@ -254,18 +258,7 @@ namespace SandHook {
DEFINE_IS
(
MOV_WIDE
)
inline
U32
instCode
()
override
{
switch
(
op
)
{
case
MOV_WideOp_K
:
return
MOVK
;
case
MOV_WideOp_N
:
return
MOVN
;
case
MOV_WideOp_Z
:
return
MOVZ
;
default
:
return
0
;
}
}
DEFINE_INST_CODE
(
MOV_WIDE
)
void
assembler
()
override
;
...
...
@@ -325,9 +318,7 @@ namespace SandHook {
return
op
;
}
inline
U32
instCode
()
override
{
return
op
==
B
?
UnconditionalBranchOp
::
B
:
UnconditionalBranchOp
::
BL
;
};
DEFINE_INST_CODE
(
B_BL
)
Off
getImmPCOffset
()
override
;
...
...
@@ -387,9 +378,7 @@ namespace SandHook {
DEFINE_IS
(
B_COND
)
inline
U32
instCode
()
override
{
return
B_cond
;
}
DEFINE_INST_CODE
(
B_COND
)
Off
getImmPCOffset
()
override
;
...
...
@@ -419,9 +408,7 @@ namespace SandHook {
DEFINE_IS
(
TBZ_TBNZ
)
inline
U32
instCode
()
override
{
return
op
==
TBZ
?
TestBranchOp
::
TBZ
:
TestBranchOp
::
TBNZ
;
};
DEFINE_INST_CODE
(
TBZ_TBNZ
)
Off
getImmPCOffset
()
override
;
...
...
@@ -455,18 +442,7 @@ namespace SandHook {
DEFINE_IS
(
LDR_LIT
)
inline
U32
instCode
()
override
{
switch
(
op
)
{
case
LDR_W
:
return
LoadLiteralOp
::
LDR_w_lit
;
case
LDR_X
:
return
LoadLiteralOp
::
LDR_x_lit
;
case
LDR_SW
:
return
LoadLiteralOp
::
LDRSW_x_lit
;
case
LDR_PRFM
:
return
LoadLiteralOp
::
PRFM_lit
;
}
}
DEFINE_INST_CODE
(
LDR_LIT
)
Off
getImmPCOffset
()
override
;
...
...
@@ -498,6 +474,8 @@ namespace SandHook {
DEFINE_IS_EXT
(
BR_BLR_RET
,
TEST_INST_OPCODE
(
BR_BLR_RET
,
1
)
&&
TEST_INST_OPCODE
(
BR_BLR_RET
,
2
)
&&
TEST_INST_OPCODE
(
BR_BLR_RET
,
3
))
DEFINE_INST_CODE
(
BR_BLR_RET
)
void
decode
(
A64_STRUCT_BR_BLR_RET
*
inst
)
override
;
void
assembler
()
override
;
...
...
@@ -529,6 +507,8 @@ namespace SandHook {
DEFINE_IS
(
STR_IMM
)
DEFINE_INST_CODE
(
MOV_REG
)
void
decode
(
STRUCT_A64
(
STR_IMM
)
*
inst
)
override
;
void
assembler
()
override
;
...
...
@@ -562,6 +542,8 @@ namespace SandHook {
DEFINE_IS
(
STR_UIMM
)
DEFINE_INST_CODE
(
STR_UIMM
)
void
decode
(
STRUCT_A64
(
STR_UIMM
)
*
inst
)
override
;
void
assembler
()
override
;
...
...
@@ -588,6 +570,8 @@ namespace SandHook {
DEFINE_IS_EXT
(
MOV_REG
,
TEST_INST_OPCODE
(
MOV_REG
,
1
)
&&
TEST_INST_OPCODE
(
MOV_REG
,
2
))
DEFINE_INST_CODE
(
MOV_REG
)
void
decode
(
A64_STRUCT_MOV_REG
*
inst
)
override
;
void
assembler
()
override
;
...
...
nativehook/src/main/cpp/archs/arm64/inst/inst_code_arm64.h
View file @
e8b846a7
...
...
@@ -7,7 +7,20 @@
#include "inst_struct_aarch64.h"
enum
InstCodeA64
{
UNKNOW
,
MOV_WIDE
,
MOV_REG
,
ADR_ADRP
,
LDR_LIT
,
STR_IMM
,
STR_UIMM
,
B_BL
,
B_COND
,
BR_BLR_RET
,
CBZ_CBNZ
,
TBZ_TBNZ
,
};
// Generic fields.
enum
GenericInstrField
{
...
...
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