mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-30 08:50:42 +00:00
104f693c11
* Add auto-sync updater. * Update Capstone core with auto-sync changes. * Update ARM via auto-sync. * Make changes to arch modules which are introduced by auto-sync. * Update tests for ARM. * Fix build warnings for make * Remove meson.build * Print shift amount in decimal * Patch non LLVM register alias. * Change type of immediate operand to unsiged (due to: #771) * Replace all occurances of a register with its alias. * Fix printing of signed imms * Print rotate amount in decimal * CHange imm type to int64_t to match LLVM imm type. * Fix search for register names, by completing string first. * Print ModImm operands always in decimal * Use number format of previous capstone version. * Correct implicit writes and update_flags according to SBit. * Add missing test for RegImmShift * Reverse incorrect comparision. * Set shift information for move instructions. * Set mem access for all memory operands * Set subtracted flag if offset is negative. * Add flag for post-index memory operands. * Add detail op for BX_RET and MOVPCLR * Use instruction post_index operand. * Add VPOP and VPUSH as unique CS IDs. * Add shifting info for MOVsr. * Add TODOs. * Add in LLVM hardcoded operands to detail. * Move detail editing from InstPrinter to Mapping * Formatting * Add removed check. * Add writeback register and constraints to RFEI instructions. * Translate shift immediate * Print negative immediates * Remove duplicate invalid entry * Add CS groups to instructions * Fix write attriutes of stores. * Add missing names of added instructions * Fix LLVM bug * Add more post_index flags * http -> https * Make generated functions static * Remove tab prefix for alias instructions. * Set ValidateMCOperand to NULL. * Fix AddrMode3Operand operands * Allow getting system and banked register name via API * Add writeback to STC/LDC instructions. * Fix (hopefully) last case where disp is negative and subtracted = true * Remove accidentially introduced regressions
85 lines
2.6 KiB
C
85 lines
2.6 KiB
C
/* Capstone Disassembly Engine */
|
|
/* By Rot127 <unisono@quyllur.org>, 2023 */
|
|
|
|
#ifndef CS_MCINSTPRINTER_H
|
|
#define CS_MCINSTPRINTER_H
|
|
|
|
#include "MCInst.h"
|
|
#include <assert.h>
|
|
#include <capstone/platform.h>
|
|
|
|
/// Returned by getMnemonic() of the AsmPrinters.
|
|
typedef struct {
|
|
const char *first; // Menmonic
|
|
uint64_t second; // Bits
|
|
} MnemonicBitsInfo;
|
|
|
|
/// Map from opcode to pattern list by binary search.
|
|
typedef struct {
|
|
uint32_t Opcode;
|
|
uint16_t PatternStart;
|
|
uint16_t NumPatterns;
|
|
} PatternsForOpcode;
|
|
|
|
/// Data for each alias pattern. Includes feature bits, string, number of
|
|
/// operands, and a variadic list of conditions to check.
|
|
typedef struct {
|
|
uint32_t AsmStrOffset;
|
|
uint32_t AliasCondStart;
|
|
uint8_t NumOperands;
|
|
uint8_t NumConds;
|
|
} AliasPattern;
|
|
|
|
typedef enum {
|
|
AliasPatternCond_K_Feature, // Match only if a feature is enabled.
|
|
AliasPatternCond_K_NegFeature, // Match only if a feature is disabled.
|
|
AliasPatternCond_K_OrFeature, // Match only if one of a set of features is
|
|
// enabled.
|
|
AliasPatternCond_K_OrNegFeature, // Match only if one of a set of features
|
|
// is disabled.
|
|
AliasPatternCond_K_EndOrFeatures, // Note end of list of K_Or(Neg)?Features.
|
|
AliasPatternCond_K_Ignore, // Match any operand.
|
|
AliasPatternCond_K_Reg, // Match a specific register.
|
|
AliasPatternCond_K_TiedReg, // Match another already matched register.
|
|
AliasPatternCond_K_Imm, // Match a specific immediate.
|
|
AliasPatternCond_K_RegClass, // Match registers in a class.
|
|
AliasPatternCond_K_Custom, // Call custom matcher by index.
|
|
} AliasPatternCond_CondKind;
|
|
|
|
typedef struct {
|
|
AliasPatternCond_CondKind Kind;
|
|
uint32_t Value;
|
|
} AliasPatternCond;
|
|
|
|
typedef bool (*ValidateMCOperandFunc)(const MCOperand *MCOp, unsigned PredicateIndex);
|
|
|
|
/// Tablegenerated data structures needed to match alias patterns.
|
|
typedef struct {
|
|
const PatternsForOpcode *OpToPatterns;
|
|
const AliasPattern *Patterns;
|
|
const AliasPatternCond *PatternConds;
|
|
const char *AsmStrings;
|
|
const ValidateMCOperandFunc ValidateMCOperand;
|
|
} AliasMatchingData;
|
|
|
|
const char *matchAliasPatterns(MCInst *MI, const AliasMatchingData *M);
|
|
bool getUseMarkup(void);
|
|
const char *markup(const char *s);
|
|
|
|
struct IndexType {
|
|
uint16_t encoding;
|
|
unsigned index;
|
|
};
|
|
|
|
struct IndexTypeStr {
|
|
const char *name;
|
|
unsigned index;
|
|
};
|
|
|
|
// binary search for encoding in IndexType array
|
|
// return -1 if not found, or index if found
|
|
unsigned int binsearch_IndexTypeEncoding(const struct IndexType *index, size_t size, uint16_t encoding);
|
|
unsigned int binsearch_IndexTypeStrEncoding(const struct IndexTypeStr *index, size_t size, const char *name);
|
|
|
|
#endif // CS_MCINSTPRINTER_H
|