diff --git a/include/Zydis/InstructionInfo.h b/include/Zydis/InstructionInfo.h index c446684..97f32a5 100644 --- a/include/Zydis/InstructionInfo.h +++ b/include/Zydis/InstructionInfo.h @@ -531,7 +531,7 @@ typedef uint64_t ZydisInstructionAttributes; */ #define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE 0x0000000000002000 /** - * @brief The instruction accepts the xrelease prefix (0xF2). + * @brief The instruction accepts the xrelease prefix (0xF3). */ #define ZYDIS_ATTRIB_ACCEPTS_XRELEASE 0x0000000000004000 /** diff --git a/include/Zydis/Status.h b/include/Zydis/Status.h index 705098f..1b21c79 100644 --- a/include/Zydis/Status.h +++ b/include/Zydis/Status.h @@ -85,7 +85,7 @@ enum ZydisStatusCode /** * @brief The instruction encoded an invalid register. */ - ZYDIS_STATUS_INVALID_REGISTER, + ZYDIS_STATUS_BAD_REGISTER, /** * @brief A lock-prefix (F0) was found while decoding an instruction that does not support * locking. @@ -147,13 +147,14 @@ enum ZydisStatusCode * @param status The zydis status-code to check. */ #define ZYDIS_CHECK(status) \ + do \ { \ ZydisStatus s = status; \ if (!ZYDIS_SUCCESS(s)) \ { \ return s; \ } \ - } + } while(0) /* ============================================================================================== */ diff --git a/src/Decoder.c b/src/Decoder.c index d2cc91c..288819c 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -600,7 +600,7 @@ static ZydisStatus ZydisDecodeOperandRegister(ZydisInstructionInfo* info, operand->reg = ZydisRegisterEncode(registerClass, registerId); if (!operand->reg) { - return ZYDIS_STATUS_INVALID_REGISTER; + return ZYDIS_STATUS_BAD_REGISTER; } } diff --git a/src/Formatter.c b/src/Formatter.c index 6d0e287..8289483 100644 --- a/src/Formatter.c +++ b/src/Formatter.c @@ -592,14 +592,14 @@ static ZydisStatus ZydisFormatterPrintSegmentIntel(ZydisInstructionFormatter* fo switch (operand->mem.segment) { case ZYDIS_REGISTER_ES: - case ZYDIS_REGISTER_SS: + case ZYDIS_REGISTER_CS: case ZYDIS_REGISTER_FS: case ZYDIS_REGISTER_GS: return ZydisStringBufferAppendFormat(buffer, bufferLen, ZYDIS_APPENDMODE, "%s:", ZydisRegisterGetString(operand->mem.segment)); - case ZYDIS_REGISTER_CS: + case ZYDIS_REGISTER_SS: if ((formatter->flags & ZYDIS_FMTFLAG_FORCE_SEGMENTS) || - (info->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_CS)) + (info->attributes & ZYDIS_ATTRIB_HAS_SEGMENT_SS)) { return ZydisStringBufferAppendFormat(buffer, bufferLen, ZYDIS_APPENDMODE, "%s:", ZydisRegisterGetString(operand->mem.segment)); diff --git a/src/Register.c b/src/Register.c index c001169..7c9e49d 100644 --- a/src/Register.c +++ b/src/Register.c @@ -132,7 +132,6 @@ struct ZydisRegisterMapItem static const struct ZydisRegisterMapItem registerMap[] = { - { ZYDIS_REGCLASS_INVALID , ZYDIS_REGISTER_NONE , ZYDIS_REGISTER_NONE , 0 , 0 }, { ZYDIS_REGCLASS_GPR8 , ZYDIS_REGISTER_AL , ZYDIS_REGISTER_R15B , 8 , 8 }, { ZYDIS_REGCLASS_GPR16 , ZYDIS_REGISTER_AX , ZYDIS_REGISTER_R15W , 16 , 16 }, { ZYDIS_REGCLASS_GPR32 , ZYDIS_REGISTER_EAX , ZYDIS_REGISTER_R15D , 32 , 32 }, @@ -146,8 +145,8 @@ static const struct ZydisRegisterMapItem registerMap[] = { ZYDIS_REGCLASS_IP , ZYDIS_REGISTER_RIP , ZYDIS_REGISTER_IP , 0 , 0 }, { ZYDIS_REGCLASS_SEGMENT , ZYDIS_REGISTER_ES , ZYDIS_REGISTER_GS , 16 , 16 }, { ZYDIS_REGCLASS_TEST , ZYDIS_REGISTER_TR0 , ZYDIS_REGISTER_TR7 , 32 , 32 }, - { ZYDIS_REGCLASS_CONTROL , ZYDIS_REGISTER_CR0 , ZYDIS_REGISTER_CR7 , 32 , 64 }, - { ZYDIS_REGCLASS_DEBUG , ZYDIS_REGISTER_DR0 , ZYDIS_REGISTER_DR7 , 32 , 64 }, + { ZYDIS_REGCLASS_CONTROL , ZYDIS_REGISTER_CR0 , ZYDIS_REGISTER_CR15 , 32 , 64 }, + { ZYDIS_REGCLASS_DEBUG , ZYDIS_REGISTER_DR0 , ZYDIS_REGISTER_DR15 , 32 , 64 }, { ZYDIS_REGCLASS_MASK , ZYDIS_REGISTER_K0 , ZYDIS_REGISTER_K7 , 64 , 64 }, { ZYDIS_REGCLASS_BOUND , ZYDIS_REGISTER_BND0 , ZYDIS_REGISTER_BND3 , 128 , 128 } };