reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
  343   dbgprintf(insn, "readPrefixes()");
  347     if (consumeByte(insn, &byte))
  354     if (insn->readerCursor - 1 == insn->startLocation && byte == 0xf0) // LOCK
  354     if (insn->readerCursor - 1 == insn->startLocation && byte == 0xf0) // LOCK
  357     if ((byte == 0xf2 || byte == 0xf3) && !lookAtByte(insn, &nextByte)) {
  367         insn->xAcquireRelease = true;
  379         insn->xAcquireRelease = true;
  382       if (isREX(insn, nextByte)) {
  385         if (consumeByte(insn, &nnextByte))
  388         if (lookAtByte(insn, &nnextByte))
  390         unconsumeByte(insn);
  398       setPrefixPresent(insn, byte);
  408         insn->segmentOverride = SEG_OVERRIDE_CS;
  411         insn->segmentOverride = SEG_OVERRIDE_SS;
  414         insn->segmentOverride = SEG_OVERRIDE_DS;
  417         insn->segmentOverride = SEG_OVERRIDE_ES;
  420         insn->segmentOverride = SEG_OVERRIDE_FS;
  423         insn->segmentOverride = SEG_OVERRIDE_GS;
  429       setPrefixPresent(insn, byte);
  432       insn->hasOpSize = true;
  433       setPrefixPresent(insn, byte);
  436       insn->hasAdSize = true;
  437       setPrefixPresent(insn, byte);
  445       dbgprintf(insn, "Found prefix 0x%hhx", byte);
  448   insn->vectorExtensionType = TYPE_NO_VEX_XOP;
  453     if (consumeByte(insn, &byte1)) {
  454       dbgprintf(insn, "Couldn't read second byte of EVEX prefix");
  458     if (lookAtByte(insn, &byte2)) {
  459       dbgprintf(insn, "Couldn't read third byte of EVEX prefix");
  463     if ((insn->mode == MODE_64BIT || (byte1 & 0xc0) == 0xc0) &&
  465       insn->vectorExtensionType = TYPE_EVEX;
  467       unconsumeByte(insn); /* unconsume byte1 */
  468       unconsumeByte(insn); /* unconsume byte  */
  471     if (insn->vectorExtensionType == TYPE_EVEX) {
  472       insn->vectorExtensionPrefix[0] = byte;
  473       insn->vectorExtensionPrefix[1] = byte1;
  474       if (consumeByte(insn, &insn->vectorExtensionPrefix[2])) {
  474       if (consumeByte(insn, &insn->vectorExtensionPrefix[2])) {
  475         dbgprintf(insn, "Couldn't read third byte of EVEX prefix");
  478       if (consumeByte(insn, &insn->vectorExtensionPrefix[3])) {
  478       if (consumeByte(insn, &insn->vectorExtensionPrefix[3])) {
  479         dbgprintf(insn, "Couldn't read fourth byte of EVEX prefix");
  484       if (insn->mode == MODE_64BIT) {
  485         insn->rexPrefix = 0x40
  486                         | (wFromEVEX3of4(insn->vectorExtensionPrefix[2]) << 3)
  487                         | (rFromEVEX2of4(insn->vectorExtensionPrefix[1]) << 2)
  488                         | (xFromEVEX2of4(insn->vectorExtensionPrefix[1]) << 1)
  489                         | (bFromEVEX2of4(insn->vectorExtensionPrefix[1]) << 0);
  492       dbgprintf(insn, "Found EVEX prefix 0x%hhx 0x%hhx 0x%hhx 0x%hhx",
  493               insn->vectorExtensionPrefix[0], insn->vectorExtensionPrefix[1],
  493               insn->vectorExtensionPrefix[0], insn->vectorExtensionPrefix[1],
  494               insn->vectorExtensionPrefix[2], insn->vectorExtensionPrefix[3]);
  494               insn->vectorExtensionPrefix[2], insn->vectorExtensionPrefix[3]);
  499     if (lookAtByte(insn, &byte1)) {
  500       dbgprintf(insn, "Couldn't read second byte of VEX");
  504     if (insn->mode == MODE_64BIT || (byte1 & 0xc0) == 0xc0)
  505       insn->vectorExtensionType = TYPE_VEX_3B;
  507       unconsumeByte(insn);
  509     if (insn->vectorExtensionType == TYPE_VEX_3B) {
  510       insn->vectorExtensionPrefix[0] = byte;
  511       consumeByte(insn, &insn->vectorExtensionPrefix[1]);
  511       consumeByte(insn, &insn->vectorExtensionPrefix[1]);
  512       consumeByte(insn, &insn->vectorExtensionPrefix[2]);
  512       consumeByte(insn, &insn->vectorExtensionPrefix[2]);
  516       if (insn->mode == MODE_64BIT)
  517         insn->rexPrefix = 0x40
  518                         | (wFromVEX3of3(insn->vectorExtensionPrefix[2]) << 3)
  519                         | (rFromVEX2of3(insn->vectorExtensionPrefix[1]) << 2)
  520                         | (xFromVEX2of3(insn->vectorExtensionPrefix[1]) << 1)
  521                         | (bFromVEX2of3(insn->vectorExtensionPrefix[1]) << 0);
  523       dbgprintf(insn, "Found VEX prefix 0x%hhx 0x%hhx 0x%hhx",
  524                 insn->vectorExtensionPrefix[0], insn->vectorExtensionPrefix[1],
  524                 insn->vectorExtensionPrefix[0], insn->vectorExtensionPrefix[1],
  525                 insn->vectorExtensionPrefix[2]);
  530     if (lookAtByte(insn, &byte1)) {
  531       dbgprintf(insn, "Couldn't read second byte of VEX");
  535     if (insn->mode == MODE_64BIT || (byte1 & 0xc0) == 0xc0)
  536       insn->vectorExtensionType = TYPE_VEX_2B;
  538       unconsumeByte(insn);
  540     if (insn->vectorExtensionType == TYPE_VEX_2B) {
  541       insn->vectorExtensionPrefix[0] = byte;
  542       consumeByte(insn, &insn->vectorExtensionPrefix[1]);
  542       consumeByte(insn, &insn->vectorExtensionPrefix[1]);
  544       if (insn->mode == MODE_64BIT)
  545         insn->rexPrefix = 0x40
  546                         | (rFromVEX2of2(insn->vectorExtensionPrefix[1]) << 2);
  548       switch (ppFromVEX2of2(insn->vectorExtensionPrefix[1])) {
  552         insn->hasOpSize = true;
  556       dbgprintf(insn, "Found VEX prefix 0x%hhx 0x%hhx",
  557                 insn->vectorExtensionPrefix[0],
  558                 insn->vectorExtensionPrefix[1]);
  563     if (lookAtByte(insn, &byte1)) {
  564       dbgprintf(insn, "Couldn't read second byte of XOP");
  569       insn->vectorExtensionType = TYPE_XOP;
  571       unconsumeByte(insn);
  573     if (insn->vectorExtensionType == TYPE_XOP) {
  574       insn->vectorExtensionPrefix[0] = byte;
  575       consumeByte(insn, &insn->vectorExtensionPrefix[1]);
  575       consumeByte(insn, &insn->vectorExtensionPrefix[1]);
  576       consumeByte(insn, &insn->vectorExtensionPrefix[2]);
  576       consumeByte(insn, &insn->vectorExtensionPrefix[2]);
  580       if (insn->mode == MODE_64BIT)
  581         insn->rexPrefix = 0x40
  582                         | (wFromXOP3of3(insn->vectorExtensionPrefix[2]) << 3)
  583                         | (rFromXOP2of3(insn->vectorExtensionPrefix[1]) << 2)
  584                         | (xFromXOP2of3(insn->vectorExtensionPrefix[1]) << 1)
  585                         | (bFromXOP2of3(insn->vectorExtensionPrefix[1]) << 0);
  587       switch (ppFromXOP3of3(insn->vectorExtensionPrefix[2])) {
  591         insn->hasOpSize = true;
  595       dbgprintf(insn, "Found XOP prefix 0x%hhx 0x%hhx 0x%hhx",
  596                 insn->vectorExtensionPrefix[0], insn->vectorExtensionPrefix[1],
  596                 insn->vectorExtensionPrefix[0], insn->vectorExtensionPrefix[1],
  597                 insn->vectorExtensionPrefix[2]);
  599   } else if (isREX(insn, byte)) {
  600     if (lookAtByte(insn, &nextByte))
  602     insn->rexPrefix = byte;
  603     dbgprintf(insn, "Found REX prefix 0x%hhx", byte);
  605     unconsumeByte(insn);
  607   if (insn->mode == MODE_16BIT) {
  608     insn->registerSize = (insn->hasOpSize ? 4 : 2);
  608     insn->registerSize = (insn->hasOpSize ? 4 : 2);
  609     insn->addressSize = (insn->hasAdSize ? 4 : 2);
  609     insn->addressSize = (insn->hasAdSize ? 4 : 2);
  610     insn->displacementSize = (insn->hasAdSize ? 4 : 2);
  610     insn->displacementSize = (insn->hasAdSize ? 4 : 2);
  611     insn->immediateSize = (insn->hasOpSize ? 4 : 2);
  611     insn->immediateSize = (insn->hasOpSize ? 4 : 2);
  612   } else if (insn->mode == MODE_32BIT) {
  613     insn->registerSize = (insn->hasOpSize ? 2 : 4);
  613     insn->registerSize = (insn->hasOpSize ? 2 : 4);
  614     insn->addressSize = (insn->hasAdSize ? 2 : 4);
  614     insn->addressSize = (insn->hasAdSize ? 2 : 4);
  615     insn->displacementSize = (insn->hasAdSize ? 2 : 4);
  615     insn->displacementSize = (insn->hasAdSize ? 2 : 4);
  616     insn->immediateSize = (insn->hasOpSize ? 2 : 4);
  616     insn->immediateSize = (insn->hasOpSize ? 2 : 4);
  617   } else if (insn->mode == MODE_64BIT) {
  618     if (insn->rexPrefix && wFromREX(insn->rexPrefix)) {
  618     if (insn->rexPrefix && wFromREX(insn->rexPrefix)) {
  619       insn->registerSize       = 8;
  620       insn->addressSize = (insn->hasAdSize ? 4 : 8);
  620       insn->addressSize = (insn->hasAdSize ? 4 : 8);
  621       insn->displacementSize   = 4;
  622       insn->immediateSize      = 4;
  624       insn->registerSize = (insn->hasOpSize ? 2 : 4);
  624       insn->registerSize = (insn->hasOpSize ? 2 : 4);
  625       insn->addressSize = (insn->hasAdSize ? 4 : 8);
  625       insn->addressSize = (insn->hasAdSize ? 4 : 8);
  626       insn->displacementSize = (insn->hasOpSize ? 2 : 4);
  626       insn->displacementSize = (insn->hasOpSize ? 2 : 4);
  627       insn->immediateSize = (insn->hasOpSize ? 2 : 4);
  627       insn->immediateSize = (insn->hasOpSize ? 2 : 4);