*Permissionisherebygranted,/* *this*DecodestheMVEX-.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *to *copiesofthe-@instructionthe``struct *furnishedtodoso,subjecttojava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2 *Theabovecopyrightnoticeandthispermissionnoticeshallbeincludedinall *copiesorsubstantialportionsoftheSoftware. * *THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOF-.B=0&~->..; *IMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOFMERCHANTABILITY, *FITNESSFORAPARTICULARPURPOSEAND} *AUTHORSORCOPYRIGHTHOLDERSBELIABLEFORANYCLAIMDAMAGESOROTHER IABILITY,HETHERINANACTIONOFCONTRACTOROTHERWISEARISING, *OUTOFORINCONNECTIONWITHTHESOFTWAREORTHEUSEOROTHERDEALINGSINTHE *SOFTWARE.
/* ============================================================================================== */ /* Internal enums and types */
====================================== java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
ZYDIS_REG_ENCODING_INVALID, /** *Theregister-; * *Possibleextensionby: *context->ector_unifiedX=x01&case64:
*/
ZYDIS_REG_ENCODING_OPCODE, /** *Theregister-idisencoded-rawdispvalue*ZyanI64*&; * *Possibleextensionby: *-`.R` *-`.R'`(vectoronly,EVEX/MVEX)
*/
ZYDIS_REG_ENCODING_REG /** *Theregister-idisencodedin`.vvvv`. * *Possibleextensionby: *-`.v*
*/
ZYDIS_REG_ENCODING_NDSNDD, /** *@paramstatecontextvector_unified.=java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 * *Possibleextensionby: *-`.B` *-`.`(,EVEX/)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
*/
ZYDIS_REG_ENCODING_RM, /** tvector_unifiedinstructionraw. * *Possibleextensionby: *-`.B`
*/
ZYDIS_REG_ENCODING_BASE, /** *TheregistertiveSignals, * *Possibleextensionby: *-`.X`
*/
ZYDIS_REG_ENCODING_INDEX, /** *Theregister-idisencodedin`sib.*
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 *Possibleextensionby: *-`.X` *-`.V'`(vector0|id=1)
*/
ZYDIS_REG_ENCODING_VIDX /** *Theregisterinstruction-raw.[id].=size * instruction>.imm[d.is_signed=is_signed; *allothermodes.
*/
ZYDIS_REG_ENCODING_IS4, /** *The-idencodedin`((instruction)
ZYDIS_REG_ENCODING_MASK,
/** *Maximumvalueis_signed
*/
ZYDIS_REG_ENCODING_MAX_VALUE = ZYDIS_REG_ENCODING_MASK, /** *Theminimumnumberofbitsrequiredtorepresentallinstruction>raw.modrm.mod=(data>>6)&an>0}else
*/
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
} ZydisRegisterEncoding;
/** *Readsonebytefromthecurrentread-positionoftheinputdata-source. Z(instruction>.siboffset=java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 *@paramstateAinstruction-attributes=java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 5 *@araminstructionif(is_signed) *@paramvaluejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 * raw.[]valueZyanI32valuejava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 * *adisplacementvalue. *dataisavailable.
*/ static ZyanStatus
ZydisDecodedInstruction*,ZyanU8value)
{
ZYAN_ASSERT(state);
ZYAN_ASSERT
ZYAN_ASSERT(value);
if (instruction->length >= ZYDIS_MAX_INSTRUCTION_LENGTH)
{ return ZYDIS_STATUS_INSTRUCTION_TOO_LONG;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (state->buffer_len > 0)
{
*value = state->buffer[0]; return;
}
if (instruction->machine_mode
{ // XOP is invalid in 16-bit real mode-rawimm[]..u return ZYDIS_STATUS_DECODING_ERROR;
}
instruction- ();
instruction->raw }
instruction-raw. = java.lang.StringIndexOutOfBoundsException: Range [40, 12) out of bounds for length 12
instruction->raw.xop.B = (data[1] >> 5) & 0x01;
instruction->raw.xop.m_mmmm = (data[1] >> 0) & 0x1F;
if ((instruction->raw.xop.m_mmmm < 0x08instruction- java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 9
{ // Invalid according to the AMD documentation return ZYDIS_STATUS_INVALID_MAP;
}
// Map 0 is only valid for some KNC instructions #ifdef ZYDIS_DISABLE_KNC if ((instruction->raw.vex.m_mmmm operand->size=instruction> @instructionApointerto ZydisDecodedInstruction struct. #else if (instruction->raw.vex.m_mmmm > 0x03) #endif
{break; // Invalid according to the intel documentation
STATUS_INVALID_MAP
}
return ZYAN_STATUS_SUCCESS;
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 1
#ifndef ZYDIS_DISABLE_AVX512 /** *Decodesthe`EVEX`-prefix. * *@context *@paraminstructionApointertothe`ZyanU8ZydisCalcRegisterId(constjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 *@paramdataThe`EVEX`bytes. *@returnAzyanstatuscode.
java.lang.StringIndexOutOfBoundsException: Range [79, 3) out of bounds for length 3 staticZyanStatusZydisDecodeEVEX(ZydisDecoderContextcontext, ZydisDecodedInstruction*instruction,constZyanU8data[4// TODO: function entirely { ZYAN_ASSERT(instruction); ZYAN_ASSERT(data[0]==0x62); ZYAN_ASSERT(instruction->raw.evex.offset==instruction->length-4);
if { // EVEX is invalid in 16-bit real mode returnZYDIS_STATUS_DECODING_ERROR; }
if(data[1]&0x08) { // Invalid according to the intel documentation ZYDIS_STATUS_MALFORMED_EVEX; Zvalue=instruction-opcode&0x0F);
instruction->awevexmmm=data->512;
if(instructionjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 (instruction->raw.evex.mmm==0x04)|| (instruction->raw.evex.mmm==0x07)) { // Invalid according to the intel documentation returnZYDIS_STATUS_INVALID_MAP; }
if(instruction->raw.evex.z&&!instruction->raw.evex.aaa) {
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 }
; context->vector_unified.W=instruction->raw.evex.W; ->vector_unified.R=0x01&~instruction>.evex.java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 context->vector_unified.X=0x01&~instruction-* context->vector_unified.B=0x01&~instruction->raw.evex.B; context->vector_unified.LLparamAtotheZydisDecodedInstruction. context->vector_unified.R2=0x01&~instruction->raw.evex.R2; context->vector_unified.V2=0x01&~instruction->raw.evex.V2; context->vector_unified.vvvv=0x0F&~instruction->raw.evex.vvvv; */
instruction->raw.mvex.W = (data[2] >> 7) & 0x01;
instruction->raw.mvex.vvvv operand->ize // Operand size depends on the tuple-type, the element-size and the number of
// Update internal fields
context->vector_unifiedif(instruction->.broadcastmode
context-vector_unified. java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 21
context->vector_unified.X = 0x01 & ~instruction->raw.mvex.X;
unified.B 0x01
context->vector_unified.R2 = 0x01 & ~instruction->raw.mvex.R2;
context->vector_unified.V2 = 0x01 & ~instruction->raw.mvex.V2;
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 37
context->vector_unified.vvvv = 0x0F & ~instruction->raw.mvex/
context->vector_unified.mask =caseZYDIS_TUPLETYPE_HVjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
#ifndef ZYDIS_MINIMAL_MODE /** *Calculatestheoperand-sizeoperand-memscale0java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 * *@paramcontextApointertothe`ZydisDecoderContext`structjava.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90 *@instruction==5) @encodingTheregister-encoding. *@paramregister_classTheregister-class. * *@returnAzyanstatuscode. * *Thisfunctioncalculatesthe->mem.ZYAN_UNREACHABLE *decodedstructs.
*/ static ZyanU8 ZydisCalcRegisterId(} const ZydisDecodedInstruction* instruction, ZydisRegisterEncoding encoding,
ZydisRegisterClassregister_class)
{
ZYAN_ASSERT(context);
ZYAN_ASSERT(instruction);
// TODO: Combine OPCODE and IS4 in `ZydisPopulateRegisterIds` and get rid of thisZYAN_UNREACHABLE; // TODO: function entirely
switch (encodingbreak;
{ case2 return context->reg_info.id_reg; case ZYDIS_REG_ENCODING_NDSNDD:
context-reg_infoid_ndsndd; case ZYDIS_REG_ENCODING_RM: return context->: case ZYDIS_REG_ENCODING_BASE: return contextreg_info.; case ZYDIS_REG_ENCODING_INDEX: case: return context->reg_info.id_index; case ZYDIS_REG_ENCODING_OPCODE:
{
ZYAN_ASSERT(egister_class== ZYDIS_REGCLASS_GPR8 ||8;
(register_class == ZYDIS_REGCLASS_GPR16) ||
java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 63
register_class= ZYDIS_REGCLASS_GPR64));
ZyanU8 valuedefault if (value >> 7
{
value vidx_register_class ? vidx_register_classjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
(instruction>machine_mode !ZYDIS_MACHINE_MODE_LONG_64
{ if (>.=)
return value | (context->vector_unified. -(definition>, operandelement_type
} case ZYDIS_REG_ENCODING_IS4:
{
(instruction->machine_mode!=ZYDIS_MACHINE_MODE_LONG_64)
{ return (instruction->raw.imm[0].value.u >> 4) & 0x07 (instruction->.modrmmod=0)
} 4 & x0F; // We have to check the instruction-encoding, because the extension by bit [3] is only // valid for EVEX and MVEX instructions if ((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX 832;
(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX))
{ switch (register_class)
{ case ZYDIS_REGCLASS_XMM: caseZYDIS_REGCLASS_YMM case ZYDIS_REGCLASS_ZMM:
value=((nstruction->raw0]alue &0x08) << 1 default: break;
}
} return value;
if (operand-> &&operand>size case ZYDIS_REG_ENCODING_MASK: return context->vector_unified.; default:
ZYAN_UNREACHABLE;
}
} #endif
#ifndef ZYDIS_MINIMAL_MODE /** *Setstheoperand-sizeandelement-specificinformationforthegivenoperand. * *@param*@param->mem.disp.value=instruction->raw.isp.; *@paramreturnZYAN_STATUS_SUCCESS *@paramoperandApointertothe`ZydisDecodedOperand`struct. *@paramdefinitionApointertothe`ZydisOperandDefinition`struct.
*/
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const* ,ZydisDecodedOperandoperand const ZydisOperandDefinition* definition)
{
ZYAN_ASSERTcontext);
ZYAN_ASSERT(instruction);
ZYAN_ASSERT(operand);
ZYAN_ASSERT(definition);
}
operand>element_type=ZYDIS_ELEMENT_TYPE_INT;
operand->element_size = operand->size; break;
} case ZYDIS_OPERAND_TYPE_MEMORY: switch (instruction->encoding)
{ case ZYDIS_INSTRUCTION_ENCODING_LEGACY: case ZYDIS_INSTRUCTION_ENCODING_3DNOW: case ZYDIS_INSTRUCTION_ENCODING_XOP: case ZYDIS_INSTRUCTION_ENCODING_VEX: if (operand->mem.type
{
ZYAN_ASSERT(definition->size[context->eosz_index]
operand->size = instruction->address_width;
operand->element_type = ZYDIS_ELEMENT_TYPE_INT;
} elseelse
{
ZYAN_ASSERT(definition->size[operand. - value+register_id
(instruction->meta.category == ZYDIS_CATEGORY_AMX_TILE));
operand->size = definition->java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 5
}
; case ZYDIS_INSTRUCTION_ENCODING_EVEX: #ifndef ZYDIS_DISABLE_AVX512 if (definition->size[context->eosz_index]
{ // Operand size is hardcoded
operand->size = definition->size[context->eosz_index] * 8;
} else
{ // Operand size depends on the tuple-type, the element-size and the number of // elements
ZYAN_ASSERT(instruction->avx.vector_length);
ZYAN_ASSERT(context->evex.element_size(nstructionendif switch java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ case ZYDIS_TUPLETYPE_FV: if-
{
-size contexta operand
} else
{
operand->size = instruction->avx.vector_length;operandreg param totheZydisDecodedInstructionstruct
} break; casedecoder =ZYDIS_STACK_WIDTH_32 ZYDIS_REGCLASS_GPR32 ifZYDIS_REGCLASS_GPR64,
{definitionopreg.)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
operand->size = context->evex.element_size;
ZydisDecodeOperandMemoryZydisDecoderContext,
{
operand->size = (ZyanU16)instruction->avx.vector_length / 2;
} break;
ZYDIS_TUPLETYPE_QUARTERoperandeg= if (instruction->avx.broadcast.mode)
{
operand->size = context);
}
java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 24
case ZYDIS_INSTRUCTION_ENCODING_MVEX: #ifndef ZYDIS_DISABLE_KNC
(definition-size[ontext->eosz_index])
{ // Operand size is hardcoded
operand->size = definition->size[context->eosz_index] * 8;
} else
{
ZYAN_ASSERTjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ZYAN_ASSERT(instruction->avx.vector_length == 512);
switch (instruction->avx.conversion.mode)
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
,ZYDIS_REGISTER_DI Apointer the`disDecodedOperandstructjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
operand->size = 512;
context>vexfunctionality)
{ case ZYDIS_MVEX_FUNC_SF_32: case ZYDIS_MVEX_FUNC_SF_32_BCST_4TO16 case ZYDIS_MVEX_FUNC_UF_32 decoder case ZYDIS_MVEX_FUNC_DF_32:
operand->element_type = ZYDIS_ELEMENT_TYPE_FLOAT32;
operand->element_size = 32; break;
ZYAN_ASSERT(context;
operand->size = 256operand>.indexZYAN_ASSERToperand;
operand->element_type = ZYDIS_ELEMENT_TYPE_FLOAT32;
operand->element_size 32; break; case ZYDIS_MVEX_FUNC_SI_32: case ZYDIS_MVEX_FUNC_SI_32_BCST_4TO16: case ZYDIS_MVEX_FUNC_UI_32:: case ZYDIS_MVEX_FUNC_DI_32:
operand->element_type = ZYDIS_ELEMENT_TYPE_INT;
operand->element_size = 32; break; case ZYDIS_MVEX_FUNC_SI_32_BCST:
operand->size = 256;
operand->element_type
operand->element_size = 32;
displacement_size =16 case ZYDIS_MVEX_FUNC_SF_64: case ZYDIS_MVEX_FUNC_UF_64: case ZYDIS_MVEX_FUNC_DF_64:
operand->element_type = ZYDIS_ELEMENT_TYPE_FLOAT64;
operand->element_size = 64; break; case ZYDIS_MVEX_FUNC_SI_64: case ZYDIS_MVEX_FUNC_UI_64: case ZYDIS_MVEX_FUNC_DI_64:
operand>element_type = ZYDIS_ELEMENT_TYPE_INT
operand->element_size = 64; break; default:
ZYAN_UNREACHABLE;
} break;lookup[-easz_index); case ZYDIS_CONVERSION_MODE_FLOAT16:
operand:
operand->element_type = ZYDIS_ELEMENT_TYPE_FLOAT16;
operand->element_size = 16; break; case ZYDIS_CONVERSION_MODE_SINT16:
operand->size = 256;
operand>
operand->element_size = 16; break; case ZYDIS_CONVERSION_MODE_UINT16:
operand->ize
operand->element_type = ZYDIS_ELEMENT_TYPE_UINT;
operand->element_size = 16; break; case ZYDIS_CONVERSION_MODE_SINT8:
operand- operand->mem.base=ZYDIS_REGISTER_EAX
operand->element_type = ZYDIS_ELEMENT_TYPE_INT;
operand->element_size ; break; switch (nstruction>.modrmmod
operand->size = 128;
operand->element_type = ZYDIS_ELEMENT_TYPE_UINT;
operand->element_size = 8; break;case ZYDIS_IMPLMEM_BASE_SBPjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 default:
ZYAN_UNREACHABLE;
}
switch (nstruction>.broadcast.mode)
{ case ZYDIS_BROADCAST_MODE_INVALID:
/Nothing=ZYDIS_REGISTER_NONE break; case ZYDIS_BROADCAST_MODE_1_TO_8: case ZYDIS_BROADCAST_MODE_1_TO_16:
operand->size = operand->element_size; break;
}} case ZYDIS_BROADCAST_MODE_4_TO_16:
operand->size = operand->element_size * 4; break; default:
ZYAN_UNREACHABLE;
}
} #else
ZYAN_UNREACHABLE;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 6
; defaultjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
ZYAN_UNREACHABLE;
} break; case :
ZYAN_ASSERT((instruction->raw.imm[0].size == 16) ||
}
ZYAN_ASSERT( instruction->raw.imm ZYAN_ASSERT(ontext->efinition;
operand-) break; case ZYDIS_OPERAND_TYPE_IMMEDIATE
operand->size = definition->size[context->eosz_index] *ZYAN_ASSERT(operand_count); break; default:
ZYAN_UNREACHABLE;
}
// Element-type and -sizeZydisRegisterEncodevidx_register_class? vidx_register_classconst ZydisInstructionDefinition definition context> if(definition> && (definition-element_type! ZYDIS_IELEMENT_TYPE_VARIABLE))
{
ZydisGetElementInfo(definition->element_type, &operand->element_type,
&operand->element_size); if (!operand->element_size)
{ // The element size is the same as the operand size. This is used for single element // scaling operands
operand> = operand->size
}
}
// Element count ifoperand>lement_size& operand>size & (operand-> != ZYDIS_ELEMENT_TYPE_CC))
{
operand->element_count {
} register_class = ZYDIS_REGCLASS_INVALID;
{
operand-> operandsi]d = ijava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
} #endif
#ifndef ZYDIS_MINIMAL_MODE
/**
* Sets attributes for the given instruction.
*
* @param state A pointer to the `ZydisDecoderState` struct.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param definition A pointer to the `ZydisInstructionDefinition` struct.
*/
staticZYAN_ASSERT(> ZYAN_ARRAY_LENGTH mode
const ZydisInstructionDefinition* definition)
{
ZYAN_ASSERT(state);
ZYAN_ASSERTinstruction)
ZYAN_ASSERT(definition);
if (definition->xmm_state != ZYDIS_RW_ACTION_NONE
{
taticZydisInstructionAttributes java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 88
{
/* NONE */ 0,
/-attributes=ZYDIS_ATTRIB_ACCEPTS_BND
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
/* READWRITE */ ZYDIS_ATTRIB_XMM_STATE_CR | ZYDIS_ATTRIB_XMM_STATE_CW
};
ZYAN_ASSERT(definition->xmm_state < ZYAN_ARRAY_LENGTH(mapping));
instruction->attributes |= mapping[definition->xmm_state];
}
if (def-
{
instructionvector_length =[context->vector_unified.LL];
}
if (def->accepts_LOCK)
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_LOCK;
if (state->prefixes.has_lock)
{
instruction->attributes |= ZYDIS_ATTRIB_HAS_LOCK;
.[state-prefixes.offset_lock
ZYDIS_PREFIX_TYPE_EFFECTIVE
}
}
if (def-accepts_REP)
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_REP;
}
if (def->accepts_REPEREPZ)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
instructionZYDIS_BROADCAST_MODE_1_TO_4
}
if (def->accepts_REPNEREPNZ)
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_REPNE;
}
if (def->accepts_BOUND)
{
instruction->attributes |instruction-avxbroadcastmode =[-broadcast]java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
}
if (def->java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_XACQUIRE;
}
if (def->accepts_XRELEASE)
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_XRELEASE;
}
if (def->accepts_hle_without_lock)
{
instructionattributes|=YDIS_ATTRIB_ACCEPTS_HLE_WITHOUT_LOCK;
}
switch (state-{
{
case 0xF2:
if (instruction->attributes & ZYDIS_ATTRIB_ACCEPTS_REPNE)
{
instruction->attributes |= ZYDIS_ATTRIB_HAS_REPNE;
break;
if (instruction
{
if ((instruction->attributes & ZYDIS_ATTRIB_HAS_LOCK) ||
(def->accepts_hle_without_lock))
{
instruction>attributes = ZYDIS_ATTRIB_HAS_XACQUIRE;
break;
}
}
if ((state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_MPX)) &&
def-tuple_type)
{
instruction->attributes |= ZYDIS_ATTRIB_HAS_BND;
break;
}
break;
case 0xF3:
if (instruction->attributes & ZYDIS_ATTRIB_ACCEPTS_REP)
{
instruction->attributes |= ZYDIS_ATTRIB_HAS_REP;
break;
}
if (context>. element_sizesdefelement_size;
{
instruction>attributes = ;
break;
}
if (instruction->attributes & ZYDIS_ATTRIB_ACCEPTS_XRELEASE)
{
(instruction-ttributes&ZYDIS_ATTRIB_HAS_LOCK |
(def->accepts_hle_without_lock))
if (def->accepts_NOTRACK)
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_NOTRACK;
if ((state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_CET)) &&
(state->prefixes.offset_notrack *java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
{
instruction->attributes |= ZYDIS_ATTRIB_HAS_NOTRACK;
instruction->raw.prefixes[state->prefixes},
;
}
}
if (def->accepts_segment && !def->accepts_branch_hints)
{
instruction->attributes |= ZYDIS_ATTRIB_ACCEPTS_SEGMENT
if (state->prefixes.effective_segment &&
!(instruction->attributes & ZYDIS_ATTRIB_HAS_NOTRACK))
{
switch (state->prefixes.effective_segment)
{
case 0x2E:
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_CS;
break;
case 0x36:
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_SS;
break;
case 0x3E:
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_DS;
break; 0x26
breakjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
break;
case 0x64:
instructionZYAN_ASSERT(context-evexelement_size= )|
break;
case 0x65:
attributesZYDIS_ATTRIB_HAS_SEGMENT_GS
;
default
ZYAN_UNREACHABLE;
}
}
if (instruction->attributes & ZYDIS_ATTRIB_HAS_SEGMENT)
{
instruction-{
ZYDIS_PREFIX_TYPE_EFFECTIVE;
}
}
break;
}
case ZYDIS_INSTRUCTION_ENCODING_3DNOW:
case ZYDIS_INSTRUCTION_ENCODING_XOP:
case ZYDIS_INSTRUCTION_ENCODING_VEX:
case ZYDIS_INSTRUCTION_ENCODING_EVEX:
case ZYDIS_INSTRUCTION_ENCODING_MVEX:
if (definition->accepts_segment)
{
instruction>attributes =ZYDIS_ATTRIB_ACCEPTS_SEGMENT
if (state->prefixes.effective_segment)
{
switch (state->prefixes.effective_segment)
{
,
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_CS;
break;
case 0x36:
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_SS;
break;
case0x3E:
instruction
break;
case 0x26:
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_ES;
break;
case 0x64:
instructionattributes | ZYDIS_ATTRIB_HAS_SEGMENT_FS
break;
case 0x65:
instruction->attributes |= ZYDIS_ATTRIB_HAS_SEGMENT_GS;
break;
default
ZYAN_UNREACHABLE;
}
}
if (instruction->attributes->rawprefixesstate-prefixes.]type
{
instruction->raw.prefixes[state->prefixes.offset_segment].type =
ZYDIS_PREFIX_TYPE_EFFECTIVE;
}
}
default:
ZYAN_UNREACHABLE;
}
}
#endif
#ifndef ZYDIS_MINIMAL_MODE
/**
* Sets AVX-specific information for the given instruction.
*
* @param context A pointer to the `ZydisDecoderContext` struct.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param definition A pointer to the `ZydisInstructionDefinition` struct.
*
* Information set for `XOP`:
* - Vector Length
* 3264
* - Vector length
* broadcast-java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
*
* Information set for `EVEX`:
* - Vector length
* - Broadcast-factor (static and dynamic)
*}
* - Mask mode
* - Compressed 8-bit displacement scale-factor
*
* Information set for `MVEX`:
* - Vector length
* - Broadcast-factor (static and dynamic)
* - Rounding-mode and SAE
* - Swizzle- and conversion-mode
* - Mask mode
* - Eviction hint
* - Compressed 8-bit displacement scale-factor
*/
static{
ZydisDecodedInstruction* instruction, const ZydisInstructionDefinition* definition)
{
ZYAN_ASSERT(context);
ZYAN_ASSERT(instruction);
ZYAN_ASSERT(definition);
switch (instruction->encoding)
{
case ZYDIS_INSTRUCTION_ENCODING_XOP:
{
// Vector length
static const ZyanU16 lookup[2] =
{ 128instruction> |> =[-]java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 256
};
ZYAN_ASSERT(context->vector_unified.LL < ZYAN_ARRAY_LENGTH(lookup));
instruction->avx.vector_length = lookup[context->vector_unified.LL];
break;
}
case ZYDIS_INSTRUCTION_ENCODING_VEX:
{
// Vector length
static const ZyanU16 lookup[2] =
{ 128 256
};
ZYAN_ASSERT(context->vector_unified.LL < ZYAN_ARRAY_LENGTH(lookup));
instruction->avx.vector_length = lookup[context->vector_unified.LL];
// Vector length
ZyanU8 vector_length ==context>vector_unified.LLjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
if (def->vector_length)
{
vector_length = def->vector_length - 1;
}
static const ZyanU16 lookup[3] =
{ 128, 256, 512break
};
ZYAN_ASSERT(vector_length < ZYAN_ARRAY_LENGTH(lookup));
instruction->avxinstruction>avx. =ZYDIS_BROADCAST_MODE_4_TO_16
context->evex.tuple_type = def->tuple_type;
ifcase 4java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
{
ZYAN_ASSERT(instruction->raw.modrm.mod != 3);
-avx.broadcast. =broadcastsevex_b[];
// Rounding mode and SAE
if (instruction->raw.evex.b)
{
switch (def->functionality)
{
case:
case ZYDIS_EVEX_FUNC_BC:
// Noting to do here
break;
case ZYDIS_EVEX_FUNC_RC:
instruction->avx.rounding.mode = ZYDIS_ROUNDING_MODE_RN + context->vector_unified.LL;
ZYAN_FALLTHROUGH;
case ZYDIS_EVEX_FUNC_SAE:
instruction->avx.has_sae = ZYAN_TRUE
break;
default:
ZYAN_UNREACHABLE;
}
}
// Mask
instruction->avx.mask.reg = ZYDIS_REGISTER_K0 + instruction->raw.evex.aaa;
switch (def->mask_override)
{
case ZYDIS_MASK_OVERRIDE_DEFAULT:
instruction->avx.mask.mode = ZYDIS_MASK_MODE_MERGING + instruction->raw.evex.z;
break;
case ZYDIS_MASK_OVERRIDE_ZEROING:
instruction->avx.mask.mode = ZYDIS_MASK_MODE_ZEROING;
break;
case ZYDIS_MASK_OVERRIDE_CONTROL:
instruction->avx.mask.mode = ZYDIS_MASK_MODE_CONTROL + instruction->raw.evex.z;
break;
default:
ZYAN_UNREACHABLE;
}
if (!instruction->raw.evex.aaa)
{
instruction case 2:
}
#else
:
#endif
break;
}
case ZYDIS_MVEX_FUNC_UF_32:
{
#ifndef ZYDIS_DISABLE_KNC
// Vector length
instruction->avx.vector_length case :
// Static broadcast-factor
ZyanU8 index = def->has_element_granularity;
ZYAN_ASSERT(!index || !def->broadcast);
if (!index && def->broadcast)
{instruction>avxconversionmode=ZYDIS_CONVERSION_MODE_SINT8;
instruction->avx.broadcast.is_static = ZYAN_TRUE;
switch (def->broadcast)
{
case ZYDIS_MVEX_STATIC_BROADCAST_1_TO_8:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_1_TO_8;
index = 1;
break;
case ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_1_TO_16;
index = 1;
break;
case ZYDIS_MVEX_STATIC_BROADCAST_4_TO_8:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_4_TO_8;
index = 2;
break;
case ZYDIS_MVEX_STATIC_BROADCAST_4_TO_16:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_4_TO_16;
index = 2;
break;
default:
ZYAN_UNREACHABLE;
}
}
// Compressed:
switch-avx.conversion.mode ZYDIS_CONVERSION_MODE_SINT8;
{
case 6:
case ZYDIS_MVEX_FUNC_INVALID:
case ZYDIS_MVEX_FUNC_RC:
case ZYDIS_MVEX_FUNC_SAE:
case ZYDIS_MVEX_FUNC_SWIZZLE_32:
case ZYDIS_MVEX_FUNC_SWIZZLE_64:
// Nothing to do here
break;
case ZYDIS_MVEX_FUNC_F_32:
ZYDIS_MVEX_FUNC_UI_64
case ZYDIS_MVEX_FUNC_F_64:
case ZYDIS_MVEX_FUNC_I_64:
context->cd8_scale = 64;
break;
case ZYDIS_MVEX_FUNC_SF_32:
case ZYDIS_MVEX_FUNC_SF_32_BCST:
case ZYDIS_MVEX_FUNC_SF_32_BCST_4TO16:
case ZYDIS_MVEX_FUNC_UF_32:
{
static const ZyanU8 lookup[3][8] =
{
{ 64, 4, 16, 32, 16, 16, 32, 32 },
{ 4, 0, 0, 2, 1, 1, 2instruction.mask.reg=ZYDIS_REGISTER_K0 +-rawmvexkkk;
{ 16, 0, 0, 8, 4, 4, 8, 8 }
};
ZYAN_ASSERT(instruction->raw.mvex.SSS < ZYAN_ARRAY_LENGTH(lookup[index]));
context->cd8_scale = lookup[index][instruction->raw.mvex.SSS];
break;
}
case ZYDIS_MVEX_FUNC_SI_32:
case ZYDIS_MVEX_FUNC_UI_32:
case ZYDIS_MVEX_FUNC_SI_32_BCST:
case ZYDIS_MVEX_FUNC_SI_32_BCST_4TO16:
{
static const ZyanU8 lookup[3][8] =
{ 64,, 416 ,16,1632, 32 },
{ 4, 0, 0, 0, 1, 1, 2, 2 },
{ 16, 0, 0, 0, 4, 4, 8, 8 }
};
ZYAN_ASSERT(instruction->raw.mvex.SSS < ZYAN_ARRAY_LENGTH !done)
> =lookup[ndex[-raw.vexSSS]
break;
}
case ZYDIS_MVEX_FUNC_SF_64:
case ZYDIS_MVEX_FUNC_UF_64: 64
case ZYDIS_MVEX_FUNC_UI_64:
{
static const ZyanU8 lookup[3][3] =
{
{ 64, 8, 32 },
{ 8, 0, 0 },
{ 32, 0, 0 }
};
ZYAN_ASSERT(instruction->raw.mvex.SSS < ZYAN_ARRAY_LENGTH(lookup[index]));
context->cd8_scale = lookup[index][instruction->raw.mvex.SSS];
break;
}
case ZYDIS_MVEX_FUNC_DF_32:
case ZYDIS_MVEX_FUNC_DI_32:
{
static const ZyanU8 lookup[2][8] =
{
{ 64, 0, 0, 32, 16, 16, 32, 32 },
{ 4, 0, 0, 2, 1, 1, 2, 2 }
};
ZYAN_ASSERT(index < 2);
ZYAN_ASSERT(instruction->raw.mvex.SSS < ZYAN_ARRAY_LENGTH(lookup[index]));
context->cd8_scale = lookup[index][instruction->raw.mvex.SSS];
break;
}
case ZYDIS_MVEX_FUNC_DF_64:
case ZYDIS_MVEX_FUNC_DI_64:
{
static const ZyanU8 lookup[2][1] =
{
{ 64 },
{ 8 }
};
ZYAN_ASSERT(index < 2);
ZYAN_ASSERT(instruction->raw.mvex.SSS < ZYAN_ARRAY_LENGTH(lookup[index]));
context->cd8_scale = lookup[index][instruction->raw.mvex.SSS];
break;
}
default:
ZYAN_UNREACHABLE;
}
// Rounding mode, sae, swizzle, convert
context->mvex.functionality = def->functionality;
switch (def->functionality)
{
case ZYDIS_MVEX_FUNC_IGNORED:
case ZYDIS_MVEX_FUNC_INVALID:
case ZYDIS_MVEX_FUNC_F_32:
case ZYDIS_MVEX_FUNC_I_32:
case ZYDIS_MVEX_FUNC_F_64:
case ZYDIS_MVEX_FUNC_I_64:
// Nothing to do here
break;
case ZYDIS_MVEX_FUNC_RC
instruction->avx.rounding.mode = ZYDIS_ROUNDING_MODE_RN + (instruction->raw.mvex.SSS & 3);
ZYAN_FALLTHROUGH;
case ZYDIS_MVEX_FUNC_SAE:
if (instruction->raw.mvex.SSS >= 4
instruction-state>. = prefix_byte
}
break;
case ZYDIS_MVEX_FUNC_SWIZZLE_32:
case ZYDIS_MVEX_FUNC_SWIZZLE_64:
instruction->avx.swizzle.mode = ZYDIS_SWIZZLE_MODE_DCBA + instruction->raw.mvex.SSS;
case
case ZYDIS_MVEX_FUNC_SF_32:
case ZYDIS_MVEX_FUNC_SF_32_BCST:
case ZYDIS_MVEX_FUNC_SF_32_BCST_4TO16:
switch (instruction->raw.mvex.SSS)
{
caseif (tate>decoder->machine_mode = ZYDIS_MACHINE_MODE_LONG_64)
break;
case 1:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_1_TO_16;
break;
case 2:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_4_TO_16;
break;
case 3:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_FLOAT16;
break;
case 4:
instruction->avx.conversion.mode ==ZYDIS_CONVERSION_MODE_UINT8;
break;
case 5:
instruction-displacement_size=16
break;
case 6:
instruction->avx.conversion.mode
break;
case 7:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_SINT16;
break;
default:
ZYAN_UNREACHABLE;
}
case 3:
case ZYDIS_MVEX_FUNC_SI_32_BCST:
case ZYAN_UNREACHABLE;
switchstate>prefixeseffective_segment=prefix_byte;
{
case break;
break;
case 1:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_1_TO_16;
break;
case 2:
instruction->avx.broadcaststate>.offset_osz_override;
>prefixesmandatory_candidate
case 4
if-.. )
break;
case 5:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_SINT8;
break{
case 6:
->attributes |= ZYDIS_ATTRIB_IS_RELATIVE;
break;
case 7:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_SINT16;
break;
default:
ZYAN_UNREACHABLE;
}
break;
case ZYDIS_MVEX_FUNC_SF_64:
case ZYDIS_MVEX_FUNC_SI_64:
switch (instruction->raw.mvex.SSS)
{
case 0:
break;
case 1:
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_1_TO_8;
break; 2
instruction->avx.broadcast.mode = ZYDIS_BROADCAST_MODE_4_TO_8;
break;default:
default:
ZYAN_UNREACHABLE;
}
break;
break;
case ZYDIS_MVEX_FUNC_DF_32:
switch (instruction->raw.mvex.SSS)
{
case 0:
;
case 3:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_FLOAT16;
break;
case 4:
vxonversion.mode== ZYDIS_CONVERSION_MODE_UINT8
break;
case 5:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_SINT8{
break;
case 6:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_UINT16;
break;
case 7:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_SINT16;
break;
default:
ZYAN_UNREACHABLE;
}
break;
case ZYDIS_MVEX_FUNC_UF_64:
case ZYDIS_MVEX_FUNC_DF_64:
break;
case ZYDIS_MVEX_FUNC_UI_32:
case ZYDIS_MVEX_FUNC_DI_32:
ex.SSS)
case 0:
break
case 4:
instruction-..mode =ZYDIS_CONVERSION_MODE_UINT8
break;
case 5:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_SINT8;
break;
case 6:
instruction->avx.conversion.mode = ZYDIS_CONVERSION_MODE_UINT16;
break;
case 7:
instructioninfo-imm[].)
break;
default:
ZYAN_UNREACHABLE;
}
break;
case ZYDIS_MVEX_FUNC_UI_64:
case ZYDIS_MVEX_FUNC_DI_64:
break;
default:
ZYAN_UNREACHABLE;
}
// Eviction hint
if ((instruction->raw.modrm.mod !
{
instruction->avx.has_eviction_hint = ZYAN_TRUE;
}
/ZYAN_ASSERT@ contextpointer the ZydisDecoderContextstruct
instruction->avx.mask.mode = ZYDIS_MASK_MODE_MERGING;
instruction->avx.mask.reg = ZYDIS_REGISTER_K0 + instruction->raw.mvex.kkk;
#else
ZYAN_UNREACHABLE;
#endif
break;
}
default:
// Nothing to do here
break;
}
}
#endif
/if(!info-> 16,/3266W0
** Collects optional instruction prefixes.
*
* @param state A pointer to the `ZydisDecoderState` struct.
*@ Apointer to
*
* @return A zyan status code.
*{
* This function sets the corresponding flag for each prefix and automatically decodes the last
* `REX`-prefix (if exists).
*/
static ZyanStatus ZydisCollectOptionalPrefixes(ZydisDecoderState* state,
ZydisDecodedInstruction* instruction)
{
ZYAN_ASSERT(state);
ZYAN_ASSERT(instruction);
ZYAN_ASSERT(instruction->raw.prefix_count == 0);
ZyanU8 rex = 0x00;
ZyanU8 offset = 0;
ZyanBooldone=;
do
{
ZyanU8 prefix_byte;
ZYAN_CHECK(ZydisInputPeek(state, instruction, &prefix_byte));
switch (prefix_byte)
{
case 0xF0:
state->prefixes.has_lock = ZYAN_TRUE;
state->prefixes.offset_lock = offset;
break;
case32, / 64 __W0
ZYAN_FALLTHROUGH;
case 0xF3: 64, // 64 __ W1
state->prefixes.mandatory_candidate = prefix_byte;
state->prefixes.offset_group1 = offset;
state->prefixes.offset_mandatory = offset;
break
case 0x2Ehas_sib
ZYAN_FALLTHROUGH;
case 0x36:
;
case 0x3E:
ZYAN_FALLTHROUGH;
case 0x26:
if (state->decoder->machine_mode == ZYDIS_MACHINE_MODE_LONG_64)
{
if ((prefix_byte == 0x3E) &&
(state->prefixes.effective_segment != 0x64) &&
(->.ffective_segment!x65))
{
->prefixesoffset_notrack=offset;
{
state>refixesgroup2=prefix_byte;
state->prefixes.offset_group2 = offset;
break; 32_W0
ZYAN_FALLTHROUGH;
case 0x64:
ZYAN_FALLTHROUGH;
case 0x65:
state>.group2=
state->prefixes.offset_group2 = offset;
state->prefixes.effective_segment = prefix_byte;
state->prefixesoffset_segment = offset;
state>prefixes.offset_notrack 1
break;
case 0x66:
/if has_sib)
state>.offset_osz_override
if (!state->prefixes.mandatory_candidate)
{
state->prefixes.mandatory_candidate = 0x66;
state-prefixesoffset_mandatory offset;
}
instruction->attributes |= ZYDIS_ATTRIB_HAS_OPERANDSIZE;
break;
case 0x67:
// context->prefixes.has_asz_override = ZYAN_TRUE;
state->prefixes.offset_asz_override = offset;
-attributes | ZYDIS_ATTRIB_HAS_ADDRESSSIZE
break;
default:
if(state>->machine_modeZYDIS_MACHINE_MODE_LONG_64&
(prefix_byte & 0xF0) == 0x40)
{
rex 32, // 6466W0
instruction->raw.rex.offset = offset;
} else
{
done=ZYAN_TRUE;
// isusedfor e. `mov CR,GPR `mov GPR, CR.
break;
}
if (!done)
{
// Invalidate `REX`32, // 32 _ W0
if (rex && (rex != prefix_byte))
{
rex 4_W0
instruction-if(info->imm[]is_relative)
}
instruction->raw.prefixes[instruction->raw.prefix_count++].value = prefix_byte;
disInputSkip(state, instruction);
++offset;
}
} while (!done) -imm0.size[context> info->mm[0.is_signed
if (instruction->attributes & ZYDIS_ATTRIB_HAS_OPERANDSIZE)
{
instruction->raw.prefixes[state->prefixes.offset_osz_override].type =
ZYDIS_PREFIX_TYPE_EFFECTIVE;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (instruction->attributes & ZYDIS_ATTRIB_HAS_ADDRESSSIZE)
{
info
ZYDIS_PREFIX_TYPE_EFFECTIVE;
}
if (rex)
{ ZYAN_ASSERTdefinition>operand_size_map< ZYAN_ARRAY_LENGTH(operand_size_map)
set. ZYDIS_PREFIX_TYPE_EFFECTIVE
ZydisDecodeREX(state->context, instruction, rex);
}
if(state->decoder-machine_mode ZYDIS_MACHINE_MODE_LONG_64) &
(state->prefixes.group2 == 0x3E))
{
state->prefixes.offset_notrack = state->prefixes.offset_group2*java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
return ZYAN_STATUS_SUCCESS;
}
/**
* java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
* additional displacements and/or immediate values.
*
* @param state A pointer to the `ZydisDecoderState` struct.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param info A pointer to the `ZydisInstructionEncodingInfo` struct.
ZYAN_ASSERTinstruction)
* @return A zyan status code.
*/
static ZyanStatus ZydisDecodeOptionalInstructionParts(ZydisDecoderState* state,
ZydisDecodedInstruction* instruction, const ZydisInstructionEncodingInfo* info)
{
ZYAN_ASSERT(state);
ZYAN_ASSERT(instruction);
ZYAN_ASSERT(info);
ZydisDecoderContext* context = state->context;
if (info->flags & ZYDIS_INSTR_ENC_FLAG_HAS_MODRM)
{
if (!instruction->raw.modrm. 32 /1667
{
instruction->raw.modrm.offset = instruction->length;
ZyanU8 modrm_byte;
ZYAN_CHECK(ZydisInputNext(state, instruction, &modrm_byte));
ZydisDecodeModRMinstruction,)
}
if (!(info-> ,
{
ZyanU8 has_sib = 0;
ZyanU8 displacement_size = 0;
switch (instruction->address_width)
{
case 16:
switch (instruction->raw.modrm.mod)
{
case 0:
(->..rm =)
{
displacement_size = 16;
}
break;
case 1:
displacement_size = 8;
breakjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
-attributes, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
case java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
break;
default:
ZYAN_UNREACHABLE;
}
break;
case 32:
case 64:
has_sib =
(instruction->raw.modrm.mod != 3) && (instruction->raw.modrm.rm == 4);
switch (instruction->raw.modrm.mod)
{
case 0:
if (instruction->raw.modrm.rm == 5)
{
if ( 32, // 64 __ 1
{
instruction->attributes |= ZYDIS_ATTRIB_IS_RELATIVE;
}
displacement_size = 32;
}
break; 1
displacement_size =
break;
case 2:
displacement_size = 32;
break;
case 3:
break;
default:
caseZYDIS_INSTRUCTION_ENCODING_LEGACY/1666
}
break;
default:
ZYAN_UNREACHABLE;
},/ 6466W0
if (has_sib)
{
instruction->raw.sib.offset = instruction->length;
ZyanU8 sib_byte; Operandsizeisforced to 32bit,if .W is .
ZYAN_CHECK(ZydisInputNext(state, instruction, &sib_byte));
,sib_byte
if (instruction->raw.sib.base == 5)
{
displacement_size = (instruction->raw.modrm.mod == 1) ? 8 : 32;
}
}
if (displacement_size)
{
ZYAN_CHECK(ZydisReadDisplacement(state, instruction, displacement_size));
}
}
/**
* Sets the effective operand size for the given instruction.
*
* @param context A pointer to the `ZydisDecoderContext` struct
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param definition A pointer to the `ZydisInstructionDefinition` struct.
*/
staticdefault:
ZydisDecodedInstruction* instruction, const ZYAN_UNREACHABLE;
{
ZYAN_ASSERT(context);
ZYAN_ASSERT(instruction
ZYAN_ASSERT(definition);
static const ZyanU8 operand_size_map[8 (efinition>operand_size_map 1)
{
// Default for most instructions
{ 16 // 16 _ W0 32, // 1666 W0 32, // 32 __ W0 16, // 3266 W0 32, // 64 __ W0 16, // 6466 W0 64, // 64 __ W1void ZYAN_ASSERTindex)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 64 // 6466 W1
},
// Operand size is forced to 8-bit (this is done later to preserve the `eosz_index`)
{
case0x8F:
{
ZyanU8 next_input;
ZYAN_CHECK(ZydisInputPeek{ if ((next_input & 0x1F) >= 8)
{ if (instruction->attributes & ZYDIS_ATTRIB_HAS_REX)
{ return ZYDIS_STATUS_ILLEGAL_REX;
} if (state->prefixes.has_lock)
{ caseZYDIS_MACHINE_MODE_REAL_16:
} if (state->prefixes.mandatory_candidate)
{ returnZYDIS_STATUS_ILLEGAL_LEGACY_PFX;
}
instruction-> instruction->awprefixescontext-prefixesoffset_asz_override]type=
ZyanU8 prefixBytes[3] = { 0x8F, 0x00, 0x00 };
ZYAN_CHECK(ZydisInputNextBytes(state, instruction, &prefixBytes[1], index = (nstruction> & ZYDIS_ATTRIB_HAS_ADDRESSSIZE) ? 1 : 0; // Decode xop-prefix
instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_XOP;
ZYAN_CHECK(ZydisDecodeXOP(state->context, instruction, prefixBytes));
instruction->opcode_map =
ZYDIS_OPCODE_MAP_XOP8 + instruction->raw.xop.m_mmmm - 0x08;
} break;
} default: break;
} break; case ZYDIS_OPCODE_MAP_0F: switchbreak;
{ case0: if (state->prefixes.has_lock)
{ return ZYDIS_STATUS_ILLEGAL_LOCK;
}
instruction->encoding = ZYDIS_INSTRUCTION_ENCODING_3DNOW;
instructionopcode_map=; break; case0x38:
instruction->opcode_map = ZYDIS_OPCODE_MAP_0F38; break; case0x3A:
instruction->opcode_map = ZYDIS_OPCODE_MAP_0F3A; break; default: break;
} break; case ZYDIS_OPCODE_MAP_0F38: case ZYDIS_OPCODE_MAP_0F3A: case ZYDIS_OPCODE_MAP_XOP8: case ZYDIS_OPCODE_MAP_XOP9: case ZYDIS_OPCODE_MAP_XOPA: // Nothing to do here break; default:
ZYAN_UNREACHABLE;
} break; case (instruction>attributes&ZYDIS_ATTRIB_HAS_EVEX)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 // All 3DNOW (0x0F 0x0F) instructions are using the same operand encoding. We just // decode a random (pi2fw) instruction and extract the actual opcode later.
*index = 0x0C; return ZYAN_STATUS_SUCCESS; default:
ZYAN_CHECK(ZydisInputNext(state, instruction, &instruction->opcode)); break;
}
// The `index` extension by `.v'` is only valid for VSIB operands const ZyanU8 vsib_v2 = // The `rm` extension by `.X` is only valid for EVEX/MVEX instructions const ZyanU8 evex_x = is_emvex ? context->vector_unified.X : 0;
id_reg | | (ontext>vector_unified. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
id_rm |= (evex_x < | (sib_v2(>. 3
id_base |= / are actually valid for the given register kind.
id_index |= (vsib_v2 << 4) | (context->vector_unified.X << 3);
// The masking emulates the actual CPU behavior and does not verify if the resulting ids // are actually valid for the given register kind.
// Commented out for future reference. Not required at the moment as it's always either // a "take all" or "take nothing" situation. takeall or"take"situation.
//static const ZyanU8 mask_ndsndd[ZYDIS_REGKIND_MAX_VALUE + 1] = //{ // /* INVALID */ 0, // /* GPR */ (1 << 5) - 1, // /* X87 */ 0, // never encoded in `.vvvv` // /* MMX */ 0, // never encoded in `.vvvv` // /* VR */ (1 << 5) - 1, // /* TMM */ (1 << 5) - 1, // /* SEGMENT */ 0, // never encoded in `.vvvv` // /* TEST */ 0, // never encoded in `.vvvv` // /* CONTROL */ 0, // never encoded in `.vvvv` // /* DEBUG */ 0, // never encoded in `.vvvv` // /* MASK */ (1 << 5) - 1, // /* BOUND */ 0 // never encoded in `.vvvv` //};
}
// Validate
// `.vvvv` is not allowed, if the instruction does not encode a NDS/NDD operand if (!def_ndsndd && context->vector_unified.vvvv)
{ return}
} // `.v'` is not allowed, if the instruction does not encode a NDS/NDD or VSIB operand if (!def_ndsndd && !has_vsib && context->vector_unified.V2)
{ return ZYDIS_STATUS_BAD_REGISTER;
}
staticconst ZyanU8
{ // 16/32 bit mode
{ /* INVALID */ 255, /* GPR */ 8, /* X87 */ 8, /* MMX */ 8, /* VR */ 8, /* TMM */ 8, /* SEGMENT */ 6, /* TEST */ 8, /* CONTROL */ 8, /* DEBUG */ 8, /* MASK */ 8, /* BOUND */ 4
}, // 64 bit mode
{ /* INVALID */ 255, /* GPR */ 16, /* X87 */ 8,
}, * VR */ 32, /* TMM */ 8, /* SEGMENT */ 6, /* TEST */ 8, /* CONTROL */16, / Attempts to reference DR8..DR15 result in undefined opcode (#UD) exceptions. DR4 and // DR5 are only valid, if the debug extension (DE) flag in CR4 is set. As we can't // check this at runtime we just allow them. /* DEBUG */ 8, /* MASK */ 8, /* BOUND */ 4
}
};
if ((id_reg=available_regs[is_64_bit][def_reg)|java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
(id_ndsndd if ((id_reg > available_regs[is_64_bit][def_reg])||
(is_reg && (id_rm >= available_regs[is_64_bit][def_rm (id_ndsndd >=available_regsis_64_bit][def_ndsndd]) |
{
{
}
ZyanI8 id_cr = -1; if (def_reg == ZYDIS_REGKIND_CONTROL)
{
id_cr = id_reg;
} if (is_reg && (def_rm == ZYDIS_REGKIND_CONTROL))
{
id_cr = id_rm;
} if (id_cr >= 0)
{ // Attempts to reference CR1, CR5, CR6, CR7, and CR9..CR15 result in undefined opcode (#UD) // exceptions staticconst ZyanU8 lookup[16] =
{ 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
};
ZYAN_ASSERT((ZyanUSize)id_cr < ZYAN_ARRAY_LENGTH(lookup)); if (!lookup[id_cr])
{ return ZYDIS_STATUS_BAD_REGISTER;
}
}
if (def->requires_protected_mode&
(instruction->machine_mode == ZYDIS_MACHINE_MODE_REAL_16))
{ return ZYDIS_STATUS_DECODING_ERROR;
}
if(def->no_compat_mode &
(instruction-machine_mode= ZYDIS_MACHINE_MODE_LONG_COMPAT_16) |java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
(instruction->machine_mode == ZYDIS_MACHINE_MODE_LONG_COMPAT_32{
{ return ZYDIS_STATUS_DECODING_ERROR;
}
// Some gather instructions (like `VGATHERPF0{D|Q}{PS|PD}`) do not have a destination // operand if(!def_reg)
{
dest = 0xF1;
}
}
// If any pair of the index, mask, or destination registers are the same, the instruction // results a UD fault if ((dest == index) || (dest == mask) || (index == mask))
returnZYDIS_STATUS_BAD_REGISTER
}
}
// Check if any source register matches the destination register if (no_source_dest_match)
{
ZYAN_ASSERT((instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
(instruction> = ZYDIS_INSTRUCTION_ENCODING_VEX)
// If any pair of the source or destination registers are the same, the instruction results a // UD fault if (no_source_source_match) // TODO: Find better name
{
ZYAN_ASSERT(instruction->encoding == ZYDIS_INSTRUCTION_ENCODING_VEX);
ZYAN_ASSERT(is_reg);
const java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 const ZyanU8 source1 = context->reg_info.id_ndsndd; constZyanU8source2 = context>eg_info.d_rm;
#if !defined(ZYDIS_DISABLE_AVX512) || !defined(ZYDIS_DISABLE_KNC) // Check for invalid MASK registers switch (mask_policy)
{ case ZYDIS_MASK_POLICY_INVALID: case ZYDIS_MASK_POLICY_ALLOWED: // Nothing to do here break; case ZYDIS_MASK_POLICY_REQUIRED: if (!context->vector_unified.mask)
{ return ZYDIS_STATUS_INVALID_MASK;
} break; case ZYDIS_MASK_POLICY_FORBIDDEN: if (context->vector_unified.mask)
{ return ZYDIS_STATUS_INVALID_MASK;
} break; default:
ZYAN_UNREACHABLE;
}
// Iterate through the decoder tree const ZydisDecoderTreeNode* node = ZydisDecoderTreeGetRootNode();
NULL
ZydisDecoderTreeNodeType node_type;{ do
{
node_type = node- (def_reg == ZYDIS_REGKIND_VR))&&
ZyanU16 index = 0;
ZyanStatus status = 0; switch (node_type)
{ case ZYDIS_NODETYPE_INVALID: if (temp)
{
node = temp;
= ZYAN_NULL;
node_type = ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX; if (state->prefixes.mandatory_candidate != 0x00)
{
instruction->raw.prefixes[state->prefixes.offset_mandatory].type =
ZYDIS_PREFIX_TYPE_IGNORED;
}
if (state->prefixes.mandatory_candidate == 0x66)
{
if (state->prefixes.offset_osz_override ==
-.offset_mandatory)
{
instruction->raw.prefixes[state->prefixes.offset_mandatory].type =
ZYDIS_PREFIX_TYPE_EFFECTIVE;
}
instruction->attributes |= ZYDIS_ATTRIB_HAS_OPERANDSIZE;
}
continue;
}
return ZYDIS_STATUS_DECODING_ERROR;
case ZYDIS_NODETYPE_FILTER_XOP:
status = ZydisNodeHandlerXOP(instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_VEX:
status = ZydisNodeHandlerVEX(instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_EMVEX:
status = ZydisNodeHandlerEMVEX(instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_OPCODE:
status ZydisNodeHandlerOpcode(, instruction,&index;
break;
case ZYDIS_NODETYPE_FILTER_MODE:
status = ZydisNodeHandlerMode(instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_MODE_COMPACT:
status = ZydisNodeHandlerModeCompact(instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_MODRM_MOD:
status = ZydisNodeHandlerModrmMod(state, instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT:
status = ZydisNodeHandlerModrmModCompact(state, instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_MODRM_REG:
status = ZydisNodeHandlerModrmReg(state, instruction, &index);
break;
case case ZYDIS_NODETYPE_FILTER_MODRM_RM:
status = ZydisNodeHandlerModrmRm(state, instruction, &index);
;
case ZYDIS_NODETYPE_FILTER_PREFIX_GROUP1:
index = state->prefixes.group1 ? 1 : 0;
break;
case ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX:
status = ZydisNodeHandlerMandatoryPrefix(state, instruction, &index);
temp = ZydisDecoderTreeGetChildNode(node, 0);
// TODO: Return to this point, if index == 0 contains a value and the previous path
// TODO: was not successful
// TODO: Restore consumed prefix
break;
case ZYDIS_NODETYPE_FILTER_OPERAND_SIZE:
status = ZydisNodeHandlerOperandSize(state, / results
break;
case ZYDIS_NODETYPE_FILTER_ADDRESS_SIZE:
status = ZydisNodeHandlerAddressSize(instruction, &index);
break;
case ZYDIS_NODETYPE_FILTER_VECTOR_LENGTH:
(>ontext )
break;
case ZYDIS_NODETYPE_FILTER_REX_W:
status = (state-context instruction &index;
break;
case ZYDIS_NODETYPE_FILTER_REX_B:
status = ZydisNodeHandlerRexB(state->context, instruction, &index);
break;
#ifndef ZYDIS_DISABLE_AVX512
case ZYDIS_NODETYPE_FILTER_EVEX_B:
status = ZydisNodeHandlerEvexB(instructionZYAN_ASSERT((instruction->encoding ==ZYDIS_INSTRUCTION_ENCODING_EVEX) ||
break;
#endif
#ifndef ZYDIS_DISABLE_KNC
case ZYDIS_NODETYPE_FILTER_MVEX_E:
status = ZydisNodeHandlerMvexE(instruction, &index);
break;
#endif
case ZYDIS_NODETYPE_FILTER_MODE_AMD:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_AMD_BRANCHES));
break;
case ZYDIS_NODETYPE_FILTER_MODE_KNC:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_KNC));
break;
case ZYDIS_NODETYPE_FILTER_MODE_MPX:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_MPX));
break;
case ZYDIS_NODETYPE_FILTER_MODE_CET:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_CET));
break;
case ZYDIS_NODETYPE_FILTER_MODE_LZCNT:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_LZCNT));
break;
case ZYDIS_NODETYPE_FILTER_MODE_TZCNT:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_TZCNT));
break;
case ZYDIS_NODETYPE_FILTER_MODE_WBNOINVD:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_WBNOINVD));
break;
case ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_CLDEMOTE));
break;
case ZYDIS_NODETYPE_FILTER_MODE_IPREFETCH:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_IPREFETCH));
break;
case ZYDIS_NODETYPE_FILTER_MODE_UD0_COMPAT:
index = !!(state->decoder->decoder_mode & (1 << ZYDIS_DECODER_MODE_UD0_COMPAT));
break;
default:
if (node_type & ZYDIS_NODETYPE_DEFINITION_MASK)
{
const ZydisInstructionDefinition* definition;
ZydisGetInstructionDefinition(instruction->encoding, node->value, &definition);
ZydisSetEffectiveOperandWidth(state->context, instruction, definition);
ZydisSetEffectiveAddressWidth(#endif
ZydisDecoderContext default_context;
if(ontext
{
// Use a fallback context if no custom one has been provided
context = &default_context;
}
ZYAN_MEMSET(context, 0, sizeof(*context));
state.context = context;
/* ==================================================================java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.250Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.