x86: identation
This commit is contained in:
parent
e31327da14
commit
ca057fa8f6
|
@ -14,8 +14,8 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/* Capstone Disassembler Engine */
|
/* Capstone Disassembly Engine */
|
||||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
|
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
||||||
|
|
||||||
#include <inttypes.h> // debug
|
#include <inttypes.h> // debug
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -122,8 +122,7 @@ static int modRMRequired(OpcodeType type,
|
||||||
|
|
||||||
index = indextable[insnContext];
|
index = indextable[insnContext];
|
||||||
if (index)
|
if (index)
|
||||||
return decision[index - 1].modRMDecisions[opcode].
|
return decision[index - 1].modRMDecisions[opcode].modrm_type != MODRM_ONEENTRY;
|
||||||
modrm_type != MODRM_ONEENTRY;
|
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -548,10 +547,12 @@ static int readPrefixes(struct InternalInstruction* insn)
|
||||||
if (insn->vectorExtensionType == TYPE_EVEX) {
|
if (insn->vectorExtensionType == TYPE_EVEX) {
|
||||||
insn->vectorExtensionPrefix[0] = byte;
|
insn->vectorExtensionPrefix[0] = byte;
|
||||||
insn->vectorExtensionPrefix[1] = byte1;
|
insn->vectorExtensionPrefix[1] = byte1;
|
||||||
|
|
||||||
if (consumeByte(insn, &insn->vectorExtensionPrefix[2])) {
|
if (consumeByte(insn, &insn->vectorExtensionPrefix[2])) {
|
||||||
dbgprintf(insn, "Couldn't read third byte of EVEX prefix");
|
dbgprintf(insn, "Couldn't read third byte of EVEX prefix");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consumeByte(insn, &insn->vectorExtensionPrefix[3])) {
|
if (consumeByte(insn, &insn->vectorExtensionPrefix[3])) {
|
||||||
dbgprintf(insn, "Couldn't read fourth byte of EVEX prefix");
|
dbgprintf(insn, "Couldn't read fourth byte of EVEX prefix");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -586,8 +587,7 @@ static int readPrefixes(struct InternalInstruction* insn)
|
||||||
if (insn->mode == MODE_64BIT || (byte1 & 0xc0) == 0xc0) {
|
if (insn->mode == MODE_64BIT || (byte1 & 0xc0) == 0xc0) {
|
||||||
insn->vectorExtensionType = TYPE_VEX_3B;
|
insn->vectorExtensionType = TYPE_VEX_3B;
|
||||||
insn->necessaryPrefixLocation = insn->readerCursor - 1;
|
insn->necessaryPrefixLocation = insn->readerCursor - 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
unconsumeByte(insn);
|
unconsumeByte(insn);
|
||||||
insn->necessaryPrefixLocation = insn->readerCursor - 1;
|
insn->necessaryPrefixLocation = insn->readerCursor - 1;
|
||||||
}
|
}
|
||||||
|
@ -1506,57 +1506,57 @@ static int readModRM(struct InternalInstruction* insn)
|
||||||
break; \
|
break; \
|
||||||
default: break; \
|
default: break; \
|
||||||
} \
|
} \
|
||||||
switch (type) { \
|
switch (type) { \
|
||||||
default: \
|
default: \
|
||||||
debug("Unhandled register type"); \
|
debug("Unhandled register type"); \
|
||||||
*valid = 0; \
|
*valid = 0; \
|
||||||
return 0; \
|
return 0; \
|
||||||
case TYPE_Rv: \
|
case TYPE_Rv: \
|
||||||
return (uint8_t)(base + index); \
|
return (uint8_t)(base + index); \
|
||||||
case TYPE_R8: \
|
case TYPE_R8: \
|
||||||
if (insn->rexPrefix && \
|
if (insn->rexPrefix && \
|
||||||
index >= 4 && index <= 7) { \
|
index >= 4 && index <= 7) { \
|
||||||
return prefix##_SPL + (index - 4); \
|
return prefix##_SPL + (index - 4); \
|
||||||
} else { \
|
} else { \
|
||||||
return prefix##_AL + index; \
|
return prefix##_AL + index; \
|
||||||
} \
|
} \
|
||||||
case TYPE_R16: \
|
case TYPE_R16: \
|
||||||
return prefix##_AX + index; \
|
return prefix##_AX + index; \
|
||||||
case TYPE_R32: \
|
case TYPE_R32: \
|
||||||
return prefix##_EAX + index; \
|
return prefix##_EAX + index; \
|
||||||
case TYPE_R64: \
|
case TYPE_R64: \
|
||||||
return prefix##_RAX + index; \
|
return prefix##_RAX + index; \
|
||||||
case TYPE_XMM512: \
|
case TYPE_XMM512: \
|
||||||
return prefix##_ZMM0 + index; \
|
return prefix##_ZMM0 + index; \
|
||||||
case TYPE_XMM256: \
|
case TYPE_XMM256: \
|
||||||
return prefix##_YMM0 + index; \
|
return prefix##_YMM0 + index; \
|
||||||
case TYPE_XMM128: \
|
case TYPE_XMM128: \
|
||||||
case TYPE_XMM64: \
|
case TYPE_XMM64: \
|
||||||
case TYPE_XMM32: \
|
case TYPE_XMM32: \
|
||||||
case TYPE_XMM: \
|
case TYPE_XMM: \
|
||||||
return prefix##_XMM0 + index; \
|
return prefix##_XMM0 + index; \
|
||||||
case TYPE_VK1: \
|
case TYPE_VK1: \
|
||||||
case TYPE_VK8: \
|
case TYPE_VK8: \
|
||||||
case TYPE_VK16: \
|
case TYPE_VK16: \
|
||||||
return prefix##_K0 + index; \
|
return prefix##_K0 + index; \
|
||||||
case TYPE_MM64: \
|
case TYPE_MM64: \
|
||||||
case TYPE_MM32: \
|
case TYPE_MM32: \
|
||||||
case TYPE_MM: \
|
case TYPE_MM: \
|
||||||
if (index > 7) \
|
if (index > 7) \
|
||||||
*valid = 0; \
|
*valid = 0; \
|
||||||
return prefix##_MM0 + index; \
|
return prefix##_MM0 + index; \
|
||||||
case TYPE_SEGMENTREG: \
|
case TYPE_SEGMENTREG: \
|
||||||
if (index > 5) \
|
if (index > 5) \
|
||||||
*valid = 0; \
|
*valid = 0; \
|
||||||
return prefix##_ES + index; \
|
return prefix##_ES + index; \
|
||||||
case TYPE_DEBUGREG: \
|
case TYPE_DEBUGREG: \
|
||||||
if (index > 7) \
|
if (index > 7) \
|
||||||
*valid = 0; \
|
*valid = 0; \
|
||||||
return prefix##_DR0 + index; \
|
return prefix##_DR0 + index; \
|
||||||
case TYPE_CONTROLREG: \
|
case TYPE_CONTROLREG: \
|
||||||
if (index > 8) \
|
if (index > 8) \
|
||||||
*valid = 0; \
|
*valid = 0; \
|
||||||
return prefix##_CR0 + index; \
|
return prefix##_CR0 + index; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue