mirror of https://github.com/x64dbg/zydis
				
				
				
			Merge branch 'develop' of https://github.com/zyantific/zyan-disassembler-engine into develop
This commit is contained in:
		
						commit
						71a551ef1a
					
				| 
						 | 
					@ -25,7 +25,7 @@ option(ZYDIS_BUILD_TOOLS "Build tools" ON)
 | 
				
			||||||
if (NOT CONFIGURED_ONCE)
 | 
					if (NOT CONFIGURED_ONCE)
 | 
				
			||||||
    if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
 | 
					    if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
 | 
				
			||||||
            "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
 | 
					            "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
 | 
				
			||||||
            "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
 | 
					            "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
 | 
				
			||||||
        set(compiler_specific "-std=c99 -pedantic -Wextra -Werror")
 | 
					        set(compiler_specific "-std=c99 -pedantic -Wextra -Werror")
 | 
				
			||||||
    elseif (MSVC)
 | 
					    elseif (MSVC)
 | 
				
			||||||
        set(compiler_specific "/WX /W4 /TC")
 | 
					        set(compiler_specific "/WX /W4 /TC")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
Zyan Disassembler Engine (Zydis)
 | 
					# Zyan Disassembler Engine (Zydis)
 | 
				
			||||||
================================
 | 
					[](https://opensource.org/licenses/MIT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Fast and lightweight x86/x86-64 disassembler library.
 | 
					Fast and lightweight x86/x86-64 disassembler library.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -357,7 +357,8 @@ typedef struct ZydisOperandInfo_
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        ZydisBool isSigned;
 | 
					        ZydisBool isSigned;
 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * @brief   Signals, if the immediate value contains a relative offset.
 | 
					         * @brief   Signals, if the immediate value contains a relative offset. You can use 
 | 
				
			||||||
 | 
					         *          @c ZydisUtilsCalcAbsoluteTargetAddress to determine the absolute address value.
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        ZydisBool isRelative;
 | 
					        ZydisBool isRelative;
 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2433,16 +2433,6 @@ ZydisStatus ZydisDecodeEx(ZydisOperatingMode operatingMode,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // For relative operands, apply instruction length offset.
 | 
					 | 
				
			||||||
    for (size_t i = 0; i < info->operandCount; ++i)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (info->operands[i].type == ZYDIS_OPERAND_TYPE_IMMEDIATE &&
 | 
					 | 
				
			||||||
            info->operands[i].imm.isRelative)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            info->operands[i].imm.value.sqword += info->length;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Replace XCHG rAX, rAX with NOP alias
 | 
					    // Replace XCHG rAX, rAX with NOP alias
 | 
				
			||||||
    if (info->mnemonic == ZYDIS_MNEMONIC_XCHG)
 | 
					    if (info->mnemonic == ZYDIS_MNEMONIC_XCHG)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,14 +56,16 @@ ZydisStatus ZydisUtilsCalcAbsoluteTargetAddress(const ZydisInstructionInfo* info
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (operand->mem.base == ZYDIS_REGISTER_RIP)
 | 
					        if (operand->mem.base == ZYDIS_REGISTER_RIP)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            *address = (uint64_t)(info->instrPointer + operand->mem.disp.value.sqword); 
 | 
					            *address = 
 | 
				
			||||||
 | 
					                (uint64_t)(info->instrPointer + operand->mem.disp.value.sqword);
 | 
				
			||||||
            return ZYDIS_STATUS_SUCCESS;   
 | 
					            return ZYDIS_STATUS_SUCCESS;   
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case ZYDIS_OPERAND_TYPE_IMMEDIATE:
 | 
					    case ZYDIS_OPERAND_TYPE_IMMEDIATE:
 | 
				
			||||||
        if (operand->imm.isSigned && operand->imm.isRelative)
 | 
					        if (operand->imm.isSigned && operand->imm.isRelative)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            *address = (uint64_t)((int64_t)info->instrPointer + operand->imm.value.sqword);
 | 
					            *address = 
 | 
				
			||||||
 | 
					                (uint64_t)((int64_t)info->instrPointer + info->length + operand->imm.value.sqword);
 | 
				
			||||||
            switch (info->mode)
 | 
					            switch (info->mode)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
            case ZYDIS_DISASSEMBLER_MODE_16BIT:
 | 
					            case ZYDIS_DISASSEMBLER_MODE_16BIT:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue