22 #include <linux/string.h> 30 #define validate_next(t, insn, n) \ 31 ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr) 33 #define __get_next(t, insn) \ 34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; }) 36 #define __peek_nbyte_next(t, insn, n) \ 37 ({ t r = *(t*)((insn)->next_byte + n); r; }) 39 #define get_next(t, insn) \ 40 ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); }) 42 #define peek_nbyte_next(t, insn, n) \ 43 ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); }) 45 #define peek_next(t, insn) peek_nbyte_next(t, insn, 0) 62 memset(insn, 0,
sizeof(*insn));
66 insn->
x86_64 = x86_64 ? 1 : 0;
98 for (i = 0; i < nb; i++)
99 if (prefixes->
bytes[i] == b)
104 prefixes->
bytes[nb++] = b;
127 for (i = 0; i < nb; i++)
128 if (prefixes->
bytes[i] == lb)
129 prefixes->
bytes[i] = b;
225 opcode->
bytes[0] = op;
316 return (modrm->
nbytes && (modrm->
value & 0xc7) == 0x5);
392 if ((mod == 0 && rm == 6) || mod == 2) {
398 if ((mod == 0 && rm == 5) || mod == 2 ||
399 (mod == 0 && base == 5)) {
605 - (
unsigned long)insn->
kaddr);
void insn_get_modrm(struct insn *insn)
static int inat_accept_vex(insn_attr_t attr)
struct insn_field vex_prefix
#define peek_next(t, insn)
const insn_byte_t * kaddr
static int insn_last_prefix_id(struct insn *insn)
static int inat_has_immediate(insn_attr_t attr)
insn_attr_t inat_get_group_attribute(insn_byte_t modrm, int lpfx_id, insn_attr_t grp_attr)
const insn_byte_t * end_kaddr
static int inat_is_operand_size_prefix(insn_attr_t attr)
void insn_init(struct insn *insn, const void *kaddr, int buf_len, int x86_64)
static int inat_is_vex3_prefix(insn_attr_t attr)
static insn_byte_t insn_vex_p_bits(struct insn *insn)
static int inat_is_legacy_prefix(insn_attr_t attr)
static int inat_is_evex_prefix(insn_attr_t attr)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
insn_attr_t inat_get_opcode_attribute(insn_byte_t opcode)
static int inat_is_group(insn_attr_t attr)
static int __get_immv(struct insn *insn)
static int inat_has_second_immediate(insn_attr_t attr)
static int inat_is_rex_prefix(insn_attr_t attr)
#define peek_nbyte_next(t, insn, n)
unsigned char insn_byte_t
static int inat_is_escape(insn_attr_t attr)
#define X86_MODRM_RM(modrm)
static int inat_must_evex(insn_attr_t attr)
void insn_get_length(struct insn *insn)
struct insn_field rex_prefix
static int __get_immv32(struct insn *insn)
struct insn_field immediate
struct insn_field displacement
static int __get_moffset(struct insn *insn)
static int inat_has_modrm(insn_attr_t attr)
void insn_get_sib(struct insn *insn)
insn_attr_t inat_get_escape_attribute(insn_byte_t opcode, int lpfx_id, insn_attr_t esc_attr)
int insn_rip_relative(struct insn *insn)
struct insn_field prefixes
void insn_get_immediate(struct insn *insn)
insn_attr_t inat_get_avx_attribute(insn_byte_t opcode, insn_byte_t vex_m, insn_byte_t vex_p)
static int __get_immptr(struct insn *insn)
const insn_byte_t * next_byte
struct insn_field moffset1
static int inat_is_force64(insn_attr_t attr)
#define X86_SIB_BASE(sib)
void insn_get_displacement(struct insn *insn)
struct insn_field moffset2
static int inat_has_moffset(insn_attr_t attr)
static int inat_is_address_size_prefix(insn_attr_t attr)
#define X86_MODRM_MOD(modrm)
static insn_byte_t insn_vex_m_bits(struct insn *insn)
static int insn_is_avx(struct insn *insn)
static int inat_is_vex_prefix(insn_attr_t attr)
static int insn_is_evex(struct insn *insn)
static int inat_must_vex(insn_attr_t attr)
#define get_next(t, insn)
struct insn_field immediate1
void insn_get_opcode(struct insn *insn)
static int inat_immediate_size(insn_attr_t attr)
void insn_get_prefixes(struct insn *insn)
struct insn_field immediate2