Commit aebe7002 authored by swift_gan's avatar swift_gan Committed by swift_gan

add inst type

parent 2c5124f5
...@@ -17,14 +17,22 @@ namespace SandHook { ...@@ -17,14 +17,22 @@ namespace SandHook {
class InstructionA64 : public Instruction<InstStruct> { class InstructionA64 : public Instruction<InstStruct> {
public: public:
InstStruct mask(InstStruct raw) { inline InstStruct mask(InstStruct raw) {
return raw & (InstStruct) *this; return raw & (InstStruct) *this;
} }
bool IsPCRelAddressing() { inline bool IsPCRelAddressing() {
return mask(PCRelAddressingFMask) == PCRelAddressingFixed; return mask(PCRelAddressingFMask) == PCRelAddressingFixed;
} }
inline InstType instType() override {
return A64;
}
inline Arch arch() override {
return arm64;
}
int getImmBranch() { int getImmBranch() {
//TODO //TODO
return 0; return 0;
...@@ -46,7 +54,7 @@ namespace SandHook { ...@@ -46,7 +54,7 @@ namespace SandHook {
class A64_ADR_ADRP : public A64_INST_PC_REL { class A64_ADR_ADRP : public A64_INST_PC_REL {
public: public:
bool isADRP() { inline bool isADRP() {
return get().op == 1; return get().op == 1;
} }
......
...@@ -27,6 +27,14 @@ namespace SandHook { ...@@ -27,6 +27,14 @@ namespace SandHook {
return (void *) this; return (void *) this;
} }
virtual InstType instType() {
return unkownInst;
}
virtual Arch arch() {
return unkownArch;
}
bool pcRelate() { bool pcRelate() {
return false; return false;
} }
......
...@@ -26,14 +26,16 @@ const ADDR PAGE_SIZE = 2 << PAGE_OFFSET; ...@@ -26,14 +26,16 @@ const ADDR PAGE_SIZE = 2 << PAGE_OFFSET;
enum Arch { enum Arch {
arm32, arm32,
arm64 arm64,
unkownArch
}; };
enum InstType { enum InstType {
A32, A32,
thumb16, thumb16,
thumb32, thumb32,
A64 A64,
unkownInst
}; };
template <int SizeInBits> template <int SizeInBits>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment