[pypy-commit] pypy vmprof-native: remove files not needed by vmprof anymore
plan_rich
pypy.commits at gmail.com
Wed Mar 15 12:22:49 EDT 2017
Author: Richard Plangger <planrichi at gmail.com>
Branch: vmprof-native
Changeset: r90706:47e816fb4917
Date: 2017-03-15 15:44 +0100
http://bitbucket.org/pypy/pypy/changeset/47e816fb4917/
Log: remove files not needed by vmprof anymore
diff too long, truncating to 2000 out of 10237 lines
diff --git a/rpython/rlib/rvmprof/src/shared/libudis86/Makefile.am b/rpython/rlib/rvmprof/src/shared/libudis86/Makefile.am
deleted file mode 100644
--- a/rpython/rlib/rvmprof/src/shared/libudis86/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# -- udis86/libudis86
-#
-
-PYTHON = @PYTHON@
-OPTABLE = @top_srcdir@/docs/x86/optable.xml
-
-MAINTAINERCLEANFILES = Makefile.in
-
-lib_LTLIBRARIES = libudis86.la
-
-libudis86_la_SOURCES = \
- itab.c \
- decode.c \
- syn.c \
- syn-intel.c \
- syn-att.c \
- udis86.c \
- udint.h \
- syn.h \
- decode.h
-
-include_ladir = ${includedir}/libudis86
-include_la_HEADERS = \
- types.h \
- extern.h \
- itab.h
-
-
-BUILT_SOURCES = \
- itab.c \
- itab.h
-
-#
-# DLLs may not contain undefined symbol references.
-# We have the linker check this explicitly.
-#
-if TARGET_WINDOWS
-libudis86_la_LDFLAGS = -no-undefined -version-info 0:0:0
-endif
-
-itab.c itab.h: $(OPTABLE) \
- $(top_srcdir)/scripts/ud_itab.py \
- $(top_srcdir)/scripts/ud_opcode.py
- $(PYTHON) $(top_srcdir)/scripts/ud_itab.py $(OPTABLE) $(srcdir)
-
-
-clean-local:
- rm -rf $(BUILT_SOURCES)
-
-maintainer-clean-local:
diff --git a/rpython/rlib/rvmprof/src/shared/libudis86/README.md b/rpython/rlib/rvmprof/src/shared/libudis86/README.md
deleted file mode 100644
--- a/rpython/rlib/rvmprof/src/shared/libudis86/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# COPYING
-
-Copied from https://github.com/vmt/udis86 and ran the script command to generate itab.h/c
-
-# LICENCE
-
-BSD 2-clause license
diff --git a/rpython/rlib/rvmprof/src/shared/libudis86/decode.c b/rpython/rlib/rvmprof/src/shared/libudis86/decode.c
deleted file mode 100644
--- a/rpython/rlib/rvmprof/src/shared/libudis86/decode.c
+++ /dev/null
@@ -1,1266 +0,0 @@
-/* udis86 - libudis86/decode.c
- *
- * Copyright (c) 2002-2009 Vivek Thampi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "udint.h"
-#include "types.h"
-#include "extern.h"
-#include "decode.h"
-
-#ifndef __UD_STANDALONE__
-# include <string.h>
-#endif /* __UD_STANDALONE__ */
-
-/* The max number of prefixes to an instruction */
-#define MAX_PREFIXES 15
-
-/* rex prefix bits */
-#define REX_W(r) ( ( 0xF & ( r ) ) >> 3 )
-#define REX_R(r) ( ( 0x7 & ( r ) ) >> 2 )
-#define REX_X(r) ( ( 0x3 & ( r ) ) >> 1 )
-#define REX_B(r) ( ( 0x1 & ( r ) ) >> 0 )
-#define REX_PFX_MASK(n) ( ( P_REXW(n) << 3 ) | \
- ( P_REXR(n) << 2 ) | \
- ( P_REXX(n) << 1 ) | \
- ( P_REXB(n) << 0 ) )
-
-/* scable-index-base bits */
-#define SIB_S(b) ( ( b ) >> 6 )
-#define SIB_I(b) ( ( ( b ) >> 3 ) & 7 )
-#define SIB_B(b) ( ( b ) & 7 )
-
-/* modrm bits */
-#define MODRM_REG(b) ( ( ( b ) >> 3 ) & 7 )
-#define MODRM_NNN(b) ( ( ( b ) >> 3 ) & 7 )
-#define MODRM_MOD(b) ( ( ( b ) >> 6 ) & 3 )
-#define MODRM_RM(b) ( ( b ) & 7 )
-
-static int decode_ext(struct ud *u, uint16_t ptr);
-static int decode_opcode(struct ud *u);
-
-enum reg_class { /* register classes */
- REGCLASS_GPR,
- REGCLASS_MMX,
- REGCLASS_CR,
- REGCLASS_DB,
- REGCLASS_SEG,
- REGCLASS_XMM
-};
-
- /*
- * inp_start
- * Should be called before each de-code operation.
- */
-static void
-inp_start(struct ud *u)
-{
- u->inp_ctr = 0;
-}
-
-static uint8_t
-inp_peek(struct ud *u)
-{
- if (u->inp_end == 0) {
- if (u->inp_buf != NULL) {
- if (u->inp_buf_index < u->inp_buf_size) {
- return u->inp_buf[u->inp_buf_index];
- }
- } else if (u->inp_peek != UD_EOI) {
- return u->inp_peek;
- } else {
- int c;
- if ((c = u->inp_hook(u)) != UD_EOI) {
- u->inp_peek = c;
- return u->inp_peek;
- }
- }
- }
- u->inp_end = 1;
- UDERR(u, "byte expected, eoi received\n");
- return 0;
-}
-
-static uint8_t
-inp_next(struct ud *u)
-{
- if (u->inp_end == 0) {
- if (u->inp_buf != NULL) {
- if (u->inp_buf_index < u->inp_buf_size) {
- u->inp_ctr++;
- return (u->inp_curr = u->inp_buf[u->inp_buf_index++]);
- }
- } else {
- int c = u->inp_peek;
- if (c != UD_EOI || (c = u->inp_hook(u)) != UD_EOI) {
- u->inp_peek = UD_EOI;
- u->inp_curr = c;
- u->inp_sess[u->inp_ctr++] = u->inp_curr;
- return u->inp_curr;
- }
- }
- }
- u->inp_end = 1;
- UDERR(u, "byte expected, eoi received\n");
- return 0;
-}
-
-static uint8_t
-inp_curr(struct ud *u)
-{
- return u->inp_curr;
-}
-
-
-/*
- * inp_uint8
- * int_uint16
- * int_uint32
- * int_uint64
- * Load little-endian values from input
- */
-static uint8_t
-inp_uint8(struct ud* u)
-{
- return inp_next(u);
-}
-
-static uint16_t
-inp_uint16(struct ud* u)
-{
- uint16_t r, ret;
-
- ret = inp_next(u);
- r = inp_next(u);
- return ret | (r << 8);
-}
-
-static uint32_t
-inp_uint32(struct ud* u)
-{
- uint32_t r, ret;
-
- ret = inp_next(u);
- r = inp_next(u);
- ret = ret | (r << 8);
- r = inp_next(u);
- ret = ret | (r << 16);
- r = inp_next(u);
- return ret | (r << 24);
-}
-
-static uint64_t
-inp_uint64(struct ud* u)
-{
- uint64_t r, ret;
-
- ret = inp_next(u);
- r = inp_next(u);
- ret = ret | (r << 8);
- r = inp_next(u);
- ret = ret | (r << 16);
- r = inp_next(u);
- ret = ret | (r << 24);
- r = inp_next(u);
- ret = ret | (r << 32);
- r = inp_next(u);
- ret = ret | (r << 40);
- r = inp_next(u);
- ret = ret | (r << 48);
- r = inp_next(u);
- return ret | (r << 56);
-}
-
-
-static UD_INLINE int
-eff_opr_mode(int dis_mode, int rex_w, int pfx_opr)
-{
- if (dis_mode == 64) {
- return rex_w ? 64 : (pfx_opr ? 16 : 32);
- } else if (dis_mode == 32) {
- return pfx_opr ? 16 : 32;
- } else {
- UD_ASSERT(dis_mode == 16);
- return pfx_opr ? 32 : 16;
- }
-}
-
-
-static UD_INLINE int
-eff_adr_mode(int dis_mode, int pfx_adr)
-{
- if (dis_mode == 64) {
- return pfx_adr ? 32 : 64;
- } else if (dis_mode == 32) {
- return pfx_adr ? 16 : 32;
- } else {
- UD_ASSERT(dis_mode == 16);
- return pfx_adr ? 32 : 16;
- }
-}
-
-
-/*
- * decode_prefixes
- *
- * Extracts instruction prefixes.
- */
-static int
-decode_prefixes(struct ud *u)
-{
- int done = 0;
- uint8_t curr = 0, last = 0;
- UD_RETURN_ON_ERROR(u);
-
- do {
- last = curr;
- curr = inp_next(u);
- UD_RETURN_ON_ERROR(u);
- if (u->inp_ctr == MAX_INSN_LENGTH) {
- UD_RETURN_WITH_ERROR(u, "max instruction length");
- }
-
- switch (curr)
- {
- case 0x2E:
- u->pfx_seg = UD_R_CS;
- break;
- case 0x36:
- u->pfx_seg = UD_R_SS;
- break;
- case 0x3E:
- u->pfx_seg = UD_R_DS;
- break;
- case 0x26:
- u->pfx_seg = UD_R_ES;
- break;
- case 0x64:
- u->pfx_seg = UD_R_FS;
- break;
- case 0x65:
- u->pfx_seg = UD_R_GS;
- break;
- case 0x67: /* adress-size override prefix */
- u->pfx_adr = 0x67;
- break;
- case 0xF0:
- u->pfx_lock = 0xF0;
- break;
- case 0x66:
- u->pfx_opr = 0x66;
- break;
- case 0xF2:
- u->pfx_str = 0xf2;
- break;
- case 0xF3:
- u->pfx_str = 0xf3;
- break;
- default:
- /* consume if rex */
- done = (u->dis_mode == 64 && (curr & 0xF0) == 0x40) ? 0 : 1;
- break;
- }
- } while (!done);
- /* rex prefixes in 64bit mode, must be the last prefix */
- if (u->dis_mode == 64 && (last & 0xF0) == 0x40) {
- u->pfx_rex = last;
- }
- return 0;
-}
-
-
-/*
- * vex_l, vex_w
- * Return the vex.L and vex.W bits
- */
-static UD_INLINE uint8_t
-vex_l(const struct ud *u)
-{
- UD_ASSERT(u->vex_op != 0);
- return ((u->vex_op == 0xc4 ? u->vex_b2 : u->vex_b1) >> 2) & 1;
-}
-
-static UD_INLINE uint8_t
-vex_w(const struct ud *u)
-{
- UD_ASSERT(u->vex_op != 0);
- return u->vex_op == 0xc4 ? ((u->vex_b2 >> 7) & 1) : 0;
-}
-
-
-static UD_INLINE uint8_t
-modrm(struct ud * u)
-{
- if ( !u->have_modrm ) {
- u->modrm = inp_next( u );
- u->modrm_offset = (uint8_t) (u->inp_ctr - 1);
- u->have_modrm = 1;
- }
- return u->modrm;
-}
-
-
-static unsigned int
-resolve_operand_size(const struct ud* u, ud_operand_size_t osize)
-{
- switch (osize) {
- case SZ_V:
- return u->opr_mode;
- case SZ_Z:
- return u->opr_mode == 16 ? 16 : 32;
- case SZ_Y:
- return u->opr_mode == 16 ? 32 : u->opr_mode;
- case SZ_RDQ:
- return u->dis_mode == 64 ? 64 : 32;
- case SZ_X:
- UD_ASSERT(u->vex_op != 0);
- return (P_VEXL(u->itab_entry->prefix) && vex_l(u)) ? SZ_QQ : SZ_DQ;
- default:
- return osize;
- }
-}
-
-
-static int resolve_mnemonic( struct ud* u )
-{
- /* resolve 3dnow weirdness. */
- if ( u->mnemonic == UD_I3dnow ) {
- u->mnemonic = ud_itab[ u->le->table[ inp_curr( u ) ] ].mnemonic;
- }
- /* SWAPGS is only valid in 64bits mode */
- if ( u->mnemonic == UD_Iswapgs && u->dis_mode != 64 ) {
- UDERR(u, "swapgs invalid in 64bits mode\n");
- return -1;
- }
-
- if (u->mnemonic == UD_Ixchg) {
- if ((u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_AX &&
- u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_AX) ||
- (u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_EAX &&
- u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_EAX)) {
- u->operand[0].type = UD_NONE;
- u->operand[1].type = UD_NONE;
- u->mnemonic = UD_Inop;
- }
- }
-
- if (u->mnemonic == UD_Inop && u->pfx_repe) {
- u->pfx_repe = 0;
- u->mnemonic = UD_Ipause;
- }
- return 0;
-}
-
-
-/* -----------------------------------------------------------------------------
- * decode_a()- Decodes operands of the type seg:offset
- * -----------------------------------------------------------------------------
- */
-static void
-decode_a(struct ud* u, struct ud_operand *op)
-{
- if (u->opr_mode == 16) {
- /* seg16:off16 */
- op->type = UD_OP_PTR;
- op->size = 32;
- op->lval.ptr.off = inp_uint16(u);
- op->lval.ptr.seg = inp_uint16(u);
- } else {
- /* seg16:off32 */
- op->type = UD_OP_PTR;
- op->size = 48;
- op->lval.ptr.off = inp_uint32(u);
- op->lval.ptr.seg = inp_uint16(u);
- }
-}
-
-/* -----------------------------------------------------------------------------
- * decode_gpr() - Returns decoded General Purpose Register
- * -----------------------------------------------------------------------------
- */
-static enum ud_type
-decode_gpr(register struct ud* u, unsigned int s, unsigned char rm)
-{
- switch (s) {
- case 64:
- return UD_R_RAX + rm;
- case 32:
- return UD_R_EAX + rm;
- case 16:
- return UD_R_AX + rm;
- case 8:
- if (u->dis_mode == 64 && u->pfx_rex) {
- if (rm >= 4)
- return UD_R_SPL + (rm-4);
- return UD_R_AL + rm;
- } else return UD_R_AL + rm;
- case 0:
- /* invalid size in case of a decode error */
- UD_ASSERT(u->error);
- return UD_NONE;
- default:
- UD_ASSERT(!"invalid operand size");
- return UD_NONE;
- }
-}
-
-static void
-decode_reg(struct ud *u,
- struct ud_operand *opr,
- int type,
- int num,
- int size)
-{
- int reg;
- size = resolve_operand_size(u, size);
- switch (type) {
- case REGCLASS_GPR : reg = decode_gpr(u, size, num); break;
- case REGCLASS_MMX : reg = UD_R_MM0 + (num & 7); break;
- case REGCLASS_XMM :
- reg = num + (size == SZ_QQ ? UD_R_YMM0 : UD_R_XMM0);
- break;
- case REGCLASS_CR : reg = UD_R_CR0 + num; break;
- case REGCLASS_DB : reg = UD_R_DR0 + num; break;
- case REGCLASS_SEG : {
- /*
- * Only 6 segment registers, anything else is an error.
- */
- if ((num & 7) > 5) {
- UDERR(u, "invalid segment register value\n");
- return;
- } else {
- reg = UD_R_ES + (num & 7);
- }
- break;
- }
- default:
- UD_ASSERT(!"invalid register type");
- return;
- }
- opr->type = UD_OP_REG;
- opr->base = reg;
- opr->size = size;
-}
-
-
-/*
- * decode_imm
- *
- * Decode Immediate values.
- */
-static void
-decode_imm(struct ud* u, unsigned int size, struct ud_operand *op)
-{
- op->size = resolve_operand_size(u, size);
- op->type = UD_OP_IMM;
-
- switch (op->size) {
- case 8: op->lval.sbyte = inp_uint8(u); break;
- case 16: op->lval.uword = inp_uint16(u); break;
- case 32: op->lval.udword = inp_uint32(u); break;
- case 64: op->lval.uqword = inp_uint64(u); break;
- default: return;
- }
-}
-
-
-/*
- * decode_mem_disp
- *
- * Decode mem address displacement.
- */
-static void
-decode_mem_disp(struct ud* u, unsigned int size, struct ud_operand *op)
-{
- switch (size) {
- case 8:
- op->offset = 8;
- op->lval.ubyte = inp_uint8(u);
- break;
- case 16:
- op->offset = 16;
- op->lval.uword = inp_uint16(u);
- break;
- case 32:
- op->offset = 32;
- op->lval.udword = inp_uint32(u);
- break;
- case 64:
- op->offset = 64;
- op->lval.uqword = inp_uint64(u);
- break;
- default:
- return;
- }
-}
-
-
-/*
- * decode_modrm_reg
- *
- * Decodes reg field of mod/rm byte
- *
- */
-static UD_INLINE void
-decode_modrm_reg(struct ud *u,
- struct ud_operand *operand,
- unsigned int type,
- unsigned int size)
-{
- uint8_t reg = (REX_R(u->_rex) << 3) | MODRM_REG(modrm(u));
- decode_reg(u, operand, type, reg, size);
-}
-
-
-/*
- * decode_modrm_rm
- *
- * Decodes rm field of mod/rm byte
- *
- */
-static void
-decode_modrm_rm(struct ud *u,
- struct ud_operand *op,
- unsigned char type, /* register type */
- unsigned int size) /* operand size */
-
-{
- size_t offset = 0;
- unsigned char mod, rm;
-
- /* get mod, r/m and reg fields */
- mod = MODRM_MOD(modrm(u));
- rm = (REX_B(u->_rex) << 3) | MODRM_RM(modrm(u));
-
- /*
- * If mod is 11b, then the modrm.rm specifies a register.
- *
- */
- if (mod == 3) {
- decode_reg(u, op, type, rm, size);
- return;
- }
-
- /*
- * !11b => Memory Address
- */
- op->type = UD_OP_MEM;
- op->size = resolve_operand_size(u, size);
-
- if (u->adr_mode == 64) {
- op->base = UD_R_RAX + rm;
- if (mod == 1) {
- offset = 8;
- } else if (mod == 2) {
- offset = 32;
- } else if (mod == 0 && (rm & 7) == 5) {
- op->base = UD_R_RIP;
- offset = 32;
- } else {
- offset = 0;
- }
- /*
- * Scale-Index-Base (SIB)
- */
- if ((rm & 7) == 4) {
- inp_next(u);
-
- op->base = UD_R_RAX + (SIB_B(inp_curr(u)) | (REX_B(u->_rex) << 3));
- op->index = UD_R_RAX + (SIB_I(inp_curr(u)) | (REX_X(u->_rex) << 3));
- /* special conditions for base reference */
- if (op->index == UD_R_RSP) {
- op->index = UD_NONE;
- op->scale = UD_NONE;
- } else {
- op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
- }
-
- if (op->base == UD_R_RBP || op->base == UD_R_R13) {
- if (mod == 0) {
- op->base = UD_NONE;
- }
- if (mod == 1) {
- offset = 8;
- } else {
- offset = 32;
- }
- }
- } else {
- op->scale = UD_NONE;
- op->index = UD_NONE;
- }
- } else if (u->adr_mode == 32) {
- op->base = UD_R_EAX + rm;
- if (mod == 1) {
- offset = 8;
- } else if (mod == 2) {
- offset = 32;
- } else if (mod == 0 && rm == 5) {
- op->base = UD_NONE;
- offset = 32;
- } else {
- offset = 0;
- }
-
- /* Scale-Index-Base (SIB) */
- if ((rm & 7) == 4) {
- inp_next(u);
-
- op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
- op->index = UD_R_EAX + (SIB_I(inp_curr(u)) | (REX_X(u->pfx_rex) << 3));
- op->base = UD_R_EAX + (SIB_B(inp_curr(u)) | (REX_B(u->pfx_rex) << 3));
-
- if (op->index == UD_R_ESP) {
- op->index = UD_NONE;
- op->scale = UD_NONE;
- }
-
- /* special condition for base reference */
- if (op->base == UD_R_EBP) {
- if (mod == 0) {
- op->base = UD_NONE;
- }
- if (mod == 1) {
- offset = 8;
- } else {
- offset = 32;
- }
- }
- } else {
- op->scale = UD_NONE;
- op->index = UD_NONE;
- }
- } else {
- const unsigned int bases[] = { UD_R_BX, UD_R_BX, UD_R_BP, UD_R_BP,
- UD_R_SI, UD_R_DI, UD_R_BP, UD_R_BX };
- const unsigned int indices[] = { UD_R_SI, UD_R_DI, UD_R_SI, UD_R_DI,
- UD_NONE, UD_NONE, UD_NONE, UD_NONE };
- op->base = bases[rm & 7];
- op->index = indices[rm & 7];
- op->scale = UD_NONE;
- if (mod == 0 && rm == 6) {
- offset = 16;
- op->base = UD_NONE;
- } else if (mod == 1) {
- offset = 8;
- } else if (mod == 2) {
- offset = 16;
- }
- }
-
- if (offset) {
- decode_mem_disp(u, offset, op);
- } else {
- op->offset = 0;
- }
-}
-
-
-/*
- * decode_moffset
- * Decode offset-only memory operand
- */
-static void
-decode_moffset(struct ud *u, unsigned int size, struct ud_operand *opr)
-{
- opr->type = UD_OP_MEM;
- opr->base = UD_NONE;
- opr->index = UD_NONE;
- opr->scale = UD_NONE;
- opr->size = resolve_operand_size(u, size);
- decode_mem_disp(u, u->adr_mode, opr);
-}
-
-
-static void
-decode_vex_vvvv(struct ud *u, struct ud_operand *opr, unsigned size)
-{
- uint8_t vvvv;
- UD_ASSERT(u->vex_op != 0);
- vvvv = ((u->vex_op == 0xc4 ? u->vex_b2 : u->vex_b1) >> 3) & 0xf;
- decode_reg(u, opr, REGCLASS_XMM, (0xf & ~vvvv), size);
-}
-
-
-/*
- * decode_vex_immreg
- * Decode source operand encoded in immediate byte [7:4]
- */
-static int
-decode_vex_immreg(struct ud *u, struct ud_operand *opr, unsigned size)
-{
- uint8_t imm = inp_next(u);
- uint8_t mask = u->dis_mode == 64 ? 0xf : 0x7;
- UD_RETURN_ON_ERROR(u);
- UD_ASSERT(u->vex_op != 0);
- decode_reg(u, opr, REGCLASS_XMM, mask & (imm >> 4), size);
- return 0;
-}
-
-
-/*
- * decode_operand
- *
- * Decodes a single operand.
- * Returns the type of the operand (UD_NONE if none)
- */
-static int
-decode_operand(struct ud *u,
- struct ud_operand *operand,
- enum ud_operand_code type,
- unsigned int size)
-{
- operand->type = UD_NONE;
- operand->_oprcode = type;
-
- switch (type) {
- case OP_A :
- decode_a(u, operand);
- break;
- case OP_MR:
- decode_modrm_rm(u, operand, REGCLASS_GPR,
- MODRM_MOD(modrm(u)) == 3 ?
- Mx_reg_size(size) : Mx_mem_size(size));
- break;
- case OP_F:
- u->br_far = 1;
- /* intended fall through */
- case OP_M:
- if (MODRM_MOD(modrm(u)) == 3) {
- UDERR(u, "expected modrm.mod != 3\n");
- }
- /* intended fall through */
- case OP_E:
- decode_modrm_rm(u, operand, REGCLASS_GPR, size);
- break;
- case OP_G:
- decode_modrm_reg(u, operand, REGCLASS_GPR, size);
- break;
- case OP_sI:
- case OP_I:
- decode_imm(u, size, operand);
- break;
- case OP_I1:
- operand->type = UD_OP_CONST;
- operand->lval.udword = 1;
- break;
- case OP_N:
- if (MODRM_MOD(modrm(u)) != 3) {
- UDERR(u, "expected modrm.mod == 3\n");
- }
- /* intended fall through */
- case OP_Q:
- decode_modrm_rm(u, operand, REGCLASS_MMX, size);
- break;
- case OP_P:
- decode_modrm_reg(u, operand, REGCLASS_MMX, size);
- break;
- case OP_U:
- if (MODRM_MOD(modrm(u)) != 3) {
- UDERR(u, "expected modrm.mod == 3\n");
- }
- /* intended fall through */
- case OP_W:
- decode_modrm_rm(u, operand, REGCLASS_XMM, size);
- break;
- case OP_V:
- decode_modrm_reg(u, operand, REGCLASS_XMM, size);
- break;
- case OP_H:
- decode_vex_vvvv(u, operand, size);
- break;
- case OP_MU:
- decode_modrm_rm(u, operand, REGCLASS_XMM,
- MODRM_MOD(modrm(u)) == 3 ?
- Mx_reg_size(size) : Mx_mem_size(size));
- break;
- case OP_S:
- decode_modrm_reg(u, operand, REGCLASS_SEG, size);
- break;
- case OP_O:
- decode_moffset(u, size, operand);
- break;
- case OP_R0:
- case OP_R1:
- case OP_R2:
- case OP_R3:
- case OP_R4:
- case OP_R5:
- case OP_R6:
- case OP_R7:
- decode_reg(u, operand, REGCLASS_GPR,
- (REX_B(u->_rex) << 3) | (type - OP_R0), size);
- break;
- case OP_AL:
- case OP_AX:
- case OP_eAX:
- case OP_rAX:
- decode_reg(u, operand, REGCLASS_GPR, 0, size);
- break;
- case OP_CL:
- case OP_CX:
- case OP_eCX:
- decode_reg(u, operand, REGCLASS_GPR, 1, size);
- break;
- case OP_DL:
- case OP_DX:
- case OP_eDX:
- decode_reg(u, operand, REGCLASS_GPR, 2, size);
- break;
- case OP_ES:
- case OP_CS:
- case OP_DS:
- case OP_SS:
- case OP_FS:
- case OP_GS:
- /* in 64bits mode, only fs and gs are allowed */
- if (u->dis_mode == 64) {
- if (type != OP_FS && type != OP_GS) {
- UDERR(u, "invalid segment register in 64bits\n");
- }
- }
- operand->type = UD_OP_REG;
- operand->base = (type - OP_ES) + UD_R_ES;
- operand->size = 16;
- break;
- case OP_J :
- decode_imm(u, size, operand);
- operand->type = UD_OP_JIMM;
- break ;
- case OP_R :
- if (MODRM_MOD(modrm(u)) != 3) {
- UDERR(u, "expected modrm.mod == 3\n");
- }
- decode_modrm_rm(u, operand, REGCLASS_GPR, size);
- break;
- case OP_C:
- decode_modrm_reg(u, operand, REGCLASS_CR, size);
- break;
- case OP_D:
- decode_modrm_reg(u, operand, REGCLASS_DB, size);
- break;
- case OP_I3 :
- operand->type = UD_OP_CONST;
- operand->lval.sbyte = 3;
- break;
- case OP_ST0:
- case OP_ST1:
- case OP_ST2:
- case OP_ST3:
- case OP_ST4:
- case OP_ST5:
- case OP_ST6:
- case OP_ST7:
- operand->type = UD_OP_REG;
- operand->base = (type - OP_ST0) + UD_R_ST0;
- operand->size = 80;
- break;
- case OP_L:
- decode_vex_immreg(u, operand, size);
- break;
- default :
- operand->type = UD_NONE;
- break;
- }
- return operand->type;
-}
-
-
-/*
- * decode_operands
- *
- * Disassemble upto 3 operands of the current instruction being
- * disassembled. By the end of the function, the operand fields
- * of the ud structure will have been filled.
- */
-static int
-decode_operands(struct ud* u)
-{
- decode_operand(u, &u->operand[0],
- u->itab_entry->operand1.type,
- u->itab_entry->operand1.size);
- if (u->operand[0].type != UD_NONE) {
- decode_operand(u, &u->operand[1],
- u->itab_entry->operand2.type,
- u->itab_entry->operand2.size);
- }
- if (u->operand[1].type != UD_NONE) {
- decode_operand(u, &u->operand[2],
- u->itab_entry->operand3.type,
- u->itab_entry->operand3.size);
- }
- if (u->operand[2].type != UD_NONE) {
- decode_operand(u, &u->operand[3],
- u->itab_entry->operand4.type,
- u->itab_entry->operand4.size);
- }
- return 0;
-}
-
-/* -----------------------------------------------------------------------------
- * clear_insn() - clear instruction structure
- * -----------------------------------------------------------------------------
- */
-static void
-clear_insn(register struct ud* u)
-{
- u->error = 0;
- u->pfx_seg = 0;
- u->pfx_opr = 0;
- u->pfx_adr = 0;
- u->pfx_lock = 0;
- u->pfx_repne = 0;
- u->pfx_rep = 0;
- u->pfx_repe = 0;
- u->pfx_rex = 0;
- u->pfx_str = 0;
- u->mnemonic = UD_Inone;
- u->itab_entry = NULL;
- u->have_modrm = 0;
- u->br_far = 0;
- u->vex_op = 0;
- u->_rex = 0;
- u->operand[0].type = UD_NONE;
- u->operand[1].type = UD_NONE;
- u->operand[2].type = UD_NONE;
- u->operand[3].type = UD_NONE;
-}
-
-
-static UD_INLINE int
-resolve_pfx_str(struct ud* u)
-{
- if (u->pfx_str == 0xf3) {
- if (P_STR(u->itab_entry->prefix)) {
- u->pfx_rep = 0xf3;
- } else {
- u->pfx_repe = 0xf3;
- }
- } else if (u->pfx_str == 0xf2) {
- u->pfx_repne = 0xf3;
- }
- return 0;
-}
-
-
-static int
-resolve_mode( struct ud* u )
-{
- int default64;
- /* if in error state, bail out */
- if ( u->error ) return -1;
-
- /* propagate prefix effects */
- if ( u->dis_mode == 64 ) { /* set 64bit-mode flags */
-
- /* Check validity of instruction m64 */
- if ( P_INV64( u->itab_entry->prefix ) ) {
- UDERR(u, "instruction invalid in 64bits\n");
- return -1;
- }
-
- /* compute effective rex based on,
- * - vex prefix (if any)
- * - rex prefix (if any, and not vex)
- * - allowed prefixes specified by the opcode map
- */
- if (u->vex_op == 0xc4) {
- /* vex has rex.rxb in 1's complement */
- u->_rex = ((~(u->vex_b1 >> 5) & 0x7) /* rex.0rxb */ |
- ((u->vex_b2 >> 4) & 0x8) /* rex.w000 */);
- } else if (u->vex_op == 0xc5) {
- /* vex has rex.r in 1's complement */
- u->_rex = (~(u->vex_b1 >> 5)) & 4;
- } else {
- UD_ASSERT(u->vex_op == 0);
- u->_rex = u->pfx_rex;
- }
- u->_rex &= REX_PFX_MASK(u->itab_entry->prefix);
-
- /* whether this instruction has a default operand size of
- * 64bit, also hardcoded into the opcode map.
- */
- default64 = P_DEF64( u->itab_entry->prefix );
- /* calculate effective operand size */
- if (REX_W(u->_rex)) {
- u->opr_mode = 64;
- } else if ( u->pfx_opr ) {
- u->opr_mode = 16;
- } else {
- /* unless the default opr size of instruction is 64,
- * the effective operand size in the absence of rex.w
- * prefix is 32.
- */
- u->opr_mode = default64 ? 64 : 32;
- }
-
- /* calculate effective address size */
- u->adr_mode = (u->pfx_adr) ? 32 : 64;
- } else if ( u->dis_mode == 32 ) { /* set 32bit-mode flags */
- u->opr_mode = ( u->pfx_opr ) ? 16 : 32;
- u->adr_mode = ( u->pfx_adr ) ? 16 : 32;
- } else if ( u->dis_mode == 16 ) { /* set 16bit-mode flags */
- u->opr_mode = ( u->pfx_opr ) ? 32 : 16;
- u->adr_mode = ( u->pfx_adr ) ? 32 : 16;
- }
-
- return 0;
-}
-
-
-static UD_INLINE int
-decode_insn(struct ud *u, uint16_t ptr)
-{
- UD_ASSERT((ptr & 0x8000) == 0);
- u->itab_entry = &ud_itab[ ptr ];
- u->mnemonic = u->itab_entry->mnemonic;
- return (resolve_pfx_str(u) == 0 &&
- resolve_mode(u) == 0 &&
- decode_operands(u) == 0 &&
- resolve_mnemonic(u) == 0) ? 0 : -1;
-}
-
-
-/*
- * decode_3dnow()
- *
- * Decoding 3dnow is a little tricky because of its strange opcode
- * structure. The final opcode disambiguation depends on the last
- * byte that comes after the operands have been decoded. Fortunately,
- * all 3dnow instructions have the same set of operand types. So we
- * go ahead and decode the instruction by picking an arbitrarily chosen
- * valid entry in the table, decode the operands, and read the final
- * byte to resolve the menmonic.
- */
-static UD_INLINE int
-decode_3dnow(struct ud* u)
-{
- uint16_t ptr;
- UD_ASSERT(u->le->type == UD_TAB__OPC_3DNOW);
- UD_ASSERT(u->le->table[0xc] != 0);
- decode_insn(u, u->le->table[0xc]);
- inp_next(u);
- if (u->error) {
- return -1;
- }
- ptr = u->le->table[inp_curr(u)];
- UD_ASSERT((ptr & 0x8000) == 0);
- u->mnemonic = ud_itab[ptr].mnemonic;
- return 0;
-}
-
-
-static int
-decode_ssepfx(struct ud *u)
-{
- uint8_t idx;
- uint8_t pfx;
-
- /*
- * String prefixes (f2, f3) take precedence over operand
- * size prefix (66).
- */
- pfx = u->pfx_str;
- if (pfx == 0) {
- pfx = u->pfx_opr;
- }
- idx = ((pfx & 0xf) + 1) / 2;
- if (u->le->table[idx] == 0) {
- idx = 0;
- }
- if (idx && u->le->table[idx] != 0) {
- /*
- * "Consume" the prefix as a part of the opcode, so it is no
- * longer exported as an instruction prefix.
- */
- u->pfx_str = 0;
- if (pfx == 0x66) {
- /*
- * consume "66" only if it was used for decoding, leaving
- * it to be used as an operands size override for some
- * simd instructions.
- */
- u->pfx_opr = 0;
- }
- }
- return decode_ext(u, u->le->table[idx]);
-}
-
-
-static int
-decode_vex(struct ud *u)
-{
- uint8_t index;
- if (u->dis_mode != 64 && MODRM_MOD(inp_peek(u)) != 0x3) {
- index = 0;
- } else {
- u->vex_op = inp_curr(u);
- u->vex_b1 = inp_next(u);
- if (u->vex_op == 0xc4) {
- uint8_t pp, m;
- /* 3-byte vex */
- u->vex_b2 = inp_next(u);
- UD_RETURN_ON_ERROR(u);
- m = u->vex_b1 & 0x1f;
- if (m == 0 || m > 3) {
- UD_RETURN_WITH_ERROR(u, "reserved vex.m-mmmm value");
- }
- pp = u->vex_b2 & 0x3;
- index = (pp << 2) | m;
- } else {
- /* 2-byte vex */
- UD_ASSERT(u->vex_op == 0xc5);
- index = 0x1 | ((u->vex_b1 & 0x3) << 2);
- }
- }
- return decode_ext(u, u->le->table[index]);
-}
-
-
-/*
- * decode_ext()
- *
- * Decode opcode extensions (if any)
- */
-static int
-decode_ext(struct ud *u, uint16_t ptr)
-{
- uint8_t idx = 0;
- if ((ptr & 0x8000) == 0) {
- return decode_insn(u, ptr);
- }
- u->le = &ud_lookup_table_list[(~0x8000 & ptr)];
- if (u->le->type == UD_TAB__OPC_3DNOW) {
- return decode_3dnow(u);
- }
-
- switch (u->le->type) {
- case UD_TAB__OPC_MOD:
- /* !11 = 0, 11 = 1 */
- idx = (MODRM_MOD(modrm(u)) + 1) / 4;
- break;
- /* disassembly mode/operand size/address size based tables.
- * 16 = 0,, 32 = 1, 64 = 2
- */
- case UD_TAB__OPC_MODE:
- idx = u->dis_mode != 64 ? 0 : 1;
- break;
- case UD_TAB__OPC_OSIZE:
- idx = eff_opr_mode(u->dis_mode, REX_W(u->pfx_rex), u->pfx_opr) / 32;
- break;
- case UD_TAB__OPC_ASIZE:
- idx = eff_adr_mode(u->dis_mode, u->pfx_adr) / 32;
- break;
- case UD_TAB__OPC_X87:
- idx = modrm(u) - 0xC0;
- break;
- case UD_TAB__OPC_VENDOR:
- if (u->vendor == UD_VENDOR_ANY) {
- /* choose a valid entry */
- idx = (u->le->table[idx] != 0) ? 0 : 1;
- } else if (u->vendor == UD_VENDOR_AMD) {
- idx = 0;
- } else {
- idx = 1;
- }
- break;
- case UD_TAB__OPC_RM:
- idx = MODRM_RM(modrm(u));
- break;
- case UD_TAB__OPC_REG:
- idx = MODRM_REG(modrm(u));
- break;
- case UD_TAB__OPC_SSE:
- return decode_ssepfx(u);
- case UD_TAB__OPC_VEX:
- return decode_vex(u);
- case UD_TAB__OPC_VEX_W:
- idx = vex_w(u);
- break;
- case UD_TAB__OPC_VEX_L:
- idx = vex_l(u);
- break;
- case UD_TAB__OPC_TABLE:
- inp_next(u);
- return decode_opcode(u);
- default:
- UD_ASSERT(!"not reached");
- break;
- }
-
- return decode_ext(u, u->le->table[idx]);
-}
-
-
-static int
-decode_opcode(struct ud *u)
-{
- uint16_t ptr;
- UD_ASSERT(u->le->type == UD_TAB__OPC_TABLE);
- UD_RETURN_ON_ERROR(u);
- ptr = u->le->table[inp_curr(u)];
- return decode_ext(u, ptr);
-}
-
-
-/* =============================================================================
- * ud_decode() - Instruction decoder. Returns the number of bytes decoded.
- * =============================================================================
- */
-unsigned int
-ud_decode(struct ud *u)
-{
- inp_start(u);
- clear_insn(u);
- u->le = &ud_lookup_table_list[0];
- u->error = decode_prefixes(u) == -1 ||
- decode_opcode(u) == -1 ||
- u->error;
- /* Handle decode error. */
- if (u->error) {
- /* clear out the decode data. */
- clear_insn(u);
- /* mark the sequence of bytes as invalid. */
- u->itab_entry = &ud_itab[0]; /* entry 0 is invalid */
- u->mnemonic = u->itab_entry->mnemonic;
- }
-
- /* maybe this stray segment override byte
- * should be spewed out?
- */
- if ( !P_SEG( u->itab_entry->prefix ) &&
- u->operand[0].type != UD_OP_MEM &&
- u->operand[1].type != UD_OP_MEM )
- u->pfx_seg = 0;
-
- u->insn_offset = u->pc; /* set offset of instruction */
- u->asm_buf_fill = 0; /* set translation buffer index to 0 */
- u->pc += u->inp_ctr; /* move program counter by bytes decoded */
-
- /* return number of bytes disassembled. */
- return u->inp_ctr;
-}
-
-/*
-vim: set ts=2 sw=2 expandtab
-*/
diff --git a/rpython/rlib/rvmprof/src/shared/libudis86/decode.h b/rpython/rlib/rvmprof/src/shared/libudis86/decode.h
deleted file mode 100644
--- a/rpython/rlib/rvmprof/src/shared/libudis86/decode.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* udis86 - libudis86/decode.h
- *
- * Copyright (c) 2002-2009 Vivek Thampi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef UD_DECODE_H
-#define UD_DECODE_H
-
-#include "types.h"
-#include "udint.h"
-#include "itab.h"
-
-#define MAX_INSN_LENGTH 15
-
-/* itab prefix bits */
-#define P_none ( 0 )
-
-#define P_inv64 ( 1 << 0 )
-#define P_INV64(n) ( ( n >> 0 ) & 1 )
-#define P_def64 ( 1 << 1 )
-#define P_DEF64(n) ( ( n >> 1 ) & 1 )
-
-#define P_oso ( 1 << 2 )
-#define P_OSO(n) ( ( n >> 2 ) & 1 )
-#define P_aso ( 1 << 3 )
-#define P_ASO(n) ( ( n >> 3 ) & 1 )
-
-#define P_rexb ( 1 << 4 )
-#define P_REXB(n) ( ( n >> 4 ) & 1 )
-#define P_rexw ( 1 << 5 )
-#define P_REXW(n) ( ( n >> 5 ) & 1 )
-#define P_rexr ( 1 << 6 )
-#define P_REXR(n) ( ( n >> 6 ) & 1 )
-#define P_rexx ( 1 << 7 )
-#define P_REXX(n) ( ( n >> 7 ) & 1 )
-
-#define P_seg ( 1 << 8 )
-#define P_SEG(n) ( ( n >> 8 ) & 1 )
-
-#define P_vexl ( 1 << 9 )
-#define P_VEXL(n) ( ( n >> 9 ) & 1 )
-#define P_vexw ( 1 << 10 )
-#define P_VEXW(n) ( ( n >> 10 ) & 1 )
-
-#define P_str ( 1 << 11 )
-#define P_STR(n) ( ( n >> 11 ) & 1 )
-#define P_strz ( 1 << 12 )
-#define P_STR_ZF(n) ( ( n >> 12 ) & 1 )
-
-/* operand type constants -- order is important! */
-
-enum ud_operand_code {
- OP_NONE,
-
- OP_A, OP_E, OP_M, OP_G,
- OP_I, OP_F,
-
- OP_R0, OP_R1, OP_R2, OP_R3,
- OP_R4, OP_R5, OP_R6, OP_R7,
-
- OP_AL, OP_CL, OP_DL,
- OP_AX, OP_CX, OP_DX,
- OP_eAX, OP_eCX, OP_eDX,
- OP_rAX, OP_rCX, OP_rDX,
-
- OP_ES, OP_CS, OP_SS, OP_DS,
- OP_FS, OP_GS,
-
- OP_ST0, OP_ST1, OP_ST2, OP_ST3,
- OP_ST4, OP_ST5, OP_ST6, OP_ST7,
-
- OP_J, OP_S, OP_O,
- OP_I1, OP_I3, OP_sI,
-
- OP_V, OP_W, OP_Q, OP_P,
- OP_U, OP_N, OP_MU, OP_H,
- OP_L,
-
- OP_R, OP_C, OP_D,
-
- OP_MR
-} UD_ATTR_PACKED;
-
-
-/*
- * Operand size constants
- *
- * Symbolic constants for various operand sizes. Some of these constants
- * are given a value equal to the width of the data (SZ_B == 8), such
- * that they maybe used interchangeably in the internals. Modifying them
- * will most certainly break things!
- */
-typedef uint16_t ud_operand_size_t;
-
-#define SZ_NA 0
-#define SZ_Z 1
-#define SZ_V 2
-#define SZ_Y 3
-#define SZ_X 4
-#define SZ_RDQ 7
-#define SZ_B 8
-#define SZ_W 16
-#define SZ_D 32
-#define SZ_Q 64
-#define SZ_T 80
-#define SZ_O 12
-#define SZ_DQ 128 /* double quad */
-#define SZ_QQ 256 /* quad quad */
-
-/*
- * Complex size types; that encode sizes for operands of type MR (memory or
- * register); for internal use only. Id space above 256.
- */
-#define SZ_BD ((SZ_B << 8) | SZ_D)
-#define SZ_BV ((SZ_B << 8) | SZ_V)
-#define SZ_WD ((SZ_W << 8) | SZ_D)
-#define SZ_WV ((SZ_W << 8) | SZ_V)
-#define SZ_WY ((SZ_W << 8) | SZ_Y)
-#define SZ_DY ((SZ_D << 8) | SZ_Y)
-#define SZ_WO ((SZ_W << 8) | SZ_O)
-#define SZ_DO ((SZ_D << 8) | SZ_O)
-#define SZ_QO ((SZ_Q << 8) | SZ_O)
-
-
-/* resolve complex size type.
- */
-static UD_INLINE ud_operand_size_t
-Mx_mem_size(ud_operand_size_t size)
-{
- return (size >> 8) & 0xff;
-}
-
-static UD_INLINE ud_operand_size_t
-Mx_reg_size(ud_operand_size_t size)
-{
- return size & 0xff;
-}
-
-/* A single operand of an entry in the instruction table.
- * (internal use only)
- */
-struct ud_itab_entry_operand
-{
- enum ud_operand_code type;
- ud_operand_size_t size;
-};
-
-
-/* A single entry in an instruction table.
- *(internal use only)
- */
-struct ud_itab_entry
-{
- enum ud_mnemonic_code mnemonic;
- struct ud_itab_entry_operand operand1;
- struct ud_itab_entry_operand operand2;
- struct ud_itab_entry_operand operand3;
- struct ud_itab_entry_operand operand4;
- uint32_t prefix;
-};
-
-struct ud_lookup_table_list_entry {
- const uint16_t *table;
- enum ud_table_type type;
- const char *meta;
-};
-
-extern struct ud_itab_entry ud_itab[];
-extern struct ud_lookup_table_list_entry ud_lookup_table_list[];
-
-#endif /* UD_DECODE_H */
-
-/* vim:cindent
- * vim:expandtab
- * vim:ts=4
- * vim:sw=4
- */
diff --git a/rpython/rlib/rvmprof/src/shared/libudis86/extern.h b/rpython/rlib/rvmprof/src/shared/libudis86/extern.h
deleted file mode 100644
--- a/rpython/rlib/rvmprof/src/shared/libudis86/extern.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* udis86 - libudis86/extern.h
- *
- * Copyright (c) 2002-2009, 2013 Vivek Thampi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef UD_EXTERN_H
-#define UD_EXTERN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "types.h"
-
-#if defined(_MSC_VER) && defined(_USRDLL)
-# ifdef LIBUDIS86_EXPORTS
-# define LIBUDIS86_DLLEXTERN __declspec(dllexport)
-# else
-# define LIBUDIS86_DLLEXTERN __declspec(dllimport)
-# endif
-#else
-# define LIBUDIS86_DLLEXTERN
-#endif
-
-/* ============================= PUBLIC API ================================= */
-
-extern LIBUDIS86_DLLEXTERN void ud_init(struct ud*);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_mode(struct ud*, uint8_t);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_pc(struct ud*, uint64_t);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_input_hook(struct ud*, int (*)(struct ud*));
-
-extern LIBUDIS86_DLLEXTERN void ud_set_input_buffer(struct ud*, const uint8_t*, size_t);
-
-#ifndef __UD_STANDALONE__
-extern LIBUDIS86_DLLEXTERN void ud_set_input_file(struct ud*, FILE*);
-#endif /* __UD_STANDALONE__ */
-
-extern LIBUDIS86_DLLEXTERN void ud_set_vendor(struct ud*, unsigned);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_syntax(struct ud*, void (*)(struct ud*));
-
-extern LIBUDIS86_DLLEXTERN void ud_input_skip(struct ud*, size_t);
-
-extern LIBUDIS86_DLLEXTERN int ud_input_end(const struct ud*);
-
-extern LIBUDIS86_DLLEXTERN unsigned int ud_decode(struct ud*);
-
-extern LIBUDIS86_DLLEXTERN unsigned int ud_disassemble(struct ud*);
-
-extern LIBUDIS86_DLLEXTERN void ud_translate_intel(struct ud*);
-
-extern LIBUDIS86_DLLEXTERN void ud_translate_att(struct ud*);
-
-extern LIBUDIS86_DLLEXTERN const char* ud_insn_asm(const struct ud* u);
-
-extern LIBUDIS86_DLLEXTERN const uint8_t* ud_insn_ptr(const struct ud* u);
-
-extern LIBUDIS86_DLLEXTERN uint64_t ud_insn_off(const struct ud*);
-
-extern LIBUDIS86_DLLEXTERN const char* ud_insn_hex(struct ud*);
-
-extern LIBUDIS86_DLLEXTERN unsigned int ud_insn_len(const struct ud* u);
-
-extern LIBUDIS86_DLLEXTERN const struct ud_operand* ud_insn_opr(const struct ud *u, unsigned int n);
-
-extern LIBUDIS86_DLLEXTERN int ud_opr_is_sreg(const struct ud_operand *opr);
-
-extern LIBUDIS86_DLLEXTERN int ud_opr_is_gpr(const struct ud_operand *opr);
-
-extern LIBUDIS86_DLLEXTERN enum ud_mnemonic_code ud_insn_mnemonic(const struct ud *u);
-
-extern LIBUDIS86_DLLEXTERN const char* ud_lookup_mnemonic(enum ud_mnemonic_code c);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_user_opaque_data(struct ud*, void*);
-
-extern LIBUDIS86_DLLEXTERN void* ud_get_user_opaque_data(const struct ud*);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_asm_buffer(struct ud *u, char *buf, size_t size);
-
-extern LIBUDIS86_DLLEXTERN void ud_set_sym_resolver(struct ud *u,
- const char* (*resolver)(struct ud*,
- uint64_t addr,
- int64_t *offset));
-
-/* ========================================================================== */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* UD_EXTERN_H */
diff --git a/rpython/rlib/rvmprof/src/shared/libudis86/itab.c b/rpython/rlib/rvmprof/src/shared/libudis86/itab.c
deleted file mode 100644
--- a/rpython/rlib/rvmprof/src/shared/libudis86/itab.c
+++ /dev/null
@@ -1,5946 +0,0 @@
-/* itab.c -- generated by udis86:scripts/ud_itab.py, do no edit */
-#include "decode.h"
-
-#define GROUP(n) (0x8000 | (n))
-#define INVALID 0
-
-
-const uint16_t ud_itab__0[] = {
- /* 0 */ 15, 16, 17, 18,
- /* 4 */ 19, 20, GROUP(1), GROUP(2),
- /* 8 */ 964, 965, 966, 967,
- /* c */ 968, 969, GROUP(3), GROUP(4),
- /* 10 */ 5, 6, 7, 8,
- /* 14 */ 9, 10, GROUP(284), GROUP(285),
- /* 18 */ 1336, 1337, 1338, 1339,
- /* 1c */ 1340, 1341, GROUP(286), GROUP(287),
- /* 20 */ 49, 50, 51, 52,
- /* 24 */ 53, 54, INVALID, GROUP(288),
- /* 28 */ 1407, 1408, 1409, 1410,
- /* 2c */ 1411, 1412, INVALID, GROUP(289),
- /* 30 */ 1487, 1488, 1489, 1490,
- /* 34 */ 1491, 1492, INVALID, GROUP(290),
- /* 38 */ 100, 101, 102, 103,
- /* 3c */ 104, 105, INVALID, GROUP(291),
- /* 40 */ 699, 700, 701, 702,
- /* 44 */ 703, 704, 705, 706,
- /* 48 */ 175, 176, 177, 178,
- /* 4c */ 179, 180, 181, 182,
- /* 50 */ 1246, 1247, 1248, 1249,
- /* 54 */ 1250, 1251, 1252, 1253,
- /* 58 */ 1101, 1102, 1103, 1104,
- /* 5c */ 1105, 1106, 1107, 1108,
- /* 60 */ GROUP(292), GROUP(295), GROUP(298), GROUP(299),
- /* 64 */ INVALID, INVALID, INVALID, INVALID,
- /* 68 */ 1254, 697, 1256, 698,
- /* 6c */ 709, GROUP(300), 982, GROUP(301),
- /* 70 */ 726, 728, 730, 732,
- /* 74 */ 734, 736, 738, 740,
- /* 78 */ 742, 744, 746, 748,
- /* 7c */ 750, 752, 754, 756,
- /* 80 */ GROUP(302), GROUP(303), GROUP(304), GROUP(313),
- /* 84 */ 1433, 1434, 1475, 1476,
- /* 88 */ 828, 829, 830, 831,
- /* 8c */ 832, 770, 833, GROUP(314),
- /* 90 */ 1477, 1478, 1479, 1480,
- /* 94 */ 1481, 1482, 1483, 1484,
- /* 98 */ GROUP(315), GROUP(316), GROUP(317), 1470,
- /* 9c */ GROUP(318), GROUP(322), 1310, 766,
- /* a0 */ 834, 835, 836, 837,
- /* a4 */ 922, GROUP(326), 114, GROUP(327),
- /* a8 */ 1435, 1436, 1402, GROUP(328),
- /* ac */ 790, GROUP(329), 1346, GROUP(330),
- /* b0 */ 838, 839, 840, 841,
- /* b4 */ 842, 843, 844, 845,
- /* b8 */ 846, 847, 848, 849,
- /* bc */ 850, 851, 852, 853,
- /* c0 */ GROUP(331), GROUP(332), 1301, 1302,
- /* c4 */ GROUP(333), GROUP(403), GROUP(405), GROUP(406),
- /* c8 */ 200, 776, 1303, 1304,
- /* cc */ 713, 714, GROUP(407), GROUP(408),
- /* d0 */ GROUP(409), GROUP(410), GROUP(411), GROUP(412),
- /* d4 */ GROUP(413), GROUP(414), GROUP(415), 1486,
- /* d8 */ GROUP(416), GROUP(419), GROUP(422), GROUP(425),
- /* dc */ GROUP(428), GROUP(431), GROUP(434), GROUP(437),
- /* e0 */ 794, 795, 796, GROUP(440),
- /* e4 */ 690, 691, 978, 979,
- /* e8 */ 72, 763, GROUP(441), 765,
- /* ec */ 692, 693, 980, 981,
- /* f0 */ 789, 712, 1299, 1300,
- /* f4 */ 687, 83, GROUP(442), GROUP(443),
- /* f8 */ 77, 1395, 81, 1398,
- /* fc */ 78, 1396, GROUP(444), GROUP(445),
-};
-
-static const uint16_t ud_itab__1[] = {
- /* 0 */ 1240, INVALID,
-};
-
-static const uint16_t ud_itab__2[] = {
- /* 0 */ 1096, INVALID,
-};
-
-static const uint16_t ud_itab__3[] = {
- /* 0 */ 1241, INVALID,
-};
-
-static const uint16_t ud_itab__4[] = {
- /* 0 */ GROUP(5), GROUP(6), 767, 797,
- /* 4 */ INVALID, 1426, 82, 1431,
- /* 8 */ 716, 1471, INVALID, 1444,
- /* c */ INVALID, GROUP(27), 430, GROUP(28),
- /* 10 */ GROUP(29), GROUP(30), GROUP(31), GROUP(34),
- /* 14 */ GROUP(35), GROUP(36), GROUP(37), GROUP(40),
- /* 18 */ GROUP(41), 955, 956, 957,
- /* 1c */ 958, 959, 960, 961,
- /* 20 */ 854, 855, 856, 857,
- /* 24 */ INVALID, INVALID, INVALID, INVALID,
- /* 28 */ GROUP(42), GROUP(43), GROUP(44), GROUP(45),
- /* 2c */ GROUP(46), GROUP(47), GROUP(48), GROUP(49),
- /* 30 */ 1472, 1297, 1295, 1296,
- /* 34 */ GROUP(50), GROUP(52), INVALID, 1514,
- /* 38 */ GROUP(54), INVALID, GROUP(116), INVALID,
- /* 3c */ INVALID, INVALID, INVALID, INVALID,
- /* 40 */ 84, 85, 86, 87,
- /* 44 */ 88, 89, 90, 91,
- /* 48 */ 92, 93, 94, 95,
- /* 4c */ 96, 97, 98, 99,
- /* 50 */ GROUP(143), GROUP(144), GROUP(145), GROUP(146),
- /* 54 */ GROUP(147), GROUP(148), GROUP(149), GROUP(150),
- /* 58 */ GROUP(151), GROUP(152), GROUP(153), GROUP(154),
- /* 5c */ GROUP(155), GROUP(156), GROUP(157), GROUP(158),
- /* 60 */ GROUP(159), GROUP(160), GROUP(161), GROUP(162),
- /* 64 */ GROUP(163), GROUP(164), GROUP(165), GROUP(166),
- /* 68 */ GROUP(167), GROUP(168), GROUP(169), GROUP(170),
- /* 6c */ GROUP(171), GROUP(172), GROUP(173), GROUP(176),
- /* 70 */ GROUP(177), GROUP(178), GROUP(182), GROUP(186),
- /* 74 */ GROUP(191), GROUP(192), GROUP(193), 199,
- /* 78 */ GROUP(194), GROUP(195), INVALID, INVALID,
- /* 7c */ GROUP(196), GROUP(197), GROUP(198), GROUP(201),
- /* 80 */ 727, 729, 731, 733,
- /* 84 */ 735, 737, 739, 741,
- /* 88 */ 743, 745, 747, 749,
- /* 8c */ 751, 753, 755, 757,
- /* 90 */ 1350, 1351, 1352, 1353,
- /* 94 */ 1354, 1355, 1356, 1357,
- /* 98 */ 1358, 1359, 1360, 1361,
- /* 9c */ 1362, 1363, 1364, 1365,
- /* a0 */ 1245, 1100, 131, 1670,
- /* a4 */ 1375, 1376, GROUP(202), GROUP(207),
- /* a8 */ 1244, 1099, 1305, 1675,
- /* ac */ 1377, 1378, GROUP(215), 694,
- /* b0 */ 122, 123, 775, 1673,
- /* b4 */ 772, 773, 940, 941,
- /* b8 */ GROUP(221), INVALID, GROUP(222), 1671,
- /* bc */ 1659, 1660, 930, 931,
- /* c0 */ 1473, 1474, GROUP(223), 904,
- /* c4 */ GROUP(224), GROUP(225), GROUP(226), GROUP(227),
- /* c8 */ 1661, 1662, 1663, 1664,
- /* cc */ 1665, 1666, 1667, 1668,
- /* d0 */ GROUP(236), GROUP(237), GROUP(238), GROUP(239),
- /* d4 */ GROUP(240), GROUP(241), GROUP(242), GROUP(243),
- /* d8 */ GROUP(244), GROUP(245), GROUP(246), GROUP(247),
- /* dc */ GROUP(248), GROUP(249), GROUP(250), GROUP(251),
- /* e0 */ GROUP(252), GROUP(253), GROUP(254), GROUP(255),
- /* e4 */ GROUP(256), GROUP(257), GROUP(258), GROUP(259),
- /* e8 */ GROUP(260), GROUP(261), GROUP(262), GROUP(263),
- /* ec */ GROUP(264), GROUP(265), GROUP(266), GROUP(267),
- /* f0 */ GROUP(268), GROUP(269), GROUP(270), GROUP(271),
- /* f4 */ GROUP(272), GROUP(273), GROUP(274), GROUP(275),
- /* f8 */ GROUP(277), GROUP(278), GROUP(279), GROUP(280),
- /* fc */ GROUP(281), GROUP(282), GROUP(283), INVALID,
-};
-
-static const uint16_t ud_itab__5[] = {
- /* 0 */ 1384, 1406, 786, 798,
- /* 4 */ 1453, 1454, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__6[] = {
- /* 0 */ GROUP(7), GROUP(8),
-};
-
-static const uint16_t ud_itab__7[] = {
- /* 0 */ 1374, 1383, 785, 774,
- /* 4 */ 1385, INVALID, 787, 719,
-};
-
-static const uint16_t ud_itab__8[] = {
- /* 0 */ GROUP(9), GROUP(14), GROUP(15), GROUP(16),
- /* 4 */ 1386, INVALID, 788, GROUP(25),
-};
-
-static const uint16_t ud_itab__9[] = {
- /* 0 */ INVALID, GROUP(10), GROUP(11), GROUP(12),
- /* 4 */ GROUP(13), INVALID, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__10[] = {
- /* 0 */ INVALID, 1455, INVALID,
-};
-
-static const uint16_t ud_itab__11[] = {
- /* 0 */ INVALID, 1461, INVALID,
-};
-
-static const uint16_t ud_itab__12[] = {
- /* 0 */ INVALID, 1462, INVALID,
-};
-
-static const uint16_t ud_itab__13[] = {
- /* 0 */ INVALID, 1463, INVALID,
-};
-
-static const uint16_t ud_itab__14[] = {
- /* 0 */ 824, 952, INVALID, INVALID,
- /* 4 */ INVALID, INVALID, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__15[] = {
- /* 0 */ 1485, 1508, INVALID, INVALID,
- /* 4 */ INVALID, INVALID, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__16[] = {
- /* 0 */ GROUP(17), GROUP(18), GROUP(19), GROUP(20),
- /* 4 */ GROUP(21), GROUP(22), GROUP(23), GROUP(24),
-};
-
-static const uint16_t ud_itab__17[] = {
- /* 0 */ 1466, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__18[] = {
- /* 0 */ 1467, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__19[] = {
- /* 0 */ 1468, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__20[] = {
- /* 0 */ 1469, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__21[] = {
- /* 0 */ 1397, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__22[] = {
- /* 0 */ 80, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__23[] = {
- /* 0 */ 1399, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__24[] = {
- /* 0 */ 720, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__25[] = {
- /* 0 */ 1425, GROUP(26), INVALID, INVALID,
- /* 4 */ INVALID, INVALID, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__26[] = {
- /* 0 */ 1298, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__27[] = {
- /* 0 */ 1119, 1120, 1121, 1122,
- /* 4 */ 1123, 1124, 1125, 1126,
-};
-
-static const uint16_t ud_itab__28[] = {
- /* 0 */ INVALID, INVALID, INVALID, INVALID,
- /* 4 */ INVALID, INVALID, INVALID, INVALID,
- /* 8 */ INVALID, INVALID, INVALID, INVALID,
- /* c */ 1216, 1217, INVALID, INVALID,
- /* 10 */ INVALID, INVALID, INVALID, INVALID,
- /* 14 */ INVALID, INVALID, INVALID, INVALID,
- /* 18 */ INVALID, INVALID, INVALID, INVALID,
- /* 1c */ 1218, 1219, INVALID, INVALID,
- /* 20 */ INVALID, INVALID, INVALID, INVALID,
- /* 24 */ INVALID, INVALID, INVALID, INVALID,
- /* 28 */ INVALID, INVALID, INVALID, INVALID,
- /* 2c */ INVALID, INVALID, INVALID, INVALID,
- /* 30 */ INVALID, INVALID, INVALID, INVALID,
- /* 34 */ INVALID, INVALID, INVALID, INVALID,
- /* 38 */ INVALID, INVALID, INVALID, INVALID,
- /* 3c */ INVALID, INVALID, INVALID, INVALID,
- /* 40 */ INVALID, INVALID, INVALID, INVALID,
- /* 44 */ INVALID, INVALID, INVALID, INVALID,
- /* 48 */ INVALID, INVALID, INVALID, INVALID,
- /* 4c */ INVALID, INVALID, INVALID, INVALID,
- /* 50 */ INVALID, INVALID, INVALID, INVALID,
- /* 54 */ INVALID, INVALID, INVALID, INVALID,
- /* 58 */ INVALID, INVALID, INVALID, INVALID,
- /* 5c */ INVALID, INVALID, INVALID, INVALID,
- /* 60 */ INVALID, INVALID, INVALID, INVALID,
- /* 64 */ INVALID, INVALID, INVALID, INVALID,
- /* 68 */ INVALID, INVALID, INVALID, INVALID,
- /* 6c */ INVALID, INVALID, INVALID, INVALID,
- /* 70 */ INVALID, INVALID, INVALID, INVALID,
- /* 74 */ INVALID, INVALID, INVALID, INVALID,
- /* 78 */ INVALID, INVALID, INVALID, INVALID,
- /* 7c */ INVALID, INVALID, INVALID, INVALID,
- /* 80 */ INVALID, INVALID, INVALID, INVALID,
- /* 84 */ INVALID, INVALID, INVALID, INVALID,
- /* 88 */ INVALID, INVALID, 1220, INVALID,
- /* 8c */ INVALID, INVALID, 1221, INVALID,
- /* 90 */ 1222, INVALID, INVALID, INVALID,
- /* 94 */ 1223, INVALID, 1224, 1225,
- /* 98 */ INVALID, INVALID, 1226, INVALID,
- /* 9c */ INVALID, INVALID, 1227, INVALID,
- /* a0 */ 1228, INVALID, INVALID, INVALID,
- /* a4 */ 1229, INVALID, 1230, 1231,
- /* a8 */ INVALID, INVALID, 1232, INVALID,
- /* ac */ INVALID, INVALID, 1233, INVALID,
- /* b0 */ 1234, INVALID, INVALID, INVALID,
- /* b4 */ 1235, INVALID, 1236, 1237,
- /* b8 */ INVALID, INVALID, INVALID, 1238,
- /* bc */ INVALID, INVALID, INVALID, 1239,
- /* c0 */ INVALID, INVALID, INVALID, INVALID,
- /* c4 */ INVALID, INVALID, INVALID, INVALID,
- /* c8 */ INVALID, INVALID, INVALID, INVALID,
- /* cc */ INVALID, INVALID, INVALID, INVALID,
- /* d0 */ INVALID, INVALID, INVALID, INVALID,
- /* d4 */ INVALID, INVALID, INVALID, INVALID,
- /* d8 */ INVALID, INVALID, INVALID, INVALID,
- /* dc */ INVALID, INVALID, INVALID, INVALID,
- /* e0 */ INVALID, INVALID, INVALID, INVALID,
- /* e4 */ INVALID, INVALID, INVALID, INVALID,
- /* e8 */ INVALID, INVALID, INVALID, INVALID,
- /* ec */ INVALID, INVALID, INVALID, INVALID,
- /* f0 */ INVALID, INVALID, INVALID, INVALID,
- /* f4 */ INVALID, INVALID, INVALID, INVALID,
- /* f8 */ INVALID, INVALID, INVALID, INVALID,
- /* fc */ INVALID, INVALID, INVALID, INVALID,
-};
-
-static const uint16_t ud_itab__29[] = {
- /* 0 */ 936, 925, 928, 932,
-};
-
-static const uint16_t ud_itab__30[] = {
- /* 0 */ 938, 926, 929, 934,
-};
-
-static const uint16_t ud_itab__31[] = {
- /* 0 */ GROUP(32), GROUP(33),
-};
-
-static const uint16_t ud_itab__32[] = {
- /* 0 */ 892, 1563, 1571, 888,
-};
More information about the pypy-commit
mailing list