Rizin
unix-like reverse engineering framework and cli tools
v810_disas.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2015 danielps
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#ifndef RZ_V810_DISASM_H
5
#define RZ_V810_DISASM_H
6
7
#define V810_INSTR_MAXLEN 24
8
9
#define OPCODE(instr) (((instr) >> 10) & 0x3F)
10
#define REG1(instr) ((instr)&0x1F)
11
#define REG2(instr) (((instr) >> 5) & 0x1F)
12
#define IMM5(instr) REG1((instr))
13
#define COND(instr) (((instr) >> 9) & 0xF)
14
15
#define SIGN_EXT_T5(imm) (((imm)&0x10) ? (imm) | 0xE0 : (imm))
16
#define SIGN_EXT_T9(imm) (((imm)&0x100) ? (imm) | 0xFFFFFE00 : (imm))
17
#define SIGN_EXT_T26(imm) (((imm)&0x2000000) ? (imm) | 0xFC000000 : (imm))
18
19
#define DISP9(word1) SIGN_EXT_T9((word1)&0x1FE)
20
#define DISP26(word1, word2) SIGN_EXT_T26((((word1)&0x3FF) << 16) | (word2))
21
22
enum
v810_cmd_opcodes
{
23
V810_MOV
= 0x0,
24
V810_ADD
= 0x1,
25
V810_SUB
= 0x2,
26
V810_CMP
= 0x3,
27
V810_SHL
= 0x4,
28
V810_SHR
= 0x5,
29
V810_JMP
= 0x6,
30
V810_SAR
= 0x7,
31
V810_MUL
= 0x8,
32
V810_DIV
= 0x9,
33
V810_MULU
= 0xA,
34
V810_DIVU
= 0xB,
35
V810_OR
= 0xC,
36
V810_AND
= 0xD,
37
V810_XOR
= 0xE,
38
V810_NOT
= 0xF,
39
V810_MOV_IMM5
= 0x10,
40
V810_ADD_IMM5
= 0x11,
41
V810_SETF
= 0x12,
42
V810_CMP_IMM5
= 0x13,
43
V810_SHL_IMM5
= 0x14,
44
V810_SHR_IMM5
= 0x15,
45
V810_CLI
= 0x16,
46
V810_SAR_IMM5
= 0x17,
47
V810_TRAP
= 0x18,
48
V810_RETI
= 0x19,
49
V810_HALT
= 0x1A,
50
V810_LDSR
= 0x1C,
51
V810_STSR
= 0x1D,
52
V810_SEI
= 0x1E,
53
V810_BSTR
= 0x1F,
54
V810_BCOND
= 0x20,
55
V810_MOVEA
= 0x28,
56
V810_ADDI
= 0x29,
57
V810_JR
= 0x2A,
58
V810_JAL
= 0x2B,
59
V810_ORI
= 0x2C,
60
V810_ANDI
= 0x2D,
61
V810_XORI
= 0x2E,
62
V810_MOVHI
= 0x2F,
63
V810_LDB
= 0x30,
64
V810_LDH
= 0x31,
65
V810_LDW
= 0x33,
66
V810_STB
= 0x34,
67
V810_STH
= 0x35,
68
V810_STW
= 0x37,
69
V810_INB
= 0x38,
70
V810_INH
= 0x39,
71
V810_CAXI
= 0x3A,
72
V810_INW
= 0x3B,
73
V810_OUTB
= 0x3C,
74
V810_OUTH
= 0x3D,
75
V810_EXT
= 0x3E,
76
V810_OUTW
= 0x3F,
77
};
78
79
enum
v810_bit_ops
{
80
V810_BIT_SCH0U
= 0x0,
81
V810_BIT_SCH0D
= 0x1,
82
V810_BIT_SCH1U
= 0x2,
83
V810_BIT_SCH1D
= 0x3,
84
V810_BIT_ORU
= 0x8,
85
V810_BIT_ANDU
= 0x9,
86
V810_BIT_XORU
= 0xA,
87
V810_BIT_MOVU
= 0xB,
88
V810_BIT_ORNU
= 0xC,
89
V810_BIT_ANDNU
= 0xD,
90
V810_BIT_XORNU
= 0xE,
91
V810_BIT_NOTU
= 0xF,
92
};
93
94
enum
v810_ext_ops
{
95
V810_EXT_CMPF_S
= 0x0,
96
V810_EXT_CVT_WS
= 0x2,
97
V810_EXT_CVT_SW
= 0x3,
98
V810_EXT_ADDF_S
= 0x4,
99
V810_EXT_SUBF_S
= 0x5,
100
V810_EXT_MULF_S
= 0x6,
101
V810_EXT_DIVF_S
= 0x7,
102
V810_EXT_XB
= 0x8,
103
V810_EXT_XH
= 0x9,
104
V810_EXT_REV
= 0xA,
105
V810_EXT_TRNC_SW
= 0xB,
106
V810_EXT_MPYHW
= 0xC,
107
};
108
109
enum
v810_conds
{
110
V810_COND_V
= 0x0,
111
V810_COND_L
= 0x1,
112
V810_COND_E
= 0x2,
113
V810_COND_NH
= 0x3,
114
V810_COND_N
= 0x4,
115
V810_COND_NONE
= 0x5,
116
V810_COND_LT
= 0x6,
117
V810_COND_LE
= 0x7,
118
V810_COND_NV
= 0x8,
119
V810_COND_NL
= 0x9,
120
V810_COND_NE
= 0xA,
121
V810_COND_H
= 0xB,
122
V810_COND_P
= 0xC,
123
V810_COND_NOP
= 0xD,
124
V810_COND_GE
= 0xE,
125
V810_COND_GT
= 0xF,
126
};
127
128
enum
v810_sysregs
{
129
V810_SREG_EIPC
= 0x0,
130
V810_SREG_EIPSW
= 0x1,
131
V810_SREG_FEPC
= 0x2,
132
V810_SREG_FEPSW
= 0x3,
133
V810_SREG_ECR
= 0x4,
134
V810_SREG_PSW
= 0x5,
135
V810_SREG_PIR
= 0x6,
136
V810_SREG_TKCW
= 0x7,
137
V810_SREG_CHCW
= 0x18,
138
V810_SREG_ADTRE
= 0x19,
139
};
140
141
struct
v810_cmd
{
142
unsigned
type
;
143
char
instr
[
V810_INSTR_MAXLEN
];
144
char
operands
[
V810_INSTR_MAXLEN
];
145
};
146
147
int
v810_decode_command
(
const
ut8
*instr,
int
len
,
struct
v810_cmd
*
cmd
);
148
149
#endif
/* RZ_V810_DISASM_H */
len
size_t len
Definition:
6502dis.c:15
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
operands
Definition:
analysis_or1k.c:9
v810_cmd
Definition:
v810_disas.h:141
v810_cmd::type
unsigned type
Definition:
v810_disas.h:142
v810_cmd::instr
char instr[V810_INSTR_MAXLEN]
Definition:
v810_disas.h:143
V810_INSTR_MAXLEN
#define V810_INSTR_MAXLEN
Definition:
v810_disas.h:7
v810_sysregs
v810_sysregs
Definition:
v810_disas.h:128
V810_SREG_FEPC
@ V810_SREG_FEPC
Definition:
v810_disas.h:131
V810_SREG_FEPSW
@ V810_SREG_FEPSW
Definition:
v810_disas.h:132
V810_SREG_PIR
@ V810_SREG_PIR
Definition:
v810_disas.h:135
V810_SREG_ADTRE
@ V810_SREG_ADTRE
Definition:
v810_disas.h:138
V810_SREG_PSW
@ V810_SREG_PSW
Definition:
v810_disas.h:134
V810_SREG_ECR
@ V810_SREG_ECR
Definition:
v810_disas.h:133
V810_SREG_EIPC
@ V810_SREG_EIPC
Definition:
v810_disas.h:129
V810_SREG_TKCW
@ V810_SREG_TKCW
Definition:
v810_disas.h:136
V810_SREG_EIPSW
@ V810_SREG_EIPSW
Definition:
v810_disas.h:130
V810_SREG_CHCW
@ V810_SREG_CHCW
Definition:
v810_disas.h:137
v810_cmd_opcodes
v810_cmd_opcodes
Definition:
v810_disas.h:22
V810_MUL
@ V810_MUL
Definition:
v810_disas.h:31
V810_JMP
@ V810_JMP
Definition:
v810_disas.h:29
V810_TRAP
@ V810_TRAP
Definition:
v810_disas.h:47
V810_STH
@ V810_STH
Definition:
v810_disas.h:67
V810_HALT
@ V810_HALT
Definition:
v810_disas.h:49
V810_JR
@ V810_JR
Definition:
v810_disas.h:57
V810_CLI
@ V810_CLI
Definition:
v810_disas.h:45
V810_LDW
@ V810_LDW
Definition:
v810_disas.h:65
V810_NOT
@ V810_NOT
Definition:
v810_disas.h:38
V810_DIV
@ V810_DIV
Definition:
v810_disas.h:32
V810_OUTW
@ V810_OUTW
Definition:
v810_disas.h:76
V810_OR
@ V810_OR
Definition:
v810_disas.h:35
V810_BCOND
@ V810_BCOND
Definition:
v810_disas.h:54
V810_MULU
@ V810_MULU
Definition:
v810_disas.h:33
V810_JAL
@ V810_JAL
Definition:
v810_disas.h:58
V810_CMP
@ V810_CMP
Definition:
v810_disas.h:26
V810_XOR
@ V810_XOR
Definition:
v810_disas.h:37
V810_MOVEA
@ V810_MOVEA
Definition:
v810_disas.h:55
V810_STW
@ V810_STW
Definition:
v810_disas.h:68
V810_DIVU
@ V810_DIVU
Definition:
v810_disas.h:34
V810_INH
@ V810_INH
Definition:
v810_disas.h:70
V810_EXT
@ V810_EXT
Definition:
v810_disas.h:75
V810_MOV_IMM5
@ V810_MOV_IMM5
Definition:
v810_disas.h:39
V810_ADDI
@ V810_ADDI
Definition:
v810_disas.h:56
V810_STSR
@ V810_STSR
Definition:
v810_disas.h:51
V810_OUTH
@ V810_OUTH
Definition:
v810_disas.h:74
V810_CAXI
@ V810_CAXI
Definition:
v810_disas.h:71
V810_BSTR
@ V810_BSTR
Definition:
v810_disas.h:53
V810_LDSR
@ V810_LDSR
Definition:
v810_disas.h:50
V810_SUB
@ V810_SUB
Definition:
v810_disas.h:25
V810_MOVHI
@ V810_MOVHI
Definition:
v810_disas.h:62
V810_SHL
@ V810_SHL
Definition:
v810_disas.h:27
V810_SETF
@ V810_SETF
Definition:
v810_disas.h:41
V810_SAR
@ V810_SAR
Definition:
v810_disas.h:30
V810_OUTB
@ V810_OUTB
Definition:
v810_disas.h:73
V810_AND
@ V810_AND
Definition:
v810_disas.h:36
V810_RETI
@ V810_RETI
Definition:
v810_disas.h:48
V810_ADD_IMM5
@ V810_ADD_IMM5
Definition:
v810_disas.h:40
V810_LDH
@ V810_LDH
Definition:
v810_disas.h:64
V810_ADD
@ V810_ADD
Definition:
v810_disas.h:24
V810_SHR_IMM5
@ V810_SHR_IMM5
Definition:
v810_disas.h:44
V810_LDB
@ V810_LDB
Definition:
v810_disas.h:63
V810_ORI
@ V810_ORI
Definition:
v810_disas.h:59
V810_STB
@ V810_STB
Definition:
v810_disas.h:66
V810_ANDI
@ V810_ANDI
Definition:
v810_disas.h:60
V810_CMP_IMM5
@ V810_CMP_IMM5
Definition:
v810_disas.h:42
V810_INB
@ V810_INB
Definition:
v810_disas.h:69
V810_INW
@ V810_INW
Definition:
v810_disas.h:72
V810_SHL_IMM5
@ V810_SHL_IMM5
Definition:
v810_disas.h:43
V810_XORI
@ V810_XORI
Definition:
v810_disas.h:61
V810_MOV
@ V810_MOV
Definition:
v810_disas.h:23
V810_SEI
@ V810_SEI
Definition:
v810_disas.h:52
V810_SHR
@ V810_SHR
Definition:
v810_disas.h:28
V810_SAR_IMM5
@ V810_SAR_IMM5
Definition:
v810_disas.h:46
v810_decode_command
int v810_decode_command(const ut8 *instr, int len, struct v810_cmd *cmd)
Definition:
v810_disas.c:309
v810_ext_ops
v810_ext_ops
Definition:
v810_disas.h:94
V810_EXT_CMPF_S
@ V810_EXT_CMPF_S
Definition:
v810_disas.h:95
V810_EXT_TRNC_SW
@ V810_EXT_TRNC_SW
Definition:
v810_disas.h:105
V810_EXT_REV
@ V810_EXT_REV
Definition:
v810_disas.h:104
V810_EXT_CVT_WS
@ V810_EXT_CVT_WS
Definition:
v810_disas.h:96
V810_EXT_XH
@ V810_EXT_XH
Definition:
v810_disas.h:103
V810_EXT_XB
@ V810_EXT_XB
Definition:
v810_disas.h:102
V810_EXT_SUBF_S
@ V810_EXT_SUBF_S
Definition:
v810_disas.h:99
V810_EXT_ADDF_S
@ V810_EXT_ADDF_S
Definition:
v810_disas.h:98
V810_EXT_CVT_SW
@ V810_EXT_CVT_SW
Definition:
v810_disas.h:97
V810_EXT_DIVF_S
@ V810_EXT_DIVF_S
Definition:
v810_disas.h:101
V810_EXT_MPYHW
@ V810_EXT_MPYHW
Definition:
v810_disas.h:106
V810_EXT_MULF_S
@ V810_EXT_MULF_S
Definition:
v810_disas.h:100
v810_conds
v810_conds
Definition:
v810_disas.h:109
V810_COND_NE
@ V810_COND_NE
Definition:
v810_disas.h:120
V810_COND_NONE
@ V810_COND_NONE
Definition:
v810_disas.h:115
V810_COND_GT
@ V810_COND_GT
Definition:
v810_disas.h:125
V810_COND_E
@ V810_COND_E
Definition:
v810_disas.h:112
V810_COND_NOP
@ V810_COND_NOP
Definition:
v810_disas.h:123
V810_COND_H
@ V810_COND_H
Definition:
v810_disas.h:121
V810_COND_LE
@ V810_COND_LE
Definition:
v810_disas.h:117
V810_COND_V
@ V810_COND_V
Definition:
v810_disas.h:110
V810_COND_GE
@ V810_COND_GE
Definition:
v810_disas.h:124
V810_COND_NL
@ V810_COND_NL
Definition:
v810_disas.h:119
V810_COND_N
@ V810_COND_N
Definition:
v810_disas.h:114
V810_COND_NH
@ V810_COND_NH
Definition:
v810_disas.h:113
V810_COND_NV
@ V810_COND_NV
Definition:
v810_disas.h:118
V810_COND_L
@ V810_COND_L
Definition:
v810_disas.h:111
V810_COND_LT
@ V810_COND_LT
Definition:
v810_disas.h:116
V810_COND_P
@ V810_COND_P
Definition:
v810_disas.h:122
v810_bit_ops
v810_bit_ops
Definition:
v810_disas.h:79
V810_BIT_SCH0D
@ V810_BIT_SCH0D
Definition:
v810_disas.h:81
V810_BIT_ORU
@ V810_BIT_ORU
Definition:
v810_disas.h:84
V810_BIT_SCH0U
@ V810_BIT_SCH0U
Definition:
v810_disas.h:80
V810_BIT_ORNU
@ V810_BIT_ORNU
Definition:
v810_disas.h:88
V810_BIT_SCH1D
@ V810_BIT_SCH1D
Definition:
v810_disas.h:83
V810_BIT_SCH1U
@ V810_BIT_SCH1U
Definition:
v810_disas.h:82
V810_BIT_MOVU
@ V810_BIT_MOVU
Definition:
v810_disas.h:87
V810_BIT_XORU
@ V810_BIT_XORU
Definition:
v810_disas.h:86
V810_BIT_NOTU
@ V810_BIT_NOTU
Definition:
v810_disas.h:91
V810_BIT_ANDNU
@ V810_BIT_ANDNU
Definition:
v810_disas.h:89
V810_BIT_XORNU
@ V810_BIT_XORNU
Definition:
v810_disas.h:90
V810_BIT_ANDU
@ V810_BIT_ANDU
Definition:
v810_disas.h:85
librz
asm
arch
v810
v810_disas.h
Generated by
1.9.1