#include <linux/ptrace.h>
#include "pf_in.h"
#ifdef __i386__
static unsigned char prefix_codes[] = {
0xF0, 0xF2, 0xF3, 0x2E, 0x36, 0x3E, 0x26, 0x64,
0x65, 0x66, 0x67
};
static unsigned int reg_rop[] = {
0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
};
static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
static unsigned int imm_wop[] = { 0xC6, 0xC7 };
static unsigned int rw8[] = { 0x88, 0x8A, 0xC6, 0xAA };
static unsigned int rw32[] = {
0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
};
static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F, 0xAA };
static unsigned int mw16[] = { 0xB70F, 0xBF0F };
static unsigned int mw32[] = { 0x89, 0x8B, 0xC7, 0xAB };
static unsigned int mw64[] = {};
#else
static unsigned char prefix_codes[] = …;
static unsigned int reg_rop[] = …;
static unsigned int reg_wop[] = …;
static unsigned int imm_wop[] = …;
static unsigned int rw8[] = …;
static unsigned int rw32[] = …;
static unsigned int mw8[] = …;
static unsigned int mw16[] = …;
static unsigned int mw32[] = …;
static unsigned int mw64[] = …;
#endif
struct prefix_bits { … };
static int skip_prefix(unsigned char *addr, struct prefix_bits *prf)
{ … }
static int get_opcode(unsigned char *addr, unsigned int *opcode)
{ … }
#define CHECK_OP_TYPE …
enum reason_type get_ins_type(unsigned long ins_addr)
{ … }
#undef CHECK_OP_TYPE
static unsigned int get_ins_reg_width(unsigned long ins_addr)
{ … }
unsigned int get_ins_mem_width(unsigned long ins_addr)
{ … }
enum { … };
static unsigned char *get_reg_w8(int no, int rex, struct pt_regs *regs)
{ … }
static unsigned long *get_reg_w32(int no, struct pt_regs *regs)
{ … }
unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
{ … }
unsigned long get_ins_imm_val(unsigned long ins_addr)
{ … }