mirror of https://github.com/x64dbg/zydis
				
				
				
			Improved encoder-table
This commit is contained in:
		
							parent
							
								
									6bd79283e0
								
							
						
					
					
						commit
						5c07598a2d
					
				|  | @ -361,14 +361,14 @@ typedef uint8_t ZydisOpcodeMap; | ||||||
|  */ |  */ | ||||||
| enum ZydisOpcodeMaps | enum ZydisOpcodeMaps | ||||||
| { | { | ||||||
|     ZYDIS_OPCODE_MAP_DEFAULT    = 0x00, |     ZYDIS_OPCODE_MAP_DEFAULT, | ||||||
|     ZYDIS_OPCODE_MAP_EX0        = 0x01, |     ZYDIS_OPCODE_MAP_0F, | ||||||
|     ZYDIS_OPCODE_MAP_0F         = 0x02, |     ZYDIS_OPCODE_MAP_0F38, | ||||||
|     ZYDIS_OPCODE_MAP_0F38       = 0x03, |     ZYDIS_OPCODE_MAP_0F3A, | ||||||
|     ZYDIS_OPCODE_MAP_0F3A       = 0x04, |     ZYDIS_OPCODE_MAP_0F0F, | ||||||
|     ZYDIS_OPCODE_MAP_XOP8       = 0x05, |     ZYDIS_OPCODE_MAP_XOP8, | ||||||
|     ZYDIS_OPCODE_MAP_XOP9       = 0x06, |     ZYDIS_OPCODE_MAP_XOP9, | ||||||
|     ZYDIS_OPCODE_MAP_XOPA       = 0x07 |     ZYDIS_OPCODE_MAP_XOPA | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /* ---------------------------------------------------------------------------------------------- */ | /* ---------------------------------------------------------------------------------------------- */ | ||||||
|  |  | ||||||
|  | @ -3583,7 +3583,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context, | ||||||
|                         instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_VEX; |                         instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_VEX; | ||||||
|                         ZYDIS_CHECK(ZydisDecodeVEX(context, instruction, prefixBytes)); |                         ZYDIS_CHECK(ZydisDecodeVEX(context, instruction, prefixBytes)); | ||||||
|                         instruction->opcodeMap =  |                         instruction->opcodeMap =  | ||||||
|                             ZYDIS_OPCODE_MAP_EX0 + instruction->raw.vex.m_mmmm; |                             ZYDIS_OPCODE_MAP_DEFAULT + instruction->raw.vex.m_mmmm; | ||||||
|                         break; |                         break; | ||||||
|                     case 0x62: |                     case 0x62: | ||||||
|                         switch ((prefixBytes[2] >> 2) & 0x01) |                         switch ((prefixBytes[2] >> 2) & 0x01) | ||||||
|  | @ -3593,14 +3593,14 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context, | ||||||
|                             instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_MVEX; |                             instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_MVEX; | ||||||
|                             ZYDIS_CHECK(ZydisDecodeMVEX(context, instruction, prefixBytes)); |                             ZYDIS_CHECK(ZydisDecodeMVEX(context, instruction, prefixBytes)); | ||||||
|                             instruction->opcodeMap =  |                             instruction->opcodeMap =  | ||||||
|                                 ZYDIS_OPCODE_MAP_EX0 + instruction->raw.mvex.mmmm; |                                 ZYDIS_OPCODE_MAP_DEFAULT + instruction->raw.mvex.mmmm; | ||||||
|                             break; |                             break; | ||||||
|                         case 1: |                         case 1: | ||||||
|                             // Decode EVEX-prefix
 |                             // Decode EVEX-prefix
 | ||||||
|                             instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_EVEX; |                             instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_EVEX; | ||||||
|                             ZYDIS_CHECK(ZydisDecodeEVEX(context, instruction, prefixBytes)); |                             ZYDIS_CHECK(ZydisDecodeEVEX(context, instruction, prefixBytes)); | ||||||
|                             instruction->opcodeMap =  |                             instruction->opcodeMap =  | ||||||
|                                 ZYDIS_OPCODE_MAP_EX0 + instruction->raw.evex.mm; |                                 ZYDIS_OPCODE_MAP_DEFAULT + instruction->raw.evex.mm; | ||||||
|                             break; |                             break; | ||||||
|                         default: |                         default: | ||||||
|                             ZYDIS_UNREACHABLE; |                             ZYDIS_UNREACHABLE; | ||||||
|  | @ -3649,7 +3649,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* context, | ||||||
|             { |             { | ||||||
|             case 0x0F: |             case 0x0F: | ||||||
|                 instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_3DNOW; |                 instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_3DNOW; | ||||||
|                 instruction->opcodeMap = ZYDIS_OPCODE_MAP_DEFAULT; |                 instruction->opcodeMap = ZYDIS_OPCODE_MAP_0F0F; | ||||||
|                 break; |                 break; | ||||||
|             case 0x38: |             case 0x38: | ||||||
|                 instruction->opcodeMap = ZYDIS_OPCODE_MAP_0F38; |                 instruction->opcodeMap = ZYDIS_OPCODE_MAP_0F38; | ||||||
|  |  | ||||||
|  | @ -56,24 +56,23 @@ extern "C" { | ||||||
|  */ |  */ | ||||||
| typedef struct ZydisEncodableInstruction_ | typedef struct ZydisEncodableInstruction_ | ||||||
| { | { | ||||||
|     ZydisInstructionEncoding encoding   ZYDIS_BITFIELD( 3); |  | ||||||
|     uint16_t definitionReference        ZYDIS_BITFIELD(13); |     uint16_t definitionReference        ZYDIS_BITFIELD(13); | ||||||
|     struct |     ZydisInstructionEncoding encoding   ZYDIS_BITFIELD( 3); | ||||||
|     { |     uint8_t opcode                      ZYDIS_BITFIELD( 8); | ||||||
|         uint8_t mode                    ZYDIS_BITFIELD( 2); |     ZydisOpcodeMap opcodeMap            ZYDIS_BITFIELD( 3);  | ||||||
|         uint8_t modrmMod                ZYDIS_BITFIELD( 3); |     uint8_t mode                        ZYDIS_BITFIELD( 3);  | ||||||
|         uint8_t modrmReg                ZYDIS_BITFIELD( 4); |     uint8_t modrmMod                    ZYDIS_BITFIELD( 4);  | ||||||
|         uint8_t modrmRm                 ZYDIS_BITFIELD( 4); |     ZydisBool forceModrmReg             ZYDIS_BITFIELD( 1); | ||||||
|         uint8_t mandatoryPrefix         ZYDIS_BITFIELD( 3); |     uint8_t modrmReg                    ZYDIS_BITFIELD( 8);  | ||||||
|         uint8_t operandSize             ZYDIS_BITFIELD( 2); |     ZydisBool forceModrmRm              ZYDIS_BITFIELD( 1); | ||||||
|         uint8_t addressSize             ZYDIS_BITFIELD( 2); |     uint8_t modrmRm                     ZYDIS_BITFIELD( 8);  | ||||||
|         uint8_t vectorLength            ZYDIS_BITFIELD( 2); |     uint8_t mandatoryPrefix             ZYDIS_BITFIELD( 3);  | ||||||
|         uint8_t rexW                    ZYDIS_BITFIELD( 2); |     uint8_t vectorLength                ZYDIS_BITFIELD( 2); | ||||||
|         uint8_t rexB                    ZYDIS_BITFIELD( 2); |     uint8_t rexW                        ZYDIS_BITFIELD( 1); | ||||||
|         uint8_t evexB                   ZYDIS_BITFIELD( 2); |     uint8_t rexB                        ZYDIS_BITFIELD( 2);  | ||||||
|         uint8_t evexZ                   ZYDIS_BITFIELD( 2); |     uint8_t evexB                       ZYDIS_BITFIELD( 1);  | ||||||
|         uint8_t mvexE                   ZYDIS_BITFIELD( 2); |     uint8_t evexZ                       ZYDIS_BITFIELD( 2);  | ||||||
|     } filters;  |     uint8_t mvexE                       ZYDIS_BITFIELD( 2);  | ||||||
| } ZydisEncodableInstruction; | } ZydisEncodableInstruction; | ||||||
| 
 | 
 | ||||||
| /* ---------------------------------------------------------------------------------------------- */ | /* ---------------------------------------------------------------------------------------------- */ | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue