xcore.h
Go to the documentation of this file.
1 #ifndef CAPSTONE_XCORE_H
2 #define CAPSTONE_XCORE_H
3 
4 /* Capstone Disassembly Engine */
5 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2015 */
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #include "platform.h"
12 
13 #ifdef _MSC_VER
14 #pragma warning(disable:4201)
15 #endif
16 
18 typedef enum xcore_op_type {
24 
26 typedef enum xcore_reg {
28 
45 
46  // pseudo registers
48 
49  // internal thread registers
50  // see The-XMOS-XS1-Architecture(X7879A).pdf
52  XCORE_REG_SSR, //< save status
53  XCORE_REG_ET, //< exception type
54  XCORE_REG_ED, //< exception data
55  XCORE_REG_SED, //< save exception data
56  XCORE_REG_KEP, //< kernel entry pointer
57  XCORE_REG_KSP, //< kernel stack pointer
58  XCORE_REG_ID, //< thread ID
59 
60  XCORE_REG_ENDING, // <-- mark the end of the list of registers
61 } xcore_reg;
62 
65 typedef struct xcore_op_mem {
67  uint8_t index;
71  int direct;
72 } xcore_op_mem;
73 
75 typedef struct cs_xcore_op {
77  union {
81  };
82 } cs_xcore_op;
83 
85 typedef struct cs_xcore {
90 } cs_xcore;
91 
93 typedef enum xcore_insn {
95 
216 
217  XCORE_INS_ENDING, // <-- mark the end of the list of instructions
218 } xcore_insn;
219 
221 typedef enum xcore_insn_group {
223 
224  // Generic groups
225  // all jump instructions (conditional+direct+indirect jumps)
227 
228  XCORE_GRP_ENDING, // <-- mark the end of the list of groups
230 
231 #ifdef __cplusplus
232 }
233 #endif
234 
235 #endif
XCORE_INS_EXTDP
@ XCORE_INS_EXTDP
Definition: xcore.h:133
XCORE_INS_CRC8
@ XCORE_INS_CRC8
Definition: xcore.h:115
XCORE_REG_ED
@ XCORE_REG_ED
Definition: xcore.h:54
XCORE_REG_R7
@ XCORE_REG_R7
Definition: xcore.h:40
XCORE_INS_BF
@ XCORE_INS_BF
Definition: xcore.h:105
XCORE_INS_KCALL
@ XCORE_INS_KCALL
Definition: xcore.h:150
XCORE_INS_OUTSHR
@ XCORE_INS_OUTSHR
Definition: xcore.h:178
XCORE_INS_KRET
@ XCORE_INS_KRET
Definition: xcore.h:153
xcore_op_mem
struct xcore_op_mem xcore_op_mem
XCORE_INS_LDAP
@ XCORE_INS_LDAP
Definition: xcore.h:158
XCORE_INS_EQ
@ XCORE_INS_EQ
Definition: xcore.h:132
XCORE_INS_OUTCT
@ XCORE_INS_OUTCT
Definition: xcore.h:176
XCORE_INS_TSETMR
@ XCORE_INS_TSETMR
Definition: xcore.h:209
XCORE_INS_CHKCT
@ XCORE_INS_CHKCT
Definition: xcore.h:110
XCORE_INS_PEEK
@ XCORE_INS_PEEK
Definition: xcore.h:181
XCORE_INS_BLAT
@ XCORE_INS_BLAT
Definition: xcore.h:103
XCORE_REG_ET
@ XCORE_REG_ET
Definition: xcore.h:53
XCORE_REG_R5
@ XCORE_REG_R5
Definition: xcore.h:38
XCORE_INS_START
@ XCORE_INS_START
Definition: xcore.h:210
XCORE_INS_FREET
@ XCORE_INS_FREET
Definition: xcore.h:136
XCORE_INS_ENDING
@ XCORE_INS_ENDING
Definition: xcore.h:217
XCORE_INS_AND
@ XCORE_INS_AND
Definition: xcore.h:98
XCORE_INS_LDA16
@ XCORE_INS_LDA16
Definition: xcore.h:157
XCORE_REG_PC
@ XCORE_REG_PC
pc
Definition: xcore.h:47
XCORE_REG_R4
@ XCORE_REG_R4
Definition: xcore.h:37
xcore_op_mem::index
uint8_t index
index register, same conditions apply here
Definition: xcore.h:69
XCORE_GRP_INVALID
@ XCORE_GRP_INVALID
= CS_GRP_INVALID
Definition: xcore.h:222
XCORE_INS_BLA
@ XCORE_INS_BLA
Definition: xcore.h:102
XCORE_GRP_JUMP
@ XCORE_GRP_JUMP
= CS_GRP_JUMP
Definition: xcore.h:226
cs_xcore_op::type
xcore_op_type type
operand type
Definition: xcore.h:76
XCORE_INS_CLRE
@ XCORE_INS_CLRE
Definition: xcore.h:111
XCORE_INS_ECALLT
@ XCORE_INS_ECALLT
Definition: xcore.h:125
XCORE_REG_ENDING
@ XCORE_REG_ENDING
Definition: xcore.h:60
XCORE_OP_MEM
@ XCORE_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: xcore.h:22
XCORE_INS_SEXT
@ XCORE_INS_SEXT
Definition: xcore.h:197
cs_xcore_op
struct cs_xcore_op cs_xcore_op
Instruction operand.
XCORE_REG_R11
@ XCORE_REG_R11
Definition: xcore.h:44
XCORE_INS_STW
@ XCORE_INS_STW
Definition: xcore.h:203
XCORE_INS_MSYNC
@ XCORE_INS_MSYNC
Definition: xcore.h:171
XCORE_INS_GETD
@ XCORE_INS_GETD
Definition: xcore.h:137
XCORE_INS_LSS
@ XCORE_INS_LSS
Definition: xcore.h:164
XCORE_INS_INCT
@ XCORE_INS_INCT
Definition: xcore.h:144
XCORE_INS_CLRPT
@ XCORE_INS_CLRPT
Definition: xcore.h:112
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
cs_xcore::operands
cs_xcore_op operands[8]
operands for this instruction.
Definition: xcore.h:89
XCORE_INS_SET
@ XCORE_INS_SET
Definition: xcore.h:186
XCORE_INS_LDC
@ XCORE_INS_LDC
Definition: xcore.h:160
XCORE_INS_ADD
@ XCORE_INS_ADD
Definition: xcore.h:96
XCORE_INS_SETTW
@ XCORE_INS_SETTW
Definition: xcore.h:195
XCORE_INS_SETD
@ XCORE_INS_SETD
Definition: xcore.h:188
XCORE_INS_KENTSP
@ XCORE_INS_KENTSP
Definition: xcore.h:151
XCORE_INS_LMUL
@ XCORE_INS_LMUL
Definition: xcore.h:163
XCORE_INS_EET
@ XCORE_INS_EET
Definition: xcore.h:128
XCORE_INS_XOR
@ XCORE_INS_XOR
Definition: xcore.h:214
XCORE_OP_INVALID
@ XCORE_OP_INVALID
= CS_OP_INVALID (Uninitialized).
Definition: xcore.h:19
XCORE_INS_SETPSC
@ XCORE_INS_SETPSC
Definition: xcore.h:191
XCORE_INS_BL
@ XCORE_INS_BL
Definition: xcore.h:104
XCORE_INS_LDW
@ XCORE_INS_LDW
Definition: xcore.h:161
XCORE_INS_EEF
@ XCORE_INS_EEF
Definition: xcore.h:127
XCORE_INS_DCALL
@ XCORE_INS_DCALL
Definition: xcore.h:117
XCORE_INS_SSYNC
@ XCORE_INS_SSYNC
Definition: xcore.h:200
XCORE_INS_DGETREG
@ XCORE_INS_DGETREG
Definition: xcore.h:119
XCORE_GRP_ENDING
@ XCORE_GRP_ENDING
Definition: xcore.h:228
XCORE_INS_CLZ
@ XCORE_INS_CLZ
Definition: xcore.h:114
XCORE_REG_R8
@ XCORE_REG_R8
Definition: xcore.h:41
XCORE_INS_ASHR
@ XCORE_INS_ASHR
Definition: xcore.h:99
XCORE_REG_SCP
@ XCORE_REG_SCP
save pc
Definition: xcore.h:51
XCORE_INS_ECALLF
@ XCORE_INS_ECALLF
Definition: xcore.h:124
XCORE_INS_REMU
@ XCORE_INS_REMU
Definition: xcore.h:183
cs_xcore
Instruction structure.
Definition: xcore.h:85
XCORE_INS_ENTSP
@ XCORE_INS_ENTSP
Definition: xcore.h:131
XCORE_REG_INVALID
@ XCORE_REG_INVALID
Definition: xcore.h:27
XCORE_INS_ENDIN
@ XCORE_INS_ENDIN
Definition: xcore.h:130
XCORE_INS_EDU
@ XCORE_INS_EDU
Definition: xcore.h:126
platform.h
xcore_reg
xcore_reg
XCore registers.
Definition: xcore.h:26
XCORE_INS_BITREV
@ XCORE_INS_BITREV
Definition: xcore.h:101
XCORE_INS_GETSR
@ XCORE_INS_GETSR
Definition: xcore.h:141
XCORE_INS_INPW
@ XCORE_INS_INPW
Definition: xcore.h:146
XCORE_REG_R6
@ XCORE_REG_R6
Definition: xcore.h:39
XCORE_INS_DENTSP
@ XCORE_INS_DENTSP
Definition: xcore.h:118
XCORE_OP_REG
@ XCORE_OP_REG
= CS_OP_REG (Register operand).
Definition: xcore.h:20
XCORE_INS_RETSP
@ XCORE_INS_RETSP
Definition: xcore.h:184
XCORE_REG_R10
@ XCORE_REG_R10
Definition: xcore.h:43
XCORE_INS_BYTEREV
@ XCORE_INS_BYTEREV
Definition: xcore.h:109
XCORE_INS_GETST
@ XCORE_INS_GETST
Definition: xcore.h:142
XCORE_INS_FREER
@ XCORE_INS_FREER
Definition: xcore.h:135
cs_xcore_op::reg
xcore_reg reg
register value for REG operand
Definition: xcore.h:78
XCORE_INS_GETTS
@ XCORE_INS_GETTS
Definition: xcore.h:143
XCORE_INS_SETN
@ XCORE_INS_SETN
Definition: xcore.h:190
XCORE_INS_SETPT
@ XCORE_INS_SETPT
Definition: xcore.h:192
XCORE_INS_WAITEF
@ XCORE_INS_WAITEF
Definition: xcore.h:211
XCORE_INS_SYNCR
@ XCORE_INS_SYNCR
Definition: xcore.h:205
XCORE_INS_LADD
@ XCORE_INS_LADD
Definition: xcore.h:154
XCORE_INS_GET
@ XCORE_INS_GET
Definition: xcore.h:138
xcore_op_mem::direct
int direct
+1: forward, -1: backward
Definition: xcore.h:71
XCORE_REG_ID
@ XCORE_REG_ID
Definition: xcore.h:58
xcore_op_mem::disp
int32_t disp
displacement/offset value
Definition: xcore.h:70
XCORE_INS_SETV
@ XCORE_INS_SETV
Definition: xcore.h:196
XCORE_REG_CP
@ XCORE_REG_CP
Definition: xcore.h:29
XCORE_REG_R0
@ XCORE_REG_R0
Definition: xcore.h:33
XCORE_INS_WAITEU
@ XCORE_INS_WAITEU
Definition: xcore.h:213
XCORE_INS_GETN
@ XCORE_INS_GETN
Definition: xcore.h:139
XCORE_INS_EXTSP
@ XCORE_INS_EXTSP
Definition: xcore.h:134
XCORE_INS_LDIVU
@ XCORE_INS_LDIVU
Definition: xcore.h:162
xcore_op_mem
Definition: xcore.h:65
XCORE_INS_REMS
@ XCORE_INS_REMS
Definition: xcore.h:182
XCORE_INS_INSHR
@ XCORE_INS_INSHR
Definition: xcore.h:147
XCORE_INS_CLRSR
@ XCORE_INS_CLRSR
Definition: xcore.h:113
XCORE_INS_EEU
@ XCORE_INS_EEU
Definition: xcore.h:129
XCORE_REG_SP
@ XCORE_REG_SP
Definition: xcore.h:32
XCORE_INS_LDAW
@ XCORE_INS_LDAW
Definition: xcore.h:159
XCORE_INS_DIVS
@ XCORE_INS_DIVS
Definition: xcore.h:120
XCORE_INS_TESTLCL
@ XCORE_INS_TESTLCL
Definition: xcore.h:207
cs_xcore_op::imm
int32_t imm
immediate value for IMM operand
Definition: xcore.h:79
XCORE_INS_INT
@ XCORE_INS_INT
Definition: xcore.h:148
XCORE_REG_SED
@ XCORE_REG_SED
Definition: xcore.h:55
XCORE_INS_INVALID
@ XCORE_INS_INVALID
Definition: xcore.h:94
cs_xcore
struct cs_xcore cs_xcore
Instruction structure.
XCORE_INS_OR
@ XCORE_INS_OR
Definition: xcore.h:175
XCORE_REG_R1
@ XCORE_REG_R1
Definition: xcore.h:34
XCORE_INS_ZEXT
@ XCORE_INS_ZEXT
Definition: xcore.h:215
XCORE_REG_R2
@ XCORE_REG_R2
Definition: xcore.h:35
XCORE_INS_LD8U
@ XCORE_INS_LD8U
Definition: xcore.h:156
XCORE_INS_MACCS
@ XCORE_INS_MACCS
Definition: xcore.h:167
cs_xcore_op
Instruction operand.
Definition: xcore.h:75
XCORE_REG_SSR
@ XCORE_REG_SSR
Definition: xcore.h:52
XCORE_INS_SETRDY
@ XCORE_INS_SETRDY
Definition: xcore.h:193
cs_xcore_op::mem
xcore_op_mem mem
base/disp value for MEM operand
Definition: xcore.h:80
XCORE_INS_DIVU
@ XCORE_INS_DIVU
Definition: xcore.h:121
XCORE_REG_LR
@ XCORE_REG_LR
Definition: xcore.h:31
XCORE_INS_ST8
@ XCORE_INS_ST8
Definition: xcore.h:202
XCORE_INS_SETC
@ XCORE_INS_SETC
Definition: xcore.h:187
XCORE_INS_WAITET
@ XCORE_INS_WAITET
Definition: xcore.h:212
XCORE_INS_SHL
@ XCORE_INS_SHL
Definition: xcore.h:198
XCORE_INS_BT
@ XCORE_INS_BT
Definition: xcore.h:106
XCORE_INS_SHR
@ XCORE_INS_SHR
Definition: xcore.h:199
XCORE_INS_MJOIN
@ XCORE_INS_MJOIN
Definition: xcore.h:169
XCORE_INS_MKMSK
@ XCORE_INS_MKMSK
Definition: xcore.h:170
XCORE_INS_LD16S
@ XCORE_INS_LD16S
Definition: xcore.h:155
XCORE_INS_SETEV
@ XCORE_INS_SETEV
Definition: xcore.h:189
XCORE_INS_CRC32
@ XCORE_INS_CRC32
Definition: xcore.h:116
XCORE_INS_NEG
@ XCORE_INS_NEG
Definition: xcore.h:173
XCORE_INS_SETCLK
@ XCORE_INS_SETCLK
Definition: xcore.h:185
XCORE_INS_DRESTSP
@ XCORE_INS_DRESTSP
Definition: xcore.h:122
xcore_op_mem::base
uint8_t base
Definition: xcore.h:66
XCORE_INS_DRET
@ XCORE_INS_DRET
Definition: xcore.h:123
XCORE_INS_BU
@ XCORE_INS_BU
Definition: xcore.h:107
XCORE_REG_KEP
@ XCORE_REG_KEP
Definition: xcore.h:56
XCORE_REG_KSP
@ XCORE_REG_KSP
Definition: xcore.h:57
cs_xcore::op_count
uint8_t op_count
Definition: xcore.h:88
xcore_op_type
xcore_op_type
Operand type for instruction's operands.
Definition: xcore.h:18
XCORE_INS_SUB
@ XCORE_INS_SUB
Definition: xcore.h:204
XCORE_INS_LSU
@ XCORE_INS_LSU
Definition: xcore.h:166
XCORE_INS_BAU
@ XCORE_INS_BAU
Definition: xcore.h:100
XCORE_INS_LSUB
@ XCORE_INS_LSUB
Definition: xcore.h:165
XCORE_INS_INIT
@ XCORE_INS_INIT
Definition: xcore.h:145
XCORE_INS_TESTWCT
@ XCORE_INS_TESTWCT
Definition: xcore.h:208
XCORE_OP_IMM
@ XCORE_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: xcore.h:21
XCORE_INS_NOT
@ XCORE_INS_NOT
Definition: xcore.h:174
XCORE_INS_OUTT
@ XCORE_INS_OUTT
Definition: xcore.h:179
XCORE_INS_IN
@ XCORE_INS_IN
Definition: xcore.h:149
XCORE_REG_R3
@ XCORE_REG_R3
Definition: xcore.h:36
XCORE_INS_ST16
@ XCORE_INS_ST16
Definition: xcore.h:201
XCORE_INS_ANDNOT
@ XCORE_INS_ANDNOT
Definition: xcore.h:97
XCORE_INS_OUT
@ XCORE_INS_OUT
Definition: xcore.h:180
XCORE_INS_SETSR
@ XCORE_INS_SETSR
Definition: xcore.h:194
XCORE_INS_TESTCT
@ XCORE_INS_TESTCT
Definition: xcore.h:206
XCORE_REG_R9
@ XCORE_REG_R9
Definition: xcore.h:42
XCORE_INS_KRESTSP
@ XCORE_INS_KRESTSP
Definition: xcore.h:152
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
xcore_insn_group
xcore_insn_group
Group of XCore instructions.
Definition: xcore.h:221
XCORE_INS_MACCU
@ XCORE_INS_MACCU
Definition: xcore.h:168
XCORE_INS_GETR
@ XCORE_INS_GETR
Definition: xcore.h:140
XCORE_INS_BRU
@ XCORE_INS_BRU
Definition: xcore.h:108
xcore_insn
xcore_insn
XCore instruction.
Definition: xcore.h:93
XCORE_INS_MUL
@ XCORE_INS_MUL
Definition: xcore.h:172
XCORE_INS_OUTPW
@ XCORE_INS_OUTPW
Definition: xcore.h:177
XCORE_REG_DP
@ XCORE_REG_DP
Definition: xcore.h:30


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:54