19 #ifndef AARCH64_INSN_H 20 #define AARCH64_INSN_H 1 147 #define ENCODE(val, size, offset) \ 148 ((uint32_t) ((val & ((1ULL << size) - 1)) << offset)) 151 unsigned *rd, int32_t *
offset);
160 int *is_cbnz,
unsigned *rn, int32_t *
offset);
163 unsigned *
bit,
unsigned *rt, int32_t *imm);
166 int *is64,
unsigned *rt, int32_t *
offset);
181 void (*
b) (
const int is_bl,
const int32_t
offset,
189 void (*
cb) (
const int32_t
offset,
const int is_cbnz,
190 const unsigned rn,
int is64,
195 const unsigned rt,
unsigned bit,
204 const unsigned rt,
const int is64,
215 #define can_encode_int32(val, bits) \ 216 (((val) >> (bits)) == 0 || ((val) >> (bits)) == -1) 228 #define emit_b(buf, is_bl, offset) \ 229 aarch64_emit_insn (buf, ((is_bl) ? BL : B) | (ENCODE ((offset) >> 2, 26, 0))) 240 #define emit_bcond(buf, cond, offset) \ 241 aarch64_emit_insn (buf, \ 242 BCOND | ENCODE ((offset) >> 2, 19, 5) \ 243 | ENCODE ((cond), 4, 0)) 256 #define emit_cb(buf, is_cbnz, rt, offset) \ 257 aarch64_emit_insn (buf, \ 258 ((is_cbnz) ? CBNZ : CBZ) \ 259 | ENCODE (rt.is64, 1, 31) \ 260 | ENCODE (offset >> 2, 19, 5) \ 261 | ENCODE (rt.num, 5, 0)) 274 #define emit_ldr(buf, rt, rn, operand) \ 275 aarch64_emit_load_store (buf, rt.is64 ? 3 : 2, LDR, rt, rn, operand) 288 #define emit_ldrsw(buf, rt, rn, operand) \ 289 aarch64_emit_load_store (buf, 3, LDRSW, rt, rn, operand) 304 #define emit_tb(buf, is_tbnz, bit, rt, offset) \ 305 aarch64_emit_insn (buf, \ 306 ((is_tbnz) ? TBNZ: TBZ) \ 307 | ENCODE (bit >> 5, 1, 31) \ 308 | ENCODE (bit, 5, 19) \ 309 | ENCODE (offset >> 2, 14, 5) \ 310 | ENCODE (rt.num, 5, 0)) 314 #define emit_nop(buf) aarch64_emit_insn (buf, NOP) void(* tb)(const int32_t offset, int is_tbnz, const unsigned rt, unsigned bit, struct aarch64_insn_data *data)
enum aarch64_memory_operand_type type
static const struct aarch64_insn_visitor visitor
void aarch64_relocate_instruction(uint32_t insn, const struct aarch64_insn_visitor *visitor, struct aarch64_insn_data *data)
void(* ldr_literal)(const int32_t offset, const int is_sw, const unsigned rt, const int is64, struct aarch64_insn_data *data)
void(* cb)(const int32_t offset, const int is_cbnz, const unsigned rn, int is64, struct aarch64_insn_data *data)
int aarch64_decode_bcond(CORE_ADDR addr, uint32_t insn, unsigned *cond, int32_t *offset)
int aarch64_emit_load_store(uint32_t *buf, uint32_t size, enum aarch64_opcodes opcode, struct aarch64_register rt, struct aarch64_register rn, struct aarch64_memory_operand operand)
void(* adr)(const int32_t offset, const unsigned rd, const int is_adrp, struct aarch64_insn_data *data)
int aarch64_decode_ldr_literal(CORE_ADDR addr, uint32_t insn, int *is_w, int *is64, unsigned *rt, int32_t *offset)
int aarch64_decode_tb(CORE_ADDR addr, uint32_t insn, int *is_tbnz, unsigned *bit, unsigned *rt, int32_t *imm)
void(* b_cond)(const unsigned cond, const int32_t offset, struct aarch64_insn_data *data)
aarch64_memory_operand_type
int aarch64_emit_insn(uint32_t *buf, uint32_t insn)
void(* b)(const int is_bl, const int32_t offset, struct aarch64_insn_data *data)
int aarch64_decode_adr(CORE_ADDR addr, uint32_t insn, int *is_adrp, unsigned *rd, int32_t *offset)
int aarch64_decode_cb(CORE_ADDR addr, uint32_t insn, int *is64, int *is_cbnz, unsigned *rn, int32_t *offset)
void(* others)(const uint32_t insn, struct aarch64_insn_data *data)
int aarch64_decode_b(CORE_ADDR addr, uint32_t insn, int *is_bl, int32_t *offset)