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 
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 
84  V810_BIT_ORU = 0x8,
92 };
93 
102  V810_EXT_XB = 0x8,
103  V810_EXT_XH = 0x9,
107 };
108 
110  V810_COND_V = 0x0,
111  V810_COND_L = 0x1,
112  V810_COND_E = 0x2,
114  V810_COND_N = 0x4,
121  V810_COND_H = 0xB,
122  V810_COND_P = 0xC,
126 };
127 
139 };
140 
141 struct v810_cmd {
142  unsigned type;
145 };
146 
147 int v810_decode_command(const ut8 *instr, int len, struct v810_cmd *cmd);
148 
149 #endif /* RZ_V810_DISASM_H */
size_t len
Definition: 6502dis.c:15
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
uint8_t ut8
Definition: lh5801.h:11
unsigned type
Definition: v810_disas.h:142
char instr[V810_INSTR_MAXLEN]
Definition: v810_disas.h:143
#define V810_INSTR_MAXLEN
Definition: v810_disas.h:7
v810_sysregs
Definition: v810_disas.h:128
@ V810_SREG_FEPC
Definition: v810_disas.h:131
@ V810_SREG_FEPSW
Definition: v810_disas.h:132
@ V810_SREG_PIR
Definition: v810_disas.h:135
@ V810_SREG_ADTRE
Definition: v810_disas.h:138
@ V810_SREG_PSW
Definition: v810_disas.h:134
@ V810_SREG_ECR
Definition: v810_disas.h:133
@ V810_SREG_EIPC
Definition: v810_disas.h:129
@ V810_SREG_TKCW
Definition: v810_disas.h:136
@ V810_SREG_EIPSW
Definition: v810_disas.h:130
@ V810_SREG_CHCW
Definition: v810_disas.h:137
v810_cmd_opcodes
Definition: v810_disas.h:22
@ V810_MUL
Definition: v810_disas.h:31
@ V810_JMP
Definition: v810_disas.h:29
@ V810_TRAP
Definition: v810_disas.h:47
@ V810_STH
Definition: v810_disas.h:67
@ V810_HALT
Definition: v810_disas.h:49
@ V810_JR
Definition: v810_disas.h:57
@ V810_CLI
Definition: v810_disas.h:45
@ V810_LDW
Definition: v810_disas.h:65
@ V810_NOT
Definition: v810_disas.h:38
@ V810_DIV
Definition: v810_disas.h:32
@ V810_OUTW
Definition: v810_disas.h:76
@ V810_OR
Definition: v810_disas.h:35
@ V810_BCOND
Definition: v810_disas.h:54
@ V810_MULU
Definition: v810_disas.h:33
@ V810_JAL
Definition: v810_disas.h:58
@ V810_CMP
Definition: v810_disas.h:26
@ V810_XOR
Definition: v810_disas.h:37
@ V810_MOVEA
Definition: v810_disas.h:55
@ V810_STW
Definition: v810_disas.h:68
@ V810_DIVU
Definition: v810_disas.h:34
@ V810_INH
Definition: v810_disas.h:70
@ V810_EXT
Definition: v810_disas.h:75
@ V810_MOV_IMM5
Definition: v810_disas.h:39
@ V810_ADDI
Definition: v810_disas.h:56
@ V810_STSR
Definition: v810_disas.h:51
@ V810_OUTH
Definition: v810_disas.h:74
@ V810_CAXI
Definition: v810_disas.h:71
@ V810_BSTR
Definition: v810_disas.h:53
@ V810_LDSR
Definition: v810_disas.h:50
@ V810_SUB
Definition: v810_disas.h:25
@ V810_MOVHI
Definition: v810_disas.h:62
@ V810_SHL
Definition: v810_disas.h:27
@ V810_SETF
Definition: v810_disas.h:41
@ V810_SAR
Definition: v810_disas.h:30
@ V810_OUTB
Definition: v810_disas.h:73
@ V810_AND
Definition: v810_disas.h:36
@ V810_RETI
Definition: v810_disas.h:48
@ V810_ADD_IMM5
Definition: v810_disas.h:40
@ V810_LDH
Definition: v810_disas.h:64
@ V810_ADD
Definition: v810_disas.h:24
@ V810_SHR_IMM5
Definition: v810_disas.h:44
@ V810_LDB
Definition: v810_disas.h:63
@ V810_ORI
Definition: v810_disas.h:59
@ V810_STB
Definition: v810_disas.h:66
@ V810_ANDI
Definition: v810_disas.h:60
@ V810_CMP_IMM5
Definition: v810_disas.h:42
@ V810_INB
Definition: v810_disas.h:69
@ V810_INW
Definition: v810_disas.h:72
@ V810_SHL_IMM5
Definition: v810_disas.h:43
@ V810_XORI
Definition: v810_disas.h:61
@ V810_MOV
Definition: v810_disas.h:23
@ V810_SEI
Definition: v810_disas.h:52
@ V810_SHR
Definition: v810_disas.h:28
@ V810_SAR_IMM5
Definition: v810_disas.h:46
int v810_decode_command(const ut8 *instr, int len, struct v810_cmd *cmd)
Definition: v810_disas.c:309
v810_ext_ops
Definition: v810_disas.h:94
@ V810_EXT_CMPF_S
Definition: v810_disas.h:95
@ V810_EXT_TRNC_SW
Definition: v810_disas.h:105
@ V810_EXT_REV
Definition: v810_disas.h:104
@ V810_EXT_CVT_WS
Definition: v810_disas.h:96
@ V810_EXT_XH
Definition: v810_disas.h:103
@ V810_EXT_XB
Definition: v810_disas.h:102
@ V810_EXT_SUBF_S
Definition: v810_disas.h:99
@ V810_EXT_ADDF_S
Definition: v810_disas.h:98
@ V810_EXT_CVT_SW
Definition: v810_disas.h:97
@ V810_EXT_DIVF_S
Definition: v810_disas.h:101
@ V810_EXT_MPYHW
Definition: v810_disas.h:106
@ V810_EXT_MULF_S
Definition: v810_disas.h:100
v810_conds
Definition: v810_disas.h:109
@ V810_COND_NE
Definition: v810_disas.h:120
@ V810_COND_NONE
Definition: v810_disas.h:115
@ V810_COND_GT
Definition: v810_disas.h:125
@ V810_COND_E
Definition: v810_disas.h:112
@ V810_COND_NOP
Definition: v810_disas.h:123
@ V810_COND_H
Definition: v810_disas.h:121
@ V810_COND_LE
Definition: v810_disas.h:117
@ V810_COND_V
Definition: v810_disas.h:110
@ V810_COND_GE
Definition: v810_disas.h:124
@ V810_COND_NL
Definition: v810_disas.h:119
@ V810_COND_N
Definition: v810_disas.h:114
@ V810_COND_NH
Definition: v810_disas.h:113
@ V810_COND_NV
Definition: v810_disas.h:118
@ V810_COND_L
Definition: v810_disas.h:111
@ V810_COND_LT
Definition: v810_disas.h:116
@ V810_COND_P
Definition: v810_disas.h:122
v810_bit_ops
Definition: v810_disas.h:79
@ V810_BIT_SCH0D
Definition: v810_disas.h:81
@ V810_BIT_ORU
Definition: v810_disas.h:84
@ V810_BIT_SCH0U
Definition: v810_disas.h:80
@ V810_BIT_ORNU
Definition: v810_disas.h:88
@ V810_BIT_SCH1D
Definition: v810_disas.h:83
@ V810_BIT_SCH1U
Definition: v810_disas.h:82
@ V810_BIT_MOVU
Definition: v810_disas.h:87
@ V810_BIT_XORU
Definition: v810_disas.h:86
@ V810_BIT_NOTU
Definition: v810_disas.h:91
@ V810_BIT_ANDNU
Definition: v810_disas.h:89
@ V810_BIT_XORNU
Definition: v810_disas.h:90
@ V810_BIT_ANDU
Definition: v810_disas.h:85