From c77c9f25616b3b1670dd7372ba98383a5e697069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20Ho=CC=88ner?= Date: Tue, 17 Oct 2017 17:30:36 +0200 Subject: [PATCH] Move encoder to `feature/encoder` branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Won’t be ready until v2.1 --- CMakeLists.txt | 30 +- include/Zydis/Encoder.h | 146 --- src/Encoder.c | 1482 ----------------------------- src/EncoderData.c | 117 --- src/EncoderData.h | 115 --- src/Generated/EncoderLookup.inc | 1546 ------------------------------- tools/ZydisDisasm.c | 2 +- 7 files changed, 16 insertions(+), 3422 deletions(-) delete mode 100644 include/Zydis/Encoder.h delete mode 100644 src/Encoder.c delete mode 100644 src/EncoderData.c delete mode 100644 src/EncoderData.h delete mode 100644 src/Generated/EncoderLookup.inc diff --git a/CMakeLists.txt b/CMakeLists.txt index da074a9..2f454c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,9 @@ project(Zydis VERSION 2.0) option(ZYDIS_FEATURE_DECODER "Enable instruction decoding and formtting functionality" ON) -option(ZYDIS_FEATURE_ENCODER - "Enable instruction encoding functionality" - OFF) +#option(ZYDIS_FEATURE_ENCODER +# "Enable instruction encoding functionality" +# OFF) option(ZYDIS_FEATURE_EVEX "Enable support for EVEX instructions" ON) @@ -95,9 +95,9 @@ endif () if (ZYDIS_FEATURE_DECODER) target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_DECODER") endif () -if (ZYDIS_FEATURE_ENCODER) - target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_ENCODER") -endif () +#if (ZYDIS_FEATURE_ENCODER) +# target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_ENCODER") +#endif () target_sources("Zydis" PUBLIC @@ -134,15 +134,15 @@ if (ZYDIS_FEATURE_DECODER) "src/FormatHelper.c") endif () -if (ZYDIS_FEATURE_ENCODER) - target_sources("Zydis" - PUBLIC - "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Encoder.h" - PRIVATE - "src/EncoderData.h" - "src/Encoder.c" - "src/EncoderData.c") -endif () +#if (ZYDIS_FEATURE_ENCODER) +# target_sources("Zydis" +# PUBLIC +# "${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Encoder.h" +# PRIVATE +# "src/EncoderData.h" +# "src/Encoder.c" +# "src/EncoderData.c") +#endif () if (BUILD_SHARED_LIBS AND WIN32) target_sources("Zydis" PRIVATE "src/VersionInfo.rc") diff --git a/include/Zydis/Encoder.h b/include/Zydis/Encoder.h deleted file mode 100644 index 67af4f2..0000000 --- a/include/Zydis/Encoder.h +++ /dev/null @@ -1,146 +0,0 @@ -/*************************************************************************************************** - - Zyan Disassembler Library (Zydis) - - Original Author : Joel Höner - - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - -***************************************************************************************************/ - -/** - * @file - * @brief Functions for (re-)encoding instructions. - */ - -#ifndef ZYDIS_ENCODER_H -#define ZYDIS_ENCODER_H - -#include -#include -#include -#include -#include -#ifdef ZYDIS_ENABLE_FEATURE_DECODER -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* ============================================================================================== */ -/* Constants */ -/* ============================================================================================== */ - -/** - * @brief Defines a mask of attributes users may excplicitly ask for. - */ -#define ZYDIS_USER_ENCODABLE_ATTRIB_MASK ( \ - ZYDIS_ATTRIB_HAS_LOCK | \ - ZYDIS_ATTRIB_HAS_REP | \ - ZYDIS_ATTRIB_HAS_REPE | \ - ZYDIS_ATTRIB_HAS_REPNE | \ - ZYDIS_ATTRIB_HAS_BOUND | \ - ZYDIS_ATTRIB_HAS_XACQUIRE | \ - ZYDIS_ATTRIB_HAS_XRELEASE | \ - ZYDIS_ATTRIB_HAS_BRANCH_TAKEN | \ - ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN \ -) - -/* ============================================================================================== */ -/* Structs */ -/* ============================================================================================== */ - -#define ZYDIS_ENCODER_MAX_OPERANDS (5) - -typedef struct ZydisEncoderOperand_ -{ - ZydisOperandType type; - ZydisRegister reg; - struct - { - ZydisRegister segment; - ZydisRegister base; - ZydisRegister index; - uint8_t scale; - uint8_t dispSize; - int64_t disp; - } mem; - struct - { - uint16_t segment; - uint32_t offset; - } ptr; - union - { - uint64_t u; - int64_t s; - } imm; -} ZydisEncoderOperand; - -typedef struct ZydisEncoderRequest_ -{ - ZydisMachineMode machineMode; - ZydisMnemonic mnemonic; - ZydisInstructionAttributes attributes; - ZydisInstructionEncoding encoding; - uint8_t operandCount; - ZydisEncoderOperand operands[ZYDIS_ENCODER_MAX_OPERANDS]; - - struct - { - ZydisVectorLength vectorLength; - struct - { - ZydisMaskMode mode; - ZydisRegister reg; - } mask; - } avx; - // TODO: mvex stuff -} ZydisEncoderRequest; - -/* ============================================================================================== */ -/* Exported functions */ -/* ============================================================================================== */ - -#ifdef ZYDIS_ENABLE_FEATURE_DECODER -ZYDIS_EXPORT ZydisStatus ZydisEncoderDecodedInstructionToRequest( - const ZydisDecodedInstruction* in, ZydisEncoderRequest* out); -#endif - -/** - * @brief Encodes the given instruction request to byte-code. - * - * @param buffer A pointer to the output buffer. - * @param bufferLen The length of the output buffer. - * @param request A pointer to the @c ZydisEncoderRequest encode. - * - * @return A zydis status code. - */ -ZYDIS_EXPORT ZydisStatus ZydisEncoderEncodeInstruction(void* buffer, size_t* bufferLen, - const ZydisEncoderRequest* request); - -/* ============================================================================================== */ - -#ifdef __cplusplus -} -#endif - -#endif /* ZYDIS_ENCODER_H */ diff --git a/src/Encoder.c b/src/Encoder.c deleted file mode 100644 index fd1274c..0000000 --- a/src/Encoder.c +++ /dev/null @@ -1,1482 +0,0 @@ -/*************************************************************************************************** - - Zyan Disassembler Library (Zydis) - - Original Author : Joel Höner - - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - -***************************************************************************************************/ - -#include -#include -#include - -#include - -/* ============================================================================================== */ -/* Internal context and table types */ -/* ============================================================================================== */ - -typedef uint32_t ZydisSemanticOperandTypeMask; - -typedef struct ZydisInstructionQuery_ -{ - ZydisSemanticOperandTypeMask semOperandTypeMasks[ZYDIS_ENCODER_MAX_OPERANDS]; - ZydisBool require66; - ZydisBool require67; - ZydisBool requireREXW; - uint8_t eosz; - uint8_t easz; -} ZydisInstructionQuery; - -typedef struct ZydisInstructionMatch_ -{ - const ZydisInstructionQuery* q; - const ZydisEncodableInstruction* insn; - const ZydisInstructionDefinition* def; - uint8_t operandCount; - const ZydisOperandDefinition* operands; - uint8_t derivedImmSizes[ZYDIS_ENCODER_MAX_OPERANDS]; -} ZydisInstructionMatch; - -typedef struct ZydisRawInstruction_ -{ - ZydisInstructionAttributes derivedAttrs; - uint8_t mandatoryPrefix; // 0 = not present - uint8_t opcodeMapPrefixLen; - uint8_t opcodeMapPrefix[3]; - uint8_t opcode; - ZydisBool didWriteFirstHalfIS4; - - struct - { - int64_t val; - uint8_t size; - } disp; - struct - { - uint64_t val; - uint8_t size; - } imms[2]; - struct - { - // REX bits - uint8_t W; - uint8_t R; - uint8_t X; - uint8_t B; - - // XOP/VEX bits - uint8_t mm; - uint8_t vvvv; - uint8_t L; - uint8_t pp; - - // EVEX/MVEX bits - uint8_t R2; - uint8_t z; - uint8_t L2; - uint8_t b; - uint8_t V2; - uint8_t mask; // `.aaa` / `.kkk` - uint8_t SSS; - uint8_t E; - } bits; - struct - { - uint8_t mod; - uint8_t reg; - uint8_t rm; - } modrm; - struct - { - uint8_t scale; - uint8_t index; - uint8_t base; - } sib; -} ZydisRawInstruction; - -typedef struct ZydisEncoderContext_ -{ - // Input parameters. - uint8_t* buffer; - size_t bufferLen; - size_t writeOffs; - const ZydisEncoderRequest* req; - - ZydisRawInstruction raw; -} ZydisEncoderContext; - -/* ============================================================================================== */ -/* Internal helpers */ -/* ============================================================================================== */ - -/* ---------------------------------------------------------------------------------------------- */ -/* Byte stream output functions. Those are the only funcs that access the output stream directly. */ -/* ---------------------------------------------------------------------------------------------- */ - -static ZydisStatus ZydisEmitImm(ZydisEncoderContext* ctx, uint64_t imm, int bits) -{ - ZYDIS_ASSERT(bits == 8 || bits == 16 || bits == 32 || bits == 64); - size_t newWriteOffs = ctx->writeOffs + bits / 8; - if (newWriteOffs >= ctx->bufferLen) - { - return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE; - } - if (newWriteOffs > ZYDIS_MAX_INSTRUCTION_LENGTH) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - - // TODO: bswap on big-endian - switch (bits) - { - case 8: *(uint8_t* )&ctx->buffer[ctx->writeOffs] = (uint8_t )imm; break; - case 16: *(uint16_t*)&ctx->buffer[ctx->writeOffs] = (uint16_t)imm; break; - case 32: *(uint32_t*)&ctx->buffer[ctx->writeOffs] = (uint32_t)imm; break; - case 64: *(uint64_t*)&ctx->buffer[ctx->writeOffs] = (uint64_t)imm; break; - default: ZYDIS_UNREACHABLE; - } - - ctx->writeOffs = newWriteOffs; - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitByte(ZydisEncoderContext* ctx, uint8_t byte) -{ - return ZydisEmitImm(ctx, byte, 8); -} - -/* ---------------------------------------------------------------------------------------------- */ -/* Byte code encoding functions. Translate prepared data to final format. */ -/* ---------------------------------------------------------------------------------------------- */ - -static ZydisStatus ZydisEmitLegacyPrefixes(ZydisEncoderContext* ctx, - const ZydisInstructionQuery* q) -{ - ZYDIS_ASSERT(ctx); - ZydisInstructionAttributes attribs = ctx->raw.derivedAttrs; - - if (attribs & ZYDIS_ATTRIB_HAS_LOCK) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0xF0)); - } - if (attribs & (ZYDIS_ATTRIB_HAS_REP | ZYDIS_ATTRIB_HAS_REPE | ZYDIS_ATTRIB_HAS_XRELEASE)) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0xF3)); - } - if (attribs & (ZYDIS_ATTRIB_HAS_REPNE | ZYDIS_ATTRIB_HAS_BOUND | ZYDIS_ATTRIB_HAS_XACQUIRE)) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0xF2)); - } - if (attribs & (ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN | ZYDIS_ATTRIB_HAS_SEGMENT_CS)) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x2E)); - } - if (attribs & (ZYDIS_ATTRIB_HAS_BRANCH_TAKEN | ZYDIS_ATTRIB_HAS_SEGMENT_DS)) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x3E)); - } - if (attribs & ZYDIS_ATTRIB_HAS_SEGMENT_SS) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x36)); - } - if (attribs & ZYDIS_ATTRIB_HAS_SEGMENT_ES) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x26)); - } - if (attribs & ZYDIS_ATTRIB_HAS_SEGMENT_FS) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x64)); - } - if (attribs & ZYDIS_ATTRIB_HAS_SEGMENT_GS) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x65)); - } - if (q->require66) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x66)); - } - if (q->require67) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x67)); - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitREX(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - 0x40 | - (ctx->raw.bits.W & 0x01) << 3 | - (ctx->raw.bits.R & 0x01) << 2 | - (ctx->raw.bits.X & 0x01) << 1 | - (ctx->raw.bits.B & 0x01) << 0 - )); - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitVEX(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - - // Can we use short 2-byte VEX encoding? - if (ctx->raw.bits.X == 0 && ctx->raw.bits.B == 0 && - ctx->raw.bits.W == 0 && ctx->raw.bits.mm == 1) - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0xC5)); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (~ctx->raw.bits.R & 0x01) << 7 | - (~ctx->raw.bits.vvvv & 0x0F) << 3 | - ( ctx->raw.bits.L & 0x01) << 2 | - ( ctx->raw.bits.pp & 0x03) << 0 - )); - } - // Nope, use 3-byte VEX. - else - { - ZYDIS_CHECK(ZydisEmitByte(ctx, 0xC4)); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (~ctx->raw.bits.R & 0x01) << 7 | - (~ctx->raw.bits.X & 0x01) << 6 | - (~ctx->raw.bits.B & 0x01) << 5 | - ( ctx->raw.bits.mm & 0x1F) << 0 - )); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - ( ctx->raw.bits.W & 0x01) << 7 | - (~ctx->raw.bits.vvvv & 0x0F) << 3 | - ( ctx->raw.bits.L & 0x01) << 2 | - ( ctx->raw.bits.pp & 0x03) << 0 - )); - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitEVEX(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x62)); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.R & 0x01) << 7 | - (ctx->raw.bits.X & 0x01) << 6 | - (ctx->raw.bits.B & 0x01) << 5 | - (ctx->raw.bits.R2 & 0x01) << 4 | - (ctx->raw.bits.mm & 0x03) << 0 - )); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.W & 0x01) << 7 | - (ctx->raw.bits.vvvv & 0x0F) << 3 | - (ctx->raw.bits.pp & 0x03) << 0 - )); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.z & 0x01) << 7 | - (ctx->raw.bits.L2 & 0x01) << 6 | - (ctx->raw.bits.L & 0x01) << 5 | - (ctx->raw.bits.b & 0x01) << 4 | - (ctx->raw.bits.V2 & 0x01) << 3 | - (ctx->raw.bits.mask & 0x07) << 0 - )); - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitMVEX(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x62)); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.R & 0x01) << 7 | - (ctx->raw.bits.X & 0x01) << 6 | - (ctx->raw.bits.B & 0x01) << 5 | - (ctx->raw.bits.R2 & 0x01) << 4 | - (ctx->raw.bits.mm & 0x0F) << 0 - )); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.W & 0x01) << 7 | - (ctx->raw.bits.vvvv & 0x0F) << 3 | - (ctx->raw.bits.pp & 0x03) << 0 - )); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.E & 0x01) << 7 | - (ctx->raw.bits.SSS & 0x07) << 4 | - (ctx->raw.bits.V2 & 0x01) << 3 | - (ctx->raw.bits.mask & 0x07) << 0 - )); - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitXOP(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_CHECK(ZydisEmitByte(ctx, 0x8F)); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.R & 0x01) << 7 | - (ctx->raw.bits.X & 0x01) << 6 | - (ctx->raw.bits.B & 0x01) << 5 | - (ctx->raw.bits.mm & 0x1F) << 0 - )); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.bits.W & 0x01) << 7 | - (ctx->raw.bits.vvvv & 0x0F) << 3 | - (ctx->raw.bits.L & 0x01) << 2 | - (ctx->raw.bits.pp & 0x03) << 0 - )); - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitModRM(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.modrm.mod & 0x03) << 6 | - (ctx->raw.modrm.reg & 0x07) << 3 | - (ctx->raw.modrm.rm & 0x07) << 0 - )); - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisEmitSIB(ZydisEncoderContext* ctx) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_CHECK(ZydisEmitByte( - ctx, - (ctx->raw.sib.scale & 0x03) << 6 | - (ctx->raw.sib.index & 0x07) << 3 | - (ctx->raw.sib.base & 0x07) << 0 - )); - return ZYDIS_STATUS_SUCCESS; -} - -/* ---------------------------------------------------------------------------------------------- */ -/* Table lookup and value translation helpers */ -/* ---------------------------------------------------------------------------------------------- */ - -/** - * @brief For a `ZydisEncoderOperand`, compose a mask of permitted semantic operand types. - * @param op The operand to compute the mask for. - * @param mask The output parameter receiving the derived mask. - * @returns A zydis error code. - */ -static ZydisStatus ZydisSemanticOperandTypeDeriveMask( - const ZydisEncoderOperand* op, ZydisSemanticOperandTypeMask* mask) -{ - ZYDIS_ASSERT(op); - ZYDIS_ASSERT(mask); - - switch (op->type) - { - case ZYDIS_OPERAND_TYPE_REGISTER: - switch (ZydisRegisterGetClass(op->reg)) - { - case ZYDIS_REGCLASS_GPR8: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_GPR8; - break; - case ZYDIS_REGCLASS_GPR16: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_GPR16 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR16_32_32 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR16_32_32; - break; - case ZYDIS_REGCLASS_GPR32: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_GPR32 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR32_32_64 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR16_32_32; - break; - case ZYDIS_REGCLASS_GPR64: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_GPR64 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR16_32_64 | - 1 << ZYDIS_SEMANTIC_OPTYPE_GPR32_32_64; - break; - case ZYDIS_REGCLASS_X87: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_FPR; - break; - case ZYDIS_REGCLASS_MMX: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_MMX; - break; - case ZYDIS_REGCLASS_XMM: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_XMM; - break; - case ZYDIS_REGCLASS_YMM: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_YMM; - break; - case ZYDIS_REGCLASS_ZMM: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_ZMM; - break; - case ZYDIS_REGCLASS_FLAGS: - case ZYDIS_REGCLASS_IP: - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - case ZYDIS_REGCLASS_SEGMENT: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_SREG; - break; - case ZYDIS_REGCLASS_TEST: - // TODO - ZYDIS_UNREACHABLE; - case ZYDIS_REGCLASS_CONTROL: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_CR; - break; - case ZYDIS_REGCLASS_DEBUG: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_DR; - break; - case ZYDIS_REGCLASS_MASK: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_MASK; - break; - case ZYDIS_REGCLASS_BOUND: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_BND; - break; - default: - ZYDIS_UNREACHABLE; - } - *mask |= 1 << ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG; - break; - case ZYDIS_OPERAND_TYPE_MEMORY: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_MEM | - 1 << ZYDIS_SEMANTIC_OPTYPE_MEM_VSIBX | - 1 << ZYDIS_SEMANTIC_OPTYPE_MEM_VSIBY | - 1 << ZYDIS_SEMANTIC_OPTYPE_MEM_VSIBZ | - 1 << ZYDIS_SEMANTIC_OPTYPE_AGEN | - 1 << ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM; - break; - case ZYDIS_OPERAND_TYPE_POINTER: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_PTR; - break; - case ZYDIS_OPERAND_TYPE_IMMEDIATE: - *mask = 1 << ZYDIS_SEMANTIC_OPTYPE_IMM | - 1 << ZYDIS_SEMANTIC_OPTYPE_REL | - 1 << ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_IMM1; - break; - default: - return ZYDIS_STATUS_INVALID_PARAMETER; - } - - return ZYDIS_STATUS_SUCCESS; -} - -static uint8_t ZydisUImmGetMinSize(uint64_t imm) -{ - if (imm <= UINT8_MAX ) return 8; - if (imm <= UINT16_MAX) return 16; - if (imm <= UINT32_MAX) return 32; - return 64; -} - -static uint8_t ZydisSImmGetMinSize(int64_t imm) -{ - if (imm <= INT8_MAX && imm >= INT8_MIN ) return 8; - if (imm <= INT16_MAX && imm >= INT16_MIN) return 16; - if (imm <= INT32_MAX && imm >= INT32_MIN) return 32; - return 64; -} - -static ZydisBool ZydisOperandEncodingImmIsSigned(ZydisOperandEncoding enc) -{ - switch (enc) - { - case ZYDIS_OPERAND_ENCODING_DISP8: - case ZYDIS_OPERAND_ENCODING_DISP16: - case ZYDIS_OPERAND_ENCODING_DISP32: - case ZYDIS_OPERAND_ENCODING_DISP64: - case ZYDIS_OPERAND_ENCODING_DISP16_32_64: - case ZYDIS_OPERAND_ENCODING_DISP32_32_64: - case ZYDIS_OPERAND_ENCODING_DISP16_32_32: - case ZYDIS_OPERAND_ENCODING_SIMM8: - case ZYDIS_OPERAND_ENCODING_SIMM16: - case ZYDIS_OPERAND_ENCODING_SIMM32: - case ZYDIS_OPERAND_ENCODING_SIMM64: - case ZYDIS_OPERAND_ENCODING_SIMM16_32_64: - case ZYDIS_OPERAND_ENCODING_SIMM32_32_64: - case ZYDIS_OPERAND_ENCODING_SIMM16_32_32: - case ZYDIS_OPERAND_ENCODING_JIMM8: - case ZYDIS_OPERAND_ENCODING_JIMM16: - case ZYDIS_OPERAND_ENCODING_JIMM32: - case ZYDIS_OPERAND_ENCODING_JIMM64: - case ZYDIS_OPERAND_ENCODING_JIMM16_32_64: - case ZYDIS_OPERAND_ENCODING_JIMM32_32_64: - case ZYDIS_OPERAND_ENCODING_JIMM16_32_32: - return ZYDIS_TRUE; - case ZYDIS_OPERAND_ENCODING_UIMM8: - case ZYDIS_OPERAND_ENCODING_UIMM16: - case ZYDIS_OPERAND_ENCODING_UIMM32: - case ZYDIS_OPERAND_ENCODING_UIMM64: - case ZYDIS_OPERAND_ENCODING_UIMM16_32_64: - case ZYDIS_OPERAND_ENCODING_UIMM32_32_64: - case ZYDIS_OPERAND_ENCODING_UIMM16_32_32: - return ZYDIS_FALSE; - default: - ZYDIS_UNREACHABLE; - } -} - -static ZydisStatus ZydisOperandEncodingGetEffectiveImmSize( - ZydisOperandEncoding enc, ZydisMachineMode machineMode, uint8_t* esz) -{ - switch (enc) - { - case ZYDIS_OPERAND_ENCODING_DISP8: - case ZYDIS_OPERAND_ENCODING_SIMM8: - case ZYDIS_OPERAND_ENCODING_UIMM8: - case ZYDIS_OPERAND_ENCODING_JIMM8: - *esz = 8; - return ZYDIS_STATUS_SUCCESS; - case ZYDIS_OPERAND_ENCODING_DISP16: - case ZYDIS_OPERAND_ENCODING_SIMM16: - case ZYDIS_OPERAND_ENCODING_UIMM16: - case ZYDIS_OPERAND_ENCODING_JIMM16: - *esz = 16; - return ZYDIS_STATUS_SUCCESS; - case ZYDIS_OPERAND_ENCODING_DISP32: - case ZYDIS_OPERAND_ENCODING_SIMM32: - case ZYDIS_OPERAND_ENCODING_UIMM32: - case ZYDIS_OPERAND_ENCODING_JIMM32: - *esz = 32; - return ZYDIS_STATUS_SUCCESS; - case ZYDIS_OPERAND_ENCODING_DISP64: - case ZYDIS_OPERAND_ENCODING_SIMM64: - case ZYDIS_OPERAND_ENCODING_UIMM64: - case ZYDIS_OPERAND_ENCODING_JIMM64: - *esz = 64; - return ZYDIS_STATUS_SUCCESS; - case ZYDIS_OPERAND_ENCODING_DISP16_32_64: - case ZYDIS_OPERAND_ENCODING_SIMM16_32_64: - case ZYDIS_OPERAND_ENCODING_JIMM16_32_64: - case ZYDIS_OPERAND_ENCODING_UIMM16_32_64: - switch (machineMode) - { - case 16: *esz = 16; return ZYDIS_STATUS_SUCCESS; - case 32: *esz = 32; return ZYDIS_STATUS_SUCCESS; - case 64: *esz = 64; return ZYDIS_STATUS_SUCCESS; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - case ZYDIS_OPERAND_ENCODING_DISP32_32_64: - case ZYDIS_OPERAND_ENCODING_SIMM32_32_64: - case ZYDIS_OPERAND_ENCODING_UIMM32_32_64: - case ZYDIS_OPERAND_ENCODING_JIMM32_32_64: - switch (machineMode) - { - case 16: *esz = 32; return ZYDIS_STATUS_SUCCESS; - case 32: *esz = 32; return ZYDIS_STATUS_SUCCESS; - case 64: *esz = 64; return ZYDIS_STATUS_SUCCESS; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - case ZYDIS_OPERAND_ENCODING_DISP16_32_32: - case ZYDIS_OPERAND_ENCODING_SIMM16_32_32: - case ZYDIS_OPERAND_ENCODING_UIMM16_32_32: - case ZYDIS_OPERAND_ENCODING_JIMM16_32_32: - switch (machineMode) - { - case 16: *esz = 16; return ZYDIS_STATUS_SUCCESS; - case 32: *esz = 32; return ZYDIS_STATUS_SUCCESS; - case 64: *esz = 32; return ZYDIS_STATUS_SUCCESS; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - default: - ZYDIS_UNREACHABLE; - } -} - -static uint8_t ZydisSizeToFlag(uint8_t size) -{ - switch (size) - { - case 16: return 1 << 0; - case 32: return 1 << 1; - case 64: return 1 << 2; - default: return 0; - } -} - -static ZydisBool ZydisRegIsBP(ZydisRegister reg) -{ - return reg == ZYDIS_REGISTER_BPL || - reg == ZYDIS_REGISTER_BP || - reg == ZYDIS_REGISTER_EBP || - reg == ZYDIS_REGISTER_RBP; -} - -static ZydisBool ZydisRegIsSP(ZydisRegister reg) -{ - return reg == ZYDIS_REGISTER_SPL || - reg == ZYDIS_REGISTER_SP || - reg == ZYDIS_REGISTER_ESP || - reg == ZYDIS_REGISTER_RSP; -} - -static ZydisBool ZydisRegIsIP(ZydisRegister reg) -{ - return reg == ZYDIS_REGISTER_IP || - reg == ZYDIS_REGISTER_EIP || - reg == ZYDIS_REGISTER_RIP; -} - -static ZydisBool ZydisRegIsStack(ZydisRegister reg) -{ - return ZydisRegIsSP(reg) || ZydisRegIsBP(reg); -} - -/* ---------------------------------------------------------------------------------------------- */ -/* Preparation functions. Parse encoder request, determine required bytes and prefixes. */ -/* ---------------------------------------------------------------------------------------------- */ - -static ZydisStatus ZydisPrepareOpcode(ZydisEncoderContext* ctx, const ZydisInstructionMatch* match) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_ASSERT(match); - - // Put opcode map prefix(es), if required. - switch (ctx->req->encoding) - { - case ZYDIS_INSTRUCTION_ENCODING_DEFAULT: - case ZYDIS_INSTRUCTION_ENCODING_3DNOW: - switch (match->insn->opcodeMap) - { - case ZYDIS_OPCODE_MAP_0F: - ctx->raw.opcodeMapPrefix[ctx->raw.opcodeMapPrefixLen++] = 0x0F; - break; - case ZYDIS_OPCODE_MAP_0F38: - ctx->raw.opcodeMapPrefix[ctx->raw.opcodeMapPrefixLen++] = 0x0F; - ctx->raw.opcodeMapPrefix[ctx->raw.opcodeMapPrefixLen++] = 0x38; - break; - case ZYDIS_OPCODE_MAP_0F3A: - ctx->raw.opcodeMapPrefix[ctx->raw.opcodeMapPrefixLen++] = 0x0F; - ctx->raw.opcodeMapPrefix[ctx->raw.opcodeMapPrefixLen++] = 0x3A; - break; - case ZYDIS_OPCODE_MAP_DEFAULT: - break; // Nothing to do. - default: - ZYDIS_UNREACHABLE; - } - break; - case ZYDIS_INSTRUCTION_ENCODING_VEX: - ctx->raw.bits.mm = match->insn->opcodeMap; - ZYDIS_ASSERT(ctx->raw.bits.mm <= 0x03); - break; - case ZYDIS_INSTRUCTION_ENCODING_EVEX: - case ZYDIS_INSTRUCTION_ENCODING_MVEX: - ctx->raw.bits.mm = match->insn->opcodeMap; - ZYDIS_ASSERT(ctx->raw.bits.mm <= 0x03); - break; - case ZYDIS_INSTRUCTION_ENCODING_XOP: - ctx->raw.bits.mm = - match->insn->opcodeMap - ZYDIS_OPCODE_MAP_XOP8 + 0x08; - ZYDIS_ASSERT(ctx->raw.bits.mm >= 0x08); - ZYDIS_ASSERT(ctx->raw.bits.mm <= 0x0B); - break; - default: - ZYDIS_UNREACHABLE; - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisPrepareRegOperand(ZydisEncoderContext* ctx, - ZydisRegister reg, char topBitDst) -{ - ZYDIS_ASSERT(ctx); - - int16_t regID = ZydisRegisterGetId(reg); - if (regID == -1) return ZYDIS_STATUS_INVALID_PARAMETER; - - uint8_t lowerBits = (regID & 0x07) >> 0; - uint8_t topBit = (regID & 0x08) >> 3; - - switch (topBitDst) - { - case 'B': ctx->raw.modrm.rm = lowerBits; break; - case 'R': ctx->raw.modrm.reg = lowerBits; break; - case 'X': ctx->raw.sib.index = lowerBits; break; - default: ZYDIS_UNREACHABLE; - } - - // No top bit? Quick exit. - if (!topBit) return ZYDIS_STATUS_SUCCESS; - - if ((ctx->req->encoding == ZYDIS_INSTRUCTION_ENCODING_DEFAULT || - ctx->req->encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW) && topBit) - { - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_REX; - } - - switch (topBitDst) - { - case 'B': ctx->raw.bits.B = topBit; break; - case 'R': ctx->raw.bits.R = topBit; break; - case 'X': ctx->raw.bits.X = topBit; break; - default: ZYDIS_UNREACHABLE; - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisPrepareSegmentPrefix(ZydisEncoderContext* ctx, - ZydisRegister segment, ZydisRegister base) -{ - // Segment prefix required? - switch (segment) - { - case ZYDIS_REGISTER_ES: - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SEGMENT_ES; - break; - case ZYDIS_REGISTER_SS: - if (!ZydisRegIsStack(base)) - { - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SEGMENT_SS; - } - break; - case ZYDIS_REGISTER_CS: - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SEGMENT_CS; - break; - case ZYDIS_REGISTER_DS: - if (ZydisRegIsStack(base)) - { - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SEGMENT_DS; - } - break; - case ZYDIS_REGISTER_FS: - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SEGMENT_FS; - break; - case ZYDIS_REGISTER_GS: - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SEGMENT_GS; - break; - default: - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO: Better status. - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisPrepareMemoryOperand(ZydisEncoderContext* ctx, - const ZydisEncoderOperand* operand, const ZydisInstructionMatch* match) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_ASSERT(ctx->req); - ZYDIS_ASSERT(operand); - - ZYDIS_CHECK(ZydisPrepareSegmentPrefix(ctx, operand->mem.segment, operand->mem.base)); - - // Absolute memory access? Special case. - if (operand->mem.base == ZYDIS_REGISTER_NONE) - { - ctx->raw.disp.val = operand->mem.disp; - ctx->raw.disp.size = 32; - - // In 32 bit mode, ModRM allows for a shortcut here. - if (ctx->req->machineMode == 32) - { - ctx->raw.modrm.mod = 0x00; - ctx->raw.modrm.rm = 0x05 /* memory */; - } - // In AMD64 mode, we have to build a special SIB. - else - { - ctx->raw.modrm.mod = 0x00; - ctx->raw.modrm.rm = 0x04 /* SIB */; - ctx->raw.sib.index = 0x04 /* none */; - ctx->raw.sib.scale = 0x00 /* * 1 */; - ctx->raw.sib.base = 0x05; - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SIB; - } - - return ZYDIS_STATUS_SUCCESS; - } - - // rIP relative addressing? Special case. - if (ZydisRegIsIP(operand->mem.base)) - { - // rIP addressing is only available since AMD64. - if (ctx->req->machineMode != 64) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - - // Only available with either EIP or RIP, not with IP. - if (operand->mem.base == ZYDIS_REGISTER_IP) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - - ctx->raw.disp.val = operand->mem.disp; - ctx->raw.disp.size = 32; - ctx->raw.modrm.mod = 0x00; - ctx->raw.modrm.rm = 0x05 /* RIP relative mem */; - - return ZYDIS_STATUS_SUCCESS; - } - - // Process base register. - ZYDIS_CHECK(ZydisPrepareRegOperand(ctx, operand->mem.base, 'B')); - - // SIB byte required? rSP can only be encoded with SIB. - if (operand->mem.index || operand->mem.scale || ZydisRegIsSP(operand->mem.base)) - { - // Translate scale to SIB format. - switch (operand->mem.scale) - { - case 0: // We take 0 (uninitialized, 0 from memset) as * 1. - case 1: ctx->raw.sib.scale = 0x00; break; - case 2: ctx->raw.sib.scale = 0x01; break; - case 4: ctx->raw.sib.scale = 0x02; break; - case 8: ctx->raw.sib.scale = 0x03; break; - default: return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - - // Move base register info to SIB. - ctx->raw.sib.base = ctx->raw.modrm.rm; - ctx->raw.modrm.rm = 0x04 /* SIB */; - - // Process index register. - if (operand->mem.index != ZYDIS_REGISTER_NONE) - { - ZYDIS_CHECK(ZydisPrepareRegOperand(ctx, operand->mem.index, 'X')); - } - else - { - ctx->raw.sib.index = 0x04 /* no index */; - } - - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_SIB; - } - - // Has displacement or is rBP and we have no SIB? - // rBP can't be ModRM-encoded without a disp. - if (operand->mem.disp || (!(ctx->req->attributes & ZYDIS_ATTRIB_HAS_SIB) - && ZydisRegIsBP(operand->mem.base))) - { - if (ZydisSImmGetMinSize(operand->mem.disp) == 8) - { - ctx->raw.disp.size = 8; - ctx->raw.modrm.mod = 0x01 /* 8 bit disp */; - } - else - { - ctx->raw.disp.size = 32; - ctx->raw.modrm.mod = 0x02 /* 32 bit disp */; - } - ctx->raw.disp.val = operand->mem.disp; - } - // No displacement. - else - { - ctx->raw.modrm.mod = 0x00 /* no disp */; - } - - // Verify if the `.reg` and `.rm` values we calculated are permitted for this - // instruction. We don't backtrace for a different definition here in that case - // since the instructions with such restrictions don't have alternate encodings - // that would allow the instruction to be encoded anyway. - if ((!match->insn->forceModrmRm && !(1 << ctx->raw.modrm.rm & match->insn->modrmRm )) || - (!match->insn->forceModrmReg && !(1 << ctx->raw.modrm.reg & match->insn->modrmReg))) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisPrepareOperand(ZydisEncoderContext* ctx, - ZydisInstructionMatch* match, uint8_t n) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_ASSERT(n < ZYDIS_ARRAY_SIZE(ctx->req->operands)); - ZYDIS_ASSERT(n < match->operandCount); - const ZydisEncoderOperand* reqOperand = ctx->req->operands + n; - const ZydisOperandDefinition* operandDef = match->operands + n; - - switch (operandDef->op.encoding) - { - case ZYDIS_OPERAND_ENCODING_NONE: - { - // For some encodings, we have to switch on the sem op type. - if (operandDef->type == ZYDIS_SEMANTIC_OPTYPE_MOFFS) - { - ZYDIS_CHECK(ZydisPrepareSegmentPrefix( - ctx, reqOperand->mem.segment, ZYDIS_REGISTER_NONE - )); - ctx->raw.imms[0].val = reqOperand->mem.disp; - ctx->raw.imms[0].size = reqOperand->mem.dispSize; - } - } break; - case ZYDIS_OPERAND_ENCODING_MODRM_REG: - { - ZYDIS_ASSERT(!ctx->raw.modrm.reg); - ZYDIS_CHECK(ZydisPrepareRegOperand(ctx, reqOperand->reg, 'R')); - } break; - case ZYDIS_OPERAND_ENCODING_MODRM_RM: - { - ZYDIS_ASSERT(!ctx->raw.modrm.mod); - ZYDIS_ASSERT(!ctx->raw.modrm.rm); - ZYDIS_ASSERT(!ctx->raw.sib.base); - ZYDIS_ASSERT(!ctx->raw.sib.index); - ZYDIS_ASSERT(!ctx->raw.sib.scale); - - // Memory operand? - if (reqOperand->type == ZYDIS_OPERAND_TYPE_MEMORY) - { - ZYDIS_CHECK(ZydisPrepareMemoryOperand(ctx, reqOperand, match)); - } - // Nope, register. - else if (reqOperand->type == ZYDIS_OPERAND_TYPE_REGISTER) - { - ZYDIS_CHECK(ZydisPrepareRegOperand(ctx, reqOperand->reg, 'B')); - ctx->raw.modrm.mod = 0x03 /* reg */; - } - - ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_MODRM; - break; - } - case ZYDIS_OPERAND_ENCODING_OPCODE: - { - int16_t reg = ZydisRegisterGetId(reqOperand->reg); - if (reg == -1) return ZYDIS_STATUS_INVALID_PARAMETER; - ctx->raw.opcode += reg & 0x07; - ctx->raw.bits.B = (reg & 0x08) >> 3; - if (ctx->raw.bits.B) ctx->raw.derivedAttrs |= ZYDIS_ATTRIB_HAS_REX; - break; - } - case ZYDIS_OPERAND_ENCODING_NDSNDD: - { - int16_t reg = ZydisRegisterGetId(reqOperand->reg); - if (reg == -1) return ZYDIS_STATUS_INVALID_PARAMETER; - ctx->raw.bits.vvvv = ctx->raw.bits.vvvv = ctx->raw.bits.vvvv = reg & 0x0F; - break; - } - case ZYDIS_OPERAND_ENCODING_MASK: - { - ctx->raw.bits.mask = reqOperand->reg - ZYDIS_REGISTER_K0; - } break; - case ZYDIS_OPERAND_ENCODING_IS4: - { - if (!ctx->raw.didWriteFirstHalfIS4) - { - ctx->raw.imms[0].size = 8; - ctx->raw.imms[0].val |= reqOperand->imm.u & 0x0F; - ctx->raw.didWriteFirstHalfIS4 = ZYDIS_TRUE; - } - else - { - ZYDIS_ASSERT(ctx->raw.imms[0].size == 8); - ctx->raw.imms[0].val |= (reqOperand->imm.u & 0x0F) << 4; - } - break; - } - case ZYDIS_OPERAND_ENCODING_SIMM8: - case ZYDIS_OPERAND_ENCODING_UIMM8: - case ZYDIS_OPERAND_ENCODING_JIMM8: - case ZYDIS_OPERAND_ENCODING_SIMM16: - case ZYDIS_OPERAND_ENCODING_UIMM16: - case ZYDIS_OPERAND_ENCODING_JIMM16: - case ZYDIS_OPERAND_ENCODING_SIMM32: - case ZYDIS_OPERAND_ENCODING_UIMM32: - case ZYDIS_OPERAND_ENCODING_JIMM32: - case ZYDIS_OPERAND_ENCODING_UIMM64: - case ZYDIS_OPERAND_ENCODING_SIMM64: - case ZYDIS_OPERAND_ENCODING_JIMM64: - { - uint8_t immIdx = ctx->raw.imms[0].size ? 1 : 0; - ctx->raw.imms[immIdx].val = reqOperand->imm.u; - ctx->raw.imms[immIdx].size = match->derivedImmSizes[n]; - break; - } - default: - ZYDIS_UNREACHABLE; - } - - return ZYDIS_STATUS_SUCCESS; -} - -static void ZydisPrepareMandatoryPrefixes(ZydisEncoderContext* ctx, - ZydisInstructionMatch* match) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_ASSERT(match); - - // Is a prefix mandatory? 0x00 is a sentinel value for `None` in the table. - uint8_t prefix = match->insn->mandatoryPrefix; - if (prefix != 0x00) - { - switch (ctx->req->encoding) - { - case ZYDIS_INSTRUCTION_ENCODING_DEFAULT: - case ZYDIS_INSTRUCTION_ENCODING_3DNOW: - ctx->raw.mandatoryPrefix = prefix; - break; - case ZYDIS_INSTRUCTION_ENCODING_XOP: - case ZYDIS_INSTRUCTION_ENCODING_VEX: - case ZYDIS_INSTRUCTION_ENCODING_EVEX: - case ZYDIS_INSTRUCTION_ENCODING_MVEX: - ctx->raw.bits.pp = prefix; - break; - default: - ZYDIS_UNREACHABLE; - } - } -} - -static ZydisStatus ZydisRequestToInstructionQuery( - ZydisEncoderContext* ctx, const ZydisEncoderRequest* req, ZydisInstructionQuery* q) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_ASSERT(req); - ZYDIS_ASSERT(q); - - // Walk list of requested operands, derive possible encodings - // and perform additional sanity checks. - q->require66 = ZYDIS_FALSE; - q->require67 = ZYDIS_FALSE; - q->requireREXW = ZYDIS_FALSE; - q->eosz = req->machineMode; - q->easz = req->machineMode; - for (uint8_t i = 0; i < req->operandCount; ++i) - { - const ZydisEncoderOperand* curReqOperand = req->operands + i; - - // Do we need any operand size overrides? - if (curReqOperand->type == ZYDIS_OPERAND_TYPE_REGISTER) - { - switch (ZydisRegisterGetClass(curReqOperand->reg)) - { - case ZYDIS_REGCLASS_GPR16: - q->eosz = 16; - switch (req->machineMode) - { - case 16: break; // Default mode. - case 32: - case 64: q->require66 = ZYDIS_TRUE; break; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - break; - case ZYDIS_REGCLASS_GPR32: - q->eosz = 32; - switch (req->machineMode) - { - case 16: q->require66 = ZYDIS_TRUE; break; - case 32: - case 64: break; // Default mode. - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - break; - case ZYDIS_REGCLASS_GPR64: - q->eosz = 64; - switch (req->machineMode) - { - case 16: - case 32: return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; - case 64: q->requireREXW = ZYDIS_TRUE; break; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - break; - default: - ; // Other registers can't be operand-scaled. - } - } - - // Address size overrides? - if (curReqOperand->type == ZYDIS_OPERAND_TYPE_MEMORY) - { - // Verify base and index have the same register class, if present. - ZydisRegisterClass baseRegClass = ZydisRegisterGetClass(curReqOperand->mem.base); - if (curReqOperand->mem.base != ZYDIS_REGISTER_NONE && - curReqOperand->mem.index != ZYDIS_REGISTER_NONE && - baseRegClass != ZydisRegisterGetClass(curReqOperand->mem.index)) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - - // Address size prefix required? - switch (baseRegClass) - { - case ZYDIS_REGCLASS_GPR16: q->easz = 16; break; - case ZYDIS_REGCLASS_GPR32: q->easz = 32; break; - case ZYDIS_REGCLASS_GPR64: q->easz = 64; break; - default: - switch (baseRegClass) - { - case ZYDIS_REGISTER_IP: q->easz = 16; break; - case ZYDIS_REGISTER_EIP: q->easz = 32; break; - case ZYDIS_REGISTER_RIP: q->easz = 64; break; - default: - ; // Other registers can't be address-scaled. - } - } - - switch (q->easz) - { - case 16: - switch (ctx->req->machineMode) - { - case 16: break; // Default mode. - case 32: q->require67 = ZYDIS_TRUE; break; - case 64: return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - break; - case 32: - switch (ctx->req->machineMode) - { - case 16: q->require67 = ZYDIS_TRUE; break; - case 32: break; // Default mode. - case 64: q->require67 = ZYDIS_TRUE; break; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - break; - case 64: - if (ctx->req->machineMode != 64) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - } - break; - default: - ; // Don't care. - } - } - - ZYDIS_CHECK(ZydisSemanticOperandTypeDeriveMask( - req->operands + i, q->semOperandTypeMasks + i - )); - } - - return ZYDIS_STATUS_SUCCESS; -} - -static ZydisStatus ZydisFindMatchingDef( - ZydisEncoderContext* ctx, const ZydisEncoderRequest* req, const ZydisInstructionQuery* q, - ZydisInstructionMatch* match) -{ - ZYDIS_ASSERT(ctx); - ZYDIS_ASSERT(req); - ZYDIS_ASSERT(match); - (void)ctx; - - // Translate sizes to flags. - uint8_t modeFlag = ZydisSizeToFlag(req->machineMode); - if (!modeFlag) return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - uint8_t easzFlag = ZydisSizeToFlag(q->easz); - uint8_t eoszFlag = ZydisSizeToFlag(q->eosz); - ZYDIS_ASSERT(easzFlag && eoszFlag); - - // Walk list of candidates. - const ZydisEncodableInstruction* insns = NULL; - uint8_t insnCount = ZydisGetEncodableInstructions(req->mnemonic, &insns); - if (!insnCount) return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; // TODO - ZYDIS_ASSERT(insns); - - for (const ZydisEncodableInstruction *candidateInsn = insns, - *insnsEnd = insns + insnCount - ; candidateInsn < insnsEnd - ; ++candidateInsn) - { - if (!(candidateInsn->mode & modeFlag)) goto _nextInsn; - //if (!candidateInsn->rexW && q->requireREXW) goto _nextInsn; - if (!(candidateInsn->addressSize & easzFlag)) goto _nextInsn; - if (!(candidateInsn->operandSize & eoszFlag)) goto _nextInsn; - - const ZydisInstructionDefinition* candidateDef = NULL; - ZydisGetInstructionDefinition( - candidateInsn->encoding, candidateInsn->definitionReference, &candidateDef); - const ZydisOperandDefinition* candidateOperands = NULL; - uint8_t defOperandCount = ZydisGetOperandDefinitions(candidateDef, &candidateOperands); - - if (req->operandCount > defOperandCount) goto _nextInsn; - - const ZydisOperandDefinition* curDefOperand = candidateOperands; - for (uint8_t k = 0; k < req->operandCount; ++k) - { - curDefOperand = candidateOperands + k; - const ZydisEncoderOperand* curReqOperand = req->operands + k; - - // Visible operands are always in the front. When we encounter the first hidden - // operand in the definition and haven't exhausted the request operands yet, - // it's safe to assume this isn't the instruction we're looking for. - if (curDefOperand->visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN) goto _nextInsn; - - // Is the type one of those we permit for the given operand? - if (!(1 << curDefOperand->type & q->semOperandTypeMasks[k])) goto _nextInsn; - - // For some operand types, additional checks are required. - switch (curDefOperand->type) - { - case ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG: - { - switch (curDefOperand->op.reg.type) - { - case ZYDIS_IMPLREG_TYPE_STATIC: - { - // reg reg reg banana phooone! - if (curDefOperand->op.reg.reg.reg != curReqOperand->reg) goto _nextInsn; - } break; - case ZYDIS_IMPLREG_TYPE_GPR_OSZ: - case ZYDIS_IMPLREG_TYPE_GPR_ASZ: - case ZYDIS_IMPLREG_TYPE_GPR_SSZ: - case ZYDIS_IMPLREG_TYPE_IP_ASZ: - case ZYDIS_IMPLREG_TYPE_IP_SSZ: - case ZYDIS_IMPLREG_TYPE_FLAGS_SSZ: - { - int16_t id = ZydisRegisterGetId(curReqOperand->reg); - if (curDefOperand->op.reg.reg.id != id) - { - if (id < 0) return ZYDIS_STATUS_INVALID_PARAMETER; // TODO - goto _nextInsn; - } - } break; - default: ZYDIS_UNREACHABLE; - } - } break; - case ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM: - { - // TODO: Can those be scaled using 67? - ZydisRegisterClass regClass; - switch (req->machineMode) - { - case 16: regClass = ZYDIS_REGCLASS_GPR16; break; - case 32: regClass = ZYDIS_REGCLASS_GPR32; break; - case 64: regClass = ZYDIS_REGCLASS_GPR64; break; - default: return ZYDIS_STATUS_INVALID_PARAMETER; - } - - static const uint8_t regIdxLookup[4] = {3, 5, 6, 7}; - ZYDIS_ASSERT(curDefOperand->op.mem.base < ZYDIS_ARRAY_SIZE(regIdxLookup)); - uint8_t regIdx = regIdxLookup[curDefOperand->op.mem.base]; - ZydisRegister derivedReg = ZydisRegisterEncode(regClass, regIdx); - - if (curReqOperand->mem.base != derivedReg) goto _nextInsn; - } break; - case ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_IMM1: - { - if (curReqOperand->imm.u != 1) goto _nextInsn; - } break; - case ZYDIS_SEMANTIC_OPTYPE_IMM: - case ZYDIS_SEMANTIC_OPTYPE_REL: - { - // Even though the user probably had an idea if their immediate was signed - // or unsigned, we try to encode it with whatever the signedness of the - // current definiton dictates. In X86 assembly, signedness only affects sign - // extension, so if a user wishes to encode e.g. 0xFFFFFFFF unsigned, we can - // also encode it as an 8-bit signed -1 that is then expanded back to 0xFFFFFFFF - // at runtime (assuming machineMode == 32), resulting in more compact and - // efficient encoding. - uint8_t minSize = ZydisOperandEncodingImmIsSigned(curDefOperand->op.encoding) - ? ZydisSImmGetMinSize(curReqOperand->imm.s) - : ZydisUImmGetMinSize(curReqOperand->imm.u); - uint8_t eisz; - ZYDIS_CHECK(ZydisOperandEncodingGetEffectiveImmSize( - curDefOperand->op.encoding, req->machineMode, &eisz - )); - if (eisz < minSize) goto _nextInsn; - match->derivedImmSizes[k] = eisz; - } break; - default: - ; // No further checks required. - } - } - - // Make sure we compared either all operands or the remaining operands are hidden. - if (req->operandCount != defOperandCount && - (curDefOperand + 1)->visibility != ZYDIS_OPERAND_VISIBILITY_HIDDEN) - { - goto _nextInsn; - } - - // Still here? Looks like we found our instruction, then! - match->q = q; - match->insn = candidateInsn; - match->def = candidateDef; - match->operands = candidateOperands; - match->operandCount = req->operandCount; - return ZYDIS_STATUS_SUCCESS; - - _nextInsn: - ; - } - - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; -} - -/* ---------------------------------------------------------------------------------------------- */ - -/* ============================================================================================== */ -/* Implementation of public functions */ -/* ============================================================================================== */ - -#ifdef ZYDIS_ENABLE_FEATURE_DECODER - -ZydisStatus ZydisEncoderDecodedInstructionToRequest( - const ZydisDecodedInstruction* in, ZydisEncoderRequest* out) -{ - if (!in || !out || in->operandCount > ZYDIS_ARRAY_SIZE(in->operands)) - { - return ZYDIS_STATUS_INVALID_PARAMETER; - } - - out->machineMode = in->machineMode; - out->mnemonic = in->mnemonic; - out->attributes = in->attributes & ZYDIS_USER_ENCODABLE_ATTRIB_MASK; - out->encoding = in->encoding; - out->operandCount = 0; - out->avx.mask.reg = in->avx.mask.reg; - out->avx.mask.mode = in->avx.mask.mode; - out->avx.vectorLength = in->avx.vectorLength; - - for (uint8_t i = 0 - ; i < in->operandCount && out->operandCount < ZYDIS_ARRAY_SIZE(out->operands) - ; ++i) - { - const ZydisDecodedOperand* inOp = in->operands + i; - ZydisEncoderOperand* outOp = out->operands + out->operandCount; - if (inOp->visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN) continue; - - outOp->type = inOp->type; - switch (inOp->type) - { - case ZYDIS_OPERAND_TYPE_REGISTER: - outOp->reg = inOp->reg.value; - break; - case ZYDIS_OPERAND_TYPE_MEMORY: - outOp->mem.segment = inOp->mem.segment; - outOp->mem.base = inOp->mem.base; - outOp->mem.index = inOp->mem.index; - outOp->mem.scale = inOp->mem.scale; - outOp->mem.disp = inOp->mem.disp.value; - outOp->mem.dispSize = in->raw.disp.size; - break; - case ZYDIS_OPERAND_TYPE_POINTER: - outOp->ptr.segment = inOp->ptr.segment; - outOp->ptr.offset = inOp->ptr.offset; - break; - case ZYDIS_OPERAND_TYPE_IMMEDIATE: - outOp->imm.u = inOp->imm.value.u; - break; - default: - return ZYDIS_STATUS_INVALID_PARAMETER; - } - - ++out->operandCount; - } - - return ZYDIS_STATUS_SUCCESS; -} - -#endif - -ZydisStatus ZydisEncoderEncodeInstruction(void* buffer, size_t* bufferLen, - const ZydisEncoderRequest* request) -{ - if (!request || !bufferLen ) return ZYDIS_STATUS_INVALID_PARAMETER; - if (!buffer || !*bufferLen) return ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE; - if (request->operandCount > ZYDIS_ARRAY_SIZE(request->operands)) - { - return ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION; - } - - ZydisEncoderContext ctx; - memset(&ctx, 0, sizeof(ctx)); - ctx.buffer = (uint8_t*)buffer; - ctx.bufferLen = *bufferLen; - ctx.writeOffs = 0; - ctx.req = request; - *bufferLen = 0; - - // Mask out attributes that can't be set explicitly by user. - // TODO: We should probably rather error on unsupported attrs. - ctx.raw.derivedAttrs = request->attributes & ZYDIS_USER_ENCODABLE_ATTRIB_MASK; - - // Evaluate request. - ZydisInstructionQuery q; - memset(&q, 0, sizeof(q)); - ZYDIS_CHECK(ZydisRequestToInstructionQuery(&ctx, request, &q)); - - // Search matching instruction, collect information about what needs to be - // encoded, what prefixes are required, etc. - ZydisInstructionMatch match; - memset(&match, 0, sizeof(match)); - ZYDIS_CHECK(ZydisFindMatchingDef(&ctx, request, &q, &match)); - ctx.raw.opcode = match.insn->opcode; - - // TODO: Check compatibility of requested prefixes to found instruction. - - // Prepare prefix bits. - ctx.raw.bits.B = match.insn->evexB; - ctx.raw.bits.L = match.insn->vectorLength & 0x01; - ctx.raw.bits.L2 = match.insn->vectorLength & 0x02; - ZydisPrepareMandatoryPrefixes(&ctx, &match); - - // Prepare opcode. - ZYDIS_CHECK(ZydisPrepareOpcode(&ctx, &match)); - - // Some instructions have additional opcode bits encoded in ModRM.[rm/reg]. - if (match.insn->forceModrmReg) ctx.raw.modrm.reg = match.insn->modrmReg; - if (match.insn->forceModrmRm ) ctx.raw.modrm.rm = match.insn->modrmRm; - - // Analyze and prepare operands. - for (uint8_t i = 0; i < match.def->operandCount; ++i) - { - ZYDIS_CHECK(ZydisPrepareOperand(&ctx, &match, i)); - } - - // Emit prepared raw instruction to bytestream. - ZYDIS_CHECK(ZydisEmitLegacyPrefixes(&ctx, &q)); - if (ctx.raw.derivedAttrs & ZYDIS_ATTRIB_HAS_REX) ZYDIS_CHECK(ZydisEmitREX(&ctx)); - - switch (match.insn->encoding) - { - case ZYDIS_INSTRUCTION_ENCODING_MVEX: ZYDIS_CHECK(ZydisEmitMVEX(&ctx)); break; - case ZYDIS_INSTRUCTION_ENCODING_EVEX: ZYDIS_CHECK(ZydisEmitEVEX(&ctx)); break; - case ZYDIS_INSTRUCTION_ENCODING_VEX: ZYDIS_CHECK(ZydisEmitVEX (&ctx)); break; - case ZYDIS_INSTRUCTION_ENCODING_XOP: ZYDIS_CHECK(ZydisEmitXOP (&ctx)); break; - default:; // Shut up linter. - } - - if (ctx.raw.mandatoryPrefix) ZYDIS_CHECK(ZydisEmitByte(&ctx, ctx.raw.mandatoryPrefix)); - - for (uint8_t i = 0; i < ctx.raw.opcodeMapPrefixLen; ++i) - { - ZYDIS_CHECK(ZydisEmitByte(&ctx, ctx.raw.opcodeMapPrefix[i])); - } - - ZYDIS_CHECK(ZydisEmitByte(&ctx, ctx.raw.opcode)); - - if (ctx.raw.derivedAttrs & ZYDIS_ATTRIB_HAS_MODRM) ZYDIS_CHECK(ZydisEmitModRM(&ctx)); - if (ctx.raw.derivedAttrs & ZYDIS_ATTRIB_HAS_SIB) ZYDIS_CHECK(ZydisEmitSIB(&ctx)); - if (ctx.raw.disp.size) ZYDIS_CHECK(ZydisEmitImm(&ctx, ctx.raw.disp.val, ctx.raw.disp.size)); - - for (uint8_t i = 0 - ; i < ZYDIS_ARRAY_SIZE(ctx.raw.imms) && ctx.raw.imms[i].size - ; ++i) - { - ZYDIS_CHECK(ZydisEmitImm(&ctx, ctx.raw.imms[i].val, ctx.raw.imms[i].size)); - } - - *bufferLen = ctx.writeOffs; - return ZYDIS_STATUS_SUCCESS; -} - -/* ============================================================================================== */ diff --git a/src/EncoderData.c b/src/EncoderData.c deleted file mode 100644 index 17d01cb..0000000 --- a/src/EncoderData.c +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************************************** - - Zyan Disassembler Library (Zydis) - - Original Author : Florian Bernd - - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - -***************************************************************************************************/ - -#include - -/* ============================================================================================== */ -/* Enums and types */ -/* ============================================================================================== */ - -// MSVC does not like types other than (un-)signed int for bitfields -#ifdef ZYDIS_MSVC -# pragma warning(push) -# pragma warning(disable:4214) -#endif - -#pragma pack(push, 1) - -/* ---------------------------------------------------------------------------------------------- */ -/* Encodable instructions */ -/* ---------------------------------------------------------------------------------------------- */ - -/** - * @brief Defines the @c ZydisEncodableInstructions struct. - */ -typedef struct ZydisEncodableInstructions_ -{ - uint8_t count; - uint16_t reference; -} ZydisEncodableInstructions; - -/* ---------------------------------------------------------------------------------------------- */ - -#pragma pack(pop) - -#ifdef ZYDIS_MSVC -# pragma warning(pop) -#endif - -/* ============================================================================================== */ -/* Data tables */ -/* ============================================================================================== */ - -/* ---------------------------------------------------------------------------------------------- */ -/* Forward declarations */ -/* ---------------------------------------------------------------------------------------------- */ - -/** - * @brief Contains an item with a reference to all encodable instructions for every mnemonic. - */ -extern const ZydisEncodableInstructions mnemonicLookup[]; - -/** - * @brief Contains the definition-data for all encodable instructions. - */ -extern const ZydisEncodableInstruction encodableInstructions[]; - -/* ---------------------------------------------------------------------------------------------- */ -/* Mnemonic lookup table */ -/* ---------------------------------------------------------------------------------------------- */ - -#include - -/* ---------------------------------------------------------------------------------------------- */ -/* Encodable instructions */ -/* ---------------------------------------------------------------------------------------------- */ - -#include - -/* ---------------------------------------------------------------------------------------------- */ - -/* ============================================================================================== */ -/* Functions */ -/* ============================================================================================== */ - -/* ---------------------------------------------------------------------------------------------- */ -/* Encodable instructions */ -/* ---------------------------------------------------------------------------------------------- */ - -uint8_t ZydisGetEncodableInstructions(ZydisMnemonic mnemonic, - const ZydisEncodableInstruction** instruction) -{ - if (mnemonic >= ZYDIS_ARRAY_SIZE(mnemonicLookup)) - { - *instruction = NULL; - return 0; - } - const ZydisEncodableInstructions* descriptor = &mnemonicLookup[mnemonic]; - *instruction = &encodableInstructions[descriptor->reference]; - return descriptor->count; -} - -/* ---------------------------------------------------------------------------------------------- */ - -/* ============================================================================================== */ diff --git a/src/EncoderData.h b/src/EncoderData.h deleted file mode 100644 index d67cee5..0000000 --- a/src/EncoderData.h +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************************************** - - Zyan Disassembler Library (Zydis) - - Original Author : Florian Bernd - - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - -***************************************************************************************************/ - -#ifndef ZYDIS_ENCODERDATA_H -#define ZYDIS_ENCODERDATA_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* ============================================================================================== */ -/* Enums and types */ -/* ============================================================================================== */ - -// MSVC does not like types other than (un-)signed int for bitfields -#ifdef ZYDIS_MSVC -# pragma warning(push) -# pragma warning(disable:4214) -#endif - -#pragma pack(push, 1) - -/* ---------------------------------------------------------------------------------------------- */ -/* Encodable instruction */ -/* ---------------------------------------------------------------------------------------------- */ - -/** - * @brief Defines the @c ZydisEncodableInstruction struct. - */ -typedef struct ZydisEncodableInstruction_ -{ - uint16_t definitionReference ZYDIS_BITFIELD(13); - ZydisInstructionEncoding encoding ZYDIS_BITFIELD( 3); - uint8_t opcode ZYDIS_BITFIELD( 8); - ZydisOpcodeMap opcodeMap ZYDIS_BITFIELD( 3); - uint8_t mode ZYDIS_BITFIELD( 3); - uint8_t operandSize ZYDIS_BITFIELD( 3); - uint8_t addressSize ZYDIS_BITFIELD( 3); - uint8_t modrmMod ZYDIS_BITFIELD( 4); - ZydisBool forceModrmReg ZYDIS_BITFIELD( 1); - uint8_t modrmReg ZYDIS_BITFIELD( 8); - ZydisBool forceModrmRm ZYDIS_BITFIELD( 1); - uint8_t modrmRm ZYDIS_BITFIELD( 8); - uint8_t mandatoryPrefix ZYDIS_BITFIELD( 3); - uint8_t vectorLength ZYDIS_BITFIELD( 2); - uint8_t rexW ZYDIS_BITFIELD( 1); - uint8_t rexB ZYDIS_BITFIELD( 2); - uint8_t evexB ZYDIS_BITFIELD( 1); - uint8_t mvexE ZYDIS_BITFIELD( 2); -} ZydisEncodableInstruction; - -/* ---------------------------------------------------------------------------------------------- */ - -#pragma pack(pop) - -#ifdef ZYDIS_MSVC -# pragma warning(pop) -#endif - -/* ============================================================================================== */ -/* Functions */ -/* ============================================================================================== */ - -/* ---------------------------------------------------------------------------------------------- */ -/* Encodable instructions */ -/* ---------------------------------------------------------------------------------------------- */ - -/** - * @brief Returns all encodable instructions matching the given `mnemonic`. - * - * @param mnemonic The mnemonic. - * @param instruction A pointer to the variable that receives a pointer to the first - * `ZydisEncodableInstruction` struct. - * - * @return The number of encodable instructions for the given mnemonic. - */ -ZYDIS_NO_EXPORT uint8_t ZydisGetEncodableInstructions(ZydisMnemonic mnemonic, - const ZydisEncodableInstruction** instruction); - -/* ---------------------------------------------------------------------------------------------- */ - -/* ============================================================================================== */ - -#ifdef __cplusplus -} -#endif - -#endif /* ZYDIS_ENCODERDATA_H */ diff --git a/src/Generated/EncoderLookup.inc b/src/Generated/EncoderLookup.inc deleted file mode 100644 index 34c0cfb..0000000 --- a/src/Generated/EncoderLookup.inc +++ /dev/null @@ -1,1546 +0,0 @@ -const ZydisEncodableInstructions mnemonicLookup[] = -{ - /*0000*/ { 0, 0x0000 }, - /*0001*/ { 1, 0x0000 }, - /*0002*/ { 1, 0x0001 }, - /*0003*/ { 1, 0x0002 }, - /*0004*/ { 1, 0x0003 }, - /*0005*/ { 18, 0x0004 }, - /*0006*/ { 4, 0x0016 }, - /*0007*/ { 18, 0x001A }, - /*0008*/ { 2, 0x002C }, - /*0009*/ { 2, 0x002E }, - /*000A*/ { 2, 0x0030 }, - /*000B*/ { 2, 0x0032 }, - /*000C*/ { 2, 0x0034 }, - /*000D*/ { 2, 0x0036 }, - /*000E*/ { 4, 0x0038 }, - /*000F*/ { 2, 0x003C }, - /*0010*/ { 2, 0x003E }, - /*0011*/ { 2, 0x0040 }, - /*0012*/ { 2, 0x0042 }, - /*0013*/ { 2, 0x0044 }, - /*0014*/ { 2, 0x0046 }, - /*0015*/ { 18, 0x0048 }, - /*0016*/ { 6, 0x005A }, - /*0017*/ { 2, 0x0060 }, - /*0018*/ { 2, 0x0062 }, - /*0019*/ { 2, 0x0064 }, - /*001A*/ { 2, 0x0066 }, - /*001B*/ { 2, 0x0068 }, - /*001C*/ { 6, 0x006A }, - /*001D*/ { 4, 0x0070 }, - /*001E*/ { 4, 0x0074 }, - /*001F*/ { 4, 0x0078 }, - /*0020*/ { 4, 0x007C }, - /*0021*/ { 4, 0x0080 }, - /*0022*/ { 4, 0x0084 }, - /*0023*/ { 2, 0x0088 }, - /*0024*/ { 2, 0x008A }, - /*0025*/ { 2, 0x008C }, - /*0026*/ { 2, 0x008E }, - /*0027*/ { 4, 0x0090 }, - /*0028*/ { 6, 0x0094 }, - /*0029*/ { 4, 0x009A }, - /*002A*/ { 6, 0x009E }, - /*002B*/ { 6, 0x00A4 }, - /*002C*/ { 3, 0x00AA }, - /*002D*/ { 3, 0x00AD }, - /*002E*/ { 3, 0x00B0 }, - /*002F*/ { 4, 0x00B3 }, - /*0030*/ { 1, 0x00B7 }, - /*0031*/ { 8, 0x00B8 }, - /*0032*/ { 4, 0x00C0 }, - /*0033*/ { 2, 0x00C4 }, - /*0034*/ { 4, 0x00C6 }, - /*0035*/ { 4, 0x00CA }, - /*0036*/ { 8, 0x00CE }, - /*0037*/ { 4, 0x00D6 }, - /*0038*/ { 4, 0x00DA }, - /*0039*/ { 4, 0x00DE }, - /*003A*/ { 4, 0x00E2 }, - /*003B*/ { 6, 0x00E6 }, - /*003C*/ { 6, 0x00EC }, - /*003D*/ { 1, 0x00F2 }, - /*003E*/ { 1, 0x00F3 }, - /*003F*/ { 1, 0x00F4 }, - /*0040*/ { 1, 0x00F5 }, - /*0041*/ { 1, 0x00F6 }, - /*0042*/ { 1, 0x00F7 }, - /*0043*/ { 2, 0x00F8 }, - /*0044*/ { 2, 0x00FA }, - /*0045*/ { 1, 0x00FC }, - /*0046*/ { 1, 0x00FD }, - /*0047*/ { 1, 0x00FE }, - /*0048*/ { 1, 0x00FF }, - /*0049*/ { 1, 0x0100 }, - /*004A*/ { 1, 0x0101 }, - /*004B*/ { 1, 0x0102 }, - /*004C*/ { 1, 0x0103 }, - /*004D*/ { 1, 0x0104 }, - /*004E*/ { 2, 0x0105 }, - /*004F*/ { 2, 0x0107 }, - /*0050*/ { 2, 0x0109 }, - /*0051*/ { 2, 0x010B }, - /*0052*/ { 2, 0x010D }, - /*0053*/ { 2, 0x010F }, - /*0054*/ { 2, 0x0111 }, - /*0055*/ { 2, 0x0113 }, - /*0056*/ { 2, 0x0115 }, - /*0057*/ { 2, 0x0117 }, - /*0058*/ { 2, 0x0119 }, - /*0059*/ { 2, 0x011B }, - /*005A*/ { 2, 0x011D }, - /*005B*/ { 2, 0x011F }, - /*005C*/ { 2, 0x0121 }, - /*005D*/ { 2, 0x0123 }, - /*005E*/ { 18, 0x0125 }, - /*005F*/ { 2, 0x0137 }, - /*0060*/ { 2, 0x0139 }, - /*0061*/ { 3, 0x013B }, - /*0062*/ { 5, 0x013E }, - /*0063*/ { 3, 0x0143 }, - /*0064*/ { 2, 0x0146 }, - /*0065*/ { 3, 0x0148 }, - /*0066*/ { 4, 0x014B }, - /*0067*/ { 1, 0x014F }, - /*0068*/ { 2, 0x0150 }, - /*0069*/ { 2, 0x0152 }, - /*006A*/ { 2, 0x0154 }, - /*006B*/ { 1, 0x0156 }, - /*006C*/ { 1, 0x0157 }, - /*006D*/ { 4, 0x0158 }, - /*006E*/ { 2, 0x015C }, - /*006F*/ { 2, 0x015E }, - /*0070*/ { 2, 0x0160 }, - /*0071*/ { 2, 0x0162 }, - /*0072*/ { 2, 0x0164 }, - /*0073*/ { 2, 0x0166 }, - /*0074*/ { 2, 0x0168 }, - /*0075*/ { 2, 0x016A }, - /*0076*/ { 2, 0x016C }, - /*0077*/ { 2, 0x016E }, - /*0078*/ { 4, 0x0170 }, - /*0079*/ { 2, 0x0174 }, - /*007A*/ { 4, 0x0176 }, - /*007B*/ { 4, 0x017A }, - /*007C*/ { 2, 0x017E }, - /*007D*/ { 4, 0x0180 }, - /*007E*/ { 2, 0x0184 }, - /*007F*/ { 2, 0x0186 }, - /*0080*/ { 2, 0x0188 }, - /*0081*/ { 2, 0x018A }, - /*0082*/ { 4, 0x018C }, - /*0083*/ { 4, 0x0190 }, - /*0084*/ { 1, 0x0194 }, - /*0085*/ { 1, 0x0195 }, - /*0086*/ { 1, 0x0196 }, - /*0087*/ { 1, 0x0197 }, - /*0088*/ { 12, 0x0198 }, - /*0089*/ { 2, 0x01A4 }, - /*008A*/ { 4, 0x01A6 }, - /*008B*/ { 2, 0x01AA }, - /*008C*/ { 2, 0x01AC }, - /*008D*/ { 2, 0x01AE }, - /*008E*/ { 2, 0x01B0 }, - /*008F*/ { 2, 0x01B2 }, - /*0090*/ { 2, 0x01B4 }, - /*0091*/ { 1, 0x01B6 }, - /*0092*/ { 1, 0x01B7 }, - /*0093*/ { 1, 0x01B8 }, - /*0094*/ { 1, 0x01B9 }, - /*0095*/ { 1, 0x01BA }, - /*0096*/ { 1, 0x01BB }, - /*0097*/ { 2, 0x01BC }, - /*0098*/ { 1, 0x01BE }, - /*0099*/ { 1, 0x01BF }, - /*009A*/ { 4, 0x01C0 }, - /*009B*/ { 1, 0x01C4 }, - /*009C*/ { 1, 0x01C5 }, - /*009D*/ { 1, 0x01C6 }, - /*009E*/ { 1, 0x01C7 }, - /*009F*/ { 1, 0x01C8 }, - /*00A0*/ { 1, 0x01C9 }, - /*00A1*/ { 1, 0x01CA }, - /*00A2*/ { 1, 0x01CB }, - /*00A3*/ { 1, 0x01CC }, - /*00A4*/ { 1, 0x01CD }, - /*00A5*/ { 1, 0x01CE }, - /*00A6*/ { 1, 0x01CF }, - /*00A7*/ { 4, 0x01D0 }, - /*00A8*/ { 1, 0x01D4 }, - /*00A9*/ { 1, 0x01D5 }, - /*00AA*/ { 5, 0x01D6 }, - /*00AB*/ { 1, 0x01DB }, - /*00AC*/ { 1, 0x01DC }, - /*00AD*/ { 1, 0x01DD }, - /*00AE*/ { 1, 0x01DE }, - /*00AF*/ { 4, 0x01DF }, - /*00B0*/ { 1, 0x01E3 }, - /*00B1*/ { 4, 0x01E4 }, - /*00B2*/ { 1, 0x01E8 }, - /*00B3*/ { 1, 0x01E9 }, - /*00B4*/ { 1, 0x01EA }, - /*00B5*/ { 1, 0x01EB }, - /*00B6*/ { 1, 0x01EC }, - /*00B7*/ { 2, 0x01ED }, - /*00B8*/ { 2, 0x01EF }, - /*00B9*/ { 2, 0x01F1 }, - /*00BA*/ { 2, 0x01F3 }, - /*00BB*/ { 2, 0x01F5 }, - /*00BC*/ { 3, 0x01F7 }, - /*00BD*/ { 2, 0x01FA }, - /*00BE*/ { 1, 0x01FC }, - /*00BF*/ { 2, 0x01FD }, - /*00C0*/ { 3, 0x01FF }, - /*00C1*/ { 3, 0x0202 }, - /*00C2*/ { 2, 0x0205 }, - /*00C3*/ { 2, 0x0207 }, - /*00C4*/ { 4, 0x0209 }, - /*00C5*/ { 1, 0x020D }, - /*00C6*/ { 1, 0x020E }, - /*00C7*/ { 2, 0x020F }, - /*00C8*/ { 1, 0x0211 }, - /*00C9*/ { 1, 0x0212 }, - /*00CA*/ { 1, 0x0213 }, - /*00CB*/ { 1, 0x0214 }, - /*00CC*/ { 1, 0x0215 }, - /*00CD*/ { 1, 0x0216 }, - /*00CE*/ { 4, 0x0217 }, - /*00CF*/ { 1, 0x021B }, - /*00D0*/ { 1, 0x021C }, - /*00D1*/ { 1, 0x021D }, - /*00D2*/ { 1, 0x021E }, - /*00D3*/ { 2, 0x021F }, - /*00D4*/ { 1, 0x0221 }, - /*00D5*/ { 2, 0x0222 }, - /*00D6*/ { 2, 0x0224 }, - /*00D7*/ { 1, 0x0226 }, - /*00D8*/ { 1, 0x0227 }, - /*00D9*/ { 1, 0x0228 }, - /*00DA*/ { 1, 0x0229 }, - /*00DB*/ { 1, 0x022A }, - /*00DC*/ { 2, 0x022B }, - /*00DD*/ { 1, 0x022D }, - /*00DE*/ { 1, 0x022E }, - /*00DF*/ { 1, 0x022F }, - /*00E0*/ { 1, 0x0230 }, - /*00E1*/ { 1, 0x0231 }, - /*00E2*/ { 3, 0x0232 }, - /*00E3*/ { 6, 0x0235 }, - /*00E4*/ { 1, 0x023B }, - /*00E5*/ { 4, 0x023C }, - /*00E6*/ { 1, 0x0240 }, - /*00E7*/ { 4, 0x0241 }, - /*00E8*/ { 1, 0x0245 }, - /*00E9*/ { 1, 0x0246 }, - /*00EA*/ { 1, 0x0247 }, - /*00EB*/ { 1, 0x0248 }, - /*00EC*/ { 1, 0x0249 }, - /*00ED*/ { 1, 0x024A }, - /*00EE*/ { 1, 0x024B }, - /*00EF*/ { 1, 0x024C }, - /*00F0*/ { 1, 0x024D }, - /*00F1*/ { 3, 0x024E }, - /*00F2*/ { 1, 0x0251 }, - /*00F3*/ { 1, 0x0252 }, - /*00F4*/ { 1, 0x0253 }, - /*00F5*/ { 1, 0x0254 }, - /*00F6*/ { 1, 0x0255 }, - /*00F7*/ { 1, 0x0256 }, - /*00F8*/ { 1, 0x0257 }, - /*00F9*/ { 1, 0x0258 }, - /*00FA*/ { 2, 0x0259 }, - /*00FB*/ { 2, 0x025B }, - /*00FC*/ { 1, 0x025D }, - /*00FD*/ { 2, 0x025E }, - /*00FE*/ { 2, 0x0260 }, - /*00FF*/ { 4, 0x0262 }, - /*0100*/ { 10, 0x0266 }, - /*0101*/ { 8, 0x0270 }, - /*0102*/ { 12, 0x0278 }, - /*0103*/ { 1, 0x0284 }, - /*0104*/ { 1, 0x0285 }, - /*0105*/ { 3, 0x0286 }, - /*0106*/ { 6, 0x0289 }, - /*0107*/ { 2, 0x028F }, - /*0108*/ { 3, 0x0291 }, - /*0109*/ { 1, 0x0294 }, - /*010A*/ { 1, 0x0295 }, - /*010B*/ { 1, 0x0296 }, - /*010C*/ { 1, 0x0297 }, - /*010D*/ { 1, 0x0298 }, - /*010E*/ { 2, 0x0299 }, - /*010F*/ { 1, 0x029B }, - /*0110*/ { 1, 0x029C }, - /*0111*/ { 2, 0x029D }, - /*0112*/ { 2, 0x029F }, - /*0113*/ { 1, 0x02A1 }, - /*0114*/ { 1, 0x02A2 }, - /*0115*/ { 1, 0x02A3 }, - /*0116*/ { 4, 0x02A4 }, - /*0117*/ { 4, 0x02A8 }, - /*0118*/ { 1, 0x02AC }, - /*0119*/ { 2, 0x02AD }, - /*011A*/ { 3, 0x02AF }, - /*011B*/ { 3, 0x02B2 }, - /*011C*/ { 4, 0x02B5 }, - /*011D*/ { 4, 0x02B9 }, - /*011E*/ { 8, 0x02BD }, - /*011F*/ { 4, 0x02C5 }, - /*0120*/ { 4, 0x02C9 }, - /*0121*/ { 4, 0x02CD }, - /*0122*/ { 4, 0x02D1 }, - /*0123*/ { 4, 0x02D5 }, - /*0124*/ { 4, 0x02D9 }, - /*0125*/ { 4, 0x02DD }, - /*0126*/ { 4, 0x02E1 }, - /*0127*/ { 4, 0x02E5 }, - /*0128*/ { 4, 0x02E9 }, - /*0129*/ { 1, 0x02ED }, - /*012A*/ { 4, 0x02EE }, - /*012B*/ { 4, 0x02F2 }, - /*012C*/ { 1, 0x02F6 }, - /*012D*/ { 1, 0x02F7 }, - /*012E*/ { 1, 0x02F8 }, - /*012F*/ { 1, 0x02F9 }, - /*0130*/ { 1, 0x02FA }, - /*0131*/ { 1, 0x02FB }, - /*0132*/ { 1, 0x02FC }, - /*0133*/ { 1, 0x02FD }, - /*0134*/ { 1, 0x02FE }, - /*0135*/ { 1, 0x02FF }, - /*0136*/ { 1, 0x0300 }, - /*0137*/ { 1, 0x0301 }, - /*0138*/ { 1, 0x0302 }, - /*0139*/ { 1, 0x0303 }, - /*013A*/ { 1, 0x0304 }, - /*013B*/ { 1, 0x0305 }, - /*013C*/ { 1, 0x0306 }, - /*013D*/ { 1, 0x0307 }, - /*013E*/ { 1, 0x0308 }, - /*013F*/ { 1, 0x0309 }, - /*0140*/ { 3, 0x030A }, - /*0141*/ { 5, 0x030D }, - /*0142*/ { 7, 0x0312 }, - /*0143*/ { 5, 0x0319 }, - /*0144*/ { 5, 0x031E }, - /*0145*/ { 1, 0x0323 }, - /*0146*/ { 1, 0x0324 }, - /*0147*/ { 1, 0x0325 }, - /*0148*/ { 1, 0x0326 }, - /*0149*/ { 1, 0x0327 }, - /*014A*/ { 1, 0x0328 }, - /*014B*/ { 1, 0x0329 }, - /*014C*/ { 1, 0x032A }, - /*014D*/ { 1, 0x032B }, - /*014E*/ { 1, 0x032C }, - /*014F*/ { 2, 0x032D }, - /*0150*/ { 1, 0x032F }, - /*0151*/ { 1, 0x0330 }, - /*0152*/ { 1, 0x0331 }, - /*0153*/ { 1, 0x0332 }, - /*0154*/ { 1, 0x0333 }, - /*0155*/ { 1, 0x0334 }, - /*0156*/ { 1, 0x0335 }, - /*0157*/ { 1, 0x0336 }, - /*0158*/ { 1, 0x0337 }, - /*0159*/ { 1, 0x0338 }, - /*015A*/ { 1, 0x0339 }, - /*015B*/ { 1, 0x033A }, - /*015C*/ { 1, 0x033B }, - /*015D*/ { 1, 0x033C }, - /*015E*/ { 1, 0x033D }, - /*015F*/ { 1, 0x033E }, - /*0160*/ { 1, 0x033F }, - /*0161*/ { 1, 0x0340 }, - /*0162*/ { 1, 0x0341 }, - /*0163*/ { 1, 0x0342 }, - /*0164*/ { 1, 0x0343 }, - /*0165*/ { 1, 0x0344 }, - /*0166*/ { 1, 0x0345 }, - /*0167*/ { 1, 0x0346 }, - /*0168*/ { 1, 0x0347 }, - /*0169*/ { 1, 0x0348 }, - /*016A*/ { 1, 0x0349 }, - /*016B*/ { 1, 0x034A }, - /*016C*/ { 1, 0x034B }, - /*016D*/ { 2, 0x034C }, - /*016E*/ { 1, 0x034E }, - /*016F*/ { 1, 0x034F }, - /*0170*/ { 1, 0x0350 }, - /*0171*/ { 1, 0x0351 }, - /*0172*/ { 1, 0x0352 }, - /*0173*/ { 1, 0x0353 }, - /*0174*/ { 1, 0x0354 }, - /*0175*/ { 1, 0x0355 }, - /*0176*/ { 2, 0x0356 }, - /*0177*/ { 1, 0x0358 }, - /*0178*/ { 2, 0x0359 }, - /*0179*/ { 2, 0x035B }, - /*017A*/ { 1, 0x035D }, - /*017B*/ { 2, 0x035E }, - /*017C*/ { 3, 0x0360 }, - /*017D*/ { 3, 0x0363 }, - /*017E*/ { 3, 0x0366 }, - /*017F*/ { 3, 0x0369 }, - /*0180*/ { 1, 0x036C }, - /*0181*/ { 1, 0x036D }, - /*0182*/ { 1, 0x036E }, - /*0183*/ { 2, 0x036F }, - /*0184*/ { 1, 0x0371 }, - /*0185*/ { 2, 0x0372 }, - /*0186*/ { 2, 0x0374 }, - /*0187*/ { 2, 0x0376 }, - /*0188*/ { 4, 0x0378 }, - /*0189*/ { 1, 0x037C }, - /*018A*/ { 1, 0x037D }, - /*018B*/ { 2, 0x037E }, - /*018C*/ { 2, 0x0380 }, - /*018D*/ { 2, 0x0382 }, - /*018E*/ { 2, 0x0384 }, - /*018F*/ { 1, 0x0386 }, - /*0190*/ { 2, 0x0387 }, - /*0191*/ { 2, 0x0389 }, - /*0192*/ { 2, 0x038B }, - /*0193*/ { 2, 0x038D }, - /*0194*/ { 4, 0x038F }, - /*0195*/ { 44, 0x0393 }, - /*0196*/ { 4, 0x03BF }, - /*0197*/ { 4, 0x03C3 }, - /*0198*/ { 2, 0x03C7 }, - /*0199*/ { 16, 0x03C9 }, - /*019A*/ { 2, 0x03D9 }, - /*019B*/ { 1, 0x03DB }, - /*019C*/ { 4, 0x03DC }, - /*019D*/ { 4, 0x03E0 }, - /*019E*/ { 1, 0x03E4 }, - /*019F*/ { 2, 0x03E5 }, - /*01A0*/ { 2, 0x03E7 }, - /*01A1*/ { 1, 0x03E9 }, - /*01A2*/ { 2, 0x03EA }, - /*01A3*/ { 2, 0x03EC }, - /*01A4*/ { 1, 0x03EE }, - /*01A5*/ { 1, 0x03EF }, - /*01A6*/ { 1, 0x03F0 }, - /*01A7*/ { 1, 0x03F1 }, - /*01A8*/ { 2, 0x03F2 }, - /*01A9*/ { 1, 0x03F4 }, - /*01AA*/ { 1, 0x03F5 }, - /*01AB*/ { 1, 0x03F6 }, - /*01AC*/ { 16, 0x03F7 }, - /*01AD*/ { 1, 0x0407 }, - /*01AE*/ { 3, 0x0408 }, - /*01AF*/ { 7, 0x040B }, - /*01B0*/ { 2, 0x0412 }, - /*01B1*/ { 2, 0x0414 }, - /*01B2*/ { 3, 0x0416 }, - /*01B3*/ { 4, 0x0419 }, - /*01B4*/ { 3, 0x041D }, - /*01B5*/ { 4, 0x0420 }, - /*01B6*/ { 2, 0x0424 }, - /*01B7*/ { 4, 0x0426 }, - /*01B8*/ { 4, 0x042A }, - /*01B9*/ { 4, 0x042E }, - /*01BA*/ { 2, 0x0432 }, - /*01BB*/ { 4, 0x0434 }, - /*01BC*/ { 2, 0x0438 }, - /*01BD*/ { 2, 0x043A }, - /*01BE*/ { 2, 0x043C }, - /*01BF*/ { 2, 0x043E }, - /*01C0*/ { 6, 0x0440 }, - /*01C1*/ { 1, 0x0446 }, - /*01C2*/ { 4, 0x0447 }, - /*01C3*/ { 58, 0x044B }, - /*01C4*/ { 4, 0x0485 }, - /*01C5*/ { 18, 0x0489 }, - /*01C6*/ { 2, 0x049B }, - /*01C7*/ { 2, 0x049D }, - /*01C8*/ { 8, 0x049F }, - /*01C9*/ { 3, 0x04A7 }, - /*01CA*/ { 6, 0x04AA }, - /*01CB*/ { 3, 0x04B0 }, - /*01CC*/ { 4, 0x04B3 }, - /*01CD*/ { 4, 0x04B7 }, - /*01CE*/ { 4, 0x04BB }, - /*01CF*/ { 4, 0x04BF }, - /*01D0*/ { 4, 0x04C3 }, - /*01D1*/ { 2, 0x04C7 }, - /*01D2*/ { 4, 0x04C9 }, - /*01D3*/ { 4, 0x04CD }, - /*01D4*/ { 4, 0x04D1 }, - /*01D5*/ { 4, 0x04D5 }, - /*01D6*/ { 4, 0x04D9 }, - /*01D7*/ { 4, 0x04DD }, - /*01D8*/ { 4, 0x04E1 }, - /*01D9*/ { 4, 0x04E5 }, - /*01DA*/ { 4, 0x04E9 }, - /*01DB*/ { 4, 0x04ED }, - /*01DC*/ { 4, 0x04F1 }, - /*01DD*/ { 4, 0x04F5 }, - /*01DE*/ { 1, 0x04F9 }, - /*01DF*/ { 4, 0x04FA }, - /*01E0*/ { 2, 0x04FE }, - /*01E1*/ { 4, 0x0500 }, - /*01E2*/ { 2, 0x0504 }, - /*01E3*/ { 2, 0x0506 }, - /*01E4*/ { 2, 0x0508 }, - /*01E5*/ { 4, 0x050A }, - /*01E6*/ { 4, 0x050E }, - /*01E7*/ { 2, 0x0512 }, - /*01E8*/ { 4, 0x0514 }, - /*01E9*/ { 4, 0x0518 }, - /*01EA*/ { 4, 0x051C }, - /*01EB*/ { 4, 0x0520 }, - /*01EC*/ { 4, 0x0524 }, - /*01ED*/ { 2, 0x0528 }, - /*01EE*/ { 4, 0x052A }, - /*01EF*/ { 4, 0x052E }, - /*01F0*/ { 2, 0x0532 }, - /*01F1*/ { 6, 0x0534 }, - /*01F2*/ { 6, 0x053A }, - /*01F3*/ { 2, 0x0540 }, - /*01F4*/ { 2, 0x0542 }, - /*01F5*/ { 2, 0x0544 }, - /*01F6*/ { 4, 0x0546 }, - /*01F7*/ { 2, 0x054A }, - /*01F8*/ { 2, 0x054C }, - /*01F9*/ { 2, 0x054E }, - /*01FA*/ { 2, 0x0550 }, - /*01FB*/ { 2, 0x0552 }, - /*01FC*/ { 2, 0x0554 }, - /*01FD*/ { 2, 0x0556 }, - /*01FE*/ { 2, 0x0558 }, - /*01FF*/ { 2, 0x055A }, - /*0200*/ { 2, 0x055C }, - /*0201*/ { 2, 0x055E }, - /*0202*/ { 2, 0x0560 }, - /*0203*/ { 2, 0x0562 }, - /*0204*/ { 2, 0x0564 }, - /*0205*/ { 2, 0x0566 }, - /*0206*/ { 2, 0x0568 }, - /*0207*/ { 2, 0x056A }, - /*0208*/ { 2, 0x056C }, - /*0209*/ { 2, 0x056E }, - /*020A*/ { 4, 0x0570 }, - /*020B*/ { 4, 0x0574 }, - /*020C*/ { 4, 0x0578 }, - /*020D*/ { 2, 0x057C }, - /*020E*/ { 4, 0x057E }, - /*020F*/ { 4, 0x0582 }, - /*0210*/ { 4, 0x0586 }, - /*0211*/ { 2, 0x058A }, - /*0212*/ { 2, 0x058C }, - /*0213*/ { 2, 0x058E }, - /*0214*/ { 2, 0x0590 }, - /*0215*/ { 2, 0x0592 }, - /*0216*/ { 4, 0x0594 }, - /*0217*/ { 4, 0x0598 }, - /*0218*/ { 4, 0x059C }, - /*0219*/ { 2, 0x05A0 }, - /*021A*/ { 2, 0x05A2 }, - /*021B*/ { 4, 0x05A4 }, - /*021C*/ { 4, 0x05A8 }, - /*021D*/ { 2, 0x05AC }, - /*021E*/ { 2, 0x05AE }, - /*021F*/ { 2, 0x05B0 }, - /*0220*/ { 2, 0x05B2 }, - /*0221*/ { 4, 0x05B4 }, - /*0222*/ { 4, 0x05B8 }, - /*0223*/ { 2, 0x05BC }, - /*0224*/ { 2, 0x05BE }, - /*0225*/ { 2, 0x05C0 }, - /*0226*/ { 2, 0x05C2 }, - /*0227*/ { 2, 0x05C4 }, - /*0228*/ { 2, 0x05C6 }, - /*0229*/ { 2, 0x05C8 }, - /*022A*/ { 2, 0x05CA }, - /*022B*/ { 2, 0x05CC }, - /*022C*/ { 2, 0x05CE }, - /*022D*/ { 2, 0x05D0 }, - /*022E*/ { 2, 0x05D2 }, - /*022F*/ { 2, 0x05D4 }, - /*0230*/ { 2, 0x05D6 }, - /*0231*/ { 2, 0x05D8 }, - /*0232*/ { 2, 0x05DA }, - /*0233*/ { 4, 0x05DC }, - /*0234*/ { 2, 0x05E0 }, - /*0235*/ { 4, 0x05E2 }, - /*0236*/ { 4, 0x05E6 }, - /*0237*/ { 2, 0x05EA }, - /*0238*/ { 4, 0x05EC }, - /*0239*/ { 4, 0x05F0 }, - /*023A*/ { 15, 0x05F4 }, - /*023B*/ { 1, 0x0603 }, - /*023C*/ { 1, 0x0604 }, - /*023D*/ { 4, 0x0605 }, - /*023E*/ { 1, 0x0609 }, - /*023F*/ { 1, 0x060A }, - /*0240*/ { 1, 0x060B }, - /*0241*/ { 4, 0x060C }, - /*0242*/ { 1, 0x0610 }, - /*0243*/ { 1, 0x0611 }, - /*0244*/ { 1, 0x0612 }, - /*0245*/ { 1, 0x0613 }, - /*0246*/ { 1, 0x0614 }, - /*0247*/ { 2, 0x0615 }, - /*0248*/ { 1, 0x0617 }, - /*0249*/ { 4, 0x0618 }, - /*024A*/ { 4, 0x061C }, - /*024B*/ { 2, 0x0620 }, - /*024C*/ { 2, 0x0622 }, - /*024D*/ { 2, 0x0624 }, - /*024E*/ { 2, 0x0626 }, - /*024F*/ { 4, 0x0628 }, - /*0250*/ { 4, 0x062C }, - /*0251*/ { 4, 0x0630 }, - /*0252*/ { 6, 0x0634 }, - /*0253*/ { 1, 0x063A }, - /*0254*/ { 6, 0x063B }, - /*0255*/ { 6, 0x0641 }, - /*0256*/ { 6, 0x0647 }, - /*0257*/ { 6, 0x064D }, - /*0258*/ { 6, 0x0653 }, - /*0259*/ { 1, 0x0659 }, - /*025A*/ { 6, 0x065A }, - /*025B*/ { 6, 0x0660 }, - /*025C*/ { 4, 0x0666 }, - /*025D*/ { 4, 0x066A }, - /*025E*/ { 4, 0x066E }, - /*025F*/ { 4, 0x0672 }, - /*0260*/ { 4, 0x0676 }, - /*0261*/ { 4, 0x067A }, - /*0262*/ { 4, 0x067E }, - /*0263*/ { 4, 0x0682 }, - /*0264*/ { 2, 0x0686 }, - /*0265*/ { 2, 0x0688 }, - /*0266*/ { 2, 0x068A }, - /*0267*/ { 4, 0x068C }, - /*0268*/ { 4, 0x0690 }, - /*0269*/ { 2, 0x0694 }, - /*026A*/ { 4, 0x0696 }, - /*026B*/ { 4, 0x069A }, - /*026C*/ { 4, 0x069E }, - /*026D*/ { 2, 0x06A2 }, - /*026E*/ { 4, 0x06A4 }, - /*026F*/ { 18, 0x06A8 }, - /*0270*/ { 1, 0x06BA }, - /*0271*/ { 1, 0x06BB }, - /*0272*/ { 1, 0x06BC }, - /*0273*/ { 1, 0x06BD }, - /*0274*/ { 1, 0x06BE }, - /*0275*/ { 4, 0x06BF }, - /*0276*/ { 12, 0x06C3 }, - /*0277*/ { 2, 0x06CF }, - /*0278*/ { 2, 0x06D1 }, - /*0279*/ { 12, 0x06D3 }, - /*027A*/ { 1, 0x06DF }, - /*027B*/ { 1, 0x06E0 }, - /*027C*/ { 1, 0x06E1 }, - /*027D*/ { 1, 0x06E2 }, - /*027E*/ { 1, 0x06E3 }, - /*027F*/ { 1, 0x06E4 }, - /*0280*/ { 1, 0x06E5 }, - /*0281*/ { 1, 0x06E6 }, - /*0282*/ { 1, 0x06E7 }, - /*0283*/ { 1, 0x06E8 }, - /*0284*/ { 1, 0x06E9 }, - /*0285*/ { 4, 0x06EA }, - /*0286*/ { 12, 0x06EE }, - /*0287*/ { 12, 0x06FA }, - /*0288*/ { 6, 0x0706 }, - /*0289*/ { 2, 0x070C }, - /*028A*/ { 2, 0x070E }, - /*028B*/ { 2, 0x0710 }, - /*028C*/ { 2, 0x0712 }, - /*028D*/ { 1, 0x0714 }, - /*028E*/ { 2, 0x0715 }, - /*028F*/ { 2, 0x0717 }, - /*0290*/ { 1, 0x0719 }, - /*0291*/ { 1, 0x071A }, - /*0292*/ { 1, 0x071B }, - /*0293*/ { 12, 0x071C }, - /*0294*/ { 6, 0x0728 }, - /*0295*/ { 1, 0x072E }, - /*0296*/ { 18, 0x072F }, - /*0297*/ { 3, 0x0741 }, - /*0298*/ { 3, 0x0744 }, - /*0299*/ { 3, 0x0747 }, - /*029A*/ { 3, 0x074A }, - /*029B*/ { 2, 0x074D }, - /*029C*/ { 2, 0x074F }, - /*029D*/ { 2, 0x0751 }, - /*029E*/ { 2, 0x0753 }, - /*029F*/ { 2, 0x0755 }, - /*02A0*/ { 2, 0x0757 }, - /*02A1*/ { 2, 0x0759 }, - /*02A2*/ { 2, 0x075B }, - /*02A3*/ { 2, 0x075D }, - /*02A4*/ { 2, 0x075F }, - /*02A5*/ { 2, 0x0761 }, - /*02A6*/ { 2, 0x0763 }, - /*02A7*/ { 2, 0x0765 }, - /*02A8*/ { 2, 0x0767 }, - /*02A9*/ { 2, 0x0769 }, - /*02AA*/ { 1, 0x076B }, - /*02AB*/ { 2, 0x076C }, - /*02AC*/ { 1, 0x076E }, - /*02AD*/ { 2, 0x076F }, - /*02AE*/ { 2, 0x0771 }, - /*02AF*/ { 2, 0x0773 }, - /*02B0*/ { 2, 0x0775 }, - /*02B1*/ { 2, 0x0777 }, - /*02B2*/ { 2, 0x0779 }, - /*02B3*/ { 2, 0x077B }, - /*02B4*/ { 2, 0x077D }, - /*02B5*/ { 24, 0x077F }, - /*02B6*/ { 4, 0x0797 }, - /*02B7*/ { 6, 0x079B }, - /*02B8*/ { 12, 0x07A1 }, - /*02B9*/ { 4, 0x07AD }, - /*02BA*/ { 6, 0x07B1 }, - /*02BB*/ { 2, 0x07B7 }, - /*02BC*/ { 2, 0x07B9 }, - /*02BD*/ { 2, 0x07BB }, - /*02BE*/ { 1, 0x07BD }, - /*02BF*/ { 2, 0x07BE }, - /*02C0*/ { 1, 0x07C0 }, - /*02C1*/ { 2, 0x07C1 }, - /*02C2*/ { 2, 0x07C3 }, - /*02C3*/ { 2, 0x07C5 }, - /*02C4*/ { 2, 0x07C7 }, - /*02C5*/ { 2, 0x07C9 }, - /*02C6*/ { 2, 0x07CB }, - /*02C7*/ { 1, 0x07CD }, - /*02C8*/ { 1, 0x07CE }, - /*02C9*/ { 1, 0x07CF }, - /*02CA*/ { 1, 0x07D0 }, - /*02CB*/ { 1, 0x07D1 }, - /*02CC*/ { 1, 0x07D2 }, - /*02CD*/ { 3, 0x07D3 }, - /*02CE*/ { 3, 0x07D6 }, - /*02CF*/ { 3, 0x07D9 }, - /*02D0*/ { 3, 0x07DC }, - /*02D1*/ { 2, 0x07DF }, - /*02D2*/ { 18, 0x07E1 }, - /*02D3*/ { 2, 0x07F3 }, - /*02D4*/ { 2, 0x07F5 }, - /*02D5*/ { 2, 0x07F7 }, - /*02D6*/ { 2, 0x07F9 }, - /*02D7*/ { 1, 0x07FB }, - /*02D8*/ { 2, 0x07FC }, - /*02D9*/ { 1, 0x07FE }, - /*02DA*/ { 1, 0x07FF }, - /*02DB*/ { 3, 0x0800 }, - /*02DC*/ { 4, 0x0803 }, - /*02DD*/ { 14, 0x0807 }, - /*02DE*/ { 4, 0x0815 }, - /*02DF*/ { 2, 0x0819 }, - /*02E0*/ { 4, 0x081B }, - /*02E1*/ { 2, 0x081F }, - /*02E2*/ { 2, 0x0821 }, - /*02E3*/ { 1, 0x0823 }, - /*02E4*/ { 2, 0x0824 }, - /*02E5*/ { 2, 0x0826 }, - /*02E6*/ { 2, 0x0828 }, - /*02E7*/ { 2, 0x082A }, - /*02E8*/ { 2, 0x082C }, - /*02E9*/ { 2, 0x082E }, - /*02EA*/ { 2, 0x0830 }, - /*02EB*/ { 2, 0x0832 }, - /*02EC*/ { 3, 0x0834 }, - /*02ED*/ { 3, 0x0837 }, - /*02EE*/ { 14, 0x083A }, - /*02EF*/ { 14, 0x0848 }, - /*02F0*/ { 5, 0x0856 }, - /*02F1*/ { 3, 0x085B }, - /*02F2*/ { 5, 0x085E }, - /*02F3*/ { 4, 0x0863 }, - /*02F4*/ { 4, 0x0867 }, - /*02F5*/ { 2, 0x086B }, - /*02F6*/ { 2, 0x086D }, - /*02F7*/ { 2, 0x086F }, - /*02F8*/ { 2, 0x0871 }, - /*02F9*/ { 2, 0x0873 }, - /*02FA*/ { 2, 0x0875 }, - /*02FB*/ { 8, 0x0877 }, - /*02FC*/ { 6, 0x087F }, - /*02FD*/ { 10, 0x0885 }, - /*02FE*/ { 10, 0x088F }, - /*02FF*/ { 10, 0x0899 }, - /*0300*/ { 10, 0x08A3 }, - /*0301*/ { 9, 0x08AD }, - /*0302*/ { 9, 0x08B6 }, - /*0303*/ { 4, 0x08BF }, - /*0304*/ { 4, 0x08C3 }, - /*0305*/ { 4, 0x08C7 }, - /*0306*/ { 4, 0x08CB }, - /*0307*/ { 1, 0x08CF }, - /*0308*/ { 4, 0x08D0 }, - /*0309*/ { 3, 0x08D4 }, - /*030A*/ { 1, 0x08D7 }, - /*030B*/ { 2, 0x08D8 }, - /*030C*/ { 2, 0x08DA }, - /*030D*/ { 1, 0x08DC }, - /*030E*/ { 6, 0x08DD }, - /*030F*/ { 3, 0x08E3 }, - /*0310*/ { 1, 0x08E6 }, - /*0311*/ { 2, 0x08E7 }, - /*0312*/ { 2, 0x08E9 }, - /*0313*/ { 7, 0x08EB }, - /*0314*/ { 11, 0x08F2 }, - /*0315*/ { 14, 0x08FD }, - /*0316*/ { 14, 0x090B }, - /*0317*/ { 5, 0x0919 }, - /*0318*/ { 5, 0x091E }, - /*0319*/ { 5, 0x0923 }, - /*031A*/ { 5, 0x0928 }, - /*031B*/ { 6, 0x092D }, - /*031C*/ { 6, 0x0933 }, - /*031D*/ { 13, 0x0939 }, - /*031E*/ { 11, 0x0946 }, - /*031F*/ { 3, 0x0951 }, - /*0320*/ { 3, 0x0954 }, - /*0321*/ { 3, 0x0957 }, - /*0322*/ { 3, 0x095A }, - /*0323*/ { 3, 0x095D }, - /*0324*/ { 3, 0x0960 }, - /*0325*/ { 11, 0x0963 }, - /*0326*/ { 14, 0x096E }, - /*0327*/ { 7, 0x097C }, - /*0328*/ { 7, 0x0983 }, - /*0329*/ { 7, 0x098A }, - /*032A*/ { 11, 0x0991 }, - /*032B*/ { 11, 0x099C }, - /*032C*/ { 14, 0x09A7 }, - /*032D*/ { 11, 0x09B5 }, - /*032E*/ { 7, 0x09C0 }, - /*032F*/ { 7, 0x09C7 }, - /*0330*/ { 7, 0x09CE }, - /*0331*/ { 7, 0x09D5 }, - /*0332*/ { 7, 0x09DC }, - /*0333*/ { 12, 0x09E3 }, - /*0334*/ { 5, 0x09EF }, - /*0335*/ { 6, 0x09F4 }, - /*0336*/ { 11, 0x09FA }, - /*0337*/ { 12, 0x0A05 }, - /*0338*/ { 5, 0x0A11 }, - /*0339*/ { 12, 0x0A16 }, - /*033A*/ { 6, 0x0A22 }, - /*033B*/ { 11, 0x0A28 }, - /*033C*/ { 7, 0x0A33 }, - /*033D*/ { 7, 0x0A3A }, - /*033E*/ { 7, 0x0A41 }, - /*033F*/ { 11, 0x0A48 }, - /*0340*/ { 7, 0x0A53 }, - /*0341*/ { 7, 0x0A5A }, - /*0342*/ { 7, 0x0A61 }, - /*0343*/ { 12, 0x0A68 }, - /*0344*/ { 6, 0x0A74 }, - /*0345*/ { 12, 0x0A7A }, - /*0346*/ { 6, 0x0A86 }, - /*0347*/ { 9, 0x0A8C }, - /*0348*/ { 7, 0x0A95 }, - /*0349*/ { 7, 0x0A9C }, - /*034A*/ { 7, 0x0AA3 }, - /*034B*/ { 5, 0x0AAA }, - /*034C*/ { 6, 0x0AAF }, - /*034D*/ { 6, 0x0AB5 }, - /*034E*/ { 11, 0x0ABB }, - /*034F*/ { 11, 0x0AC6 }, - /*0350*/ { 5, 0x0AD1 }, - /*0351*/ { 5, 0x0AD6 }, - /*0352*/ { 2, 0x0ADB }, - /*0353*/ { 4, 0x0ADD }, - /*0354*/ { 2, 0x0AE1 }, - /*0355*/ { 2, 0x0AE3 }, - /*0356*/ { 3, 0x0AE5 }, - /*0357*/ { 3, 0x0AE8 }, - /*0358*/ { 3, 0x0AEB }, - /*0359*/ { 6, 0x0AEE }, - /*035A*/ { 6, 0x0AF4 }, - /*035B*/ { 2, 0x0AFA }, - /*035C*/ { 4, 0x0AFC }, - /*035D*/ { 2, 0x0B00 }, - /*035E*/ { 4, 0x0B02 }, - /*035F*/ { 2, 0x0B06 }, - /*0360*/ { 2, 0x0B08 }, - /*0361*/ { 4, 0x0B0A }, - /*0362*/ { 2, 0x0B0E }, - /*0363*/ { 4, 0x0B10 }, - /*0364*/ { 2, 0x0B14 }, - /*0365*/ { 4, 0x0B16 }, - /*0366*/ { 7, 0x0B1A }, - /*0367*/ { 7, 0x0B21 }, - /*0368*/ { 3, 0x0B28 }, - /*0369*/ { 3, 0x0B2B }, - /*036A*/ { 3, 0x0B2E }, - /*036B*/ { 3, 0x0B31 }, - /*036C*/ { 14, 0x0B34 }, - /*036D*/ { 14, 0x0B42 }, - /*036E*/ { 5, 0x0B50 }, - /*036F*/ { 5, 0x0B55 }, - /*0370*/ { 14, 0x0B5A }, - /*0371*/ { 14, 0x0B68 }, - /*0372*/ { 5, 0x0B76 }, - /*0373*/ { 5, 0x0B7B }, - /*0374*/ { 14, 0x0B80 }, - /*0375*/ { 14, 0x0B8E }, - /*0376*/ { 5, 0x0B9C }, - /*0377*/ { 5, 0x0BA1 }, - /*0378*/ { 3, 0x0BA6 }, - /*0379*/ { 8, 0x0BA9 }, - /*037A*/ { 8, 0x0BB1 }, - /*037B*/ { 4, 0x0BB9 }, - /*037C*/ { 4, 0x0BBD }, - /*037D*/ { 11, 0x0BC1 }, - /*037E*/ { 11, 0x0BCC }, - /*037F*/ { 11, 0x0BD7 }, - /*0380*/ { 11, 0x0BE2 }, - /*0381*/ { 11, 0x0BED }, - /*0382*/ { 11, 0x0BF8 }, - /*0383*/ { 8, 0x0C03 }, - /*0384*/ { 8, 0x0C0B }, - /*0385*/ { 14, 0x0C13 }, - /*0386*/ { 14, 0x0C21 }, - /*0387*/ { 5, 0x0C2F }, - /*0388*/ { 5, 0x0C34 }, - /*0389*/ { 14, 0x0C39 }, - /*038A*/ { 14, 0x0C47 }, - /*038B*/ { 5, 0x0C55 }, - /*038C*/ { 5, 0x0C5A }, - /*038D*/ { 14, 0x0C5F }, - /*038E*/ { 14, 0x0C6D }, - /*038F*/ { 5, 0x0C7B }, - /*0390*/ { 5, 0x0C80 }, - /*0391*/ { 11, 0x0C85 }, - /*0392*/ { 11, 0x0C90 }, - /*0393*/ { 11, 0x0C9B }, - /*0394*/ { 11, 0x0CA6 }, - /*0395*/ { 11, 0x0CB1 }, - /*0396*/ { 11, 0x0CBC }, - /*0397*/ { 8, 0x0CC7 }, - /*0398*/ { 8, 0x0CCF }, - /*0399*/ { 8, 0x0CD7 }, - /*039A*/ { 8, 0x0CDF }, - /*039B*/ { 4, 0x0CE7 }, - /*039C*/ { 4, 0x0CEB }, - /*039D*/ { 14, 0x0CEF }, - /*039E*/ { 14, 0x0CFD }, - /*039F*/ { 5, 0x0D0B }, - /*03A0*/ { 5, 0x0D10 }, - /*03A1*/ { 14, 0x0D15 }, - /*03A2*/ { 14, 0x0D23 }, - /*03A3*/ { 5, 0x0D31 }, - /*03A4*/ { 5, 0x0D36 }, - /*03A5*/ { 14, 0x0D3B }, - /*03A6*/ { 14, 0x0D49 }, - /*03A7*/ { 5, 0x0D57 }, - /*03A8*/ { 5, 0x0D5C }, - /*03A9*/ { 8, 0x0D61 }, - /*03AA*/ { 8, 0x0D69 }, - /*03AB*/ { 4, 0x0D71 }, - /*03AC*/ { 4, 0x0D75 }, - /*03AD*/ { 14, 0x0D79 }, - /*03AE*/ { 14, 0x0D87 }, - /*03AF*/ { 5, 0x0D95 }, - /*03B0*/ { 5, 0x0D9A }, - /*03B1*/ { 14, 0x0D9F }, - /*03B2*/ { 14, 0x0DAD }, - /*03B3*/ { 5, 0x0DBB }, - /*03B4*/ { 5, 0x0DC0 }, - /*03B5*/ { 14, 0x0DC5 }, - /*03B6*/ { 14, 0x0DD3 }, - /*03B7*/ { 5, 0x0DE1 }, - /*03B8*/ { 5, 0x0DE6 }, - /*03B9*/ { 8, 0x0DEB }, - /*03BA*/ { 8, 0x0DF3 }, - /*03BB*/ { 4, 0x0DFB }, - /*03BC*/ { 4, 0x0DFF }, - /*03BD*/ { 6, 0x0E03 }, - /*03BE*/ { 6, 0x0E09 }, - /*03BF*/ { 2, 0x0E0F }, - /*03C0*/ { 2, 0x0E11 }, - /*03C1*/ { 4, 0x0E13 }, - /*03C2*/ { 4, 0x0E17 }, - /*03C3*/ { 2, 0x0E1B }, - /*03C4*/ { 2, 0x0E1D }, - /*03C5*/ { 6, 0x0E1F }, - /*03C6*/ { 6, 0x0E25 }, - /*03C7*/ { 1, 0x0E2B }, - /*03C8*/ { 2, 0x0E2C }, - /*03C9*/ { 1, 0x0E2E }, - /*03CA*/ { 1, 0x0E2F }, - /*03CB*/ { 1, 0x0E30 }, - /*03CC*/ { 1, 0x0E31 }, - /*03CD*/ { 1, 0x0E32 }, - /*03CE*/ { 2, 0x0E33 }, - /*03CF*/ { 1, 0x0E35 }, - /*03D0*/ { 1, 0x0E36 }, - /*03D1*/ { 5, 0x0E37 }, - /*03D2*/ { 5, 0x0E3C }, - /*03D3*/ { 10, 0x0E41 }, - /*03D4*/ { 10, 0x0E4B }, - /*03D5*/ { 3, 0x0E55 }, - /*03D6*/ { 3, 0x0E58 }, - /*03D7*/ { 10, 0x0E5B }, - /*03D8*/ { 10, 0x0E65 }, - /*03D9*/ { 3, 0x0E6F }, - /*03DA*/ { 3, 0x0E72 }, - /*03DB*/ { 3, 0x0E75 }, - /*03DC*/ { 3, 0x0E78 }, - /*03DD*/ { 3, 0x0E7B }, - /*03DE*/ { 3, 0x0E7E }, - /*03DF*/ { 3, 0x0E81 }, - /*03E0*/ { 4, 0x0E84 }, - /*03E1*/ { 4, 0x0E88 }, - /*03E2*/ { 4, 0x0E8C }, - /*03E3*/ { 4, 0x0E90 }, - /*03E4*/ { 2, 0x0E94 }, - /*03E5*/ { 4, 0x0E96 }, - /*03E6*/ { 2, 0x0E9A }, - /*03E7*/ { 4, 0x0E9C }, - /*03E8*/ { 2, 0x0EA0 }, - /*03E9*/ { 2, 0x0EA2 }, - /*03EA*/ { 4, 0x0EA4 }, - /*03EB*/ { 2, 0x0EA8 }, - /*03EC*/ { 4, 0x0EAA }, - /*03ED*/ { 2, 0x0EAE }, - /*03EE*/ { 4, 0x0EB0 }, - /*03EF*/ { 2, 0x0EB4 }, - /*03F0*/ { 1, 0x0EB6 }, - /*03F1*/ { 1, 0x0EB7 }, - /*03F2*/ { 1, 0x0EB8 }, - /*03F3*/ { 1, 0x0EB9 }, - /*03F4*/ { 1, 0x0EBA }, - /*03F5*/ { 1, 0x0EBB }, - /*03F6*/ { 1, 0x0EBC }, - /*03F7*/ { 1, 0x0EBD }, - /*03F8*/ { 1, 0x0EBE }, - /*03F9*/ { 3, 0x0EBF }, - /*03FA*/ { 1, 0x0EC2 }, - /*03FB*/ { 4, 0x0EC3 }, - /*03FC*/ { 4, 0x0EC7 }, - /*03FD*/ { 11, 0x0ECB }, - /*03FE*/ { 11, 0x0ED6 }, - /*03FF*/ { 5, 0x0EE1 }, - /*0400*/ { 5, 0x0EE6 }, - /*0401*/ { 1, 0x0EEB }, - /*0402*/ { 1, 0x0EEC }, - /*0403*/ { 1, 0x0EED }, - /*0404*/ { 11, 0x0EEE }, - /*0405*/ { 11, 0x0EF9 }, - /*0406*/ { 5, 0x0F04 }, - /*0407*/ { 5, 0x0F09 }, - /*0408*/ { 1, 0x0F0E }, - /*0409*/ { 1, 0x0F0F }, - /*040A*/ { 1, 0x0F10 }, - /*040B*/ { 24, 0x0F11 }, - /*040C*/ { 24, 0x0F29 }, - /*040D*/ { 12, 0x0F41 }, - /*040E*/ { 10, 0x0F4D }, - /*040F*/ { 8, 0x0F57 }, - /*0410*/ { 16, 0x0F5F }, - /*0411*/ { 16, 0x0F6F }, - /*0412*/ { 8, 0x0F7F }, - /*0413*/ { 12, 0x0F87 }, - /*0414*/ { 12, 0x0F93 }, - /*0415*/ { 12, 0x0F9F }, - /*0416*/ { 12, 0x0FAB }, - /*0417*/ { 2, 0x0FB7 }, - /*0418*/ { 4, 0x0FB9 }, - /*0419*/ { 4, 0x0FBD }, - /*041A*/ { 2, 0x0FC1 }, - /*041B*/ { 4, 0x0FC3 }, - /*041C*/ { 4, 0x0FC7 }, - /*041D*/ { 2, 0x0FCB }, - /*041E*/ { 2, 0x0FCD }, - /*041F*/ { 1, 0x0FCF }, - /*0420*/ { 1, 0x0FD0 }, - /*0421*/ { 1, 0x0FD1 }, - /*0422*/ { 1, 0x0FD2 }, - /*0423*/ { 5, 0x0FD3 }, - /*0424*/ { 5, 0x0FD8 }, - /*0425*/ { 5, 0x0FDD }, - /*0426*/ { 5, 0x0FE2 }, - /*0427*/ { 16, 0x0FE7 }, - /*0428*/ { 8, 0x0FF7 }, - /*0429*/ { 10, 0x0FFF }, - /*042A*/ { 10, 0x1009 }, - /*042B*/ { 8, 0x1013 }, - /*042C*/ { 20, 0x101B }, - /*042D*/ { 20, 0x102F }, - /*042E*/ { 4, 0x1043 }, - /*042F*/ { 1, 0x1047 }, - /*0430*/ { 1, 0x1048 }, - /*0431*/ { 4, 0x1049 }, - /*0432*/ { 1, 0x104D }, - /*0433*/ { 1, 0x104E }, - /*0434*/ { 1, 0x104F }, - /*0435*/ { 14, 0x1050 }, - /*0436*/ { 14, 0x105E }, - /*0437*/ { 5, 0x106C }, - /*0438*/ { 5, 0x1071 }, - /*0439*/ { 4, 0x1076 }, - /*043A*/ { 1, 0x107A }, - /*043B*/ { 1, 0x107B }, - /*043C*/ { 10, 0x107C }, - /*043D*/ { 10, 0x1086 }, - /*043E*/ { 2, 0x1090 }, - /*043F*/ { 2, 0x1092 }, - /*0440*/ { 10, 0x1094 }, - /*0441*/ { 10, 0x109E }, - /*0442*/ { 6, 0x10A8 }, - /*0443*/ { 10, 0x10AE }, - /*0444*/ { 10, 0x10B8 }, - /*0445*/ { 10, 0x10C2 }, - /*0446*/ { 1, 0x10CC }, - /*0447*/ { 1, 0x10CD }, - /*0448*/ { 1, 0x10CE }, - /*0449*/ { 1, 0x10CF }, - /*044A*/ { 1, 0x10D0 }, - /*044B*/ { 1, 0x10D1 }, - /*044C*/ { 1, 0x10D2 }, - /*044D*/ { 1, 0x10D3 }, - /*044E*/ { 10, 0x10D4 }, - /*044F*/ { 10, 0x10DE }, - /*0450*/ { 3, 0x10E8 }, - /*0451*/ { 10, 0x10EB }, - /*0452*/ { 13, 0x10F5 }, - /*0453*/ { 10, 0x1102 }, - /*0454*/ { 10, 0x110C }, - /*0455*/ { 3, 0x1116 }, - /*0456*/ { 3, 0x1119 }, - /*0457*/ { 10, 0x111C }, - /*0458*/ { 10, 0x1126 }, - /*0459*/ { 10, 0x1130 }, - /*045A*/ { 10, 0x113A }, - /*045B*/ { 10, 0x1144 }, - /*045C*/ { 4, 0x114E }, - /*045D*/ { 9, 0x1152 }, - /*045E*/ { 4, 0x115B }, - /*045F*/ { 9, 0x115F }, - /*0460*/ { 9, 0x1168 }, - /*0461*/ { 9, 0x1171 }, - /*0462*/ { 10, 0x117A }, - /*0463*/ { 10, 0x1184 }, - /*0464*/ { 4, 0x118E }, - /*0465*/ { 6, 0x1192 }, - /*0466*/ { 9, 0x1198 }, - /*0467*/ { 9, 0x11A1 }, - /*0468*/ { 6, 0x11AA }, - /*0469*/ { 4, 0x11B0 }, - /*046A*/ { 4, 0x11B4 }, - /*046B*/ { 13, 0x11B8 }, - /*046C*/ { 14, 0x11C5 }, - /*046D*/ { 3, 0x11D3 }, - /*046E*/ { 3, 0x11D6 }, - /*046F*/ { 14, 0x11D9 }, - /*0470*/ { 13, 0x11E7 }, - /*0471*/ { 2, 0x11F4 }, - /*0472*/ { 8, 0x11F6 }, - /*0473*/ { 6, 0x11FE }, - /*0474*/ { 9, 0x1204 }, - /*0475*/ { 10, 0x120D }, - /*0476*/ { 13, 0x1217 }, - /*0477*/ { 10, 0x1224 }, - /*0478*/ { 10, 0x122E }, - /*0479*/ { 6, 0x1238 }, - /*047A*/ { 6, 0x123E }, - /*047B*/ { 10, 0x1244 }, - /*047C*/ { 13, 0x124E }, - /*047D*/ { 10, 0x125B }, - /*047E*/ { 10, 0x1265 }, - /*047F*/ { 6, 0x126F }, - /*0480*/ { 2, 0x1275 }, - /*0481*/ { 3, 0x1277 }, - /*0482*/ { 6, 0x127A }, - /*0483*/ { 6, 0x1280 }, - /*0484*/ { 9, 0x1286 }, - /*0485*/ { 6, 0x128F }, - /*0486*/ { 6, 0x1295 }, - /*0487*/ { 6, 0x129B }, - /*0488*/ { 2, 0x12A1 }, - /*0489*/ { 2, 0x12A3 }, - /*048A*/ { 6, 0x12A5 }, - /*048B*/ { 6, 0x12AB }, - /*048C*/ { 2, 0x12B1 }, - /*048D*/ { 2, 0x12B3 }, - /*048E*/ { 2, 0x12B5 }, - /*048F*/ { 2, 0x12B7 }, - /*0490*/ { 2, 0x12B9 }, - /*0491*/ { 2, 0x12BB }, - /*0492*/ { 6, 0x12BD }, - /*0493*/ { 6, 0x12C3 }, - /*0494*/ { 2, 0x12C9 }, - /*0495*/ { 2, 0x12CB }, - /*0496*/ { 6, 0x12CD }, - /*0497*/ { 8, 0x12D3 }, - /*0498*/ { 3, 0x12DB }, - /*0499*/ { 6, 0x12DE }, - /*049A*/ { 6, 0x12E4 }, - /*049B*/ { 6, 0x12EA }, - /*049C*/ { 6, 0x12F0 }, - /*049D*/ { 6, 0x12F6 }, - /*049E*/ { 6, 0x12FC }, - /*049F*/ { 8, 0x1302 }, - /*04A0*/ { 8, 0x130A }, - /*04A1*/ { 20, 0x1312 }, - /*04A2*/ { 20, 0x1326 }, - /*04A3*/ { 10, 0x133A }, - /*04A4*/ { 6, 0x1344 }, - /*04A5*/ { 10, 0x134A }, - /*04A6*/ { 6, 0x1354 }, - /*04A7*/ { 6, 0x135A }, - /*04A8*/ { 6, 0x1360 }, - /*04A9*/ { 6, 0x1366 }, - /*04AA*/ { 6, 0x136C }, - /*04AB*/ { 6, 0x1372 }, - /*04AC*/ { 6, 0x1378 }, - /*04AD*/ { 6, 0x137E }, - /*04AE*/ { 6, 0x1384 }, - /*04AF*/ { 4, 0x138A }, - /*04B0*/ { 6, 0x138E }, - /*04B1*/ { 4, 0x1394 }, - /*04B2*/ { 6, 0x1398 }, - /*04B3*/ { 6, 0x139E }, - /*04B4*/ { 6, 0x13A4 }, - /*04B5*/ { 5, 0x13AA }, - /*04B6*/ { 5, 0x13AF }, - /*04B7*/ { 2, 0x13B4 }, - /*04B8*/ { 2, 0x13B6 }, - /*04B9*/ { 2, 0x13B8 }, - /*04BA*/ { 4, 0x13BA }, - /*04BB*/ { 2, 0x13BE }, - /*04BC*/ { 4, 0x13C0 }, - /*04BD*/ { 2, 0x13C4 }, - /*04BE*/ { 2, 0x13C6 }, - /*04BF*/ { 2, 0x13C8 }, - /*04C0*/ { 2, 0x13CA }, - /*04C1*/ { 2, 0x13CC }, - /*04C2*/ { 2, 0x13CE }, - /*04C3*/ { 4, 0x13D0 }, - /*04C4*/ { 2, 0x13D4 }, - /*04C5*/ { 2, 0x13D6 }, - /*04C6*/ { 4, 0x13D8 }, - /*04C7*/ { 2, 0x13DC }, - /*04C8*/ { 4, 0x13DE }, - /*04C9*/ { 2, 0x13E2 }, - /*04CA*/ { 4, 0x13E4 }, - /*04CB*/ { 4, 0x13E8 }, - /*04CC*/ { 2, 0x13EC }, - /*04CD*/ { 4, 0x13EE }, - /*04CE*/ { 6, 0x13F2 }, - /*04CF*/ { 4, 0x13F8 }, - /*04D0*/ { 4, 0x13FC }, - /*04D1*/ { 6, 0x1400 }, - /*04D2*/ { 6, 0x1406 }, - /*04D3*/ { 2, 0x140C }, - /*04D4*/ { 2, 0x140E }, - /*04D5*/ { 2, 0x1410 }, - /*04D6*/ { 2, 0x1412 }, - /*04D7*/ { 2, 0x1414 }, - /*04D8*/ { 2, 0x1416 }, - /*04D9*/ { 2, 0x1418 }, - /*04DA*/ { 2, 0x141A }, - /*04DB*/ { 2, 0x141C }, - /*04DC*/ { 2, 0x141E }, - /*04DD*/ { 2, 0x1420 }, - /*04DE*/ { 2, 0x1422 }, - /*04DF*/ { 3, 0x1424 }, - /*04E0*/ { 3, 0x1427 }, - /*04E1*/ { 6, 0x142A }, - /*04E2*/ { 6, 0x1430 }, - /*04E3*/ { 10, 0x1436 }, - /*04E4*/ { 10, 0x1440 }, - /*04E5*/ { 4, 0x144A }, - /*04E6*/ { 4, 0x144E }, - /*04E7*/ { 10, 0x1452 }, - /*04E8*/ { 13, 0x145C }, - /*04E9*/ { 6, 0x1469 }, - /*04EA*/ { 10, 0x146F }, - /*04EB*/ { 10, 0x1479 }, - /*04EC*/ { 13, 0x1483 }, - /*04ED*/ { 6, 0x1490 }, - /*04EE*/ { 10, 0x1496 }, - /*04EF*/ { 10, 0x14A0 }, - /*04F0*/ { 13, 0x14AA }, - /*04F1*/ { 6, 0x14B7 }, - /*04F2*/ { 10, 0x14BD }, - /*04F3*/ { 10, 0x14C7 }, - /*04F4*/ { 13, 0x14D1 }, - /*04F5*/ { 6, 0x14DE }, - /*04F6*/ { 10, 0x14E4 }, - /*04F7*/ { 3, 0x14EE }, - /*04F8*/ { 3, 0x14F1 }, - /*04F9*/ { 6, 0x14F4 }, - /*04FA*/ { 6, 0x14FA }, - /*04FB*/ { 3, 0x1500 }, - /*04FC*/ { 3, 0x1503 }, - /*04FD*/ { 3, 0x1506 }, - /*04FE*/ { 3, 0x1509 }, - /*04FF*/ { 2, 0x150C }, - /*0500*/ { 3, 0x150E }, - /*0501*/ { 6, 0x1511 }, - /*0502*/ { 6, 0x1517 }, - /*0503*/ { 6, 0x151D }, - /*0504*/ { 6, 0x1523 }, - /*0505*/ { 6, 0x1529 }, - /*0506*/ { 6, 0x152F }, - /*0507*/ { 6, 0x1535 }, - /*0508*/ { 6, 0x153B }, - /*0509*/ { 6, 0x1541 }, - /*050A*/ { 10, 0x1547 }, - /*050B*/ { 10, 0x1551 }, - /*050C*/ { 10, 0x155B }, - /*050D*/ { 10, 0x1565 }, - /*050E*/ { 10, 0x156F }, - /*050F*/ { 10, 0x1579 }, - /*0510*/ { 6, 0x1583 }, - /*0511*/ { 6, 0x1589 }, - /*0512*/ { 6, 0x158F }, - /*0513*/ { 6, 0x1595 }, - /*0514*/ { 6, 0x159B }, - /*0515*/ { 6, 0x15A1 }, - /*0516*/ { 3, 0x15A7 }, - /*0517*/ { 6, 0x15AA }, - /*0518*/ { 10, 0x15B0 }, - /*0519*/ { 10, 0x15BA }, - /*051A*/ { 10, 0x15C4 }, - /*051B*/ { 10, 0x15CE }, - /*051C*/ { 10, 0x15D8 }, - /*051D*/ { 10, 0x15E2 }, - /*051E*/ { 10, 0x15EC }, - /*051F*/ { 3, 0x15F6 }, - /*0520*/ { 10, 0x15F9 }, - /*0521*/ { 3, 0x1603 }, - /*0522*/ { 10, 0x1606 }, - /*0523*/ { 10, 0x1610 }, - /*0524*/ { 13, 0x161A }, - /*0525*/ { 6, 0x1627 }, - /*0526*/ { 10, 0x162D }, - /*0527*/ { 6, 0x1637 }, - /*0528*/ { 10, 0x163D }, - /*0529*/ { 2, 0x1647 }, - /*052A*/ { 2, 0x1649 }, - /*052B*/ { 4, 0x164B }, - /*052C*/ { 9, 0x164F }, - /*052D*/ { 9, 0x1658 }, - /*052E*/ { 4, 0x1661 }, - /*052F*/ { 2, 0x1665 }, - /*0530*/ { 2, 0x1667 }, - /*0531*/ { 2, 0x1669 }, - /*0532*/ { 2, 0x166B }, - /*0533*/ { 2, 0x166D }, - /*0534*/ { 2, 0x166F }, - /*0535*/ { 2, 0x1671 }, - /*0536*/ { 2, 0x1673 }, - /*0537*/ { 6, 0x1675 }, - /*0538*/ { 6, 0x167B }, - /*0539*/ { 6, 0x1681 }, - /*053A*/ { 6, 0x1687 }, - /*053B*/ { 6, 0x168D }, - /*053C*/ { 6, 0x1693 }, - /*053D*/ { 6, 0x1699 }, - /*053E*/ { 6, 0x169F }, - /*053F*/ { 6, 0x16A5 }, - /*0540*/ { 6, 0x16AB }, - /*0541*/ { 6, 0x16B1 }, - /*0542*/ { 6, 0x16B7 }, - /*0543*/ { 10, 0x16BD }, - /*0544*/ { 3, 0x16C7 }, - /*0545*/ { 3, 0x16CA }, - /*0546*/ { 4, 0x16CD }, - /*0547*/ { 4, 0x16D1 }, - /*0548*/ { 3, 0x16D5 }, - /*0549*/ { 3, 0x16D8 }, - /*054A*/ { 4, 0x16DB }, - /*054B*/ { 4, 0x16DF }, - /*054C*/ { 4, 0x16E3 }, - /*054D*/ { 4, 0x16E7 }, - /*054E*/ { 4, 0x16EB }, - /*054F*/ { 4, 0x16EF }, - /*0550*/ { 4, 0x16F3 }, - /*0551*/ { 4, 0x16F7 }, - /*0552*/ { 10, 0x16FB }, - /*0553*/ { 13, 0x1705 }, - /*0554*/ { 10, 0x1712 }, - /*0555*/ { 10, 0x171C }, - /*0556*/ { 4, 0x1726 }, - /*0557*/ { 4, 0x172A }, - /*0558*/ { 4, 0x172E }, - /*0559*/ { 21, 0x1732 }, - /*055A*/ { 8, 0x1747 }, - /*055B*/ { 18, 0x174F }, - /*055C*/ { 13, 0x1761 }, - /*055D*/ { 10, 0x176E }, - /*055E*/ { 6, 0x1778 }, - /*055F*/ { 18, 0x177E }, - /*0560*/ { 21, 0x1790 }, - /*0561*/ { 12, 0x17A5 }, - /*0562*/ { 13, 0x17B1 }, - /*0563*/ { 6, 0x17BE }, - /*0564*/ { 6, 0x17C4 }, - /*0565*/ { 18, 0x17CA }, - /*0566*/ { 21, 0x17DC }, - /*0567*/ { 8, 0x17F1 }, - /*0568*/ { 18, 0x17F9 }, - /*0569*/ { 13, 0x180B }, - /*056A*/ { 10, 0x1818 }, - /*056B*/ { 6, 0x1822 }, - /*056C*/ { 18, 0x1828 }, - /*056D*/ { 10, 0x183A }, - /*056E*/ { 13, 0x1844 }, - /*056F*/ { 10, 0x1851 }, - /*0570*/ { 3, 0x185B }, - /*0571*/ { 3, 0x185E }, - /*0572*/ { 10, 0x1861 }, - /*0573*/ { 3, 0x186B }, - /*0574*/ { 10, 0x186E }, - /*0575*/ { 10, 0x1878 }, - /*0576*/ { 10, 0x1882 }, - /*0577*/ { 10, 0x188C }, - /*0578*/ { 6, 0x1896 }, - /*0579*/ { 6, 0x189C }, - /*057A*/ { 4, 0x18A2 }, - /*057B*/ { 6, 0x18A6 }, - /*057C*/ { 9, 0x18AC }, - /*057D*/ { 6, 0x18B5 }, - /*057E*/ { 6, 0x18BB }, - /*057F*/ { 6, 0x18C1 }, - /*0580*/ { 6, 0x18C7 }, - /*0581*/ { 6, 0x18CD }, - /*0582*/ { 6, 0x18D3 }, - /*0583*/ { 10, 0x18D9 }, - /*0584*/ { 10, 0x18E3 }, - /*0585*/ { 10, 0x18ED }, - /*0586*/ { 10, 0x18F7 }, - /*0587*/ { 10, 0x1901 }, - /*0588*/ { 10, 0x190B }, - /*0589*/ { 10, 0x1915 }, - /*058A*/ { 10, 0x191F }, - /*058B*/ { 4, 0x1929 }, - /*058C*/ { 9, 0x192D }, - /*058D*/ { 9, 0x1936 }, - /*058E*/ { 7, 0x193F }, - /*058F*/ { 7, 0x1946 }, - /*0590*/ { 3, 0x194D }, - /*0591*/ { 3, 0x1950 }, - /*0592*/ { 6, 0x1953 }, - /*0593*/ { 6, 0x1959 }, - /*0594*/ { 2, 0x195F }, - /*0595*/ { 2, 0x1961 }, - /*0596*/ { 3, 0x1963 }, - /*0597*/ { 3, 0x1966 }, - /*0598*/ { 3, 0x1969 }, - /*0599*/ { 3, 0x196C }, - /*059A*/ { 3, 0x196F }, - /*059B*/ { 4, 0x1972 }, - /*059C*/ { 2, 0x1976 }, - /*059D*/ { 7, 0x1978 }, - /*059E*/ { 7, 0x197F }, - /*059F*/ { 3, 0x1986 }, - /*05A0*/ { 3, 0x1989 }, - /*05A1*/ { 3, 0x198C }, - /*05A2*/ { 3, 0x198F }, - /*05A3*/ { 7, 0x1992 }, - /*05A4*/ { 7, 0x1999 }, - /*05A5*/ { 3, 0x19A0 }, - /*05A6*/ { 3, 0x19A3 }, - /*05A7*/ { 4, 0x19A6 }, - /*05A8*/ { 4, 0x19AA }, - /*05A9*/ { 2, 0x19AE }, - /*05AA*/ { 2, 0x19B0 }, - /*05AB*/ { 6, 0x19B2 }, - /*05AC*/ { 6, 0x19B8 }, - /*05AD*/ { 2, 0x19BE }, - /*05AE*/ { 2, 0x19C0 }, - /*05AF*/ { 3, 0x19C2 }, - /*05B0*/ { 3, 0x19C5 }, - /*05B1*/ { 3, 0x19C8 }, - /*05B2*/ { 3, 0x19CB }, - /*05B3*/ { 3, 0x19CE }, - /*05B4*/ { 4, 0x19D1 }, - /*05B5*/ { 2, 0x19D5 }, - /*05B6*/ { 7, 0x19D7 }, - /*05B7*/ { 7, 0x19DE }, - /*05B8*/ { 3, 0x19E5 }, - /*05B9*/ { 3, 0x19E8 }, - /*05BA*/ { 3, 0x19EB }, - /*05BB*/ { 4, 0x19EE }, - /*05BC*/ { 4, 0x19F2 }, - /*05BD*/ { 1, 0x19F6 }, - /*05BE*/ { 2, 0x19F7 }, - /*05BF*/ { 1, 0x19F9 }, - /*05C0*/ { 1, 0x19FA }, - /*05C1*/ { 1, 0x19FB }, - /*05C2*/ { 1, 0x19FC }, - /*05C3*/ { 1, 0x19FD }, - /*05C4*/ { 2, 0x19FE }, - /*05C5*/ { 1, 0x1A00 }, - /*05C6*/ { 1, 0x1A01 }, - /*05C7*/ { 3, 0x1A02 }, - /*05C8*/ { 3, 0x1A05 }, - /*05C9*/ { 4, 0x1A08 }, - /*05CA*/ { 4, 0x1A0C }, - /*05CB*/ { 4, 0x1A10 }, - /*05CC*/ { 4, 0x1A14 }, - /*05CD*/ { 10, 0x1A18 }, - /*05CE*/ { 10, 0x1A22 }, - /*05CF*/ { 11, 0x1A2C }, - /*05D0*/ { 11, 0x1A37 }, - /*05D1*/ { 5, 0x1A42 }, - /*05D2*/ { 5, 0x1A47 }, - /*05D3*/ { 1, 0x1A4C }, - /*05D4*/ { 14, 0x1A4D }, - /*05D5*/ { 14, 0x1A5B }, - /*05D6*/ { 3, 0x1A69 }, - /*05D7*/ { 3, 0x1A6C }, - /*05D8*/ { 5, 0x1A6F }, - /*05D9*/ { 5, 0x1A74 }, - /*05DA*/ { 4, 0x1A79 }, - /*05DB*/ { 4, 0x1A7D }, - /*05DC*/ { 5, 0x1A81 }, - /*05DD*/ { 5, 0x1A86 }, - /*05DE*/ { 10, 0x1A8B }, - /*05DF*/ { 10, 0x1A95 }, - /*05E0*/ { 10, 0x1A9F }, - /*05E1*/ { 10, 0x1AA9 }, - /*05E2*/ { 10, 0x1AB3 }, - /*05E3*/ { 10, 0x1ABD }, - /*05E4*/ { 1, 0x1AC7 }, - /*05E5*/ { 1, 0x1AC8 }, - /*05E6*/ { 1, 0x1AC9 }, - /*05E7*/ { 1, 0x1ACA }, - /*05E8*/ { 1, 0x1ACB }, - /*05E9*/ { 1, 0x1ACC }, - /*05EA*/ { 1, 0x1ACD }, - /*05EB*/ { 1, 0x1ACE }, - /*05EC*/ { 1, 0x1ACF }, - /*05ED*/ { 1, 0x1AD0 }, - /*05EE*/ { 1, 0x1AD1 }, - /*05EF*/ { 1, 0x1AD2 }, - /*05F0*/ { 4, 0x1AD3 }, - /*05F1*/ { 1, 0x1AD7 }, - /*05F2*/ { 12, 0x1AD8 }, - /*05F3*/ { 1, 0x1AE4 }, - /*05F4*/ { 1, 0x1AE5 }, - /*05F5*/ { 1, 0x1AE6 }, - /*05F6*/ { 18, 0x1AE7 }, - /*05F7*/ { 2, 0x1AF9 }, - /*05F8*/ { 2, 0x1AFB }, - /*05F9*/ { 1, 0x1AFD }, - /*05FA*/ { 1, 0x1AFE }, - /*05FB*/ { 1, 0x1AFF }, - /*05FC*/ { 1, 0x1B00 }, - /*05FD*/ { 1, 0x1B01 }, - /*05FE*/ { 1, 0x1B02 }, - /*05FF*/ { 1, 0x1B03 }, - /*0600*/ { 1, 0x1B04 }, - /*0601*/ { 1, 0x1B05 }, - /*0602*/ { 1, 0x1B06 }, - /*0603*/ { 1, 0x1B07 }, - /*0604*/ { 1, 0x1B08 }, - /*0605*/ { 1, 0x1B09 }, - /*0606*/ { 1, 0x1B0A } -}; diff --git a/tools/ZydisDisasm.c b/tools/ZydisDisasm.c index 0b98d01..e642a23 100644 --- a/tools/ZydisDisasm.c +++ b/tools/ZydisDisasm.c @@ -31,7 +31,7 @@ #include #include #include -#include "Zydis/Encoder.h" +//#include "Zydis/Encoder.h" /* ============================================================================================== */ /* Entry point */