Rizin
unix-like reverse engineering framework and cli tools
cr16_disas.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2014 Fedor Sakharov <fedor.sakharov@gmail.com>
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#ifndef RZ_CR16_DISASM_H
5
#define RZ_CR16_DISASM_H
6
7
#define CR16_INSTR_MAXLEN 24
8
#define STOR_LOAD_MASK 0x181F
9
10
enum
cr16_cmd_types
{
11
CR16_TYPE_MOV
,
12
CR16_TYPE_ADD
,
13
CR16_TYPE_MUL
,
14
CR16_TYPE_SUB
,
15
CR16_TYPE_CMP
,
16
CR16_TYPE_BE
,
17
CR16_TYPE_BNE
,
18
CR16_TYPE_AND
,
19
CR16_TYPE_OR
,
20
CR16_TYPE_SCOND
,
21
CR16_TYPE_XOR
,
22
CR16_TYPE_SHIFT
,
23
CR16_TYPE_BIT
,
24
CR16_TYPE_SLPR
,
25
CR16_TYPE_BCOND
,
26
CR16_TYPE_BAL
,
27
CR16_TYPE_BR
,
28
CR16_TYPE_EXCP
,
29
CR16_TYPE_JCOND
,
30
CR16_TYPE_JAL
,
31
CR16_TYPE_JUMP
,
32
CR16_TYPE_JUMP_UNK
,
33
CR16_TYPE_RETX
,
34
CR16_TYPE_PUSH
,
35
CR16_TYPE_POP
,
36
CR16_TYPE_LOAD
,
37
CR16_TYPE_STOR
,
38
CR16_TYPE_DI
,
39
CR16_TYPE_EI
,
40
CR16_TYPE_NOP
,
41
CR16_TYPE_WAIT
,
42
CR16_TYPE_EWAIT
,
43
};
44
45
struct
cr16_cmd
{
46
st32
reladdr
;
47
unsigned
type
;
48
char
instr
[
CR16_INSTR_MAXLEN
];
49
char
operands
[
CR16_INSTR_MAXLEN
];
50
};
51
52
int
cr16_decode_command
(
const
ut8
*instr,
struct
cr16_cmd
*
cmd
,
int
len
);
53
54
enum
cr16_opcodes
{
55
CR16_ADD
= 0x0,
56
CR16_ADDU
= 0x1,
57
CR16_BITI
= 0x2,
58
CR16_MUL
= 0x3,
59
CR16_ASHU
= 0x4,
60
CR16_LSH
= 0x5,
61
CR16_XOR
= 0x6,
62
CR16_CMP
= 0x7,
63
CR16_AND
= 0x8,
64
CR16_ADDC
= 0x9,
65
CR16_BCOND01
= 0xA,
66
CR16_TBIT
= 0xB,
67
CR16_MOV
= 0xC,
68
CR16_SUB
= 0xF,
69
CR16_SUBC
= 0xD,
70
CR16_OR
= 0xE,
71
CR16_MOVD
= 0x19,
72
CR16_MULSB
= 0x30,
73
CR16_MULSW
= 0x31,
74
CR16_MULUW
= 0x3F,
75
CR16_MOVXB
= 0x34,
76
CR16_MOVZB
= 0x35,
77
CR16_SCOND
= 0x37,
78
CR16_TBIT_R_R
= 0x3B,
79
CR16_TBIT_I_R
= 0x1B,
80
CR16_JUMP
= 0x2A,
81
CR16_JAL
= 0x3A,
82
CR16_BAL
= 0x1A,
83
CR16_LPR
= 0x38,
84
CR16_SPR
= 0x39,
85
CR16_BCOND_2
= 0x0A,
86
CR16_PUSH
= 0xD8,
87
CR16_POP
= 0xD9,
88
CR16_POPRET_1
= 0xDA,
89
CR16_POPRET_2
= 0xDB,
90
CR16_LOADM
= 0xFC,
91
CR16_STORM
= 0xFD,
92
};
93
94
enum
cr16_opcodes_long
{
95
CR16_RETX
= 0x79FE,
96
CR16_DI
= 0x7DDE,
97
CR16_EI
= 0x7DFE,
98
CR16_NOP
= 0x0200,
99
CR16_WAIT
= 0x7FFE,
100
CR16_EWAIT
= 0x7FD6,
101
};
102
103
enum
cr16_cmd_forms
{
104
CR16_I_R
= 0x0,
105
CR16_R_R
= 0x1,
106
};
107
108
enum
cr16_regs
{
109
CR16_R0
= 0,
110
CR16_R1
,
111
CR16_R2
,
112
CR16_R3
,
113
CR16_R4
,
114
CR16_R5
,
115
CR16_R6
,
116
CR16_R7
,
117
CR16_R8
,
118
CR16_R9
,
119
CR16_R10
,
120
CR16_R11
,
121
CR16_R12
,
122
CR16_R13
,
123
CR16_RA
,
124
CR16_SP
,
125
CR16_LAST
,
126
};
127
128
enum
cr16_dedic_regs
{
129
CR16_PSR
= 0x1,
130
CR16_INTBASE
= 0x3,
131
CR16_ISP
= 0xB,
132
};
133
134
enum
cr16_conds
{
135
CR16_COND_EQ
= 0x0,
136
CR16_COND_NE
,
137
CR16_COND_CS
,
138
CR16_COND_CC
,
139
CR16_COND_HI
,
140
CR16_COND_LS
,
141
CR16_COND_GT
,
142
CR16_COND_LE
,
143
CR16_COND_FS
,
144
CR16_COND_FC
,
145
CR16_COND_LO
,
146
CR16_COND_HS
,
147
CR16_COND_LT
,
148
CR16_COND_GE
,
149
};
150
151
#endif
/* CR16_DISASM_H */
len
size_t len
Definition:
6502dis.c:15
cr16_cmd_forms
cr16_cmd_forms
Definition:
cr16_disas.h:103
CR16_R_R
@ CR16_R_R
Definition:
cr16_disas.h:105
CR16_I_R
@ CR16_I_R
Definition:
cr16_disas.h:104
cr16_opcodes
cr16_opcodes
Definition:
cr16_disas.h:54
CR16_CMP
@ CR16_CMP
Definition:
cr16_disas.h:62
CR16_ASHU
@ CR16_ASHU
Definition:
cr16_disas.h:59
CR16_SUB
@ CR16_SUB
Definition:
cr16_disas.h:68
CR16_JUMP
@ CR16_JUMP
Definition:
cr16_disas.h:80
CR16_MULUW
@ CR16_MULUW
Definition:
cr16_disas.h:74
CR16_BCOND01
@ CR16_BCOND01
Definition:
cr16_disas.h:65
CR16_MOVD
@ CR16_MOVD
Definition:
cr16_disas.h:71
CR16_PUSH
@ CR16_PUSH
Definition:
cr16_disas.h:86
CR16_BCOND_2
@ CR16_BCOND_2
Definition:
cr16_disas.h:85
CR16_SUBC
@ CR16_SUBC
Definition:
cr16_disas.h:69
CR16_LSH
@ CR16_LSH
Definition:
cr16_disas.h:60
CR16_XOR
@ CR16_XOR
Definition:
cr16_disas.h:61
CR16_LOADM
@ CR16_LOADM
Definition:
cr16_disas.h:90
CR16_SCOND
@ CR16_SCOND
Definition:
cr16_disas.h:77
CR16_OR
@ CR16_OR
Definition:
cr16_disas.h:70
CR16_MOV
@ CR16_MOV
Definition:
cr16_disas.h:67
CR16_BAL
@ CR16_BAL
Definition:
cr16_disas.h:82
CR16_AND
@ CR16_AND
Definition:
cr16_disas.h:63
CR16_BITI
@ CR16_BITI
Definition:
cr16_disas.h:57
CR16_ADDU
@ CR16_ADDU
Definition:
cr16_disas.h:56
CR16_ADD
@ CR16_ADD
Definition:
cr16_disas.h:55
CR16_MOVXB
@ CR16_MOVXB
Definition:
cr16_disas.h:75
CR16_POPRET_2
@ CR16_POPRET_2
Definition:
cr16_disas.h:89
CR16_TBIT_R_R
@ CR16_TBIT_R_R
Definition:
cr16_disas.h:78
CR16_MOVZB
@ CR16_MOVZB
Definition:
cr16_disas.h:76
CR16_POP
@ CR16_POP
Definition:
cr16_disas.h:87
CR16_MUL
@ CR16_MUL
Definition:
cr16_disas.h:58
CR16_SPR
@ CR16_SPR
Definition:
cr16_disas.h:84
CR16_TBIT_I_R
@ CR16_TBIT_I_R
Definition:
cr16_disas.h:79
CR16_LPR
@ CR16_LPR
Definition:
cr16_disas.h:83
CR16_ADDC
@ CR16_ADDC
Definition:
cr16_disas.h:64
CR16_MULSB
@ CR16_MULSB
Definition:
cr16_disas.h:72
CR16_STORM
@ CR16_STORM
Definition:
cr16_disas.h:91
CR16_MULSW
@ CR16_MULSW
Definition:
cr16_disas.h:73
CR16_POPRET_1
@ CR16_POPRET_1
Definition:
cr16_disas.h:88
CR16_TBIT
@ CR16_TBIT
Definition:
cr16_disas.h:66
CR16_JAL
@ CR16_JAL
Definition:
cr16_disas.h:81
cr16_regs
cr16_regs
Definition:
cr16_disas.h:108
CR16_RA
@ CR16_RA
Definition:
cr16_disas.h:123
CR16_LAST
@ CR16_LAST
Definition:
cr16_disas.h:125
CR16_R4
@ CR16_R4
Definition:
cr16_disas.h:113
CR16_R0
@ CR16_R0
Definition:
cr16_disas.h:109
CR16_R1
@ CR16_R1
Definition:
cr16_disas.h:110
CR16_R8
@ CR16_R8
Definition:
cr16_disas.h:117
CR16_R12
@ CR16_R12
Definition:
cr16_disas.h:121
CR16_R2
@ CR16_R2
Definition:
cr16_disas.h:111
CR16_R7
@ CR16_R7
Definition:
cr16_disas.h:116
CR16_R6
@ CR16_R6
Definition:
cr16_disas.h:115
CR16_R9
@ CR16_R9
Definition:
cr16_disas.h:118
CR16_R5
@ CR16_R5
Definition:
cr16_disas.h:114
CR16_SP
@ CR16_SP
Definition:
cr16_disas.h:124
CR16_R10
@ CR16_R10
Definition:
cr16_disas.h:119
CR16_R11
@ CR16_R11
Definition:
cr16_disas.h:120
CR16_R13
@ CR16_R13
Definition:
cr16_disas.h:122
CR16_R3
@ CR16_R3
Definition:
cr16_disas.h:112
cr16_dedic_regs
cr16_dedic_regs
Definition:
cr16_disas.h:128
CR16_ISP
@ CR16_ISP
Definition:
cr16_disas.h:131
CR16_INTBASE
@ CR16_INTBASE
Definition:
cr16_disas.h:130
CR16_PSR
@ CR16_PSR
Definition:
cr16_disas.h:129
cr16_opcodes_long
cr16_opcodes_long
Definition:
cr16_disas.h:94
CR16_WAIT
@ CR16_WAIT
Definition:
cr16_disas.h:99
CR16_EWAIT
@ CR16_EWAIT
Definition:
cr16_disas.h:100
CR16_DI
@ CR16_DI
Definition:
cr16_disas.h:96
CR16_NOP
@ CR16_NOP
Definition:
cr16_disas.h:98
CR16_EI
@ CR16_EI
Definition:
cr16_disas.h:97
CR16_RETX
@ CR16_RETX
Definition:
cr16_disas.h:95
cr16_conds
cr16_conds
Definition:
cr16_disas.h:134
CR16_COND_EQ
@ CR16_COND_EQ
Definition:
cr16_disas.h:135
CR16_COND_HI
@ CR16_COND_HI
Definition:
cr16_disas.h:139
CR16_COND_CC
@ CR16_COND_CC
Definition:
cr16_disas.h:138
CR16_COND_LE
@ CR16_COND_LE
Definition:
cr16_disas.h:142
CR16_COND_GT
@ CR16_COND_GT
Definition:
cr16_disas.h:141
CR16_COND_LT
@ CR16_COND_LT
Definition:
cr16_disas.h:147
CR16_COND_GE
@ CR16_COND_GE
Definition:
cr16_disas.h:148
CR16_COND_HS
@ CR16_COND_HS
Definition:
cr16_disas.h:146
CR16_COND_FC
@ CR16_COND_FC
Definition:
cr16_disas.h:144
CR16_COND_FS
@ CR16_COND_FS
Definition:
cr16_disas.h:143
CR16_COND_LO
@ CR16_COND_LO
Definition:
cr16_disas.h:145
CR16_COND_LS
@ CR16_COND_LS
Definition:
cr16_disas.h:140
CR16_COND_CS
@ CR16_COND_CS
Definition:
cr16_disas.h:137
CR16_COND_NE
@ CR16_COND_NE
Definition:
cr16_disas.h:136
CR16_INSTR_MAXLEN
#define CR16_INSTR_MAXLEN
Definition:
cr16_disas.h:7
cr16_cmd_types
cr16_cmd_types
Definition:
cr16_disas.h:10
CR16_TYPE_EI
@ CR16_TYPE_EI
Definition:
cr16_disas.h:39
CR16_TYPE_DI
@ CR16_TYPE_DI
Definition:
cr16_disas.h:38
CR16_TYPE_JAL
@ CR16_TYPE_JAL
Definition:
cr16_disas.h:30
CR16_TYPE_BE
@ CR16_TYPE_BE
Definition:
cr16_disas.h:16
CR16_TYPE_EXCP
@ CR16_TYPE_EXCP
Definition:
cr16_disas.h:28
CR16_TYPE_BNE
@ CR16_TYPE_BNE
Definition:
cr16_disas.h:17
CR16_TYPE_JUMP
@ CR16_TYPE_JUMP
Definition:
cr16_disas.h:31
CR16_TYPE_STOR
@ CR16_TYPE_STOR
Definition:
cr16_disas.h:37
CR16_TYPE_BIT
@ CR16_TYPE_BIT
Definition:
cr16_disas.h:23
CR16_TYPE_RETX
@ CR16_TYPE_RETX
Definition:
cr16_disas.h:33
CR16_TYPE_BR
@ CR16_TYPE_BR
Definition:
cr16_disas.h:27
CR16_TYPE_MOV
@ CR16_TYPE_MOV
Definition:
cr16_disas.h:11
CR16_TYPE_SLPR
@ CR16_TYPE_SLPR
Definition:
cr16_disas.h:24
CR16_TYPE_MUL
@ CR16_TYPE_MUL
Definition:
cr16_disas.h:13
CR16_TYPE_SUB
@ CR16_TYPE_SUB
Definition:
cr16_disas.h:14
CR16_TYPE_PUSH
@ CR16_TYPE_PUSH
Definition:
cr16_disas.h:34
CR16_TYPE_WAIT
@ CR16_TYPE_WAIT
Definition:
cr16_disas.h:41
CR16_TYPE_POP
@ CR16_TYPE_POP
Definition:
cr16_disas.h:35
CR16_TYPE_BAL
@ CR16_TYPE_BAL
Definition:
cr16_disas.h:26
CR16_TYPE_JUMP_UNK
@ CR16_TYPE_JUMP_UNK
Definition:
cr16_disas.h:32
CR16_TYPE_SCOND
@ CR16_TYPE_SCOND
Definition:
cr16_disas.h:20
CR16_TYPE_LOAD
@ CR16_TYPE_LOAD
Definition:
cr16_disas.h:36
CR16_TYPE_OR
@ CR16_TYPE_OR
Definition:
cr16_disas.h:19
CR16_TYPE_XOR
@ CR16_TYPE_XOR
Definition:
cr16_disas.h:21
CR16_TYPE_SHIFT
@ CR16_TYPE_SHIFT
Definition:
cr16_disas.h:22
CR16_TYPE_ADD
@ CR16_TYPE_ADD
Definition:
cr16_disas.h:12
CR16_TYPE_CMP
@ CR16_TYPE_CMP
Definition:
cr16_disas.h:15
CR16_TYPE_NOP
@ CR16_TYPE_NOP
Definition:
cr16_disas.h:40
CR16_TYPE_EWAIT
@ CR16_TYPE_EWAIT
Definition:
cr16_disas.h:42
CR16_TYPE_BCOND
@ CR16_TYPE_BCOND
Definition:
cr16_disas.h:25
CR16_TYPE_AND
@ CR16_TYPE_AND
Definition:
cr16_disas.h:18
CR16_TYPE_JCOND
@ CR16_TYPE_JCOND
Definition:
cr16_disas.h:29
cr16_decode_command
int cr16_decode_command(const ut8 *instr, struct cr16_cmd *cmd, int len)
Definition:
cr16_disas.c:1184
cmd
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
Definition:
sflib.h:79
ut8
uint8_t ut8
Definition:
lh5801.h:11
st32
#define st32
Definition:
rz_types_base.h:12
cr16_cmd
Definition:
cr16_disas.h:45
cr16_cmd::type
unsigned type
Definition:
cr16_disas.h:47
cr16_cmd::instr
char instr[CR16_INSTR_MAXLEN]
Definition:
cr16_disas.h:48
cr16_cmd::reladdr
st32 reladdr
Definition:
cr16_disas.h:46
operands
Definition:
analysis_or1k.c:9
librz
asm
arch
cr16
cr16_disas.h
Generated by
1.9.1