linux/arch/x86/include/asm/inat.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _ASM_X86_INAT_H
#define _ASM_X86_INAT_H
/*
 * x86 instruction attributes
 *
 * Written by Masami Hiramatsu <[email protected]>
 */
#include <asm/inat_types.h> /* __ignore_sync_check__ */

/*
 * Internal bits. Don't use bitmasks directly, because these bits are
 * unstable. You should use checking functions.
 */

#define INAT_OPCODE_TABLE_SIZE
#define INAT_GROUP_TABLE_SIZE

/* Legacy last prefixes */
#define INAT_PFX_OPNDSZ
#define INAT_PFX_REPE
#define INAT_PFX_REPNE
/* Other Legacy prefixes */
#define INAT_PFX_LOCK
#define INAT_PFX_CS
#define INAT_PFX_DS
#define INAT_PFX_ES
#define INAT_PFX_FS
#define INAT_PFX_GS
#define INAT_PFX_SS
#define INAT_PFX_ADDRSZ
/* x86-64 REX prefix */
#define INAT_PFX_REX
/* AVX VEX prefixes */
#define INAT_PFX_VEX2
#define INAT_PFX_VEX3
#define INAT_PFX_EVEX
/* x86-64 REX2 prefix */
#define INAT_PFX_REX2

#define INAT_LSTPFX_MAX
#define INAT_LGCPFX_MAX

/* Immediate size */
#define INAT_IMM_BYTE
#define INAT_IMM_WORD
#define INAT_IMM_DWORD
#define INAT_IMM_QWORD
#define INAT_IMM_PTR
#define INAT_IMM_VWORD32
#define INAT_IMM_VWORD

/* Legacy prefix */
#define INAT_PFX_OFFS
#define INAT_PFX_BITS
#define INAT_PFX_MAX
#define INAT_PFX_MASK
/* Escape opcodes */
#define INAT_ESC_OFFS
#define INAT_ESC_BITS
#define INAT_ESC_MAX
#define INAT_ESC_MASK
/* Group opcodes (1-16) */
#define INAT_GRP_OFFS
#define INAT_GRP_BITS
#define INAT_GRP_MAX
#define INAT_GRP_MASK
/* Immediates */
#define INAT_IMM_OFFS
#define INAT_IMM_BITS
#define INAT_IMM_MASK
/* Flags */
#define INAT_FLAG_OFFS
#define INAT_MODRM
#define INAT_FORCE64
#define INAT_SCNDIMM
#define INAT_MOFFSET
#define INAT_VARIANT
#define INAT_VEXOK
#define INAT_VEXONLY
#define INAT_EVEXONLY
#define INAT_NO_REX2
#define INAT_REX2_VARIANT
#define INAT_EVEX_SCALABLE
/* Attribute making macros for attribute tables */
#define INAT_MAKE_PREFIX(pfx)
#define INAT_MAKE_ESCAPE(esc)
#define INAT_MAKE_GROUP(grp)
#define INAT_MAKE_IMM(imm)

/* Identifiers for segment registers */
#define INAT_SEG_REG_IGNORE
#define INAT_SEG_REG_DEFAULT
#define INAT_SEG_REG_CS
#define INAT_SEG_REG_SS
#define INAT_SEG_REG_DS
#define INAT_SEG_REG_ES
#define INAT_SEG_REG_FS
#define INAT_SEG_REG_GS

/* Attribute search APIs */
extern insn_attr_t inat_get_opcode_attribute(insn_byte_t opcode);
extern int inat_get_last_prefix_id(insn_byte_t last_pfx);
extern insn_attr_t inat_get_escape_attribute(insn_byte_t opcode,
					     int lpfx_id,
					     insn_attr_t esc_attr);
extern insn_attr_t inat_get_group_attribute(insn_byte_t modrm,
					    int lpfx_id,
					    insn_attr_t esc_attr);
extern insn_attr_t inat_get_avx_attribute(insn_byte_t opcode,
					  insn_byte_t vex_m,
					  insn_byte_t vex_pp);

/* Attribute checking functions */
static inline int inat_is_legacy_prefix(insn_attr_t attr)
{}

static inline int inat_is_address_size_prefix(insn_attr_t attr)
{}

static inline int inat_is_operand_size_prefix(insn_attr_t attr)
{}

static inline int inat_is_rex_prefix(insn_attr_t attr)
{}

static inline int inat_is_rex2_prefix(insn_attr_t attr)
{}

static inline int inat_last_prefix_id(insn_attr_t attr)
{}

static inline int inat_is_vex_prefix(insn_attr_t attr)
{}

static inline int inat_is_evex_prefix(insn_attr_t attr)
{}

static inline int inat_is_vex3_prefix(insn_attr_t attr)
{}

static inline int inat_is_escape(insn_attr_t attr)
{}

static inline int inat_escape_id(insn_attr_t attr)
{}

static inline int inat_is_group(insn_attr_t attr)
{}

static inline int inat_group_id(insn_attr_t attr)
{}

static inline int inat_group_common_attribute(insn_attr_t attr)
{}

static inline int inat_has_immediate(insn_attr_t attr)
{}

static inline int inat_immediate_size(insn_attr_t attr)
{}

static inline int inat_has_modrm(insn_attr_t attr)
{}

static inline int inat_is_force64(insn_attr_t attr)
{}

static inline int inat_has_second_immediate(insn_attr_t attr)
{}

static inline int inat_has_moffset(insn_attr_t attr)
{}

static inline int inat_has_variant(insn_attr_t attr)
{}

static inline int inat_accept_vex(insn_attr_t attr)
{}

static inline int inat_must_vex(insn_attr_t attr)
{}

static inline int inat_must_evex(insn_attr_t attr)
{}

static inline int inat_evex_scalable(insn_attr_t attr)
{}
#endif