/***************************************************************************************************12Zyan Disassembler Library (Zydis)34Original Author : Florian Bernd56* Permission is hereby granted, free of charge, to any person obtaining a copy7* of this software and associated documentation files (the "Software"), to deal8* in the Software without restriction, including without limitation the rights9* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10* copies of the Software, and to permit persons to whom the Software is11* furnished to do so, subject to the following conditions:12*13* The above copyright notice and this permission notice shall be included in all14* copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE19* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE22* SOFTWARE.2324***************************************************************************************************/2526/**27* @file28* Status code definitions and check macros.29*/3031#ifndef ZYDIS_STATUS_H32#define ZYDIS_STATUS_H3334#include <Zycore/Status.h>3536#ifdef __cplusplus37extern "C" {38#endif3940/* ============================================================================================== */41/* Status codes */42/* ============================================================================================== */4344/* ---------------------------------------------------------------------------------------------- */45/* Module IDs */46/* ---------------------------------------------------------------------------------------------- */4748/**49* The zydis module id.50*/51#define ZYAN_MODULE_ZYDIS 0x002u5253/* ---------------------------------------------------------------------------------------------- */54/* Status codes */55/* ---------------------------------------------------------------------------------------------- */5657/* ---------------------------------------------------------------------------------------------- */58/* Decoder */59/* ---------------------------------------------------------------------------------------------- */6061/**62* An attempt was made to read data from an input data-source that has no more63* data available.64*/65#define ZYDIS_STATUS_NO_MORE_DATA \66ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x00u)6768/**69* An general error occured while decoding the current instruction. The70* instruction might be undefined.71*/72#define ZYDIS_STATUS_DECODING_ERROR \73ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x01u)7475/**76* The instruction exceeded the maximum length of 15 bytes.77*/78#define ZYDIS_STATUS_INSTRUCTION_TOO_LONG \79ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x02u)8081/**82* The instruction encoded an invalid register.83*/84#define ZYDIS_STATUS_BAD_REGISTER \85ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x03u)8687/**88* A lock-prefix (F0) was found while decoding an instruction that does not89* support locking.90*/91#define ZYDIS_STATUS_ILLEGAL_LOCK \92ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x04u)9394/**95* A legacy-prefix (F2, F3, 66) was found while decoding a XOP/VEX/EVEX/MVEX96* instruction.97*/98#define ZYDIS_STATUS_ILLEGAL_LEGACY_PFX \99ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x05u)100101/**102* A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.103*/104#define ZYDIS_STATUS_ILLEGAL_REX \105ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x06u)106107/**108* An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.109*/110#define ZYDIS_STATUS_INVALID_MAP \111ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x07u)112113/**114* An error occured while decoding the EVEX-prefix.115*/116#define ZYDIS_STATUS_MALFORMED_EVEX \117ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x08u)118119/**120* An error occured while decoding the MVEX-prefix.121*/122#define ZYDIS_STATUS_MALFORMED_MVEX \123ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x09u)124125/**126* An invalid write-mask was specified for an EVEX/MVEX instruction.127*/128#define ZYDIS_STATUS_INVALID_MASK \129ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Au)130131/* ---------------------------------------------------------------------------------------------- */132/* Formatter */133/* ---------------------------------------------------------------------------------------------- */134135/**136* Returning this status code in some specified formatter callbacks will cause137* the formatter to omit the corresponding token.138*139* Valid callbacks:140* - `ZYDIS_FORMATTER_FUNC_PRE_OPERAND`141* - `ZYDIS_FORMATTER_FUNC_POST_OPERAND`142* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG`143* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM`144* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR`145* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`146*/147#define ZYDIS_STATUS_SKIP_TOKEN \148ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYDIS, 0x0Bu)149150/* ---------------------------------------------------------------------------------------------- */151/* Encoder */152/* ---------------------------------------------------------------------------------------------- */153154#define ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION \155ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Cu)156157/* ---------------------------------------------------------------------------------------------- */158159/* ============================================================================================== */160161162#ifdef __cplusplus163}164#endif165166#endif /* ZYDIS_STATUS_H */167168169