diff --git a/arch/TriCore/TriCoreDisassembler.c b/arch/TriCore/TriCoreDisassembler.c index b94b1fc928..dc7e05f57a 100644 --- a/arch/TriCore/TriCoreDisassembler.c +++ b/arch/TriCore/TriCoreDisassembler.c @@ -26,6 +26,8 @@ #include "../../MCDisassembler.h" #include "../../MathExtras.h" +#include "TriCoreDisassembler.h" + static bool readInstruction16(const uint8_t *code, size_t code_len, uint16_t *insn) { diff --git a/arch/TriCore/TriCoreDisassembler.h b/arch/TriCore/TriCoreDisassembler.h index 30bb4d12af..de4f53bf9a 100644 --- a/arch/TriCore/TriCoreDisassembler.h +++ b/arch/TriCore/TriCoreDisassembler.h @@ -18,4 +18,6 @@ bool TriCore_getInstruction(csh ud, const uint8_t *code, size_t code_len, MCInst *instr, uint16_t *size, uint64_t address, void *info); +bool TriCore_getFeatureBits(unsigned int mode, unsigned int feature); + #endif diff --git a/arch/TriCore/TriCoreInstPrinter.c b/arch/TriCore/TriCoreInstPrinter.c index 254b7d073e..7385f33f8a 100644 --- a/arch/TriCore/TriCoreInstPrinter.c +++ b/arch/TriCore/TriCoreInstPrinter.c @@ -514,11 +514,14 @@ typedef struct { uint64_t second; // Bits } MnemonicBitsInfo; -void set_mem_access(MCInst *MI, unsigned int access) +static void set_mem_access(MCInst *MI, unsigned int access) { // TODO: TriCore } +MnemonicBitsInfo getMnemonic(MCInst *MI, SStream *O); +bool printAliasInstr(MCInst *MI, uint64_t Address, SStream *OS); + #define PRINT_ALIAS_INSTR #include "TriCoreGenAsmWriter.inc" diff --git a/arch/TriCore/TriCoreMapping.h b/arch/TriCore/TriCoreMapping.h index 1eac1d3515..57ef507d27 100644 --- a/arch/TriCore/TriCoreMapping.h +++ b/arch/TriCore/TriCoreMapping.h @@ -15,4 +15,7 @@ const char *TriCore_insn_name(csh handle, unsigned int id); const char *TriCore_group_name(csh handle, unsigned int id); +cs_err TRICORE_global_init(cs_struct *ud); +cs_err TRICORE_option(cs_struct *handle, cs_opt_type type, size_t value); + #endif diff --git a/cstool/cstool.c b/cstool/cstool.c index 68e9051563..de1205c845 100644 --- a/cstool/cstool.c +++ b/cstool/cstool.c @@ -7,6 +7,7 @@ #include "getopt.h" #include +#include "cstool.h" void print_string_hex(const char *comment, unsigned char *str, size_t len); @@ -115,25 +116,6 @@ static struct { { NULL } }; -void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins); -void print_insn_detail_arm(csh handle, cs_insn *ins); -void print_insn_detail_arm64(csh handle, cs_insn *ins); -void print_insn_detail_mips(csh handle, cs_insn *ins); -void print_insn_detail_ppc(csh handle, cs_insn *ins); -void print_insn_detail_sparc(csh handle, cs_insn *ins); -void print_insn_detail_sysz(csh handle, cs_insn *ins); -void print_insn_detail_xcore(csh handle, cs_insn *ins); -void print_insn_detail_m68k(csh handle, cs_insn *ins); -void print_insn_detail_tms320c64x(csh handle, cs_insn *ins); -void print_insn_detail_m680x(csh handle, cs_insn *ins); -void print_insn_detail_evm(csh handle, cs_insn *ins); -void print_insn_detail_riscv(csh handle, cs_insn *ins); -void print_insn_detail_wasm(csh handle, cs_insn *ins); -void print_insn_detail_mos65xx(csh handle, cs_insn *ins); -void print_insn_detail_bpf(csh handle, cs_insn *ins); -void print_insn_detail_sh(csh handle, cs_insn *ins); -void print_insn_detail_tricore(csh handle, cs_insn *ins); - static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins); void print_string_hex(const char *comment, unsigned char *str, size_t len) diff --git a/cstool/cstool.h b/cstool/cstool.h new file mode 100644 index 0000000000..118167618e --- /dev/null +++ b/cstool/cstool.h @@ -0,0 +1,23 @@ +#ifndef CAPSTONE_CSTOOL_CSTOOL_H_ +#define CAPSTONE_CSTOOL_CSTOOL_H_ + +void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins); +void print_insn_detail_arm(csh handle, cs_insn *ins); +void print_insn_detail_arm64(csh handle, cs_insn *ins); +void print_insn_detail_mips(csh handle, cs_insn *ins); +void print_insn_detail_ppc(csh handle, cs_insn *ins); +void print_insn_detail_sparc(csh handle, cs_insn *ins); +void print_insn_detail_sysz(csh handle, cs_insn *ins); +void print_insn_detail_xcore(csh handle, cs_insn *ins); +void print_insn_detail_m68k(csh handle, cs_insn *ins); +void print_insn_detail_tms320c64x(csh handle, cs_insn *ins); +void print_insn_detail_m680x(csh handle, cs_insn *ins); +void print_insn_detail_evm(csh handle, cs_insn *ins); +void print_insn_detail_riscv(csh handle, cs_insn *ins); +void print_insn_detail_wasm(csh handle, cs_insn *ins); +void print_insn_detail_mos65xx(csh handle, cs_insn *ins); +void print_insn_detail_bpf(csh handle, cs_insn *ins); +void print_insn_detail_sh(csh handle, cs_insn *ins); +void print_insn_detail_tricore(csh handle, cs_insn *ins); + +#endif //CAPSTONE_CSTOOL_CSTOOL_H_ diff --git a/cstool/cstool_arm.c b/cstool/cstool_arm.c index 26cba3bd05..9ec6b43376 100644 --- a/cstool/cstool_arm.c +++ b/cstool/cstool_arm.c @@ -2,8 +2,7 @@ #include #include - -void print_insn_detail_arm(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_arm(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_arm64.c b/cstool/cstool_arm64.c index 065aa86238..f22328222e 100644 --- a/cstool/cstool_arm64.c +++ b/cstool/cstool_arm64.c @@ -5,8 +5,7 @@ #include #include - -void print_insn_detail_arm64(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_arm64(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_bpf.c b/cstool/cstool_bpf.c index 879f45fef6..a20f0aef5c 100644 --- a/cstool/cstool_bpf.c +++ b/cstool/cstool_bpf.c @@ -2,13 +2,12 @@ #include #include +#include "cstool.h" static const char * ext_name[] = { [BPF_EXT_LEN] = "#len", }; -void print_insn_detail_bpf(csh handle, cs_insn *ins); - void print_insn_detail_bpf(csh handle, cs_insn *ins) { unsigned i; diff --git a/cstool/cstool_evm.c b/cstool/cstool_evm.c index d3ecb5c341..9262eba0c8 100644 --- a/cstool/cstool_evm.c +++ b/cstool/cstool_evm.c @@ -2,8 +2,7 @@ #include #include - -void print_insn_detail_evm(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_evm(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_m680x.c b/cstool/cstool_m680x.c index b1f931a76e..c744b686e1 100644 --- a/cstool/cstool_m680x.c +++ b/cstool/cstool_m680x.c @@ -3,14 +3,12 @@ #include #include - -void print_insn_detail_m680x(csh handle, cs_insn *insn); +#include "cstool.h" static const char *s_access[] = { "UNCHANGED", "READ", "WRITE", "READ | WRITE", }; - static void print_read_write_regs(csh handle, cs_detail *detail) { int i; diff --git a/cstool/cstool_m68k.c b/cstool/cstool_m68k.c index 9d860ea99b..ca884a4169 100644 --- a/cstool/cstool_m68k.c +++ b/cstool/cstool_m68k.c @@ -8,8 +8,7 @@ #include #include - -void print_insn_detail_m68k(csh handle, cs_insn *ins); +#include "cstool.h" static const char* s_addressing_modes[] = { "", diff --git a/cstool/cstool_mips.c b/cstool/cstool_mips.c index df87aeae19..a2d7e35a0d 100644 --- a/cstool/cstool_mips.c +++ b/cstool/cstool_mips.c @@ -5,8 +5,7 @@ #include #include - -void print_insn_detail_mips(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_mips(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_mos65xx.c b/cstool/cstool_mos65xx.c index 316253f6ee..6791fdd01f 100644 --- a/cstool/cstool_mos65xx.c +++ b/cstool/cstool_mos65xx.c @@ -2,9 +2,7 @@ #include #include - -void print_insn_detail_mos65xx(csh handle, cs_insn *ins); - +#include "cstool.h" static const char *get_am_name(mos65xx_address_mode mode) { @@ -65,7 +63,6 @@ static const char *get_am_name(mos65xx_address_mode mode) } } - void print_insn_detail_mos65xx(csh handle, cs_insn *ins) { int i; diff --git a/cstool/cstool_ppc.c b/cstool/cstool_powerpc.c similarity index 97% rename from cstool/cstool_ppc.c rename to cstool/cstool_powerpc.c index 73de772fdf..79d1b55b6f 100644 --- a/cstool/cstool_ppc.c +++ b/cstool/cstool_powerpc.c @@ -4,9 +4,7 @@ #include #include - -void print_insn_detail_ppc(csh handle, cs_insn *ins); - +#include "cstool.h" static const char* get_bc_name(int bc) { diff --git a/cstool/cstool_riscv.c b/cstool/cstool_riscv.c index 2fd5b5be35..fcd60d09a9 100644 --- a/cstool/cstool_riscv.c +++ b/cstool/cstool_riscv.c @@ -3,8 +3,7 @@ #include #include - -void print_insn_detail_riscv(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_riscv(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_sh.c b/cstool/cstool_sh.c index 4440382ed1..5ce604c88b 100644 --- a/cstool/cstool_sh.c +++ b/cstool/cstool_sh.c @@ -6,8 +6,7 @@ #include #include - -void print_insn_detail_sh(csh handle, cs_insn *ins); +#include "cstool.h" static const char* s_addressing_modes[] = { "", diff --git a/cstool/cstool_sparc.c b/cstool/cstool_sparc.c index f3594a5969..0acdf8b706 100644 --- a/cstool/cstool_sparc.c +++ b/cstool/cstool_sparc.c @@ -4,9 +4,7 @@ #include #include - -void print_insn_detail_sparc(csh handle, cs_insn *ins); - +#include "cstool.h" void print_insn_detail_sparc(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_systemz.c b/cstool/cstool_systemz.c index 002f9a80d1..aa3962685a 100644 --- a/cstool/cstool_systemz.c +++ b/cstool/cstool_systemz.c @@ -4,8 +4,7 @@ #include #include - -void print_insn_detail_sysz(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_sysz(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_tms320c64x.c b/cstool/cstool_tms320c64x.c index 7eae894aa8..f0db9a12ae 100644 --- a/cstool/cstool_tms320c64x.c +++ b/cstool/cstool_tms320c64x.c @@ -3,8 +3,7 @@ #include #include - -void print_insn_detail_tms320c64x(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_tms320c64x(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_tricore.c b/cstool/cstool_tricore.c index 45b0f53b20..d5ac10dc6c 100644 --- a/cstool/cstool_tricore.c +++ b/cstool/cstool_tricore.c @@ -2,6 +2,7 @@ #include #include +#include "cstool.h" void print_insn_detail_tricore(csh handle, cs_insn *ins) { @@ -68,4 +69,4 @@ void print_insn_detail_tricore(csh handle, cs_insn *ins) } } } -} \ No newline at end of file +} diff --git a/cstool/cstool_wasm.c b/cstool/cstool_wasm.c index 80bb2b9121..f353d8dfc4 100644 --- a/cstool/cstool_wasm.c +++ b/cstool/cstool_wasm.c @@ -2,8 +2,7 @@ #include #include - -void print_insn_detail_wasm(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_wasm(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_x86.c b/cstool/cstool_x86.c index e504e8a142..bba46d848b 100644 --- a/cstool/cstool_x86.c +++ b/cstool/cstool_x86.c @@ -4,8 +4,7 @@ #include #include - -void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins); +#include "cstool.h" void print_string_hex(const char *comment, unsigned char *str, size_t len); diff --git a/cstool/cstool_xcore.c b/cstool/cstool_xcore.c index 2ab95507a1..cab8be3b41 100644 --- a/cstool/cstool_xcore.c +++ b/cstool/cstool_xcore.c @@ -3,8 +3,7 @@ #include #include - -void print_insn_detail_xcore(csh handle, cs_insn *ins); +#include "cstool.h" void print_insn_detail_xcore(csh handle, cs_insn *ins) {