/** An instruction set architecture. */ export declare enum Architecture { /** 32 bit Arm architectures (e.g. Armv6 and Armv7) */ ARM = 0, /** 64 bit Arm (e.g. Armv8-A) */ ARM64 = 1, /** Mips */ MIPS = 2, /** x86 related architectures (including x64) */ X86 = 3, /** Power PC */ PPC = 4, /** Sparc */ SPARC = 5, /** System-Z */ SYSZ = 6, /** XCore */ XCORE = 7, M68K = 8, TMS320C64X = 9, M680X = 10, /** Etherium virtual Machine */ EVM = 11, MOS65XX = 12, /** WebAssembly */ WASM = 13, /** Berkely Packet Filter */ BPF = 14, /** Risc-V */ RISCV = 15, /** Tensilica Xtensa */ XTENSA = 16 } /** The mode for the architecture (e.g. Thumb for Arm or Bits64 for X86) */ export declare enum Mode { /** No mode/default */ Default = 0, /** little-endian mode (default mode) */ LittleEndian = 0, /** 32-bit ARM */ Arm = 0, /** 16-bit mode (X86) */ Bits16 = 2, /** 32-bit mode (X86) */ Bits32 = 4, /** 64-bit mode (X86, PPC) */ Bits64 = 8, /** ARM's Thumb mode, including Thumb-2 */ Thumb = 16, /** ARM's Cortex-M series */ MClass = 32, /** ARMv8 A32 encodings for ARM */ V8 = 64, /** MicroMips mode (MIPS) */ Micro = 16, /** Mips III ISA */ MIPS3 = 32, /** Mips32r6 ISA */ MIPS32R6 = 64, /** Mips II ISA */ MIPS2 = 128, /** SparcV9 mode (Sparc) */ V9 = 16, /** Quad Processing eXtensions mode (PPC) */ QPX = 16, /** Signal Processing Engine mode (PPC) */ SPE = 32, /** Book-E mode (PPC) */ BOOKE = 64, /** M68K 68000 mode */ M68K_000 = 2, /** M68K 68010 mode */ M68K_010 = 4, /** M68K 68020 mode */ M68K_020 = 8, /** M68K 68030 mode */ M68K_030 = 16, /** M68K 68040 mode */ M68K_040 = 32, /** M68K 68060 mode */ M68K_060 = 64, /** big-endian mode */ BIG_ENDIAN = -2147483648, /** Mips32 ISA (Mips) */ MIPS32 = 4, /** Mips64 ISA (Mips) */ MIPS64 = 8, /** M680X Hitachi 6301,6303 mode */ M680X_6301 = 2, /** M680X Hitachi 6309 mode */ M680X_6309 = 4, /** M680X Motorola 6800,6802 mode */ M680X_6800 = 8, /** M680X Motorola 6801,6803 mode */ M680X_6801 = 16, /** M680X Motorola/Freescale 6805 mode */ M680X_6805 = 32, /** M680X Motorola/Freescale/NXP 68HC08 mode */ M680X_6808 = 64, /** M680X Motorola 6809 mode */ M680X_6809 = 128, /** M680X Motorola/Freescale/NXP 68HC11 mode */ M680X_6811 = 256, /** M680X Motorola/Freescale/NXP CPU12 */ M680X_CPU12 = 512, /** M680X Freescale/NXP HCS08 mode */ M680X_HCS08 = 1024, /** Classic BPF mode (default) */ BPF_CLASSIC = 0, /** Extended BPF mode */ BPF_EXTENDED = 1, /** RISCV RV32G */ RISCV32 = 1, /** RISCV RV64G */ RISCV64 = 2, /** RISCV compressed instructure mode */ RISCVC = 4, /** MOS65XXX MOS 6502 */ MOS65XX_6502 = 2, /** MOS65XXX WDC 65c02 */ MOS65XX_65C02 = 4, /** MOS65XXX WDC W65c02 */ MOS65XX_W65C02 = 8, /** MOS65XXX WDC 65816, 8-bit m/x */ MOS65XX_65816 = 16, /** MOS65XXX WDC 65816, 16-bit m, 8-bit x */ MOS65XX_65816_LONG_M = 32, /** MOS65XXX WDC 65816, 8-bit m, 16-bit x */ MOS65XX_65816_LONG_X = 64, MOS65XX_65816_LONG_MX = 96 } export declare enum Option { /** No option specified */ INVALID = 0, /** Assembly output syntax */ SYNTAX = 1, /** Break down instruction structure into details */ DETAIL = 2, /** Change engine's mode at run-time */ MODE = 3, /** User-defined dynamic memory related functions */ MEM = 4, /** Skip data when disassembling. Then engine is in SKIPDATA mode. */ SKIPDATA = 5, /** Setup user-defined function for SKIPDATA option */ SKIPDATA_SETUP = 6, /** Customize instruction mnemonic */ MNEMONIC = 7, /** print immediate operands in unsigned form */ UNSIGNED = 8 } export declare enum OptionType { /** Turn OFF an option - default for DETAIL, SKIPDATA, UNSIGNED. */ OFF = 0, /** Turn ON an option (DETAIL, SKIPDATA). */ ON = 3, /** Default asm syntax (SYNTAX). */ SYNTAX_DEFAULT = 0, /** X86 Intel asm syntax - default on X86 (SYNTAX). */ SYNTAX_INTEL = 1, /** X86 ATT asm syntax (SYNTAX). */ SYNTAX_ATT = 2, /** Prints register name with only number (SYNTAX) */ SYNTAX_NOREGNAME = 3, /** X86 Intel Masm syntax (SYNTAX). */ SYNTAX_MASM = 4, /** MOS65XX use $ as hex prefix */ SYNTAX_MOTOROLA = 5 } /** An operand type */ export declare enum OperandType { Invalid = 0, /** A general purpose register. */ Register = 1, /** An immediate constant. */ Immediate = 2, /** A memory location. */ Memory = 3, /** A floating point register. */ FloatingPoint = 4 } /** The type of access on an operand */ export declare enum AccessType { Invalid = 0, /** Read access */ Read = 1, /** Write access */ Write = 2, /** Read and write access */ ReadWrite = 3 } /** An instruction group */ export declare enum InstructionGroupType { Invalid = 0, /** all jump instructions (conditional+direct+indirect jumps) */ Jump = 1, /** all call instructions */ Call = 2, /** all return instructions */ ret = 3, /** all interrupt instructions (int+syscall) */ Int = 4, /** all interrupt return instructions */ Iret = 5, /** all privileged instructions */ Privileged = 6, /** all relative branching instructions */ BranchRelative = 7 } export interface InstructionDetail { /** list of implicit registers read by this insn */ regs_read: number[]; /** list of implicit registers modified by this insn */ regs_write: number[]; /** list of group this instruction belong to */ groups: number[]; } export interface Instruction { /** Instruction ID (basically a numeric ID for the instruction mnemonic) * Find the instruction id in the '[ARCH]_insn' enum in the header file * of corresponding architecture, such as 'arm_insn' in arm.h for ARM, * 'x86_insn' in x86.h for X86, etc... */ id: number; /** Address (EIP) of this instruction */ address: bigint; /** Size of this instruction */ size: number; /** Machine bytes of this instruction */ bytes: Uint8Array; /** Ascii text of instruction mnemonic */ mnemonic: string; /** Ascii text of instruction operands */ operands: string; /** Instruction details. */ detail?: InstructionDetail; } /** An instance for the disassembly of a specific ISA and mode. * Created by calling @see Capstone.createInstance */ export interface CapstoneInstance { /** The architecure this instance disassembles for. */ readonly architecture: Architecture; /** Any mode flags this instance is configured for. */ readonly mode: Mode; /** Disassemble some binary code * @param code The binary code * @param address The address the code starts at. This * is referenced by @see Instruction.address for example. */ disassemble: (code: Uint8Array | DataView | ArrayBuffer, address?: bigint) => Instruction[]; } /** An interface to the capstone disassembly framework. */ export interface Capstone { /** Create a new instance for disassembling a specific ISA * @param architecture The architecture to disassemble for. * @param mode Any specific mode flags for the architecture (e.g 64-bit for x86 or Thumb for Arm). */ createInstance: (architecture: Architecture, mode?: Mode) => CapstoneInstance; }