x86: temporarily solve conflicts caused by the last merge

test2
Nguyen Anh Quynh 10 years ago
commit 72bbcacb88
  1. 42
      arch/X86/X86DisassemblerDecoder.c
  2. 6221
      arch/X86/X86GenInstrInfo.inc
  3. 1742
      arch/X86/X86GenInstrInfo_reduce.inc

@ -22,6 +22,7 @@
#include <stdlib.h> /* for exit() */ #include <stdlib.h> /* for exit() */
#include "../../cs_priv.h" #include "../../cs_priv.h"
#include "../../utils.h"
#include "X86DisassemblerDecoder.h" #include "X86DisassemblerDecoder.h"
@ -62,11 +63,6 @@ struct ContextDecision {
#include "X86GenInstrInfo.inc" #include "X86GenInstrInfo.inc"
#endif #endif
static const char *x86DisassemblerGetInstrName(unsigned Opcode)
{
return &X86InstrNameData[X86InstrNameIndices[Opcode]];
}
/* /*
* contextForAttrs - Client for the instruction context table. Takes a set of * contextForAttrs - Client for the instruction context table. Takes a set of
* attributes and returns the appropriate decode context. * attributes and returns the appropriate decode context.
@ -955,28 +951,23 @@ static int getIDWithAttrMask(uint16_t* instructionID,
* is16BitEquivalent - Determines whether two instruction names refer to * is16BitEquivalent - Determines whether two instruction names refer to
* equivalent instructions but one is 16-bit whereas the other is not. * equivalent instructions but one is 16-bit whereas the other is not.
* *
* @param orig - The instruction that is not 16-bit * @param orig - The instruction ID that is not 16-bit
* @param equiv - The instruction that is 16-bit * @param equiv - The instruction ID that is 16-bit
*/ */
static bool is16BitEquivalent(const char* orig, const char* equiv) static bool is16BitEquivalent(unsigned orig, unsigned equiv)
{ {
size_t i; size_t i;
uint16_t idx;
for (i = 0;; i++) {
if (orig[i] == '\0' && equiv[i] == '\0') if ((idx = x86_16_bit_eq_lookup[orig]) != 0)
return true; {
if (orig[i] == '\0' || equiv[i] == '\0') for (i = idx - 1; x86_16_bit_eq_tbl[i].first == orig && i < ARR_SIZE(x86_16_bit_eq_tbl); ++i)
return false; {
if (orig[i] != equiv[i]) { if (x86_16_bit_eq_tbl[i].second == equiv)
if ((orig[i] == 'Q' || orig[i] == 'L') && equiv[i] == 'W') return true;
continue;
if ((orig[i] == '6' || orig[i] == '3') && equiv[i] == '1')
continue;
if ((orig[i] == '4' || orig[i] == '2') && equiv[i] == '6')
continue;
return false;
} }
} }
return false;
} }
/* /*
@ -1121,7 +1112,6 @@ static int getID(struct InternalInstruction* insn)
const struct InstructionSpecifier *spec; const struct InstructionSpecifier *spec;
uint16_t instructionIDWithOpsize; uint16_t instructionIDWithOpsize;
const char *specName, *specWithOpSizeName;
spec = specifierForUID(instructionID); spec = specifierForUID(instructionID);
@ -1137,11 +1127,7 @@ static int getID(struct InternalInstruction* insn)
return 0; return 0;
} }
specName = x86DisassemblerGetInstrName(instructionID); if (is16BitEquivalent(instructionID, instructionIDWithOpsize) &&
specWithOpSizeName =
x86DisassemblerGetInstrName(instructionIDWithOpsize);
if (is16BitEquivalent(specName, specWithOpSizeName) &&
(insn->mode == MODE_16BIT) ^ insn->prefixPresent[0x66]) { (insn->mode == MODE_16BIT) ^ insn->prefixPresent[0x66]) {
insn->instructionID = instructionIDWithOpsize; insn->instructionID = instructionIDWithOpsize;
insn->spec = specifierForUID(instructionIDWithOpsize); insn->spec = specifierForUID(instructionIDWithOpsize);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save