2021-03-06 18:46:56 -05:00
|
|
|
#ifndef YJIT_ASM_H
|
|
|
|
#define YJIT_ASM_H 1
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2021-09-21 10:59:55 -04:00
|
|
|
// Size of code pages to allocate
|
|
|
|
#define CODE_PAGE_SIZE 16 * 1024
|
|
|
|
|
|
|
|
// How many code pages to allocate at once
|
|
|
|
#define PAGES_PER_ALLOC 512
|
|
|
|
|
2020-09-04 15:56:00 -04:00
|
|
|
// Maximum number of labels to link
|
|
|
|
#define MAX_LABELS 32
|
|
|
|
|
|
|
|
// Maximum number of label references
|
|
|
|
#define MAX_LABEL_REFS 32
|
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
// Reference to an ASM label
|
2020-09-04 15:56:00 -04:00
|
|
|
typedef struct LabelRef
|
|
|
|
{
|
2020-09-08 16:45:35 -04:00
|
|
|
// Position in the code block where the label reference exists
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t pos;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
// Label which this refers to
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t label_idx;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
} labelref_t;
|
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
// Block of executable memory into which instructions can be written
|
2020-09-04 15:56:00 -04:00
|
|
|
typedef struct CodeBlock
|
|
|
|
{
|
|
|
|
// Memory block
|
2021-09-29 14:58:01 -04:00
|
|
|
uint8_t *mem_block;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
// Memory block size
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t mem_size;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
/// Current writing position
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t write_pos;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
// Table of registered label addresses
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t label_addrs[MAX_LABELS];
|
2020-09-04 15:56:00 -04:00
|
|
|
|
2020-09-11 15:10:16 -04:00
|
|
|
// Table of registered label names
|
|
|
|
// Note that these should be constant strings only
|
2021-09-29 14:58:01 -04:00
|
|
|
const char *label_names[MAX_LABELS];
|
2020-09-11 15:10:16 -04:00
|
|
|
|
2020-09-04 15:56:00 -04:00
|
|
|
// References to labels
|
|
|
|
labelref_t label_refs[MAX_LABEL_REFS];
|
|
|
|
|
|
|
|
// Number of labels registeered
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t num_labels;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
// Number of references to labels
|
2021-01-12 14:56:43 -05:00
|
|
|
uint32_t num_refs;
|
2020-09-04 15:56:00 -04:00
|
|
|
|
|
|
|
// TODO: system for disassembly/comment strings, indexed by position
|
|
|
|
|
|
|
|
// Flag to enable or disable comments
|
|
|
|
bool has_asm;
|
|
|
|
|
|
|
|
} codeblock_t;
|
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
enum OpndType
|
|
|
|
{
|
|
|
|
OPND_NONE,
|
|
|
|
OPND_REG,
|
|
|
|
OPND_IMM,
|
2020-09-15 15:12:31 -04:00
|
|
|
OPND_MEM
|
2020-09-08 16:45:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum RegType
|
|
|
|
{
|
|
|
|
REG_GP,
|
|
|
|
REG_FP,
|
|
|
|
REG_XMM,
|
|
|
|
REG_IP
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct X86Reg
|
|
|
|
{
|
|
|
|
// Register type
|
|
|
|
uint8_t reg_type;
|
|
|
|
|
|
|
|
// Register index number
|
|
|
|
uint8_t reg_no;
|
|
|
|
|
|
|
|
} x86reg_t;
|
|
|
|
|
|
|
|
typedef struct X86Mem
|
|
|
|
{
|
|
|
|
/// Base register number
|
|
|
|
uint8_t base_reg_no;
|
|
|
|
|
|
|
|
/// Index register number
|
|
|
|
uint8_t idx_reg_no;
|
|
|
|
|
|
|
|
/// SIB scale exponent value (power of two, two bits)
|
|
|
|
uint8_t scale_exp;
|
|
|
|
|
|
|
|
/// Has index register flag
|
|
|
|
bool has_idx;
|
|
|
|
|
2020-09-09 16:45:28 -04:00
|
|
|
// TODO: should this be here, or should we have an extra operand type?
|
2020-09-08 16:45:35 -04:00
|
|
|
/// IP-relative addressing flag
|
|
|
|
bool is_iprel;
|
|
|
|
|
|
|
|
/// Constant displacement from the base, not scaled
|
|
|
|
int32_t disp;
|
|
|
|
|
|
|
|
} x86mem_t;
|
|
|
|
|
2020-09-04 17:10:11 -04:00
|
|
|
typedef struct X86Opnd
|
|
|
|
{
|
2020-09-08 16:45:35 -04:00
|
|
|
// Operand type
|
|
|
|
uint8_t type;
|
2020-09-04 17:10:11 -04:00
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
// Size in bits
|
|
|
|
uint16_t num_bits;
|
2020-09-04 17:10:11 -04:00
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
union
|
|
|
|
{
|
|
|
|
// Register operand
|
|
|
|
x86reg_t reg;
|
2020-09-04 17:10:11 -04:00
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
// Memory operand
|
|
|
|
x86mem_t mem;
|
|
|
|
|
|
|
|
// Signed immediate value
|
|
|
|
int64_t imm;
|
|
|
|
|
|
|
|
// Unsigned immediate value
|
2020-09-14 14:36:39 -04:00
|
|
|
uint64_t unsig_imm;
|
2020-10-05 17:11:50 -04:00
|
|
|
} as;
|
2020-09-04 17:10:11 -04:00
|
|
|
|
|
|
|
} x86opnd_t;
|
|
|
|
|
2021-07-13 14:56:02 -04:00
|
|
|
// Struct representing a code page
|
|
|
|
typedef struct code_page_struct
|
|
|
|
{
|
|
|
|
// Chunk of executable memory
|
2021-09-29 14:58:01 -04:00
|
|
|
uint8_t *mem_block;
|
2021-07-13 14:56:02 -04:00
|
|
|
|
|
|
|
// Size of the executable memory chunk
|
|
|
|
uint32_t page_size;
|
|
|
|
|
|
|
|
// Next node in the free list (private)
|
2021-09-29 14:58:01 -04:00
|
|
|
struct code_page_struct *_next;
|
2021-07-13 14:56:02 -04:00
|
|
|
|
|
|
|
} code_page_t;
|
|
|
|
|
2020-09-09 16:45:28 -04:00
|
|
|
// Dummy none/null operand
|
2020-10-05 17:11:50 -04:00
|
|
|
static const x86opnd_t NO_OPND = { OPND_NONE, 0, .as.imm = 0 };
|
2020-09-09 16:45:28 -04:00
|
|
|
|
2020-09-15 15:12:31 -04:00
|
|
|
// Instruction pointer
|
2020-10-05 17:11:50 -04:00
|
|
|
static const x86opnd_t RIP = { OPND_REG, 64, .as.reg = { REG_IP, 5 }};
|
2020-09-15 15:12:31 -04:00
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
// 64-bit GP registers
|
2020-10-05 17:11:50 -04:00
|
|
|
static const x86opnd_t RAX = { OPND_REG, 64, .as.reg = { REG_GP, 0 }};
|
|
|
|
static const x86opnd_t RCX = { OPND_REG, 64, .as.reg = { REG_GP, 1 }};
|
|
|
|
static const x86opnd_t RDX = { OPND_REG, 64, .as.reg = { REG_GP, 2 }};
|
|
|
|
static const x86opnd_t RBX = { OPND_REG, 64, .as.reg = { REG_GP, 3 }};
|
|
|
|
static const x86opnd_t RSP = { OPND_REG, 64, .as.reg = { REG_GP, 4 }};
|
|
|
|
static const x86opnd_t RBP = { OPND_REG, 64, .as.reg = { REG_GP, 5 }};
|
|
|
|
static const x86opnd_t RSI = { OPND_REG, 64, .as.reg = { REG_GP, 6 }};
|
|
|
|
static const x86opnd_t RDI = { OPND_REG, 64, .as.reg = { REG_GP, 7 }};
|
|
|
|
static const x86opnd_t R8 = { OPND_REG, 64, .as.reg = { REG_GP, 8 }};
|
|
|
|
static const x86opnd_t R9 = { OPND_REG, 64, .as.reg = { REG_GP, 9 }};
|
|
|
|
static const x86opnd_t R10 = { OPND_REG, 64, .as.reg = { REG_GP, 10 }};
|
|
|
|
static const x86opnd_t R11 = { OPND_REG, 64, .as.reg = { REG_GP, 11 }};
|
|
|
|
static const x86opnd_t R12 = { OPND_REG, 64, .as.reg = { REG_GP, 12 }};
|
|
|
|
static const x86opnd_t R13 = { OPND_REG, 64, .as.reg = { REG_GP, 13 }};
|
|
|
|
static const x86opnd_t R14 = { OPND_REG, 64, .as.reg = { REG_GP, 14 }};
|
|
|
|
static const x86opnd_t R15 = { OPND_REG, 64, .as.reg = { REG_GP, 15 }};
|
2020-09-08 16:45:35 -04:00
|
|
|
|
2020-09-10 10:57:29 -04:00
|
|
|
// 32-bit GP registers
|
2020-10-05 17:11:50 -04:00
|
|
|
static const x86opnd_t EAX = { OPND_REG, 32, .as.reg = { REG_GP, 0 }};
|
|
|
|
static const x86opnd_t ECX = { OPND_REG, 32, .as.reg = { REG_GP, 1 }};
|
|
|
|
static const x86opnd_t EDX = { OPND_REG, 32, .as.reg = { REG_GP, 2 }};
|
|
|
|
static const x86opnd_t EBX = { OPND_REG, 32, .as.reg = { REG_GP, 3 }};
|
|
|
|
static const x86opnd_t ESP = { OPND_REG, 32, .as.reg = { REG_GP, 4 }};
|
|
|
|
static const x86opnd_t EBP = { OPND_REG, 32, .as.reg = { REG_GP, 5 }};
|
|
|
|
static const x86opnd_t ESI = { OPND_REG, 32, .as.reg = { REG_GP, 6 }};
|
|
|
|
static const x86opnd_t EDI = { OPND_REG, 32, .as.reg = { REG_GP, 7 }};
|
|
|
|
static const x86opnd_t R8D = { OPND_REG, 32, .as.reg = { REG_GP, 8 }};
|
|
|
|
static const x86opnd_t R9D = { OPND_REG, 32, .as.reg = { REG_GP, 9 }};
|
|
|
|
static const x86opnd_t R10D = { OPND_REG, 32, .as.reg = { REG_GP, 10 }};
|
|
|
|
static const x86opnd_t R11D = { OPND_REG, 32, .as.reg = { REG_GP, 11 }};
|
|
|
|
static const x86opnd_t R12D = { OPND_REG, 32, .as.reg = { REG_GP, 12 }};
|
|
|
|
static const x86opnd_t R13D = { OPND_REG, 32, .as.reg = { REG_GP, 13 }};
|
|
|
|
static const x86opnd_t R14D = { OPND_REG, 32, .as.reg = { REG_GP, 14 }};
|
|
|
|
static const x86opnd_t R15D = { OPND_REG, 32, .as.reg = { REG_GP, 15 }};
|
2020-09-10 10:57:29 -04:00
|
|
|
|
2020-09-22 11:39:04 -04:00
|
|
|
// 16-bit GP registers
|
2020-10-05 17:11:50 -04:00
|
|
|
static const x86opnd_t AX = { OPND_REG, 16, .as.reg = { REG_GP, 0 }};
|
|
|
|
static const x86opnd_t CX = { OPND_REG, 16, .as.reg = { REG_GP, 1 }};
|
|
|
|
static const x86opnd_t DX = { OPND_REG, 16, .as.reg = { REG_GP, 2 }};
|
|
|
|
static const x86opnd_t BX = { OPND_REG, 16, .as.reg = { REG_GP, 3 }};
|
|
|
|
static const x86opnd_t SP = { OPND_REG, 16, .as.reg = { REG_GP, 4 }};
|
|
|
|
static const x86opnd_t BP = { OPND_REG, 16, .as.reg = { REG_GP, 5 }};
|
|
|
|
static const x86opnd_t SI = { OPND_REG, 16, .as.reg = { REG_GP, 6 }};
|
|
|
|
static const x86opnd_t DI = { OPND_REG, 16, .as.reg = { REG_GP, 7 }};
|
|
|
|
static const x86opnd_t R8W = { OPND_REG, 16, .as.reg = { REG_GP, 8 }};
|
|
|
|
static const x86opnd_t R9W = { OPND_REG, 16, .as.reg = { REG_GP, 9 }};
|
|
|
|
static const x86opnd_t R10W = { OPND_REG, 16, .as.reg = { REG_GP, 10 }};
|
|
|
|
static const x86opnd_t R11W = { OPND_REG, 16, .as.reg = { REG_GP, 11 }};
|
|
|
|
static const x86opnd_t R12W = { OPND_REG, 16, .as.reg = { REG_GP, 12 }};
|
|
|
|
static const x86opnd_t R13W = { OPND_REG, 16, .as.reg = { REG_GP, 13 }};
|
|
|
|
static const x86opnd_t R14W = { OPND_REG, 16, .as.reg = { REG_GP, 14 }};
|
|
|
|
static const x86opnd_t R15W = { OPND_REG, 16, .as.reg = { REG_GP, 15 }};
|
2020-09-22 11:39:04 -04:00
|
|
|
|
|
|
|
// 8-bit GP registers
|
2020-10-05 17:11:50 -04:00
|
|
|
static const x86opnd_t AL = { OPND_REG, 8, .as.reg = { REG_GP, 0 }};
|
|
|
|
static const x86opnd_t CL = { OPND_REG, 8, .as.reg = { REG_GP, 1 }};
|
|
|
|
static const x86opnd_t DL = { OPND_REG, 8, .as.reg = { REG_GP, 2 }};
|
|
|
|
static const x86opnd_t BL = { OPND_REG, 8, .as.reg = { REG_GP, 3 }};
|
|
|
|
static const x86opnd_t SPL = { OPND_REG, 8, .as.reg = { REG_GP, 4 }};
|
|
|
|
static const x86opnd_t BPL = { OPND_REG, 8, .as.reg = { REG_GP, 5 }};
|
|
|
|
static const x86opnd_t SIL = { OPND_REG, 8, .as.reg = { REG_GP, 6 }};
|
|
|
|
static const x86opnd_t DIL = { OPND_REG, 8, .as.reg = { REG_GP, 7 }};
|
|
|
|
static const x86opnd_t R8B = { OPND_REG, 8, .as.reg = { REG_GP, 8 }};
|
|
|
|
static const x86opnd_t R9B = { OPND_REG, 8, .as.reg = { REG_GP, 9 }};
|
|
|
|
static const x86opnd_t R10B = { OPND_REG, 8, .as.reg = { REG_GP, 10 }};
|
|
|
|
static const x86opnd_t R11B = { OPND_REG, 8, .as.reg = { REG_GP, 11 }};
|
|
|
|
static const x86opnd_t R12B = { OPND_REG, 8, .as.reg = { REG_GP, 12 }};
|
|
|
|
static const x86opnd_t R13B = { OPND_REG, 8, .as.reg = { REG_GP, 13 }};
|
|
|
|
static const x86opnd_t R14B = { OPND_REG, 8, .as.reg = { REG_GP, 14 }};
|
|
|
|
static const x86opnd_t R15B = { OPND_REG, 8, .as.reg = { REG_GP, 15 }};
|
2020-09-22 11:39:04 -04:00
|
|
|
|
2020-10-20 15:03:06 -04:00
|
|
|
// C argument registers
|
|
|
|
#define NUM_C_ARG_REGS 6
|
|
|
|
#define C_ARG_REGS ( (x86opnd_t[]){ RDI, RSI, RDX, RCX, R8, R9 } )
|
|
|
|
|
2021-10-01 07:17:09 -04:00
|
|
|
// Compute the number of bits needed to store a signed or unsigned value
|
2021-10-01 18:38:39 -04:00
|
|
|
static inline uint32_t sig_imm_size(int64_t imm);
|
|
|
|
static inline uint32_t unsig_imm_size(uint64_t imm);
|
2021-10-01 07:17:09 -04:00
|
|
|
|
2020-09-09 16:45:28 -04:00
|
|
|
// Memory operand with base register and displacement/offset
|
2021-10-01 18:38:39 -04:00
|
|
|
static inline x86opnd_t mem_opnd(uint32_t num_bits, x86opnd_t base_reg, int32_t disp);
|
2020-09-09 16:45:28 -04:00
|
|
|
|
2021-01-27 16:13:27 -05:00
|
|
|
// Scale-index-base memory operand
|
2021-10-01 18:38:39 -04:00
|
|
|
static inline x86opnd_t mem_opnd_sib(uint32_t num_bits, x86opnd_t base_reg, x86opnd_t index_reg, int32_t scale, int32_t disp);
|
2021-01-27 16:13:27 -05:00
|
|
|
|
2020-09-09 16:45:28 -04:00
|
|
|
// Immediate number operand
|
2021-10-01 18:38:39 -04:00
|
|
|
static inline x86opnd_t imm_opnd(int64_t val);
|
2020-09-09 16:45:28 -04:00
|
|
|
|
2020-09-14 14:36:39 -04:00
|
|
|
// Constant pointer operand
|
2021-10-01 18:38:39 -04:00
|
|
|
static inline x86opnd_t const_ptr_opnd(const void *ptr);
|
2020-09-14 14:36:39 -04:00
|
|
|
|
2020-09-30 16:57:54 -04:00
|
|
|
// Struct member operand
|
|
|
|
#define member_opnd(base_reg, struct_type, member_name) mem_opnd( \
|
|
|
|
8 * sizeof(((struct_type*)0)->member_name), \
|
|
|
|
base_reg, \
|
|
|
|
offsetof(struct_type, member_name) \
|
|
|
|
)
|
|
|
|
|
2020-10-02 12:12:28 -04:00
|
|
|
// Struct member operand with an array index
|
|
|
|
#define member_opnd_idx(base_reg, struct_type, member_name, idx) mem_opnd( \
|
2020-10-05 11:19:11 -04:00
|
|
|
8 * sizeof(((struct_type*)0)->member_name[0]), \
|
2020-10-02 12:12:28 -04:00
|
|
|
base_reg, \
|
|
|
|
(offsetof(struct_type, member_name) + \
|
2020-10-05 11:19:11 -04:00
|
|
|
sizeof(((struct_type*)0)->member_name[0]) * idx) \
|
2020-10-02 12:12:28 -04:00
|
|
|
)
|
|
|
|
|
2021-07-07 15:26:58 -04:00
|
|
|
// Machine code allocation
|
2021-10-01 18:38:39 -04:00
|
|
|
static uint8_t *alloc_exec_mem(uint32_t mem_size);
|
|
|
|
static code_page_t *alloc_code_page(void);
|
|
|
|
static void free_code_page(code_page_t *code_page);
|
|
|
|
|
|
|
|
|
|
|
|
static inline void cb_init(codeblock_t *cb, uint8_t *mem_block, uint32_t mem_size);
|
|
|
|
static inline void cb_align_pos(codeblock_t *cb, uint32_t multiple);
|
|
|
|
static inline void cb_set_pos(codeblock_t *cb, uint32_t pos);
|
|
|
|
static inline void cb_set_write_ptr(codeblock_t *cb, uint8_t *code_ptr);
|
|
|
|
static inline uint8_t *cb_get_ptr(codeblock_t *cb, uint32_t index);
|
|
|
|
static inline uint8_t *cb_get_write_ptr(codeblock_t *cb);
|
|
|
|
static inline void cb_write_byte(codeblock_t *cb, uint8_t byte);
|
|
|
|
static inline void cb_write_bytes(codeblock_t *cb, uint32_t num_bytes, ...);
|
|
|
|
static inline void cb_write_int(codeblock_t *cb, uint64_t val, uint32_t num_bits);
|
|
|
|
static inline uint32_t cb_new_label(codeblock_t *cb, const char *name);
|
|
|
|
static inline void cb_write_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void cb_label_ref(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void cb_link_labels(codeblock_t *cb);
|
2020-09-04 15:56:00 -04:00
|
|
|
|
2020-09-08 16:45:35 -04:00
|
|
|
// Encode individual instructions into a code block
|
2021-10-01 18:38:39 -04:00
|
|
|
static inline void add(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void and(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void call_ptr(codeblock_t *cb, x86opnd_t scratch_reg, uint8_t *dst_ptr);
|
|
|
|
static inline void call_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void call(codeblock_t *cb, x86opnd_t opnd);
|
|
|
|
static inline void cmova(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovae(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovb(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovbe(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovc(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmove(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovg(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovge(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovl(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovle(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovna(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnae(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnb(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnbe(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnc(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovne(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovng(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnge(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnl(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnle(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovno(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnp(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovns(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovnz(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovo(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovp(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovpe(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovpo(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovs(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmovz(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void cmp(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void cdq(codeblock_t *cb);
|
|
|
|
static inline void cqo(codeblock_t *cb);
|
|
|
|
static inline void int3(codeblock_t *cb);
|
|
|
|
static inline void ja_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jae_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jb_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jbe_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jc_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void je_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jg_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jge_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jl_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jle_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jna_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnae_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnb_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnbe_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnc_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jne_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jng_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnge_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnl_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnle_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jno_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnp_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jns_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jnz_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jo_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jp_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jpe_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jpo_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void js_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jz_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void ja_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jae_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jb_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jbe_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jc_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void je_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jg_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jge_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jl_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jle_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jna_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnae_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnb_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnbe_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnc_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jne_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jng_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnge_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnl_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnle_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jno_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnp_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jns_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jnz_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jo_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jp_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jpe_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jpo_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void js_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jz_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jmp_label(codeblock_t *cb, uint32_t label_idx);
|
|
|
|
static inline void jmp_ptr(codeblock_t *cb, uint8_t *ptr);
|
|
|
|
static inline void jmp_rm(codeblock_t *cb, x86opnd_t opnd);
|
|
|
|
static inline void jmp32(codeblock_t *cb, int32_t offset);
|
|
|
|
static inline void lea(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void mov(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void movsx(codeblock_t *cb, x86opnd_t dst, x86opnd_t src);
|
|
|
|
static inline void neg(codeblock_t *cb, x86opnd_t opnd);
|
|
|
|
static inline void nop(codeblock_t *cb, uint32_t length);
|
|
|
|
static inline void not(codeblock_t *cb, x86opnd_t opnd);
|
|
|
|
static inline void or(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void pop(codeblock_t *cb, x86opnd_t reg);
|
|
|
|
static inline void popfq(codeblock_t *cb);
|
|
|
|
static inline void push(codeblock_t *cb, x86opnd_t opnd);
|
|
|
|
static inline void pushfq(codeblock_t *cb);
|
|
|
|
static inline void ret(codeblock_t *cb);
|
|
|
|
static inline void sal(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void sar(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void shl(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void shr(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void sub(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void test(codeblock_t *cb, x86opnd_t rm_opnd, x86opnd_t test_opnd);
|
|
|
|
static inline void ud2(codeblock_t *cb);
|
|
|
|
static inline void xchg(codeblock_t *cb, x86opnd_t rm_opnd, x86opnd_t r_opnd);
|
|
|
|
static inline void xor(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
|
|
|
static inline void cb_write_lock_prefix(codeblock_t *cb);
|
2021-03-02 18:27:50 -05:00
|
|
|
|
2020-09-04 15:56:00 -04:00
|
|
|
#endif
|