亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? asm-x86.c

?? It s a Linux disassemble, can set break point, disassemble ELF file.
?? C
字號:
/* * libDASM * * Copyright (C) 2000-2003 Patrick Alken * This library comes with absolutely NO WARRANTY * * Should you choose to use and/or modify this source code, please * do so under the terms of the GNU General Public License under which * this library is distributed. * * $Id: asm-x86.c,v 1.1.1.1 2004/04/26 00:40:11 pa33 Exp $ */#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>#include <strings.h>#include <assert.h>#include "asm-x86.h"#include "inames-x86.h"#include "operands-x86.h"#include "optab-x86.h"#include "regs-x86.h"/* * Top-level includes */#include "assemble.h"#include "libDASM.h"static int parseInstructionAsm(char *buf,                               struct instructionInfo *info);static int findInstructionAsm(struct instructionInfo *insInfo,                              struct x86OpCode **match,                              char *errstr);static int x86isConstantAsm(char *str, struct immediateInfo *immInfo);static int matchOperandsAsm(struct instructionInfo *ins,                            struct x86OpCode *match,                            int num, char *errstr);static int binarySearchAsm(char *needle, const char **haystack,                           int n);/*x86procAsm()  Assemble one x86 instructionInputs: ws     - asm workspace        str    - buffer containing instruction        outbuf - where to store resulting opcodeReturn: length of 'outbuf' upon success        -1 upon error (error goes in outbuf)*/intx86procAsm(struct asmWorkspace *ws, char *str,           unsigned char *outbuf){  struct instructionInfo insInfo;  struct x86OpCode *match;  int ret;  char buffer[MAXLINE];  strncpy(buffer, str, MAXLINE - 1);  memset((void *) &insInfo, '\0', sizeof(struct instructionInfo));  /*   * Determine if we have a valid instruction: if so   * put name/operand stuff in insInfo   */  ret = parseInstructionAsm(buffer, &insInfo);  if (ret < 0)  {    sprintf((char *) outbuf,            "x86procAsm: parse error:%d: %s",            -ret,            str);    return (-1);  }  else if (ret == 0)  {    sprintf((char *) outbuf,            "x86procAsm: invalid instruction: %s",            str);    return (-1);  }  /*   * If we get here, we have a valid instruction name   * with at most 3 operands   */  printf("[%s]\n", str);  for (ret = 0; ret < insInfo.opnum; ++ret)  {    if (insInfo.operands[ret] & REGISTER)    {      printf("  operand %d = [%s] (register)\n",             ret + 1,             x86RegistersDASM[insInfo.opinfo[ret]].name);    }    else if (insInfo.operands[ret] & IMMEDIATE)    {      if (insInfo.hasImmed)      {        printf("  operand %d = [%lx] (constant)\n",          ret + 1,          insInfo.immInfo.inum);      }    }  }  ret = findInstructionAsm(&insInfo, &match, (char *)outbuf);  if (ret <= 0)    return (ret);  /*   * We have a matching instruction   */  ret = 0;  /*   * Store opcode into outbuf   */  strncpy((char *) outbuf, match->mcode, match->oplen);  ret += match->oplen;  outbuf += match->oplen;  /*   * Store immediate byte(s) into outbuf: the size   * attributes of the immediate bytes will have been   * filled in by findInstructionAsm()   */  if (insInfo.immInfo.flags != 0)  {    /*     * XXX - this is little endian specific     */    if (insInfo.immInfo.flags & DASM_IMMED_BITS8)    {      /*       * The 0xFF is unnecessary but I'm paranoid       */      *outbuf++ = (unsigned char) insInfo.immInfo.inum & 0xFF;      ret += 1;    }    else if (insInfo.immInfo.flags & DASM_IMMED_BITS16)    {      *outbuf++ = (unsigned char) insInfo.immInfo.inum & 0xFF;      *outbuf++ = (unsigned char) (insInfo.immInfo.inum >> 8) & 0xFF;      ret += 2;    }    else if (insInfo.immInfo.flags & DASM_IMMED_BITS32)    {      *outbuf++ = (unsigned char) insInfo.immInfo.inum & 0xFF;      *outbuf++ = (unsigned char) (insInfo.immInfo.inum >> 8) & 0xFF;      *outbuf++ = (unsigned char) (insInfo.immInfo.inum >> 16) & 0xFF;      *outbuf++ = (unsigned char) (insInfo.immInfo.inum >> 24) & 0xFF;      ret += 4;    }    else      assert(0);  } /* if (insInfo.immInfo.flags != 0) */  return (ret);} /* x86procAsm() *//***************************************************** *              INTERNAL ROUTINES                    * *****************************************************//*parseInstructionAsm()  Called from x86procAsm() to parse an instruction inascii form. Determine if the line is a valid instruction,and isolate instruction name and operands.Inputs: buf - buffer containing ascii instruction        info - where to store resulting infoReturn: Valid instruction: 1 (various values go into info)        Invalid instruction name: 0        Operand parse error: -<num>, where <num> is the position          of 'buf' where parse error occurs*/static intparseInstructionAsm(char *buf, struct instructionInfo *info){  char *origbuf;                 /* original buffer */  char *iname;                   /* name of instruction */  int ret;  int opcnt;                     /* number of operands */  char *operands[3];             /* operands */  struct immediateInfo immInfo;  /* numerical constant info */  int ii;                        /* looping */  unsigned int sizeflag;         /* size of instruction */  origbuf = buf;  /*   * Eliminate any preceding whitespace   */  while (*buf && isspace(*buf))    ++buf;  if (!*buf)    return (0); /* empty string */  /*   * Store location of instruction name   */  iname = buf;  /*   * Advance buf to the end of the instruction name   */  while (*buf && !isspace(*buf))    ++buf;  /*   * Put in a '\0' to isolate instruction name   */  *buf++ = '\0';  /*   * Look for instruction in our list   */  ret = binarySearchAsm(iname,                        x86InstructionNames,                        NUM_ELEMENTS(x86InstructionNames));  if (ret < 0)    return (0); /* instruction not found */  info->name = ret;  /*   * The instruction name is ok, now look at operands   */  opcnt = 0;  while (*buf)  {    /*     * Get rid of whitespace     */    while (*buf && isspace(*buf))      ++buf;    if (!*buf)      break;    if (*buf == ',')    {      if (!opcnt)        return (-(buf - origbuf)); /* comma with no operand */      *buf++ = '\0';      while (*buf && isspace(*buf))        ++buf;      if (!*buf)        break;    }    if (opcnt >= 3)      return (-(buf - origbuf)); /* too many operands */    operands[opcnt++] = buf;    /*     * Advance to the end of this operand     */    while (*buf && !isspace(*buf) && (*buf != ','))      ++buf;    /*     * Set this character to \0 to isolate the operand     */    *buf++ = '\0';  } /* while (*buf) */  assert(opcnt <= 3);  printf("INSTRUCTION: %s\n", iname);  /*   * We now have pointers to each operand. We will   * now determine what types of operands we have   */  for (ii = 0; ii < opcnt; ++ii)  {    printf("operand %d = [%s]\n", ii, operands[ii]);    if ((ret = x86findRegisterDASM(operands[ii])) >= 0)    {      /*       * This operand is a register       */      info->operands[ii] = x86RegistersDASM[ret].flags;      info->opinfo[ii] = ret;    }    else if ((ret = x86isConstantAsm(operands[ii], &immInfo)) >= 0)    {      /*       * This operand is a numerical value (integer or float)       */      info->operands[ii] = IMMEDIATE;      info->immInfo = immInfo;      info->hasImmed = 1;    }  #if 0    else if ((ret = x86isEffectiveAddressAsm()) >= 0)    {    }  #endif  }  info->opnum = opcnt;  return (1);} /* parseInstructionAsm() *//*findInstructionAsm()  This routine is called after parseInstructionAsm() to locatea given instruction and verify it has correct operands.Inputs: insInfo - various information about instruction provided by                  parseInstructionAsm()        match   - where to store match        errstr  - where to store errorsReturn: 1 if instruction is found (goes in match)        0 if not        -1 if error occurs (error goes in errstr)Side effects: If instruction is found and has an immediate operand,              the size attributes of insInfo->immInfo are filled in.*/static intfindInstructionAsm(struct instructionInfo *insInfo,                   struct x86OpCode **match, char *errstr){  struct x86OpCode *candidates;  /* instruction candidates */  struct x86OpCode *iptr;        /* current instruction */  struct x86OpCode *bestmatch;   /* best match */  int ii;                        /* looping */  int badMatch;                  /* bad match? */  int ret;  int opnum;                     /* operand number */  /*   * insInfo->name contains the I_xxx entry corresponding to   * the instruction name.   */  candidates = x86Instructions[insInfo->name];  /*   * 'candidates' points to one of the Instruction_XXX   * arrays which are arranged according to the name of   * the instruction. We now need to find which one of   * them matches their operands with insInfo.   */  for (iptr = candidates; iptr->name != (-1); ++iptr)  {    assert(iptr->name == insInfo->name);    badMatch = 0;    /*     * Check if number of operands match     */    if (iptr->OperandCount != insInfo->opnum)      continue; /* operand mismatch */    /*     * Loop through operands, checking if each one     * matches up     */    for (ii = 0; ii < insInfo->opnum; ++ii)    {      ret = matchOperandsAsm(insInfo, iptr, ii, errstr);      if (ret < 0)        return (-1); /* error */      else if (ret == 0)      {        badMatch = 1;        break;      }    }    if (badMatch)      continue;    /*     * All operands match up     */    if (insInfo->immInfo.flags)    {      /*       * The instruction we are assembling contains       * immediate bytes - determine the size attributes       * (ib/iw/id) from the matching instruction       */      opnum = -1;      for (ii = 0; ii < iptr->OperandCount; ++ii)      {        if (iptr->operands[ii] & IMMEDIATE)          opnum = ii;      }      if (opnum < 0)      {        sprintf(errstr,                "findInstructionAsm: matching instruction has no immediate operand");        return (-1);      }      /*       * Fill in the appropriate immediate size so       * later we can put it in the opcode       */      if (iptr->operands[opnum] & BITS32)        insInfo->immInfo.flags |= DASM_IMMED_BITS32;      else if (iptr->operands[opnum] & BITS16)        insInfo->immInfo.flags |= DASM_IMMED_BITS16;      else      {        assert(iptr->operands[opnum] & BITS8);        insInfo->immInfo.flags |= DASM_IMMED_BITS8;      }    } /* if (insInfo->immInfo.flags) */    *match = iptr;    return (1);  } /* for (iptr = candidates; iptr->name != (-1); ++iptr) */  return (0);} /* findInstructionAsm() *//*x86isConstantAsm()  Determine whether an operand is a numerical constant (integeror floating point).Inputs: str       - string containing potential constant        immInfo   - where to store immediate informationReturn: 1 if str is a numerical constant (size goes in 'size')        0 if not*/static intx86isConstantAsm(char *str, struct immediateInfo *immInfo){  long inum;  char *endptr;  inum = strtol(str, &endptr, 0);  if ((endptr != str) && (*endptr == '\0'))  {    /*     * It is a valid integer     */    immInfo->inum = inum;    if (inum > 65535)      immInfo->flags = DASM_IMMED_BITS32;    else if (inum > 255)      immInfo->flags = DASM_IMMED_BITS16;    else      immInfo->flags = DASM_IMMED_BITS8;    return (1);  }  return (0);} /* x86isConstantAsm() *//*matchOperandsAsm()  Check if an operand for a potential match corresponds tothe operand for the instruction we are assembling.Inputs: ins    - instruction we are assembling        match  - potential match        num    - operand number        errstr - where to store errorsReturn: 1 if operands match        0 if not        -1 upon error (error goes in errstr)*/static intmatchOperandsAsm(struct instructionInfo *ins, struct x86OpCode *match,                 int num, char *errstr){  unsigned int insop,   /* instruction operand */               matchop; /* potential match operand */  unsigned int mask;  insop = ins->operands[num];  matchop = match->operands[num];  mask = 0;  /*   * Now attempt to identity the defining property of   * our instruction's operand.   */  if (insop & REGISTER)    mask = REGISTER;  else if (insop & IMMEDIATE)    mask = IMMEDIATE;  else if (insop & REGMEM)    mask = REGMEM;  else if (insop & MEMORY)    mask = MEMORY;  /*   * These guys override the above properties since it   * is possible that insop will be REGISTER|REG_FPU   * since it is defined that way in x86RegistersDASM[]   */  if (insop & REG_FPU)    mask = REG_FPU;  if (insop & REG_MMX)    mask = REG_MMX;  if (insop & REG_XMM)    mask = REG_XMM;  if (!mask)  {    sprintf(errstr,            "matchOperandsAsm: operand does not have a well defined type");    return (-1);  }  /*   * The potential match's operand must match mask or   * there is no match.   */  if (!(matchop & mask))    return (0);  /*   * At this point the two operands are of the same type   * (register/immediate/rm/memory/...). Now check size   * attributes.   */  mask = 0;  if (insop & BITS8)    mask = BITS8;  else if (insop & BITS16)    mask = BITS16;  else if (insop & BITS32)    mask = BITS32;  else if (insop & BITS64)    mask = BITS64;  else if (insop & BITS80)    mask = BITS80;  /*   * Make sure potential match operand has same size attributes   */  if (mask && !(matchop & mask))    return (0);  return (1);} /* matchOperandsAsm() *//*binarySearchAsm()  Search an array of strings for a string. The array of stringsmust be sorted alphabetically.Inputs: needle   - what to look for        haystack - where to search        n        - number of elements in haystackReturn: index of haystack if element found        -1 if not found*/static intbinarySearchAsm(char *needle, const char **haystack, int n){  int i;  int low,      high,      middle;  low = (-1);  high = n;  while ((high - low) >= 2)  {    middle = (low + high) / 2;    i = strcasecmp(needle, haystack[middle]);    if (i < 0)      high = middle;   /* it is below the middle */    else if (i > 0)      low = middle;    /* it is above the middle */    else      return (middle); /* we got a match */  }  return (-1);} /* binarySearchAsm() */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久久久久免费看农村| 不卡的av中国片| 国产精品网曝门| 777亚洲妇女| 色哟哟一区二区| 国产成a人亚洲| 免费欧美高清视频| 亚洲精品伦理在线| 欧美经典一区二区| 日韩欧美成人激情| 欧美日韩精品专区| 色婷婷av一区二区三区软件| 国产毛片一区二区| 麻豆91在线播放| 亚洲国产精品一区二区久久| 中文字幕中文字幕在线一区| 久久久久久黄色| 精品电影一区二区| 欧美美女直播网站| 欧洲亚洲国产日韩| 色婷婷香蕉在线一区二区| 成人激情综合网站| 国产成人精品影院| 国产不卡视频一区| 日本午夜精品视频在线观看 | 欧美哺乳videos| 欧美性大战xxxxx久久久| 99re视频精品| 99精品视频一区| www.欧美.com| a级精品国产片在线观看| 成人在线视频一区| a在线欧美一区| 99久久99久久精品国产片果冻 | 99热精品一区二区| 成人av综合在线| 粉嫩绯色av一区二区在线观看| 国产资源精品在线观看| 久久精品二区亚洲w码| 美女任你摸久久| 久久99国产精品久久99 | 免费人成网站在线观看欧美高清| 午夜视频在线观看一区二区三区| 天天射综合影视| 日本美女一区二区三区| 老色鬼精品视频在线观看播放| 久久99热狠狠色一区二区| 国产麻豆视频一区| 不卡影院免费观看| 91免费观看视频| 欧美色网一区二区| 91精品国产麻豆国产自产在线 | 欧美成人伊人久久综合网| 日韩精品一区二| 欧美极品少妇xxxxⅹ高跟鞋| 国产欧美一区二区三区网站| 日韩理论片在线| 午夜精品国产更新| 久久国产麻豆精品| 成人av午夜影院| 91黄色免费版| 日韩美女在线视频| 国产偷v国产偷v亚洲高清| 亚洲三级理论片| 日韩国产精品久久| 成人一区二区在线观看| 91黄色激情网站| 精品久久久久一区二区国产| 国产精品美女一区二区在线观看| 亚洲精品视频在线| 日韩激情在线观看| 成人激情视频网站| 欧美日韩国产成人在线免费| 精品成人免费观看| 亚洲精品乱码久久久久| 麻豆高清免费国产一区| va亚洲va日韩不卡在线观看| 欧美精选一区二区| 国产欧美一区二区精品性色超碰 | 精品日产卡一卡二卡麻豆| 国产欧美视频一区二区三区| 一区二区三区欧美视频| 蜜臀av一区二区在线免费观看 | 精品欧美乱码久久久久久1区2区| 国产精品久久久久一区二区三区 | 久久国产精品一区二区| 一本一道波多野结衣一区二区| 日韩天堂在线观看| 亚洲欧美电影院| 国产一区二三区| 欧美日韩高清在线| 国产精品高潮呻吟久久| 日本视频在线一区| 色婷婷久久综合| 国产亚洲欧美日韩日本| 全国精品久久少妇| 日本精品免费观看高清观看| 国产婷婷色一区二区三区四区| 天堂av在线一区| 91成人在线观看喷潮| 中文av一区特黄| 狠狠久久亚洲欧美| 欧美久久久久久蜜桃| 亚洲理论在线观看| 丰满少妇在线播放bd日韩电影| 日韩午夜在线影院| 亚洲成精国产精品女| 99精品国产91久久久久久| 国产午夜精品久久久久久免费视 | 韩国av一区二区三区| 欧美三级在线看| 日韩美女精品在线| 成人av在线观| 久久久精品免费网站| 免费xxxx性欧美18vr| 欧美伦理电影网| 亚洲综合激情另类小说区| 不卡av电影在线播放| 日本一二三四高清不卡| 国产精一区二区三区| 26uuu精品一区二区在线观看| 日韩成人精品视频| 在线播放一区二区三区| 亚洲一区二区欧美激情| 色8久久精品久久久久久蜜| 国产精品福利一区| 成人激情动漫在线观看| 国产精品福利影院| www.欧美色图| 亚洲色大成网站www久久九九| 成人av在线资源网| 国产精品二三区| 91麻豆国产自产在线观看| 亚洲图片欧美激情| 在线看日韩精品电影| 一区二区三区日韩精品视频| 在线精品视频小说1| 亚洲激情av在线| 欧美色视频在线| 日本亚洲电影天堂| 精品日韩av一区二区| 国产美女精品人人做人人爽| 久久免费视频一区| 丰满放荡岳乱妇91ww| 国产精品传媒视频| 欧美在线免费视屏| 日本欧美加勒比视频| 亚洲精品一区二区三区影院| 国产福利一区二区三区视频| 国产精品亲子乱子伦xxxx裸| av一区二区三区四区| 亚洲午夜免费电影| 欧美一个色资源| 国产精品18久久久久久久久| 亚洲天堂福利av| 欧美色网一区二区| 久久精品99国产精品日本| 国产蜜臀av在线一区二区三区| 成人av在线一区二区三区| 亚洲一区二区精品视频| 日韩欧美自拍偷拍| 成人福利电影精品一区二区在线观看| 亚洲你懂的在线视频| 欧美一区二区三区色| 国产精品综合久久| 亚洲一区视频在线| 精品国产三级a在线观看| 成人福利电影精品一区二区在线观看| 亚洲与欧洲av电影| 久久综合九色综合97婷婷女人| 99久久精品国产网站| 日韩国产精品91| 国产精品美女久久久久aⅴ | av高清久久久| 日本中文字幕一区二区有限公司| 久久美女高清视频| 欧美系列在线观看| 国产毛片精品视频| 性感美女久久精品| 日本一二三不卡| 日韩三级免费观看| 色婷婷久久久久swag精品| 久久99精品国产| 亚洲图片欧美综合| 国产精品欧美极品| 日韩一区二区免费在线电影| av网站免费线看精品| 久久精品噜噜噜成人88aⅴ| 亚洲精品五月天| 久久精品免视看| 51久久夜色精品国产麻豆| av亚洲精华国产精华精华| 久久精品国产99| 亚洲mv在线观看| 亚洲特黄一级片| 久久久一区二区三区| 欧美一区二区网站| 欧美亚日韩国产aⅴ精品中极品| 国产成人精品网址| 免费高清不卡av|