Squashed 'external/ircolib/' changes from ce3cd726c..de6e324bd
de6e324bdseparate emu thread10d3daf86Roms List improvements95d202f37Let's make the rom list process on a separate thread so the emulator doesnt take ages to load.fc306967fWow the ROM Header was just completely busted. Game list view works nowbad1691eefuck this shit2b59e5f46game list in progressd26417b83remappable inputs in progressac4af8106inpute72abc240update readme430139dc9Qt6 frontend3080d4d45Fix this small bug too08cd13b85Cop0 unused functions do not actually pose a threat (as per manual). They don't do anything, so shall we.61bb4fb44make idle loop detection a little more specific with where the load goesb037de4c3SAZDFsdff12e81e73eneed to figure out why n64-systemtest loops indefinitely at some address that appears to be valid (i think it's me not invalidating the cache properly)204f0e13bidle skipping seems to work!cb8bb634asdkfjlasdf58e5c89c1Fix compilation issue on my machine (no idea)24fb2898eattempting more serious idle skipping214719577Place rsp.Step inside cached interpreter. Gains about 3 more fpsbb97dcc23mmmmm920b77d38wjkhasdfjhkasdf430ccdab4it's a start...4f42a673aCached interpreter plays Mario 64. Start looking into RSP as wellc9a030787idle skipping works!5fbda03cenew idea366637abaIdle skipping... maybe?609fa2fb0Cache instructions implemented but broken lmao. Commented out for nowe140a6d12- Stop using inheritance for CPU, instead use composition. - Introduce KAIZEN_JIT_ENABLED optional define instead of relying on __aarch64__ and the like. - More cache work68e613057prep cache impl811b4d809fix clang formatfda755f7didkd5024ebbfsmall MI refactor in preparation of (eventually) implementing the RDRAM interface properly694b45341Merge commit '206dcdedf195fb320913584180edb12c7731e396' as 'external/SDL'206dcdedfSquashed 'external/SDL/' content from commit 4d17b99d0a4d16e1cb4need to update sdl848b19920Fix compilation errordb61b5299Merge commit 'e94a94559f28e49678fbcf72199a5258137b0fe9' as 'external/imgui'e94a94559Squashed 'external/imgui/' content from commit 02e9b8cac52edb3757need to update imguic1a705e86Emulate weird JALR behaviour4b4c32f4bFix exception for "unusable COP1" in 4 instructions i missed accidentally (again)df5828142Bug putting 0s in the log everywheref8b580048Make isviewer a sink to file8241e9735Fix exception for "unusable COP1" in 4 instructions i missed accidentallyb29715f20small changesd9a620bc1make use of my new small utility library0d1aa938eAdd 'external/ircolib/' from commit 'ce3cd726c8df8388d554abf8bb55d55020eb4450'e64eb40b3Fuck git git-subtree-dir: external/ircolib git-subtree-split:de6e324bde
This commit is contained in:
+1751
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
||||
|
||||
#ifndef CS_TRICOREDISASSEMBLER_H
|
||||
#define CS_TRICOREDISASSEMBLER_H
|
||||
|
||||
#if !defined(_MSC_VER) || !defined(_KERNEL_MODE)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <capstone/capstone.h>
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include "../../MCInst.h"
|
||||
|
||||
void TriCore_init_mri(MCRegisterInfo *MRI);
|
||||
bool TriCore_getFeatureBits(unsigned int mode, unsigned int feature);
|
||||
|
||||
#endif
|
||||
+3784
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
{ TRICORE_FEATURE_HASV110, "HasV110" },
|
||||
{ TRICORE_FEATURE_HASV120, "HasV120" },
|
||||
{ TRICORE_FEATURE_HASV130, "HasV130" },
|
||||
{ TRICORE_FEATURE_HASV131, "HasV131" },
|
||||
{ TRICORE_FEATURE_HASV160, "HasV160" },
|
||||
{ TRICORE_FEATURE_HASV161, "HasV161" },
|
||||
{ TRICORE_FEATURE_HASV162, "HasV162" },
|
||||
{ TRICORE_FEATURE_HASV180, "HasV180" },
|
||||
{ TRICORE_FEATURE_HASV120_UP, "HasV120_UP" },
|
||||
{ TRICORE_FEATURE_HASV130_UP, "HasV130_UP" },
|
||||
{ TRICORE_FEATURE_HASV131_UP, "HasV131_UP" },
|
||||
{ TRICORE_FEATURE_HASV160_UP, "HasV160_UP" },
|
||||
{ TRICORE_FEATURE_HASV161_UP, "HasV161_UP" },
|
||||
{ TRICORE_FEATURE_HASV162_UP, "HasV162_UP" },
|
||||
{ TRICORE_FEATURE_HASV180_UP, "HasV180_UP" },
|
||||
{ TRICORE_FEATURE_HASV120_DN, "HasV120_DN" },
|
||||
{ TRICORE_FEATURE_HASV130_DN, "HasV130_DN" },
|
||||
{ TRICORE_FEATURE_HASV131_DN, "HasV131_DN" },
|
||||
{ TRICORE_FEATURE_HASV160_DN, "HasV160_DN" },
|
||||
{ TRICORE_FEATURE_HASV161_DN, "HasV161_DN" },
|
||||
{ TRICORE_FEATURE_HASV162_DN, "HasV162_DN" },
|
||||
{ TRICORE_FEATURE_HASV180_DN, "HasV180_DN" },
|
||||
+10366
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,440 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
"invalid", // TRICORE_INS_INVALID
|
||||
"absdifs.b", // TRICORE_INS_ABSDIFS_B
|
||||
"absdifs.h", // TRICORE_INS_ABSDIFS_H
|
||||
"absdifs", // TRICORE_INS_ABSDIFS
|
||||
"absdif.b", // TRICORE_INS_ABSDIF_B
|
||||
"absdif.h", // TRICORE_INS_ABSDIF_H
|
||||
"absdif", // TRICORE_INS_ABSDIF
|
||||
"abss.b", // TRICORE_INS_ABSS_B
|
||||
"abss.h", // TRICORE_INS_ABSS_H
|
||||
"abss", // TRICORE_INS_ABSS
|
||||
"abs.b", // TRICORE_INS_ABS_B
|
||||
"abs.df", // TRICORE_INS_ABS_DF
|
||||
"abs.f", // TRICORE_INS_ABS_F
|
||||
"abs.h", // TRICORE_INS_ABS_H
|
||||
"abs", // TRICORE_INS_ABS
|
||||
"addc", // TRICORE_INS_ADDC
|
||||
"addih.a", // TRICORE_INS_ADDIH_A
|
||||
"addih", // TRICORE_INS_ADDIH
|
||||
"addi", // TRICORE_INS_ADDI
|
||||
"addsc.at", // TRICORE_INS_ADDSC_AT
|
||||
"addsc.a", // TRICORE_INS_ADDSC_A
|
||||
"adds.bu", // TRICORE_INS_ADDS_BU
|
||||
"adds.b", // TRICORE_INS_ADDS_B
|
||||
"adds.h", // TRICORE_INS_ADDS_H
|
||||
"adds.hu", // TRICORE_INS_ADDS_HU
|
||||
"adds.u", // TRICORE_INS_ADDS_U
|
||||
"adds", // TRICORE_INS_ADDS
|
||||
"addx", // TRICORE_INS_ADDX
|
||||
"add.a", // TRICORE_INS_ADD_A
|
||||
"add.b", // TRICORE_INS_ADD_B
|
||||
"add.df", // TRICORE_INS_ADD_DF
|
||||
"add.f", // TRICORE_INS_ADD_F
|
||||
"add.h", // TRICORE_INS_ADD_H
|
||||
"add", // TRICORE_INS_ADD
|
||||
"andn.t", // TRICORE_INS_ANDN_T
|
||||
"andn", // TRICORE_INS_ANDN
|
||||
"and.andn.t", // TRICORE_INS_AND_ANDN_T
|
||||
"and.and.t", // TRICORE_INS_AND_AND_T
|
||||
"and.eq", // TRICORE_INS_AND_EQ
|
||||
"and.ge.u", // TRICORE_INS_AND_GE_U
|
||||
"and.ge", // TRICORE_INS_AND_GE
|
||||
"and.lt.u", // TRICORE_INS_AND_LT_U
|
||||
"and.lt", // TRICORE_INS_AND_LT
|
||||
"and.ne", // TRICORE_INS_AND_NE
|
||||
"and.nor.t", // TRICORE_INS_AND_NOR_T
|
||||
"and.or.t", // TRICORE_INS_AND_OR_T
|
||||
"and.t", // TRICORE_INS_AND_T
|
||||
"and", // TRICORE_INS_AND
|
||||
"bisr", // TRICORE_INS_BISR
|
||||
"bmerge", // TRICORE_INS_BMERGE
|
||||
"bsplit", // TRICORE_INS_BSPLIT
|
||||
"cachea.i", // TRICORE_INS_CACHEA_I
|
||||
"cachea.wi", // TRICORE_INS_CACHEA_WI
|
||||
"cachea.w", // TRICORE_INS_CACHEA_W
|
||||
"cachei.i", // TRICORE_INS_CACHEI_I
|
||||
"cachei.wi", // TRICORE_INS_CACHEI_WI
|
||||
"cachei.w", // TRICORE_INS_CACHEI_W
|
||||
"caddn.a", // TRICORE_INS_CADDN_A
|
||||
"caddn", // TRICORE_INS_CADDN
|
||||
"cadd.a", // TRICORE_INS_CADD_A
|
||||
"cadd", // TRICORE_INS_CADD
|
||||
"calla", // TRICORE_INS_CALLA
|
||||
"calli", // TRICORE_INS_CALLI
|
||||
"call", // TRICORE_INS_CALL
|
||||
"clo.b", // TRICORE_INS_CLO_B
|
||||
"clo.h", // TRICORE_INS_CLO_H
|
||||
"clo", // TRICORE_INS_CLO
|
||||
"cls.b", // TRICORE_INS_CLS_B
|
||||
"cls.h", // TRICORE_INS_CLS_H
|
||||
"cls", // TRICORE_INS_CLS
|
||||
"clz.b", // TRICORE_INS_CLZ_B
|
||||
"clz.h", // TRICORE_INS_CLZ_H
|
||||
"clz", // TRICORE_INS_CLZ
|
||||
"cmovn", // TRICORE_INS_CMOVN
|
||||
"cmov", // TRICORE_INS_CMOV
|
||||
"cmpswap.w", // TRICORE_INS_CMPSWAP_W
|
||||
"cmp.df", // TRICORE_INS_CMP_DF
|
||||
"cmp.f", // TRICORE_INS_CMP_F
|
||||
"crc32b.w", // TRICORE_INS_CRC32B_W
|
||||
"crc32l.w", // TRICORE_INS_CRC32L_W
|
||||
"crc32.b", // TRICORE_INS_CRC32_B
|
||||
"crcn", // TRICORE_INS_CRCN
|
||||
"csubn.a", // TRICORE_INS_CSUBN_A
|
||||
"csubn", // TRICORE_INS_CSUBN
|
||||
"csub.a", // TRICORE_INS_CSUB_A
|
||||
"csub", // TRICORE_INS_CSUB
|
||||
"debug", // TRICORE_INS_DEBUG
|
||||
"dextr", // TRICORE_INS_DEXTR
|
||||
"dftof", // TRICORE_INS_DFTOF
|
||||
"dftoin", // TRICORE_INS_DFTOIN
|
||||
"dftoiz", // TRICORE_INS_DFTOIZ
|
||||
"dftoi", // TRICORE_INS_DFTOI
|
||||
"dftolz", // TRICORE_INS_DFTOLZ
|
||||
"dftol", // TRICORE_INS_DFTOL
|
||||
"dftoulz", // TRICORE_INS_DFTOULZ
|
||||
"dftoul", // TRICORE_INS_DFTOUL
|
||||
"dftouz", // TRICORE_INS_DFTOUZ
|
||||
"dftou", // TRICORE_INS_DFTOU
|
||||
"difsc.a", // TRICORE_INS_DIFSC_A
|
||||
"disable", // TRICORE_INS_DISABLE
|
||||
"div64.u", // TRICORE_INS_DIV64_U
|
||||
"div64", // TRICORE_INS_DIV64
|
||||
"div.df", // TRICORE_INS_DIV_DF
|
||||
"div.f", // TRICORE_INS_DIV_F
|
||||
"div.u", // TRICORE_INS_DIV_U
|
||||
"div", // TRICORE_INS_DIV
|
||||
"dsync", // TRICORE_INS_DSYNC
|
||||
"dvadj", // TRICORE_INS_DVADJ
|
||||
"dvinit.bu", // TRICORE_INS_DVINIT_BU
|
||||
"dvinit.b", // TRICORE_INS_DVINIT_B
|
||||
"dvinit.hu", // TRICORE_INS_DVINIT_HU
|
||||
"dvinit.h", // TRICORE_INS_DVINIT_H
|
||||
"dvinit.u", // TRICORE_INS_DVINIT_U
|
||||
"dvinit", // TRICORE_INS_DVINIT
|
||||
"dvstep.u", // TRICORE_INS_DVSTEP_U
|
||||
"dvstep", // TRICORE_INS_DVSTEP
|
||||
"enable", // TRICORE_INS_ENABLE
|
||||
"eqany.b", // TRICORE_INS_EQANY_B
|
||||
"eqany.h", // TRICORE_INS_EQANY_H
|
||||
"eqz.a", // TRICORE_INS_EQZ_A
|
||||
"eq.a", // TRICORE_INS_EQ_A
|
||||
"eq.b", // TRICORE_INS_EQ_B
|
||||
"eq.h", // TRICORE_INS_EQ_H
|
||||
"eq.w", // TRICORE_INS_EQ_W
|
||||
"eq", // TRICORE_INS_EQ
|
||||
"extr.u", // TRICORE_INS_EXTR_U
|
||||
"extr", // TRICORE_INS_EXTR
|
||||
"fcalla", // TRICORE_INS_FCALLA
|
||||
"fcalli", // TRICORE_INS_FCALLI
|
||||
"fcall", // TRICORE_INS_FCALL
|
||||
"fret", // TRICORE_INS_FRET
|
||||
"ftodf", // TRICORE_INS_FTODF
|
||||
"ftohp", // TRICORE_INS_FTOHP
|
||||
"ftoin", // TRICORE_INS_FTOIN
|
||||
"ftoiz", // TRICORE_INS_FTOIZ
|
||||
"ftoi", // TRICORE_INS_FTOI
|
||||
"ftoq31z", // TRICORE_INS_FTOQ31Z
|
||||
"ftoq31", // TRICORE_INS_FTOQ31
|
||||
"ftouz", // TRICORE_INS_FTOUZ
|
||||
"ftou", // TRICORE_INS_FTOU
|
||||
"ge.a", // TRICORE_INS_GE_A
|
||||
"ge.u", // TRICORE_INS_GE_U
|
||||
"ge", // TRICORE_INS_GE
|
||||
"hptof", // TRICORE_INS_HPTOF
|
||||
"imask", // TRICORE_INS_IMASK
|
||||
"insert", // TRICORE_INS_INSERT
|
||||
"insn.t", // TRICORE_INS_INSN_T
|
||||
"ins.t", // TRICORE_INS_INS_T
|
||||
"isync", // TRICORE_INS_ISYNC
|
||||
"itodf", // TRICORE_INS_ITODF
|
||||
"itof", // TRICORE_INS_ITOF
|
||||
"ixmax.u", // TRICORE_INS_IXMAX_U
|
||||
"ixmax", // TRICORE_INS_IXMAX
|
||||
"ixmin.u", // TRICORE_INS_IXMIN_U
|
||||
"ixmin", // TRICORE_INS_IXMIN
|
||||
"ja", // TRICORE_INS_JA
|
||||
"jeq.a", // TRICORE_INS_JEQ_A
|
||||
"jeq", // TRICORE_INS_JEQ
|
||||
"jgez", // TRICORE_INS_JGEZ
|
||||
"jge.u", // TRICORE_INS_JGE_U
|
||||
"jge", // TRICORE_INS_JGE
|
||||
"jgtz", // TRICORE_INS_JGTZ
|
||||
"ji", // TRICORE_INS_JI
|
||||
"jla", // TRICORE_INS_JLA
|
||||
"jlez", // TRICORE_INS_JLEZ
|
||||
"jli", // TRICORE_INS_JLI
|
||||
"jltz", // TRICORE_INS_JLTZ
|
||||
"jlt.u", // TRICORE_INS_JLT_U
|
||||
"jlt", // TRICORE_INS_JLT
|
||||
"jl", // TRICORE_INS_JL
|
||||
"jned", // TRICORE_INS_JNED
|
||||
"jnei", // TRICORE_INS_JNEI
|
||||
"jne.a", // TRICORE_INS_JNE_A
|
||||
"jne", // TRICORE_INS_JNE
|
||||
"jnz.a", // TRICORE_INS_JNZ_A
|
||||
"jnz.t", // TRICORE_INS_JNZ_T
|
||||
"jnz", // TRICORE_INS_JNZ
|
||||
"jz.a", // TRICORE_INS_JZ_A
|
||||
"jz.t", // TRICORE_INS_JZ_T
|
||||
"jz", // TRICORE_INS_JZ
|
||||
"j", // TRICORE_INS_J
|
||||
"ldlcx", // TRICORE_INS_LDLCX
|
||||
"ldmst", // TRICORE_INS_LDMST
|
||||
"lducx", // TRICORE_INS_LDUCX
|
||||
"ld.a", // TRICORE_INS_LD_A
|
||||
"ld.bu", // TRICORE_INS_LD_BU
|
||||
"ld.b", // TRICORE_INS_LD_B
|
||||
"ld.da", // TRICORE_INS_LD_DA
|
||||
"ld.d", // TRICORE_INS_LD_D
|
||||
"ld.hu", // TRICORE_INS_LD_HU
|
||||
"ld.h", // TRICORE_INS_LD_H
|
||||
"ld.q", // TRICORE_INS_LD_Q
|
||||
"ld.w", // TRICORE_INS_LD_W
|
||||
"lea", // TRICORE_INS_LEA
|
||||
"lha", // TRICORE_INS_LHA
|
||||
"loopu", // TRICORE_INS_LOOPU
|
||||
"loop", // TRICORE_INS_LOOP
|
||||
"ltodf", // TRICORE_INS_LTODF
|
||||
"lt.a", // TRICORE_INS_LT_A
|
||||
"lt.b", // TRICORE_INS_LT_B
|
||||
"lt.bu", // TRICORE_INS_LT_BU
|
||||
"lt.h", // TRICORE_INS_LT_H
|
||||
"lt.hu", // TRICORE_INS_LT_HU
|
||||
"lt.u", // TRICORE_INS_LT_U
|
||||
"lt.w", // TRICORE_INS_LT_W
|
||||
"lt.wu", // TRICORE_INS_LT_WU
|
||||
"lt", // TRICORE_INS_LT
|
||||
"maddms.h", // TRICORE_INS_MADDMS_H
|
||||
"maddms.u", // TRICORE_INS_MADDMS_U
|
||||
"maddms", // TRICORE_INS_MADDMS
|
||||
"maddm.h", // TRICORE_INS_MADDM_H
|
||||
"maddm.q", // TRICORE_INS_MADDM_Q
|
||||
"maddm.u", // TRICORE_INS_MADDM_U
|
||||
"maddm", // TRICORE_INS_MADDM
|
||||
"maddrs.h", // TRICORE_INS_MADDRS_H
|
||||
"maddrs.q", // TRICORE_INS_MADDRS_Q
|
||||
"maddr.h", // TRICORE_INS_MADDR_H
|
||||
"maddr.q", // TRICORE_INS_MADDR_Q
|
||||
"maddsums.h", // TRICORE_INS_MADDSUMS_H
|
||||
"maddsum.h", // TRICORE_INS_MADDSUM_H
|
||||
"maddsurs.h", // TRICORE_INS_MADDSURS_H
|
||||
"maddsur.h", // TRICORE_INS_MADDSUR_H
|
||||
"maddsus.h", // TRICORE_INS_MADDSUS_H
|
||||
"maddsu.h", // TRICORE_INS_MADDSU_H
|
||||
"madds.h", // TRICORE_INS_MADDS_H
|
||||
"madds.q", // TRICORE_INS_MADDS_Q
|
||||
"madds.u", // TRICORE_INS_MADDS_U
|
||||
"madds", // TRICORE_INS_MADDS
|
||||
"madd.df", // TRICORE_INS_MADD_DF
|
||||
"madd.f", // TRICORE_INS_MADD_F
|
||||
"madd.h", // TRICORE_INS_MADD_H
|
||||
"madd.q", // TRICORE_INS_MADD_Q
|
||||
"madd.u", // TRICORE_INS_MADD_U
|
||||
"madd", // TRICORE_INS_MADD
|
||||
"max.b", // TRICORE_INS_MAX_B
|
||||
"max.bu", // TRICORE_INS_MAX_BU
|
||||
"max.df", // TRICORE_INS_MAX_DF
|
||||
"max.f", // TRICORE_INS_MAX_F
|
||||
"max.h", // TRICORE_INS_MAX_H
|
||||
"max.hu", // TRICORE_INS_MAX_HU
|
||||
"max.u", // TRICORE_INS_MAX_U
|
||||
"max", // TRICORE_INS_MAX
|
||||
"mfcr", // TRICORE_INS_MFCR
|
||||
"min.b", // TRICORE_INS_MIN_B
|
||||
"min.bu", // TRICORE_INS_MIN_BU
|
||||
"min.df", // TRICORE_INS_MIN_DF
|
||||
"min.f", // TRICORE_INS_MIN_F
|
||||
"min.h", // TRICORE_INS_MIN_H
|
||||
"min.hu", // TRICORE_INS_MIN_HU
|
||||
"min.u", // TRICORE_INS_MIN_U
|
||||
"min", // TRICORE_INS_MIN
|
||||
"movh.a", // TRICORE_INS_MOVH_A
|
||||
"movh", // TRICORE_INS_MOVH
|
||||
"movz.a", // TRICORE_INS_MOVZ_A
|
||||
"mov.aa", // TRICORE_INS_MOV_AA
|
||||
"mov.a", // TRICORE_INS_MOV_A
|
||||
"mov.d", // TRICORE_INS_MOV_D
|
||||
"mov.u", // TRICORE_INS_MOV_U
|
||||
"mov", // TRICORE_INS_MOV
|
||||
"msubadms.h", // TRICORE_INS_MSUBADMS_H
|
||||
"msubadm.h", // TRICORE_INS_MSUBADM_H
|
||||
"msubadrs.h", // TRICORE_INS_MSUBADRS_H
|
||||
"msubadr.h", // TRICORE_INS_MSUBADR_H
|
||||
"msubads.h", // TRICORE_INS_MSUBADS_H
|
||||
"msubad.h", // TRICORE_INS_MSUBAD_H
|
||||
"msubms.h", // TRICORE_INS_MSUBMS_H
|
||||
"msubms.u", // TRICORE_INS_MSUBMS_U
|
||||
"msubms", // TRICORE_INS_MSUBMS
|
||||
"msubm.h", // TRICORE_INS_MSUBM_H
|
||||
"msubm.q", // TRICORE_INS_MSUBM_Q
|
||||
"msubm.u", // TRICORE_INS_MSUBM_U
|
||||
"msubm", // TRICORE_INS_MSUBM
|
||||
"msubrs.h", // TRICORE_INS_MSUBRS_H
|
||||
"msubrs.q", // TRICORE_INS_MSUBRS_Q
|
||||
"msubr.h", // TRICORE_INS_MSUBR_H
|
||||
"msubr.q", // TRICORE_INS_MSUBR_Q
|
||||
"msubs.h", // TRICORE_INS_MSUBS_H
|
||||
"msubs.q", // TRICORE_INS_MSUBS_Q
|
||||
"msubs.u", // TRICORE_INS_MSUBS_U
|
||||
"msubs", // TRICORE_INS_MSUBS
|
||||
"msub.df", // TRICORE_INS_MSUB_DF
|
||||
"msub.f", // TRICORE_INS_MSUB_F
|
||||
"msub.h", // TRICORE_INS_MSUB_H
|
||||
"msub.q", // TRICORE_INS_MSUB_Q
|
||||
"msub.u", // TRICORE_INS_MSUB_U
|
||||
"msub", // TRICORE_INS_MSUB
|
||||
"mtcr", // TRICORE_INS_MTCR
|
||||
"mulms.h", // TRICORE_INS_MULMS_H
|
||||
"mulm.h", // TRICORE_INS_MULM_H
|
||||
"mulm.u", // TRICORE_INS_MULM_U
|
||||
"mulm", // TRICORE_INS_MULM
|
||||
"mulr.h", // TRICORE_INS_MULR_H
|
||||
"mulr.q", // TRICORE_INS_MULR_Q
|
||||
"muls.u", // TRICORE_INS_MULS_U
|
||||
"muls", // TRICORE_INS_MULS
|
||||
"mul.df", // TRICORE_INS_MUL_DF
|
||||
"mul.f", // TRICORE_INS_MUL_F
|
||||
"mul.h", // TRICORE_INS_MUL_H
|
||||
"mul.q", // TRICORE_INS_MUL_Q
|
||||
"mul.u", // TRICORE_INS_MUL_U
|
||||
"mul", // TRICORE_INS_MUL
|
||||
"nand.t", // TRICORE_INS_NAND_T
|
||||
"nand", // TRICORE_INS_NAND
|
||||
"neg.df", // TRICORE_INS_NEG_DF
|
||||
"neg.f", // TRICORE_INS_NEG_F
|
||||
"nez.a", // TRICORE_INS_NEZ_A
|
||||
"ne.a", // TRICORE_INS_NE_A
|
||||
"ne", // TRICORE_INS_NE
|
||||
"nop", // TRICORE_INS_NOP
|
||||
"nor.t", // TRICORE_INS_NOR_T
|
||||
"nor", // TRICORE_INS_NOR
|
||||
"not", // TRICORE_INS_NOT
|
||||
"orn.t", // TRICORE_INS_ORN_T
|
||||
"orn", // TRICORE_INS_ORN
|
||||
"or.andn.t", // TRICORE_INS_OR_ANDN_T
|
||||
"or.and.t", // TRICORE_INS_OR_AND_T
|
||||
"or.eq", // TRICORE_INS_OR_EQ
|
||||
"or.ge.u", // TRICORE_INS_OR_GE_U
|
||||
"or.ge", // TRICORE_INS_OR_GE
|
||||
"or.lt.u", // TRICORE_INS_OR_LT_U
|
||||
"or.lt", // TRICORE_INS_OR_LT
|
||||
"or.ne", // TRICORE_INS_OR_NE
|
||||
"or.nor.t", // TRICORE_INS_OR_NOR_T
|
||||
"or.or.t", // TRICORE_INS_OR_OR_T
|
||||
"or.t", // TRICORE_INS_OR_T
|
||||
"or", // TRICORE_INS_OR
|
||||
"pack", // TRICORE_INS_PACK
|
||||
"parity", // TRICORE_INS_PARITY
|
||||
"popcnt.w", // TRICORE_INS_POPCNT_W
|
||||
"q31tof", // TRICORE_INS_Q31TOF
|
||||
"qseed.df", // TRICORE_INS_QSEED_DF
|
||||
"qseed.f", // TRICORE_INS_QSEED_F
|
||||
"rem64.u", // TRICORE_INS_REM64_U
|
||||
"rem64", // TRICORE_INS_REM64
|
||||
"restore", // TRICORE_INS_RESTORE
|
||||
"ret", // TRICORE_INS_RET
|
||||
"rfe", // TRICORE_INS_RFE
|
||||
"rfm", // TRICORE_INS_RFM
|
||||
"rslcx", // TRICORE_INS_RSLCX
|
||||
"rstv", // TRICORE_INS_RSTV
|
||||
"rsubs.u", // TRICORE_INS_RSUBS_U
|
||||
"rsubs", // TRICORE_INS_RSUBS
|
||||
"rsub", // TRICORE_INS_RSUB
|
||||
"sat.bu", // TRICORE_INS_SAT_BU
|
||||
"sat.b", // TRICORE_INS_SAT_B
|
||||
"sat.hu", // TRICORE_INS_SAT_HU
|
||||
"sat.h", // TRICORE_INS_SAT_H
|
||||
"seln.a", // TRICORE_INS_SELN_A
|
||||
"seln", // TRICORE_INS_SELN
|
||||
"sel.a", // TRICORE_INS_SEL_A
|
||||
"sel", // TRICORE_INS_SEL
|
||||
"shas", // TRICORE_INS_SHAS
|
||||
"sha.b", // TRICORE_INS_SHA_B
|
||||
"sha.h", // TRICORE_INS_SHA_H
|
||||
"sha", // TRICORE_INS_SHA
|
||||
"shuffle", // TRICORE_INS_SHUFFLE
|
||||
"sh.andn.t", // TRICORE_INS_SH_ANDN_T
|
||||
"sh.and.t", // TRICORE_INS_SH_AND_T
|
||||
"sh.b", // TRICORE_INS_SH_B
|
||||
"sh.eq", // TRICORE_INS_SH_EQ
|
||||
"sh.ge.u", // TRICORE_INS_SH_GE_U
|
||||
"sh.ge", // TRICORE_INS_SH_GE
|
||||
"sh.h", // TRICORE_INS_SH_H
|
||||
"sh.lt.u", // TRICORE_INS_SH_LT_U
|
||||
"sh.lt", // TRICORE_INS_SH_LT
|
||||
"sh.nand.t", // TRICORE_INS_SH_NAND_T
|
||||
"sh.ne", // TRICORE_INS_SH_NE
|
||||
"sh.nor.t", // TRICORE_INS_SH_NOR_T
|
||||
"sh.orn.t", // TRICORE_INS_SH_ORN_T
|
||||
"sh.or.t", // TRICORE_INS_SH_OR_T
|
||||
"sh.xnor.t", // TRICORE_INS_SH_XNOR_T
|
||||
"sh.xor.t", // TRICORE_INS_SH_XOR_T
|
||||
"sh", // TRICORE_INS_SH
|
||||
"stlcx", // TRICORE_INS_STLCX
|
||||
"stucx", // TRICORE_INS_STUCX
|
||||
"st.a", // TRICORE_INS_ST_A
|
||||
"st.b", // TRICORE_INS_ST_B
|
||||
"st.da", // TRICORE_INS_ST_DA
|
||||
"st.d", // TRICORE_INS_ST_D
|
||||
"st.h", // TRICORE_INS_ST_H
|
||||
"st.q", // TRICORE_INS_ST_Q
|
||||
"st.t", // TRICORE_INS_ST_T
|
||||
"st.w", // TRICORE_INS_ST_W
|
||||
"subc", // TRICORE_INS_SUBC
|
||||
"subsc.a", // TRICORE_INS_SUBSC_A
|
||||
"subs.bu", // TRICORE_INS_SUBS_BU
|
||||
"subs.b", // TRICORE_INS_SUBS_B
|
||||
"subs.hu", // TRICORE_INS_SUBS_HU
|
||||
"subs.h", // TRICORE_INS_SUBS_H
|
||||
"subs.u", // TRICORE_INS_SUBS_U
|
||||
"subs", // TRICORE_INS_SUBS
|
||||
"subx", // TRICORE_INS_SUBX
|
||||
"sub.a", // TRICORE_INS_SUB_A
|
||||
"sub.b", // TRICORE_INS_SUB_B
|
||||
"sub.df", // TRICORE_INS_SUB_DF
|
||||
"sub.f", // TRICORE_INS_SUB_F
|
||||
"sub.h", // TRICORE_INS_SUB_H
|
||||
"sub", // TRICORE_INS_SUB
|
||||
"svlcx", // TRICORE_INS_SVLCX
|
||||
"swapmsk.w", // TRICORE_INS_SWAPMSK_W
|
||||
"swap.a", // TRICORE_INS_SWAP_A
|
||||
"swap.w", // TRICORE_INS_SWAP_W
|
||||
"syscall", // TRICORE_INS_SYSCALL
|
||||
"tlbdemap", // TRICORE_INS_TLBDEMAP
|
||||
"tlbflush.a", // TRICORE_INS_TLBFLUSH_A
|
||||
"tlbflush.b", // TRICORE_INS_TLBFLUSH_B
|
||||
"tlbmap", // TRICORE_INS_TLBMAP
|
||||
"tlbprobe.a", // TRICORE_INS_TLBPROBE_A
|
||||
"tlbprobe.i", // TRICORE_INS_TLBPROBE_I
|
||||
"trapsv", // TRICORE_INS_TRAPSV
|
||||
"trapv", // TRICORE_INS_TRAPV
|
||||
"ultodf", // TRICORE_INS_ULTODF
|
||||
"unpack", // TRICORE_INS_UNPACK
|
||||
"updfl", // TRICORE_INS_UPDFL
|
||||
"utodf", // TRICORE_INS_UTODF
|
||||
"utof", // TRICORE_INS_UTOF
|
||||
"wait", // TRICORE_INS_WAIT
|
||||
"xnor.t", // TRICORE_INS_XNOR_T
|
||||
"xnor", // TRICORE_INS_XNOR
|
||||
"xor.eq", // TRICORE_INS_XOR_EQ
|
||||
"xor.ge.u", // TRICORE_INS_XOR_GE_U
|
||||
"xor.ge", // TRICORE_INS_XOR_GE
|
||||
"xor.lt.u", // TRICORE_INS_XOR_LT_U
|
||||
"xor.lt", // TRICORE_INS_XOR_LT
|
||||
"xor.ne", // TRICORE_INS_XOR_NE
|
||||
"xor.t", // TRICORE_INS_XOR_T
|
||||
"xor", // TRICORE_INS_XOR
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
TriCore_OP_GROUP_Operand = 0,
|
||||
TriCore_OP_GROUP_SExtImm_9 = 1,
|
||||
TriCore_OP_GROUP_ZExtImm_16 = 2,
|
||||
TriCore_OP_GROUP_SExtImm_16 = 3,
|
||||
TriCore_OP_GROUP_ZExtImm_2 = 4,
|
||||
TriCore_OP_GROUP_SExtImm_4 = 5,
|
||||
TriCore_OP_GROUP_ZExtImm_4 = 6,
|
||||
TriCore_OP_GROUP_ZExtImm_8 = 7,
|
||||
TriCore_OP_GROUP_SExtImm_10 = 8,
|
||||
TriCore_OP_GROUP_Disp24Imm = 9,
|
||||
TriCore_OP_GROUP_Disp8Imm = 10,
|
||||
TriCore_OP_GROUP_Disp15Imm = 11,
|
||||
TriCore_OP_GROUP_Disp4Imm = 12,
|
||||
TriCore_OP_GROUP_Off18Imm = 13,
|
||||
TriCore_OP_GROUP_OExtImm_4 = 14,
|
||||
TriCore_OP_GROUP_ZExtImm_9 = 15,
|
||||
File diff suppressed because it is too large
Load Diff
+2832
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,354 @@
|
||||
#ifdef GET_REGINFO_ENUM
|
||||
#undef GET_REGINFO_ENUM
|
||||
|
||||
enum {
|
||||
TriCore_NoRegister,
|
||||
TriCore_FCX = 1,
|
||||
TriCore_PC = 2,
|
||||
TriCore_PCXI = 3,
|
||||
TriCore_PSW = 4,
|
||||
TriCore_A0 = 5,
|
||||
TriCore_A1 = 6,
|
||||
TriCore_A2 = 7,
|
||||
TriCore_A3 = 8,
|
||||
TriCore_A4 = 9,
|
||||
TriCore_A5 = 10,
|
||||
TriCore_A6 = 11,
|
||||
TriCore_A7 = 12,
|
||||
TriCore_A8 = 13,
|
||||
TriCore_A9 = 14,
|
||||
TriCore_A10 = 15,
|
||||
TriCore_A11 = 16,
|
||||
TriCore_A12 = 17,
|
||||
TriCore_A13 = 18,
|
||||
TriCore_A14 = 19,
|
||||
TriCore_A15 = 20,
|
||||
TriCore_D0 = 21,
|
||||
TriCore_D1 = 22,
|
||||
TriCore_D2 = 23,
|
||||
TriCore_D3 = 24,
|
||||
TriCore_D4 = 25,
|
||||
TriCore_D5 = 26,
|
||||
TriCore_D6 = 27,
|
||||
TriCore_D7 = 28,
|
||||
TriCore_D8 = 29,
|
||||
TriCore_D9 = 30,
|
||||
TriCore_D10 = 31,
|
||||
TriCore_D11 = 32,
|
||||
TriCore_D12 = 33,
|
||||
TriCore_D13 = 34,
|
||||
TriCore_D14 = 35,
|
||||
TriCore_D15 = 36,
|
||||
TriCore_E0 = 37,
|
||||
TriCore_E2 = 38,
|
||||
TriCore_E4 = 39,
|
||||
TriCore_E6 = 40,
|
||||
TriCore_E8 = 41,
|
||||
TriCore_E10 = 42,
|
||||
TriCore_E12 = 43,
|
||||
TriCore_E14 = 44,
|
||||
TriCore_P0 = 45,
|
||||
TriCore_P2 = 46,
|
||||
TriCore_P4 = 47,
|
||||
TriCore_P6 = 48,
|
||||
TriCore_P8 = 49,
|
||||
TriCore_P10 = 50,
|
||||
TriCore_P12 = 51,
|
||||
TriCore_P14 = 52,
|
||||
TriCore_A0_A1 = 53,
|
||||
TriCore_A2_A3 = 54,
|
||||
TriCore_A4_A5 = 55,
|
||||
TriCore_A6_A7 = 56,
|
||||
TriCore_A8_A9 = 57,
|
||||
TriCore_A10_A11 = 58,
|
||||
TriCore_A12_A13 = 59,
|
||||
TriCore_A14_A15 = 60,
|
||||
NUM_TARGET_REGS // 61
|
||||
};
|
||||
|
||||
// Register classes
|
||||
|
||||
enum {
|
||||
TriCore_RARegClassID = 0,
|
||||
TriCore_RDRegClassID = 1,
|
||||
TriCore_PSRegsRegClassID = 2,
|
||||
TriCore_PairAddrRegsRegClassID = 3,
|
||||
TriCore_RERegClassID = 4,
|
||||
TriCore_RPRegClassID = 5,
|
||||
|
||||
};
|
||||
|
||||
// Subregister indices
|
||||
|
||||
enum {
|
||||
TriCore_NoSubRegister,
|
||||
TriCore_subreg_even, // 1
|
||||
TriCore_subreg_odd, // 2
|
||||
TriCore_NUM_TARGET_SUBREGS
|
||||
};
|
||||
#endif // GET_REGINFO_ENUM
|
||||
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
#ifdef GET_REGINFO_MC_DESC
|
||||
#undef GET_REGINFO_MC_DESC
|
||||
|
||||
static const MCPhysReg TriCoreRegDiffLists[] = {
|
||||
/* 0 */ -48, 1, 0,
|
||||
/* 3 */ -47, 1, 0,
|
||||
/* 6 */ -46, 1, 0,
|
||||
/* 9 */ -45, 1, 0,
|
||||
/* 12 */ -44, 1, 0,
|
||||
/* 15 */ -43, 1, 0,
|
||||
/* 18 */ -42, 1, 0,
|
||||
/* 21 */ -41, 1, 0,
|
||||
/* 24 */ -40, 1, 0,
|
||||
/* 27 */ -39, 1, 0,
|
||||
/* 30 */ -38, 1, 0,
|
||||
/* 33 */ -37, 1, 0,
|
||||
/* 36 */ -36, 1, 0,
|
||||
/* 39 */ -35, 1, 0,
|
||||
/* 42 */ -34, 1, 0,
|
||||
/* 45 */ -33, 1, 0,
|
||||
/* 48 */ -16, 1, 0,
|
||||
/* 51 */ -15, 1, 0,
|
||||
/* 54 */ -14, 1, 0,
|
||||
/* 57 */ -13, 1, 0,
|
||||
/* 60 */ -12, 1, 0,
|
||||
/* 63 */ -11, 1, 0,
|
||||
/* 66 */ -10, 1, 0,
|
||||
/* 69 */ -9, 1, 0,
|
||||
/* 72 */ 32, 8, 0,
|
||||
/* 75 */ 33, 8, 0,
|
||||
/* 78 */ 34, 8, 0,
|
||||
/* 81 */ 35, 8, 0,
|
||||
/* 84 */ 36, 8, 0,
|
||||
/* 87 */ 37, 8, 0,
|
||||
/* 90 */ 38, 8, 0,
|
||||
/* 93 */ 39, 8, 0,
|
||||
/* 96 */ 40, 8, 0,
|
||||
/* 99 */ 9, 0,
|
||||
/* 101 */ 10, 0,
|
||||
/* 103 */ 11, 0,
|
||||
/* 105 */ 12, 0,
|
||||
/* 107 */ 13, 0,
|
||||
/* 109 */ 14, 0,
|
||||
/* 111 */ 15, 0,
|
||||
/* 113 */ 16, 0,
|
||||
};
|
||||
|
||||
static const uint16_t TriCoreSubRegIdxLists[] = {
|
||||
/* 0 */ 1, 2, 0,
|
||||
};
|
||||
|
||||
static const MCRegisterDesc TriCoreRegDesc[] = { // Descriptors
|
||||
{ 3, 0, 0, 0, 0, 0 },
|
||||
{ 201, 2, 2, 2, 8192, 3 },
|
||||
{ 189, 2, 2, 2, 8193, 3 },
|
||||
{ 192, 2, 2, 2, 8194, 3 },
|
||||
{ 197, 2, 2, 2, 8195, 3 },
|
||||
{ 16, 2, 96, 2, 8196, 3 },
|
||||
{ 43, 2, 93, 2, 8197, 3 },
|
||||
{ 65, 2, 93, 2, 8198, 3 },
|
||||
{ 92, 2, 90, 2, 8199, 3 },
|
||||
{ 114, 2, 90, 2, 8200, 3 },
|
||||
{ 141, 2, 87, 2, 8201, 3 },
|
||||
{ 147, 2, 87, 2, 8202, 3 },
|
||||
{ 162, 2, 84, 2, 8203, 3 },
|
||||
{ 168, 2, 84, 2, 8204, 3 },
|
||||
{ 183, 2, 81, 2, 8205, 3 },
|
||||
{ 0, 2, 81, 2, 8206, 3 },
|
||||
{ 32, 2, 78, 2, 8207, 3 },
|
||||
{ 49, 2, 78, 2, 8208, 3 },
|
||||
{ 81, 2, 75, 2, 8209, 3 },
|
||||
{ 98, 2, 75, 2, 8210, 3 },
|
||||
{ 130, 2, 72, 2, 8211, 3 },
|
||||
{ 19, 2, 113, 2, 8212, 3 },
|
||||
{ 46, 2, 111, 2, 8213, 3 },
|
||||
{ 68, 2, 111, 2, 8214, 3 },
|
||||
{ 95, 2, 109, 2, 8215, 3 },
|
||||
{ 117, 2, 109, 2, 8216, 3 },
|
||||
{ 144, 2, 107, 2, 8217, 3 },
|
||||
{ 150, 2, 107, 2, 8218, 3 },
|
||||
{ 165, 2, 105, 2, 8219, 3 },
|
||||
{ 171, 2, 105, 2, 8220, 3 },
|
||||
{ 186, 2, 103, 2, 8221, 3 },
|
||||
{ 4, 2, 103, 2, 8222, 3 },
|
||||
{ 36, 2, 101, 2, 8223, 3 },
|
||||
{ 53, 2, 101, 2, 8224, 3 },
|
||||
{ 85, 2, 99, 2, 8225, 3 },
|
||||
{ 102, 2, 99, 2, 8226, 3 },
|
||||
{ 134, 2, 73, 2, 8227, 3 },
|
||||
{ 22, 48, 2, 0, 4116, 0 },
|
||||
{ 71, 51, 2, 0, 4118, 0 },
|
||||
{ 120, 54, 2, 0, 4120, 0 },
|
||||
{ 153, 57, 2, 0, 4122, 0 },
|
||||
{ 174, 60, 2, 0, 4124, 0 },
|
||||
{ 8, 63, 2, 0, 4126, 0 },
|
||||
{ 57, 66, 2, 0, 4128, 0 },
|
||||
{ 106, 69, 2, 0, 4130, 0 },
|
||||
{ 25, 24, 2, 0, 4100, 0 },
|
||||
{ 74, 27, 2, 0, 4102, 0 },
|
||||
{ 123, 30, 2, 0, 4104, 0 },
|
||||
{ 156, 33, 2, 0, 4106, 0 },
|
||||
{ 177, 36, 2, 0, 4108, 0 },
|
||||
{ 12, 39, 2, 0, 4110, 0 },
|
||||
{ 61, 42, 2, 0, 4112, 0 },
|
||||
{ 110, 45, 2, 0, 4114, 0 },
|
||||
{ 40, 0, 2, 0, 4100, 0 },
|
||||
{ 89, 3, 2, 0, 4102, 0 },
|
||||
{ 138, 6, 2, 0, 4104, 0 },
|
||||
{ 159, 9, 2, 0, 4106, 0 },
|
||||
{ 180, 12, 2, 0, 4108, 0 },
|
||||
{ 28, 15, 2, 0, 4110, 0 },
|
||||
{ 77, 18, 2, 0, 4112, 0 },
|
||||
{ 126, 21, 2, 0, 4114, 0 },
|
||||
};
|
||||
|
||||
// RA Register Class...
|
||||
static const MCPhysReg RA[] = {
|
||||
TriCore_A0, TriCore_A1, TriCore_A2, TriCore_A3, TriCore_A4, TriCore_A5, TriCore_A6, TriCore_A7, TriCore_A8, TriCore_A9, TriCore_A10, TriCore_A11, TriCore_A12, TriCore_A13, TriCore_A14, TriCore_A15,
|
||||
};
|
||||
|
||||
// RA Bit set.
|
||||
static const uint8_t RABits[] = {
|
||||
0xe0, 0xff, 0x1f,
|
||||
};
|
||||
|
||||
// RD Register Class...
|
||||
static const MCPhysReg RD[] = {
|
||||
TriCore_D0, TriCore_D1, TriCore_D2, TriCore_D3, TriCore_D4, TriCore_D5, TriCore_D6, TriCore_D7, TriCore_D8, TriCore_D9, TriCore_D10, TriCore_D11, TriCore_D12, TriCore_D13, TriCore_D14, TriCore_D15,
|
||||
};
|
||||
|
||||
// RD Bit set.
|
||||
static const uint8_t RDBits[] = {
|
||||
0x00, 0x00, 0xe0, 0xff, 0x1f,
|
||||
};
|
||||
|
||||
// PSRegs Register Class...
|
||||
static const MCPhysReg PSRegs[] = {
|
||||
TriCore_PSW, TriCore_PCXI, TriCore_PC, TriCore_FCX,
|
||||
};
|
||||
|
||||
// PSRegs Bit set.
|
||||
static const uint8_t PSRegsBits[] = {
|
||||
0x1e,
|
||||
};
|
||||
|
||||
// PairAddrRegs Register Class...
|
||||
static const MCPhysReg PairAddrRegs[] = {
|
||||
TriCore_A0_A1, TriCore_A2_A3, TriCore_A4_A5, TriCore_A6_A7, TriCore_A8_A9, TriCore_A10_A11, TriCore_A12_A13, TriCore_A14_A15,
|
||||
};
|
||||
|
||||
// PairAddrRegs Bit set.
|
||||
static const uint8_t PairAddrRegsBits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f,
|
||||
};
|
||||
|
||||
// RE Register Class...
|
||||
static const MCPhysReg RE[] = {
|
||||
TriCore_E0, TriCore_E2, TriCore_E4, TriCore_E6, TriCore_E8, TriCore_E10, TriCore_E12, TriCore_E14,
|
||||
};
|
||||
|
||||
// RE Bit set.
|
||||
static const uint8_t REBits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f,
|
||||
};
|
||||
|
||||
// RP Register Class...
|
||||
static const MCPhysReg RP[] = {
|
||||
TriCore_P0, TriCore_P2, TriCore_P4, TriCore_P6, TriCore_P8, TriCore_P10, TriCore_P12, TriCore_P14,
|
||||
};
|
||||
|
||||
// RP Bit set.
|
||||
static const uint8_t RPBits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f,
|
||||
};
|
||||
|
||||
static const MCRegisterClass TriCoreMCRegisterClasses[] = {
|
||||
{ RA, RABits, sizeof(RABits) },
|
||||
{ RD, RDBits, sizeof(RDBits) },
|
||||
{ PSRegs, PSRegsBits, sizeof(PSRegsBits) },
|
||||
{ PairAddrRegs, PairAddrRegsBits, sizeof(PairAddrRegsBits) },
|
||||
{ RE, REBits, sizeof(REBits) },
|
||||
{ RP, RPBits, sizeof(RPBits) },
|
||||
};
|
||||
|
||||
static const uint16_t TriCoreRegEncodingTable[] = {
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
10,
|
||||
12,
|
||||
14,
|
||||
};
|
||||
#endif // GET_REGINFO_MC_DESC
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
#ifdef GET_SUBTARGETINFO_ENUM
|
||||
#undef GET_SUBTARGETINFO_ENUM
|
||||
|
||||
enum {
|
||||
TriCore_HasV110Ops = 0,
|
||||
TriCore_HasV120Ops = 1,
|
||||
TriCore_HasV130Ops = 2,
|
||||
TriCore_HasV131Ops = 3,
|
||||
TriCore_HasV160Ops = 4,
|
||||
TriCore_HasV161Ops = 5,
|
||||
TriCore_HasV162Ops = 6,
|
||||
TriCore_HasV180Ops = 7,
|
||||
TriCore_TRICORE_PCP = 8,
|
||||
TriCore_TRICORE_PCP2 = 9,
|
||||
TriCore_TRICORE_RIDER_A = 10,
|
||||
TriCore_TRICORE_V1_1 = 11,
|
||||
TriCore_TRICORE_V1_2 = 12,
|
||||
TriCore_TRICORE_V1_3 = 13,
|
||||
TriCore_TRICORE_V1_3_1 = 14,
|
||||
TriCore_TRICORE_V1_6 = 15,
|
||||
TriCore_TRICORE_V1_6_1 = 16,
|
||||
TriCore_TRICORE_V1_6_2 = 17,
|
||||
TriCore_TRICORE_V1_8_0 = 18,
|
||||
TriCore_NumSubtargetFeatures = 19
|
||||
};
|
||||
#endif // GET_SUBTARGETINFO_ENUM
|
||||
|
||||
|
||||
|
||||
+482
@@ -0,0 +1,482 @@
|
||||
//===- TriCoreInstPrinter.cpp - Convert TriCore MCInst to assembly syntax -===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class prints an TriCore MCInst to a .s file.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
||||
|
||||
#ifdef CAPSTONE_HAS_TRICORE
|
||||
|
||||
#include <platform.h>
|
||||
|
||||
#include "../../MCInst.h"
|
||||
#include "../../Mapping.h"
|
||||
#include "../../MathExtras.h"
|
||||
|
||||
#include "TriCoreMapping.h"
|
||||
#include "TriCoreLinkage.h"
|
||||
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
|
||||
static void printInstruction(MCInst *, uint64_t, SStream *);
|
||||
|
||||
static void printOperand(MCInst *MI, int OpNum, SStream *O);
|
||||
|
||||
#define GET_INSTRINFO_ENUM
|
||||
|
||||
#include "TriCoreGenInstrInfo.inc"
|
||||
|
||||
#define GET_REGINFO_ENUM
|
||||
|
||||
#include "TriCoreGenRegisterInfo.inc"
|
||||
|
||||
static uint32_t wrapping_u32(int64_t x)
|
||||
{
|
||||
x %= (int64_t)(UINT32_MAX);
|
||||
return (uint32_t)x;
|
||||
}
|
||||
|
||||
static bool fill_mem(MCInst *MI, unsigned int reg, int64_t disp);
|
||||
|
||||
static inline void set_mem(cs_tricore_op *op, uint8_t base, int64_t disp)
|
||||
{
|
||||
op->type |= TRICORE_OP_MEM;
|
||||
op->mem.base = base;
|
||||
op->mem.disp = disp;
|
||||
}
|
||||
|
||||
static inline void fill_reg(MCInst *MI, uint32_t reg)
|
||||
{
|
||||
if (!detail_is_set(MI))
|
||||
return;
|
||||
cs_tricore_op *op = TriCore_get_detail_op(MI, 0);
|
||||
op->type = TRICORE_OP_REG;
|
||||
op->reg = reg;
|
||||
TriCore_inc_op_count(MI);
|
||||
}
|
||||
|
||||
static inline void fill_imm(MCInst *MI, int64_t imm)
|
||||
{
|
||||
if (!detail_is_set(MI))
|
||||
return;
|
||||
cs_tricore *tricore = TriCore_get_detail(MI);
|
||||
if (tricore->op_count >= 1) {
|
||||
cs_tricore_op *op = TriCore_get_detail_op(MI, -1);
|
||||
if (op->type == TRICORE_OP_REG && fill_mem(MI, op->reg, imm))
|
||||
return;
|
||||
}
|
||||
|
||||
cs_tricore_op *op = TriCore_get_detail_op(MI, 0);
|
||||
op->type = TRICORE_OP_IMM;
|
||||
op->imm = imm;
|
||||
tricore->op_count++;
|
||||
}
|
||||
|
||||
static bool fill_mem(MCInst *MI, unsigned int reg, int64_t disp)
|
||||
{
|
||||
if (!detail_is_set(MI))
|
||||
return false;
|
||||
switch (MI->flat_insn->id) {
|
||||
case TRICORE_INS_LDMST:
|
||||
case TRICORE_INS_LDLCX:
|
||||
case TRICORE_INS_LD_A:
|
||||
case TRICORE_INS_LD_B:
|
||||
case TRICORE_INS_LD_BU:
|
||||
case TRICORE_INS_LD_H:
|
||||
case TRICORE_INS_LD_HU:
|
||||
case TRICORE_INS_LD_D:
|
||||
case TRICORE_INS_LD_DA:
|
||||
case TRICORE_INS_LD_W:
|
||||
case TRICORE_INS_LD_Q:
|
||||
case TRICORE_INS_STLCX:
|
||||
case TRICORE_INS_STUCX:
|
||||
case TRICORE_INS_ST_A:
|
||||
case TRICORE_INS_ST_B:
|
||||
case TRICORE_INS_ST_H:
|
||||
case TRICORE_INS_ST_D:
|
||||
case TRICORE_INS_ST_DA:
|
||||
case TRICORE_INS_ST_W:
|
||||
case TRICORE_INS_ST_Q:
|
||||
case TRICORE_INS_CACHEI_I:
|
||||
case TRICORE_INS_CACHEI_W:
|
||||
case TRICORE_INS_CACHEI_WI:
|
||||
case TRICORE_INS_CACHEA_I:
|
||||
case TRICORE_INS_CACHEA_W:
|
||||
case TRICORE_INS_CACHEA_WI:
|
||||
case TRICORE_INS_CMPSWAP_W:
|
||||
case TRICORE_INS_SWAP_A:
|
||||
case TRICORE_INS_SWAP_W:
|
||||
case TRICORE_INS_SWAPMSK_W:
|
||||
case TRICORE_INS_LEA:
|
||||
case TRICORE_INS_LHA: {
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_LDMST_abs:
|
||||
case TriCore_LDLCX_abs:
|
||||
case TriCore_LD_A_abs:
|
||||
case TriCore_LD_B_abs:
|
||||
case TriCore_LD_BU_abs:
|
||||
case TriCore_LD_H_abs:
|
||||
case TriCore_LD_HU_abs:
|
||||
case TriCore_LD_D_abs:
|
||||
case TriCore_LD_DA_abs:
|
||||
case TriCore_LD_W_abs:
|
||||
case TriCore_LD_Q_abs:
|
||||
case TriCore_STLCX_abs:
|
||||
case TriCore_STUCX_abs:
|
||||
case TriCore_ST_A_abs:
|
||||
case TriCore_ST_B_abs:
|
||||
case TriCore_ST_H_abs:
|
||||
case TriCore_ST_D_abs:
|
||||
case TriCore_ST_DA_abs:
|
||||
case TriCore_ST_W_abs:
|
||||
case TriCore_ST_Q_abs:
|
||||
case TriCore_SWAP_A_abs:
|
||||
case TriCore_SWAP_W_abs:
|
||||
case TriCore_LEA_abs:
|
||||
case TriCore_LHA_abs: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
cs_tricore_op *op = TriCore_get_detail_op(MI, -1);
|
||||
op->type = 0;
|
||||
set_mem(op, reg, disp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void printOperand(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
if (OpNum >= MI->size)
|
||||
return;
|
||||
|
||||
MCOperand *Op = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isReg(Op)) {
|
||||
unsigned reg = MCOperand_getReg(Op);
|
||||
SStream_concat0(O, getRegisterName(reg));
|
||||
fill_reg(MI, reg);
|
||||
} else if (MCOperand_isImm(Op)) {
|
||||
int64_t Imm = MCOperand_getImm(Op);
|
||||
printUInt32Bang(O, wrapping_u32(Imm));
|
||||
fill_imm(MI, Imm);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_sign_ext(MCInst *MI, int OpNum, SStream *O, unsigned n)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t imm = MCOperand_getImm(MO);
|
||||
int32_t res = SignExtend32(wrapping_u32(imm), n);
|
||||
printInt32Bang(O, res);
|
||||
fill_imm(MI, res);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
static void off4_fixup(MCInst *MI, int64_t *off4)
|
||||
{
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_LD_A_slro:
|
||||
case TriCore_LD_A_sro:
|
||||
case TriCore_LD_W_slro:
|
||||
case TriCore_LD_W_sro:
|
||||
case TriCore_ST_A_sro:
|
||||
case TriCore_ST_A_ssro:
|
||||
case TriCore_ST_W_sro:
|
||||
case TriCore_ST_W_ssro: {
|
||||
*off4 = *off4 * 4;
|
||||
break;
|
||||
}
|
||||
case TriCore_LD_H_sro:
|
||||
case TriCore_LD_H_slro:
|
||||
case TriCore_ST_H_sro:
|
||||
case TriCore_ST_H_ssro: {
|
||||
*off4 = *off4 * 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void const8_fixup(MCInst *MI, int64_t *const8)
|
||||
{
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_LD_A_sc:
|
||||
case TriCore_ST_A_sc:
|
||||
case TriCore_ST_W_sc:
|
||||
case TriCore_LD_W_sc: {
|
||||
*const8 = *const8 * 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void print_zero_ext(MCInst *MI, int OpNum, SStream *O, unsigned n)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t imm = MCOperand_getImm(MO);
|
||||
for (unsigned i = n + 1; i < 32; ++i) {
|
||||
imm &= ~(1LL << i);
|
||||
}
|
||||
if (n == 4) {
|
||||
off4_fixup(MI, &imm);
|
||||
}
|
||||
if (n == 8) {
|
||||
const8_fixup(MI, &imm);
|
||||
}
|
||||
|
||||
printUInt32Bang(O, wrapping_u32(imm));
|
||||
fill_imm(MI, imm);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
static void printOff18Imm(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t imm = MCOperand_getImm(MO);
|
||||
imm = ((wrapping_u32(imm) & 0x3C000) << 14) |
|
||||
(wrapping_u32(imm) & 0x3fff);
|
||||
printUInt32Bang(O, wrapping_u32(imm));
|
||||
fill_imm(MI, imm);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
// PC + sext(disp) * 2
|
||||
#define DISP_SEXT_2ALIGN(N) ((int64_t)(MI->address) + SignExtend64(disp, N) * 2)
|
||||
|
||||
static void printDisp24Imm(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t disp = MCOperand_getImm(MO);
|
||||
int64_t res = 0;
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_CALL_b:
|
||||
case TriCore_FCALL_b: {
|
||||
res = DISP_SEXT_2ALIGN(24);
|
||||
break;
|
||||
}
|
||||
case TriCore_CALLA_b:
|
||||
case TriCore_FCALLA_b:
|
||||
case TriCore_JA_b:
|
||||
case TriCore_JLA_b:
|
||||
// {disp24[23:20], 7’b0000000, disp24[19:0], 1’b0}
|
||||
res = ((disp & 0xf00000ULL) << 8) |
|
||||
((disp & 0xfffffULL) << 1);
|
||||
break;
|
||||
case TriCore_J_b:
|
||||
case TriCore_JL_b:
|
||||
res = DISP_SEXT_2ALIGN(24);
|
||||
break;
|
||||
}
|
||||
|
||||
printUInt32Bang(O, wrapping_u32(res));
|
||||
fill_imm(MI, res);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
static void printDisp15Imm(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t disp = MCOperand_getImm(MO);
|
||||
int64_t res = 0;
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_LOOP_brr:
|
||||
case TriCore_LOOPU_brr:
|
||||
res = DISP_SEXT_2ALIGN(15);
|
||||
break;
|
||||
case TriCore_JEQ_brc:
|
||||
case TriCore_JEQ_brr:
|
||||
case TriCore_JEQ_A_brr:
|
||||
case TriCore_JGE_brc:
|
||||
case TriCore_JGE_brr:
|
||||
case TriCore_JGE_U_brc:
|
||||
case TriCore_JGE_U_brr:
|
||||
case TriCore_JLT_brc:
|
||||
case TriCore_JLT_brr:
|
||||
case TriCore_JLT_U_brc:
|
||||
case TriCore_JLT_U_brr:
|
||||
case TriCore_JNE_brc:
|
||||
case TriCore_JNE_brr:
|
||||
case TriCore_JNE_A_brr:
|
||||
case TriCore_JNED_brc:
|
||||
case TriCore_JNED_brr:
|
||||
case TriCore_JNEI_brc:
|
||||
case TriCore_JNEI_brr:
|
||||
case TriCore_JNZ_A_brr:
|
||||
case TriCore_JNZ_T_brn:
|
||||
case TriCore_JZ_A_brr:
|
||||
case TriCore_JZ_T_brn:
|
||||
res = DISP_SEXT_2ALIGN(15);
|
||||
break;
|
||||
default:
|
||||
// handle other cases, if any
|
||||
break;
|
||||
}
|
||||
|
||||
printUInt32Bang(O, wrapping_u32(res));
|
||||
fill_imm(MI, res);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
static void printDisp8Imm(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t disp = MCOperand_getImm(MO);
|
||||
int64_t res = 0;
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_CALL_sb:
|
||||
res = DISP_SEXT_2ALIGN(8);
|
||||
break;
|
||||
case TriCore_J_sb:
|
||||
case TriCore_JNZ_sb:
|
||||
case TriCore_JZ_sb:
|
||||
res = DISP_SEXT_2ALIGN(8);
|
||||
break;
|
||||
default:
|
||||
// handle other cases, if any
|
||||
break;
|
||||
}
|
||||
|
||||
printUInt32Bang(O, wrapping_u32(res));
|
||||
fill_imm(MI, res);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
static void printDisp4Imm(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t disp = MCOperand_getImm(MO);
|
||||
int64_t res = 0;
|
||||
switch (MCInst_getOpcode(MI)) {
|
||||
case TriCore_JEQ_sbc1:
|
||||
case TriCore_JEQ_sbr1:
|
||||
case TriCore_JGEZ_sbr:
|
||||
case TriCore_JGTZ_sbr:
|
||||
case TriCore_JLEZ_sbr:
|
||||
case TriCore_JLTZ_sbr:
|
||||
case TriCore_JNE_sbc1:
|
||||
case TriCore_JNE_sbr1:
|
||||
case TriCore_JNZ_sbr:
|
||||
case TriCore_JNZ_A_sbr:
|
||||
case TriCore_JNZ_T_sbrn:
|
||||
case TriCore_JZ_sbr:
|
||||
case TriCore_JZ_A_sbr:
|
||||
case TriCore_JZ_T_sbrn:
|
||||
// PC + zero_ext(disp4) * 2;
|
||||
res = (int64_t)(MI->address) + disp * 2;
|
||||
break;
|
||||
case TriCore_JEQ_sbc2:
|
||||
case TriCore_JEQ_sbr2:
|
||||
case TriCore_JNE_sbc2:
|
||||
case TriCore_JNE_sbr2:
|
||||
// PC + zero_ext(disp4 + 16) * 2;
|
||||
res = (int64_t)(MI->address) + ((disp + 16) * 2);
|
||||
break;
|
||||
case TriCore_LOOP_sbr:
|
||||
// PC + {27b’111111111111111111111111111, disp4, 0};
|
||||
res = (int64_t)MI->address +
|
||||
OneExtend32(wrapping_u32(disp) << 1, 5);
|
||||
break;
|
||||
default:
|
||||
// handle other cases, if any
|
||||
break;
|
||||
}
|
||||
|
||||
printUInt32Bang(O, wrapping_u32(res));
|
||||
fill_imm(MI, res);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
#define printSExtImm_(n) \
|
||||
static void printSExtImm_##n(MCInst *MI, int OpNum, SStream *O) \
|
||||
{ \
|
||||
print_sign_ext(MI, OpNum, O, n); \
|
||||
}
|
||||
|
||||
#define printZExtImm_(n) \
|
||||
static void printZExtImm_##n(MCInst *MI, int OpNum, SStream *O) \
|
||||
{ \
|
||||
print_zero_ext(MI, OpNum, O, n); \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
||||
printSExtImm_(16)
|
||||
|
||||
printSExtImm_(10)
|
||||
|
||||
printSExtImm_(9)
|
||||
|
||||
printSExtImm_(4)
|
||||
|
||||
printZExtImm_(16)
|
||||
|
||||
printZExtImm_(9)
|
||||
|
||||
printZExtImm_(8)
|
||||
|
||||
printZExtImm_(4)
|
||||
|
||||
printZExtImm_(2);
|
||||
|
||||
// clang-format on
|
||||
|
||||
static void printOExtImm_4(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isImm(MO)) {
|
||||
int64_t disp = MCOperand_getImm(MO);
|
||||
int64_t res = (int64_t)MI->address +
|
||||
(int64_t)OneExtend64(disp << 1, 5);
|
||||
printUInt32Bang(O, wrapping_u32(res));
|
||||
fill_imm(MI, res);
|
||||
} else
|
||||
printOperand(MI, OpNum, O);
|
||||
}
|
||||
|
||||
/// Returned by getMnemonic() of the AsmPrinters.
|
||||
typedef struct {
|
||||
const char *first; // Mnemonic
|
||||
uint64_t second; // Bits
|
||||
} MnemonicBitsInfo;
|
||||
|
||||
#include "TriCoreGenAsmWriter.inc"
|
||||
|
||||
const char *TriCore_LLVM_getRegisterName(unsigned int id)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
return getRegisterName(id);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TriCore_LLVM_printInst(MCInst *MI, uint64_t Address, SStream *O)
|
||||
{
|
||||
printInstruction(MI, Address, O);
|
||||
TriCore_set_access(MI);
|
||||
}
|
||||
|
||||
#endif // CAPSTONE_HAS_TRICORE
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_TRICORE_LINKAGE_H
|
||||
#define CS_TRICORE_LINKAGE_H
|
||||
|
||||
// Function definitions to call static LLVM functions.
|
||||
|
||||
#include "../../MCDisassembler.h"
|
||||
#include "../../MCInst.h"
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include "../../SStream.h"
|
||||
#include "capstone/capstone.h"
|
||||
|
||||
bool TriCore_LLVM_getInstruction(csh handle, const uint8_t *Bytes,
|
||||
size_t ByteLen, MCInst *MI, uint16_t *Size,
|
||||
uint64_t Address);
|
||||
const char *TriCore_LLVM_getRegisterName(unsigned RegNo);
|
||||
void TriCore_LLVM_printInst(MCInst *MI, uint64_t Address, SStream *O);
|
||||
|
||||
#endif // CS_TRICORE_LINKAGE_H
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
||||
|
||||
#ifdef CAPSTONE_HAS_TRICORE
|
||||
|
||||
#include <stdio.h> // debug
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "../../Mapping.h"
|
||||
#include "../../utils.h"
|
||||
#include "../../cs_simple_types.h"
|
||||
|
||||
#include "TriCoreMapping.h"
|
||||
#include "TriCoreLinkage.h"
|
||||
|
||||
#define GET_INSTRINFO_ENUM
|
||||
|
||||
#include "TriCoreGenInstrInfo.inc"
|
||||
|
||||
static const name_map group_name_maps[] = {
|
||||
{ TRICORE_GRP_INVALID, "invalid" },
|
||||
{ TRICORE_GRP_CALL, "call" },
|
||||
{ TRICORE_GRP_JUMP, "jump" },
|
||||
#include "TriCoreGenCSFeatureName.inc"
|
||||
};
|
||||
|
||||
static const insn_map mapping_insns[] = {
|
||||
#include "TriCoreGenCSMappingInsn.inc"
|
||||
};
|
||||
|
||||
static const map_insn_ops insn_operands[] = {
|
||||
#include "TriCoreGenCSMappingInsnOp.inc"
|
||||
};
|
||||
|
||||
static const char *const insn_names[] = {
|
||||
#include "TriCoreGenCSMappingInsnName.inc"
|
||||
};
|
||||
|
||||
// special alias insn
|
||||
static const name_map alias_insn_names[] = { { 0, NULL } };
|
||||
|
||||
#ifndef CAPSTONE_DIET
|
||||
static const tricore_reg flag_regs[] = { TRICORE_REG_PSW };
|
||||
#endif // CAPSTONE_DIET
|
||||
|
||||
static inline void check_updates_flags(MCInst *MI)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!detail_is_set(MI)) {
|
||||
return;
|
||||
}
|
||||
|
||||
cs_detail *detail = get_detail(MI);
|
||||
|
||||
for (int i = 0; i < detail->regs_write_count; ++i) {
|
||||
if (detail->regs_write[i] == 0)
|
||||
return;
|
||||
for (int j = 0; j < ARR_SIZE(flag_regs); ++j) {
|
||||
if (detail->regs_write[i] == flag_regs[j]) {
|
||||
detail->tricore.update_flags = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CAPSTONE_DIET
|
||||
}
|
||||
|
||||
static void set_instr_map_data(MCInst *MI)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
map_cs_id(MI, mapping_insns, ARR_SIZE(mapping_insns));
|
||||
map_implicit_reads(MI, mapping_insns);
|
||||
map_implicit_writes(MI, mapping_insns);
|
||||
map_groups(MI, mapping_insns);
|
||||
check_updates_flags(MI);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TriCore_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
|
||||
{
|
||||
// Not used. Information is set after disassembly.
|
||||
}
|
||||
|
||||
const char *TriCore_insn_name(csh handle, unsigned int id)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (id >= TRICORE_INS_ENDING)
|
||||
return NULL;
|
||||
|
||||
const char *alias_name =
|
||||
id2name(alias_insn_names, ARR_SIZE(alias_insn_names), id);
|
||||
if (alias_name)
|
||||
return alias_name;
|
||||
|
||||
return insn_names[id];
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *TriCore_group_name(csh handle, unsigned int id)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
return id2name(group_name_maps, ARR_SIZE(group_name_maps), id);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TriCore_set_access(MCInst *MI)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!detail_is_set(MI))
|
||||
return;
|
||||
|
||||
CS_ASSERT_RET(MI->Opcode < ARR_SIZE(insn_operands));
|
||||
|
||||
cs_detail *detail = get_detail(MI);
|
||||
cs_tricore *tc = &(detail->tricore);
|
||||
for (int i = 0; i < tc->op_count; ++i) {
|
||||
cs_ac_type ac = map_get_op_access(MI, i);
|
||||
cs_tricore_op *op = &tc->operands[i];
|
||||
op->access = ac;
|
||||
cs_op_type op_type = map_get_op_type(MI, i);
|
||||
if (op_type != CS_OP_REG) {
|
||||
continue;
|
||||
}
|
||||
if (ac & CS_AC_READ) {
|
||||
detail->regs_read[detail->regs_read_count++] = op->reg;
|
||||
}
|
||||
if (ac & CS_AC_WRITE) {
|
||||
detail->regs_write[detail->regs_write_count++] =
|
||||
op->reg;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void TriCore_reg_access(const cs_insn *insn, cs_regs regs_read,
|
||||
uint8_t *regs_read_count, cs_regs regs_write,
|
||||
uint8_t *regs_write_count)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
uint8_t read_count, write_count;
|
||||
cs_detail *detail = insn->detail;
|
||||
read_count = detail->regs_read_count;
|
||||
write_count = detail->regs_write_count;
|
||||
|
||||
// implicit registers
|
||||
memcpy(regs_read, detail->regs_read,
|
||||
read_count * sizeof(detail->regs_read[0]));
|
||||
memcpy(regs_write, detail->regs_write,
|
||||
write_count * sizeof(detail->regs_write[0]));
|
||||
|
||||
// explicit registers
|
||||
cs_tricore *tc = &detail->tricore;
|
||||
for (uint8_t i = 0; i < tc->op_count; i++) {
|
||||
cs_tricore_op *op = &(tc->operands[i]);
|
||||
switch ((int)op->type) {
|
||||
case TRICORE_OP_REG:
|
||||
if ((op->access & CS_AC_READ) &&
|
||||
!arr_exist(regs_read, read_count, op->reg)) {
|
||||
regs_read[read_count] = (uint16_t)op->reg;
|
||||
read_count++;
|
||||
}
|
||||
if ((op->access & CS_AC_WRITE) &&
|
||||
!arr_exist(regs_write, write_count, op->reg)) {
|
||||
regs_write[write_count] = (uint16_t)op->reg;
|
||||
write_count++;
|
||||
}
|
||||
break;
|
||||
case TRICORE_OP_MEM:
|
||||
// registers appeared in memory references always being read
|
||||
if ((op->mem.base != ARM_REG_INVALID) &&
|
||||
!arr_exist(regs_read, read_count, op->mem.base)) {
|
||||
regs_read[read_count] = (uint16_t)op->mem.base;
|
||||
read_count++;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*regs_read_count = read_count;
|
||||
*regs_write_count = write_count;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TriCore_disasm(csh handle, const uint8_t *code, size_t code_len,
|
||||
MCInst *instr, uint16_t *size, uint64_t address, void *info)
|
||||
{
|
||||
instr->MRI = (MCRegisterInfo *)info;
|
||||
if (instr->flat_insn->detail) {
|
||||
memset(instr->flat_insn->detail, 0, sizeof(cs_detail));
|
||||
}
|
||||
|
||||
bool res = TriCore_LLVM_getInstruction(handle, code, code_len, instr,
|
||||
size, address);
|
||||
if (!res)
|
||||
return res;
|
||||
set_instr_map_data(instr);
|
||||
return res;
|
||||
}
|
||||
|
||||
void TriCore_printInst(MCInst *MI, SStream *O, void *Info)
|
||||
{
|
||||
MI->MRI = Info;
|
||||
TriCore_LLVM_printInst(MI, MI->address, O);
|
||||
}
|
||||
|
||||
const char *TriCore_getRegisterName(csh handle, unsigned int RegNo)
|
||||
{
|
||||
return TriCore_LLVM_getRegisterName(RegNo);
|
||||
}
|
||||
|
||||
#endif // CAPSTONE_HAS_TRICORE
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
||||
|
||||
#ifndef CS_TRICORE_MAP_H
|
||||
#define CS_TRICORE_MAP_H
|
||||
|
||||
#include <capstone/capstone.h>
|
||||
|
||||
// given internal insn id, return public instruction info
|
||||
void TriCore_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id);
|
||||
|
||||
const char *TriCore_insn_name(csh handle, unsigned int id);
|
||||
|
||||
const char *TriCore_group_name(csh handle, unsigned int id);
|
||||
|
||||
void TriCore_reg_access(const cs_insn *insn, cs_regs regs_read,
|
||||
uint8_t *regs_read_count, cs_regs regs_write,
|
||||
uint8_t *regs_write_count);
|
||||
|
||||
void TriCore_set_access(MCInst *MI);
|
||||
|
||||
bool TriCore_disasm(csh handle, const uint8_t *code, size_t code_len,
|
||||
MCInst *instr, uint16_t *size, uint64_t address,
|
||||
void *info);
|
||||
|
||||
void TriCore_printInst(MCInst *MI, SStream *O, void *Info);
|
||||
|
||||
const char *TriCore_getRegisterName(csh handle, unsigned int RegNo);
|
||||
|
||||
#endif
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
||||
|
||||
#ifdef CAPSTONE_HAS_TRICORE
|
||||
|
||||
#include "../../utils.h"
|
||||
#include "TriCoreMapping.h"
|
||||
#include "TriCoreModule.h"
|
||||
#include "TriCoreDisassembler.h"
|
||||
|
||||
cs_err TRICORE_global_init(cs_struct *ud)
|
||||
{
|
||||
MCRegisterInfo *mri;
|
||||
mri = cs_mem_calloc(sizeof(*mri), 1);
|
||||
TriCore_init_mri(mri);
|
||||
ud->printer = TriCore_printInst;
|
||||
ud->printer_info = mri;
|
||||
ud->getinsn_info = mri;
|
||||
ud->disasm = TriCore_disasm;
|
||||
ud->post_printer = NULL;
|
||||
|
||||
ud->reg_name = TriCore_getRegisterName;
|
||||
ud->insn_id = TriCore_get_insn_id;
|
||||
ud->insn_name = TriCore_insn_name;
|
||||
ud->group_name = TriCore_group_name;
|
||||
|
||||
#ifndef CAPSTONE_DIET
|
||||
ud->reg_access = TriCore_reg_access;
|
||||
#endif
|
||||
|
||||
return CS_ERR_OK;
|
||||
}
|
||||
|
||||
cs_err TRICORE_option(cs_struct *handle, cs_opt_type type, size_t value)
|
||||
{
|
||||
if (type == CS_OPT_SYNTAX) {
|
||||
handle->syntax = (int)value;
|
||||
} else if (type == CS_OPT_MODE) {
|
||||
handle->mode = (cs_mode)value;
|
||||
}
|
||||
|
||||
return CS_ERR_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by aya on 3/4/23.
|
||||
//
|
||||
|
||||
#ifndef CAPSTONE_TRICODEMODULE_H
|
||||
#define CAPSTONE_TRICODEMODULE_H
|
||||
|
||||
cs_err TRICORE_global_init(cs_struct *ud);
|
||||
cs_err TRICORE_option(cs_struct *handle, cs_opt_type type, size_t value);
|
||||
|
||||
#endif // CAPSTONE_TRICODEMODULE_H
|
||||
Reference in New Issue
Block a user