Rizin
unix-like reverse engineering framework and cli tools
v850_disas.h File Reference

Go to the source code of this file.

Classes

struct  v850_cmd
 

Macros

#define V850_INSTR_MAXLEN   24
 
#define SIGN_EXT_T5(imm)   (((imm)&0x10) ? (imm) | 0xE0 : (imm))
 
#define SIGN_EXT_T9(imm)   (((imm)&0x100) ? (imm) | 0xFFFFFE00 : (imm))
 
#define SIGN_EXT_T26(imm)   (((imm)&0x2000000) ? (imm) | 0xFC000000 : (imm))
 

Enumerations

enum  v850_cmd_opcodes {
  V850_MOV = 0x0 , V850_NOT = 0x1 , V850_DIVH = 0x2 , V850_JMP = 0x3 ,
  V850_SATSUBR = 0x4 , V850_SATSUB = 0x5 , V850_SATADD = 0x6 , V850_MULH = 0x7 ,
  V850_OR = 0x8 , V850_XOR = 0x9 , V850_AND = 0xA , V850_TST = 0xB ,
  V850_SUBR = 0xC , V850_SUB = 0xD , V850_ADD = 0xE , V850_CMP = 0xF ,
  V850_MOV_IMM5 = 0x10 , V850_SATADD_IMM5 = 0x11 , V850_ADD_IMM5 = 0x12 , V850_CMP_IMM5 = 0x13 ,
  V850_SHR_IMM5 = 0x14 , V850_SAR_IMM5 = 0x15 , V850_SHL_IMM5 = 0x16 , V850_MULH_IMM5 = 0x17 ,
  V850_SLDB = 0x18 , V850_SSTB = 0x1C , V850_SLDH = 0x20 , V850_SSTH = 0x24 ,
  V850_SLDW = 0x28 , V850_SSTW = 0x29 , V850_BCOND = 0x2C , V850_BCOND2 = 0x2D ,
  V850_BCOND3 = 0x2E , V850_BCOND4 = 0x2F , V850_ADDI = 0x30 , V850_MOVEA = 0x31 ,
  V850_MOVHI = 0x32 , V850_SATSUBI = 0x33 , V850_ORI = 0x34 , V850_XORI = 0x35 ,
  V850_ANDI = 0x36 , V850_MULHI = 0x37 , V850_LDB = 0x38 , V850_LDHW = 0x39 ,
  V850_STB = 0x3A , V850_STHW = 0x3B , V850_JARL1 = 0x3C , V850_JARL2 = 0x3D ,
  V850_BIT_MANIP = 0x3E , V850_EXT1 = 0x3F
}
 
enum  v850_conds {
  V850_COND_V = 0x0 , V850_COND_CL = 0x1 , V850_COND_ZE = 0x2 , V850_COND_NH = 0x3 ,
  V850_COND_N = 0x4 , V850_COND_AL = 0x5 , V850_COND_LT = 0x6 , V850_COND_LE = 0x7 ,
  V850_COND_NV = 0x8 , V850_COND_NL = 0x9 , V850_COND_NC = 0x9 , V850_COND_NE = 0xA ,
  V850_COND_NZ = 0xA , V850_COND_H = 0xB , V850_COND_P = 0xC , V850_COND_NS = 0xC ,
  V850_COND_SA = 0xD , V850_COND_GE = 0xE , V850_COND_GT = 0xF
}
 
enum  v850_bit_ops { V850_BIT_SET1 = 0x0 , V850_BIT_NOT1 = 0x1 , V850_BIT_CLR1 = 0x2 , V850_BIT_TST1 = 0x3 }
 
enum  v850_extension1 {
  V850_EXT_SETF = 0x0 , V850_EXT_LDSR = 0x1 , V850_EXT_STSR = 0x2 , V850_EXT_UNDEF1 = 0x3 ,
  V850_EXT_SHR = 0x4 , V850_EXT_SAR = 0x5 , V850_EXT_SHL = 0x6 , V850_EXT_UNDEF2 = 0x7 ,
  V850_EXT_TRAP = 0x8 , V850_EXT_HALT = 0x9 , V850_EXT_RETI = 0xa , V850_EXT_EXT2 = 0xb
}
 
enum  v850_extension2 { V850_EXT_DI = 0x0 , V850_EXT_EI = 0x4 }
 
enum  v850_regs {
  V850_ZERO = 0x0 , V850_R1 = 0x1 , V850_R2 = 0x2 , V850_SP = 0x3 ,
  V850_GP = 0x4 , V850_TP = 0x5 , V850_R6 = 0x6 , V850_R7 = 0x7 ,
  V850_R8 = 0x8 , V850_R9 = 0x9 , V850_R10 = 0xA , V850_R11 = 0xB ,
  V850_R12 = 0xC , V850_R13 = 0xD , V850_R14 = 0xE , V850_R15 = 0xF ,
  V850_R16 = 0x10 , V850_R17 = 0x11 , V850_R18 = 0x12 , V850_R19 = 0x13 ,
  V850_R20 = 0x14 , V850_R21 = 0x15 , V850_R22 = 0x16 , V850_R23 = 0x17 ,
  V850_R24 = 0x18 , V850_R25 = 0x19 , V850_R26 = 0x1A , V850_R27 = 0x1B ,
  V850_R28 = 0x1C , V850_R29 = 0x1D , V850_EP = 0x1E , V850_LP = 0x1F
}
 
enum  v850_sysregs {
  V850_SREG_EIPC = 0x0 , V850_SREG_EIPCW = 0x1 , V850_SREG_FEPC = 0x2 , V850_SREG_FEPSW = 0x3 ,
  V850_SREG_ECR = 0x4 , V850_SREG_PSW = 0x5 , V850_SREG_CTPC = 0x10 , V850_SREG_CTPSW = 0x11 ,
  V850_SREG_DBPC = 0x12 , V850_SREG_DBPSW = 0x13 , V850_SREG_CTBP = 0x14 , V850_SREG_DIR = 0x15
}
 
enum  v850_flags { V850_FLAG_CY = 1 , V850_FLAG_OV , V850_FLAG_S , V850_FLAG_Z }
 

Functions

static ut8 get_opcode (const ut16 instr)
 
static ut8 get_subopcode (const ut16 instr)
 
static ut8 get_reg1 (const ut16 instr)
 
static ut8 get_reg2 (const ut16 instr)
 
int v850_decode_command (const ut8 *instr, int len, struct v850_cmd *cmd)
 

Macro Definition Documentation

◆ SIGN_EXT_T26

#define SIGN_EXT_T26 (   imm)    (((imm)&0x2000000) ? (imm) | 0xFC000000 : (imm))

Definition at line 11 of file v850_disas.h.

◆ SIGN_EXT_T5

#define SIGN_EXT_T5 (   imm)    (((imm)&0x10) ? (imm) | 0xE0 : (imm))

Definition at line 9 of file v850_disas.h.

◆ SIGN_EXT_T9

#define SIGN_EXT_T9 (   imm)    (((imm)&0x100) ? (imm) | 0xFFFFFE00 : (imm))

Definition at line 10 of file v850_disas.h.

◆ V850_INSTR_MAXLEN

#define V850_INSTR_MAXLEN   24

Definition at line 7 of file v850_disas.h.

Enumeration Type Documentation

◆ v850_bit_ops

Enumerator
V850_BIT_SET1 
V850_BIT_NOT1 
V850_BIT_CLR1 
V850_BIT_TST1 

Definition at line 88 of file v850_disas.h.

88  {
89  V850_BIT_SET1 = 0x0,
90  V850_BIT_NOT1 = 0x1,
91  V850_BIT_CLR1 = 0x2,
92  V850_BIT_TST1 = 0x3,
93 };
@ V850_BIT_SET1
Definition: v850_disas.h:89
@ V850_BIT_NOT1
Definition: v850_disas.h:90
@ V850_BIT_TST1
Definition: v850_disas.h:92
@ V850_BIT_CLR1
Definition: v850_disas.h:91

◆ v850_cmd_opcodes

Enumerator
V850_MOV 
V850_NOT 
V850_DIVH 
V850_JMP 
V850_SATSUBR 
V850_SATSUB 
V850_SATADD 
V850_MULH 
V850_OR 
V850_XOR 
V850_AND 
V850_TST 
V850_SUBR 
V850_SUB 
V850_ADD 
V850_CMP 
V850_MOV_IMM5 
V850_SATADD_IMM5 
V850_ADD_IMM5 
V850_CMP_IMM5 
V850_SHR_IMM5 
V850_SAR_IMM5 
V850_SHL_IMM5 
V850_MULH_IMM5 
V850_SLDB 
V850_SSTB 
V850_SLDH 
V850_SSTH 
V850_SLDW 
V850_SSTW 
V850_BCOND 
V850_BCOND2 
V850_BCOND3 
V850_BCOND4 
V850_ADDI 
V850_MOVEA 
V850_MOVHI 
V850_SATSUBI 
V850_ORI 
V850_XORI 
V850_ANDI 
V850_MULHI 
V850_LDB 
V850_LDHW 
V850_STB 
V850_STHW 
V850_JARL1 
V850_JARL2 
V850_BIT_MANIP 
V850_EXT1 

Definition at line 13 of file v850_disas.h.

13  {
14  V850_MOV = 0x0,
15  V850_NOT = 0x1,
16  V850_DIVH = 0x2,
17  V850_JMP = 0x3,
18  V850_SATSUBR = 0x4,
19  V850_SATSUB = 0x5,
20  V850_SATADD = 0x6,
21  V850_MULH = 0x7,
22  V850_OR = 0x8,
23  V850_XOR = 0x9,
24  V850_AND = 0xA,
25  V850_TST = 0xB,
26  V850_SUBR = 0xC,
27  V850_SUB = 0xD,
28  V850_ADD = 0xE,
29  V850_CMP = 0xF,
30  V850_MOV_IMM5 = 0x10,
31  V850_SATADD_IMM5 = 0x11,
32  V850_ADD_IMM5 = 0x12,
33  V850_CMP_IMM5 = 0x13,
34  V850_SHR_IMM5 = 0x14,
35  V850_SAR_IMM5 = 0x15,
36  V850_SHL_IMM5 = 0x16,
37  V850_MULH_IMM5 = 0x17,
38  V850_SLDB = 0x18,
39  V850_SSTB = 0x1C,
40  V850_SLDH = 0x20,
41  V850_SSTH = 0x24,
42  V850_SLDW = 0x28,
43  V850_SSTW = 0x29,
44  V850_BCOND = 0x2C,
45  V850_BCOND2 = 0x2D,
46  V850_BCOND3 = 0x2E,
47  V850_BCOND4 = 0x2F,
48  V850_ADDI = 0x30,
49  V850_MOVEA = 0x31,
50  V850_MOVHI = 0x32,
51  V850_SATSUBI = 0x33,
52  V850_ORI = 0x34,
53  V850_XORI = 0x35,
54  V850_ANDI = 0x36,
55  V850_MULHI = 0x37,
56  V850_LDB = 0x38,
57  V850_LDHW = 0x39,
58  V850_STB = 0x3A,
59  V850_STHW = 0x3B,
60  V850_JARL1 = 0x3C,
61  V850_JARL2 = 0x3D,
62  V850_BIT_MANIP = 0x3E,
63  V850_EXT1 = 0x3F,
64 };
@ V850_MULH_IMM5
Definition: v850_disas.h:37
@ V850_SAR_IMM5
Definition: v850_disas.h:35
@ V850_SLDB
Definition: v850_disas.h:38
@ V850_BIT_MANIP
Definition: v850_disas.h:62
@ V850_STHW
Definition: v850_disas.h:59
@ V850_AND
Definition: v850_disas.h:24
@ V850_TST
Definition: v850_disas.h:25
@ V850_ADDI
Definition: v850_disas.h:48
@ V850_LDB
Definition: v850_disas.h:56
@ V850_SLDH
Definition: v850_disas.h:40
@ V850_SUBR
Definition: v850_disas.h:26
@ V850_ADD
Definition: v850_disas.h:28
@ V850_CMP_IMM5
Definition: v850_disas.h:33
@ V850_EXT1
Definition: v850_disas.h:63
@ V850_XORI
Definition: v850_disas.h:53
@ V850_JMP
Definition: v850_disas.h:17
@ V850_JARL1
Definition: v850_disas.h:60
@ V850_SHR_IMM5
Definition: v850_disas.h:34
@ V850_OR
Definition: v850_disas.h:22
@ V850_SATSUBI
Definition: v850_disas.h:51
@ V850_SUB
Definition: v850_disas.h:27
@ V850_DIVH
Definition: v850_disas.h:16
@ V850_BCOND4
Definition: v850_disas.h:47
@ V850_ORI
Definition: v850_disas.h:52
@ V850_MOV_IMM5
Definition: v850_disas.h:30
@ V850_SATSUBR
Definition: v850_disas.h:18
@ V850_NOT
Definition: v850_disas.h:15
@ V850_LDHW
Definition: v850_disas.h:57
@ V850_MOVEA
Definition: v850_disas.h:49
@ V850_STB
Definition: v850_disas.h:58
@ V850_MOV
Definition: v850_disas.h:14
@ V850_SLDW
Definition: v850_disas.h:42
@ V850_SSTH
Definition: v850_disas.h:41
@ V850_MOVHI
Definition: v850_disas.h:50
@ V850_BCOND3
Definition: v850_disas.h:46
@ V850_SATADD_IMM5
Definition: v850_disas.h:31
@ V850_SATADD
Definition: v850_disas.h:20
@ V850_MULH
Definition: v850_disas.h:21
@ V850_SHL_IMM5
Definition: v850_disas.h:36
@ V850_ADD_IMM5
Definition: v850_disas.h:32
@ V850_SSTW
Definition: v850_disas.h:43
@ V850_XOR
Definition: v850_disas.h:23
@ V850_SSTB
Definition: v850_disas.h:39
@ V850_MULHI
Definition: v850_disas.h:55
@ V850_CMP
Definition: v850_disas.h:29
@ V850_BCOND2
Definition: v850_disas.h:45
@ V850_ANDI
Definition: v850_disas.h:54
@ V850_SATSUB
Definition: v850_disas.h:19
@ V850_JARL2
Definition: v850_disas.h:61
@ V850_BCOND
Definition: v850_disas.h:44

◆ v850_conds

enum v850_conds
Enumerator
V850_COND_V 
V850_COND_CL 
V850_COND_ZE 
V850_COND_NH 
V850_COND_N 
V850_COND_AL 
V850_COND_LT 
V850_COND_LE 
V850_COND_NV 
V850_COND_NL 
V850_COND_NC 
V850_COND_NE 
V850_COND_NZ 
V850_COND_H 
V850_COND_P 
V850_COND_NS 
V850_COND_SA 
V850_COND_GE 
V850_COND_GT 

Definition at line 66 of file v850_disas.h.

66  {
67  V850_COND_V = 0x0, // Overflow
68  V850_COND_CL = 0x1, // Carry/Lower
69  V850_COND_ZE = 0x2, // Zero/equal
70  V850_COND_NH = 0x3, // Not higher
71  V850_COND_N = 0x4, // Negative
72  V850_COND_AL = 0x5, // Always
73  V850_COND_LT = 0x6, // Less than signed
74  V850_COND_LE = 0x7, // Less than or equal signed
75  V850_COND_NV = 0x8, // No overflow
76  V850_COND_NL = 0x9, // No carry / not lower
77  V850_COND_NC = 0x9, // No carry / not lower
78  V850_COND_NE = 0xA, // Not zero / not equal
79  V850_COND_NZ = 0xA, // Not zero / not equal
80  V850_COND_H = 0xB, // Higher/Greater than
81  V850_COND_P = 0xC, // Positive / not sign
82  V850_COND_NS = 0xC, // Positive / not sign
83  V850_COND_SA = 0xD, // Saturated
84  V850_COND_GE = 0xE, // Greater than or equal signed
85  V850_COND_GT = 0xF, // Greater than signed
86 };
@ V850_COND_H
Definition: v850_disas.h:80
@ V850_COND_NZ
Definition: v850_disas.h:79
@ V850_COND_ZE
Definition: v850_disas.h:69
@ V850_COND_LT
Definition: v850_disas.h:73
@ V850_COND_N
Definition: v850_disas.h:71
@ V850_COND_V
Definition: v850_disas.h:67
@ V850_COND_CL
Definition: v850_disas.h:68
@ V850_COND_NL
Definition: v850_disas.h:76
@ V850_COND_P
Definition: v850_disas.h:81
@ V850_COND_NE
Definition: v850_disas.h:78
@ V850_COND_GE
Definition: v850_disas.h:84
@ V850_COND_NV
Definition: v850_disas.h:75
@ V850_COND_NS
Definition: v850_disas.h:82
@ V850_COND_GT
Definition: v850_disas.h:85
@ V850_COND_SA
Definition: v850_disas.h:83
@ V850_COND_AL
Definition: v850_disas.h:72
@ V850_COND_LE
Definition: v850_disas.h:74
@ V850_COND_NH
Definition: v850_disas.h:70
@ V850_COND_NC
Definition: v850_disas.h:77

◆ v850_extension1

Enumerator
V850_EXT_SETF 
V850_EXT_LDSR 
V850_EXT_STSR 
V850_EXT_UNDEF1 
V850_EXT_SHR 
V850_EXT_SAR 
V850_EXT_SHL 
V850_EXT_UNDEF2 
V850_EXT_TRAP 
V850_EXT_HALT 
V850_EXT_RETI 
V850_EXT_EXT2 

Definition at line 95 of file v850_disas.h.

95  {
96  V850_EXT_SETF = 0x0,
97  V850_EXT_LDSR = 0x1,
98  V850_EXT_STSR = 0x2,
99  V850_EXT_UNDEF1 = 0x3,
100  V850_EXT_SHR = 0x4,
101  V850_EXT_SAR = 0x5,
102  V850_EXT_SHL = 0x6,
103  V850_EXT_UNDEF2 = 0x7,
104  V850_EXT_TRAP = 0x8,
105  V850_EXT_HALT = 0x9,
106  V850_EXT_RETI = 0xa,
107  V850_EXT_EXT2 = 0xb,
108 };
@ V850_EXT_UNDEF1
Definition: v850_disas.h:99
@ V850_EXT_LDSR
Definition: v850_disas.h:97
@ V850_EXT_SHL
Definition: v850_disas.h:102
@ V850_EXT_SHR
Definition: v850_disas.h:100
@ V850_EXT_SAR
Definition: v850_disas.h:101
@ V850_EXT_UNDEF2
Definition: v850_disas.h:103
@ V850_EXT_EXT2
Definition: v850_disas.h:107
@ V850_EXT_HALT
Definition: v850_disas.h:105
@ V850_EXT_RETI
Definition: v850_disas.h:106
@ V850_EXT_STSR
Definition: v850_disas.h:98
@ V850_EXT_TRAP
Definition: v850_disas.h:104
@ V850_EXT_SETF
Definition: v850_disas.h:96

◆ v850_extension2

Enumerator
V850_EXT_DI 
V850_EXT_EI 

Definition at line 110 of file v850_disas.h.

110  {
111  V850_EXT_DI = 0x0,
112  V850_EXT_EI = 0x4,
113 };
@ V850_EXT_EI
Definition: v850_disas.h:112
@ V850_EXT_DI
Definition: v850_disas.h:111

◆ v850_flags

enum v850_flags
Enumerator
V850_FLAG_CY 
V850_FLAG_OV 
V850_FLAG_S 
V850_FLAG_Z 

Definition at line 165 of file v850_disas.h.

165  {
166  V850_FLAG_CY = 1,
167  V850_FLAG_OV,
168  V850_FLAG_S,
169  V850_FLAG_Z,
170 };
@ V850_FLAG_CY
Definition: v850_disas.h:166
@ V850_FLAG_OV
Definition: v850_disas.h:167
@ V850_FLAG_S
Definition: v850_disas.h:168
@ V850_FLAG_Z
Definition: v850_disas.h:169

◆ v850_regs

enum v850_regs
Enumerator
V850_ZERO 
V850_R1 
V850_R2 
V850_SP 
V850_GP 
V850_TP 
V850_R6 
V850_R7 
V850_R8 
V850_R9 
V850_R10 
V850_R11 
V850_R12 
V850_R13 
V850_R14 
V850_R15 
V850_R16 
V850_R17 
V850_R18 
V850_R19 
V850_R20 
V850_R21 
V850_R22 
V850_R23 
V850_R24 
V850_R25 
V850_R26 
V850_R27 
V850_R28 
V850_R29 
V850_EP 
V850_LP 

Definition at line 115 of file v850_disas.h.

115  {
116  V850_ZERO = 0x0,
117  V850_R1 = 0x1,
118  V850_R2 = 0x2,
119  V850_SP = 0x3,
120  V850_GP = 0x4,
121  V850_TP = 0x5,
122  V850_R6 = 0x6,
123  V850_R7 = 0x7,
124  V850_R8 = 0x8,
125  V850_R9 = 0x9,
126  V850_R10 = 0xA,
127  V850_R11 = 0xB,
128  V850_R12 = 0xC,
129  V850_R13 = 0xD,
130  V850_R14 = 0xE,
131  V850_R15 = 0xF,
132  V850_R16 = 0x10,
133  V850_R17 = 0x11,
134  V850_R18 = 0x12,
135  V850_R19 = 0x13,
136  V850_R20 = 0x14,
137  V850_R21 = 0x15,
138  V850_R22 = 0x16,
139  V850_R23 = 0x17,
140  V850_R24 = 0x18,
141  V850_R25 = 0x19,
142  V850_R26 = 0x1A,
143  V850_R27 = 0x1B,
144  V850_R28 = 0x1C,
145  V850_R29 = 0x1D,
146  V850_EP = 0x1E,
147  V850_LP = 0x1F,
148 };
@ V850_R9
Definition: v850_disas.h:125
@ V850_R22
Definition: v850_disas.h:138
@ V850_R27
Definition: v850_disas.h:143
@ V850_R25
Definition: v850_disas.h:141
@ V850_R14
Definition: v850_disas.h:130
@ V850_R15
Definition: v850_disas.h:131
@ V850_R19
Definition: v850_disas.h:135
@ V850_R13
Definition: v850_disas.h:129
@ V850_GP
Definition: v850_disas.h:120
@ V850_R18
Definition: v850_disas.h:134
@ V850_ZERO
Definition: v850_disas.h:116
@ V850_R24
Definition: v850_disas.h:140
@ V850_LP
Definition: v850_disas.h:147
@ V850_R12
Definition: v850_disas.h:128
@ V850_R10
Definition: v850_disas.h:126
@ V850_R17
Definition: v850_disas.h:133
@ V850_R6
Definition: v850_disas.h:122
@ V850_EP
Definition: v850_disas.h:146
@ V850_R23
Definition: v850_disas.h:139
@ V850_R29
Definition: v850_disas.h:145
@ V850_R1
Definition: v850_disas.h:117
@ V850_R28
Definition: v850_disas.h:144
@ V850_R16
Definition: v850_disas.h:132
@ V850_R2
Definition: v850_disas.h:118
@ V850_R8
Definition: v850_disas.h:124
@ V850_R26
Definition: v850_disas.h:142
@ V850_R21
Definition: v850_disas.h:137
@ V850_R7
Definition: v850_disas.h:123
@ V850_R11
Definition: v850_disas.h:127
@ V850_R20
Definition: v850_disas.h:136
@ V850_TP
Definition: v850_disas.h:121
@ V850_SP
Definition: v850_disas.h:119

◆ v850_sysregs

Enumerator
V850_SREG_EIPC 
V850_SREG_EIPCW 
V850_SREG_FEPC 
V850_SREG_FEPSW 
V850_SREG_ECR 
V850_SREG_PSW 
V850_SREG_CTPC 
V850_SREG_CTPSW 
V850_SREG_DBPC 
V850_SREG_DBPSW 
V850_SREG_CTBP 
V850_SREG_DIR 

Definition at line 150 of file v850_disas.h.

150  {
151  V850_SREG_EIPC = 0x0,
152  V850_SREG_EIPCW = 0x1,
153  V850_SREG_FEPC = 0x2,
154  V850_SREG_FEPSW = 0x3,
155  V850_SREG_ECR = 0x4,
156  V850_SREG_PSW = 0x5,
157  V850_SREG_CTPC = 0x10,
158  V850_SREG_CTPSW = 0x11,
159  V850_SREG_DBPC = 0x12,
160  V850_SREG_DBPSW = 0x13,
161  V850_SREG_CTBP = 0x14,
162  V850_SREG_DIR = 0x15,
163 };
@ V850_SREG_DBPC
Definition: v850_disas.h:159
@ V850_SREG_CTPC
Definition: v850_disas.h:157
@ V850_SREG_ECR
Definition: v850_disas.h:155
@ V850_SREG_CTPSW
Definition: v850_disas.h:158
@ V850_SREG_EIPCW
Definition: v850_disas.h:152
@ V850_SREG_PSW
Definition: v850_disas.h:156
@ V850_SREG_FEPC
Definition: v850_disas.h:153
@ V850_SREG_FEPSW
Definition: v850_disas.h:154
@ V850_SREG_CTBP
Definition: v850_disas.h:161
@ V850_SREG_DIR
Definition: v850_disas.h:162
@ V850_SREG_EIPC
Definition: v850_disas.h:151
@ V850_SREG_DBPSW
Definition: v850_disas.h:160

Function Documentation

◆ get_opcode()

static ut8 get_opcode ( const ut16  instr)
inlinestatic

Definition at line 179 of file v850_disas.h.

179  {
180  return (instr >> 5) & 0x3F;
181 }

◆ get_reg1()

static ut8 get_reg1 ( const ut16  instr)
inlinestatic

Definition at line 188 of file v850_disas.h.

188  {
189  return instr & 0x1F;
190 }

Referenced by decode_3operands(), decode_bit_op(), decode_extended(), decode_imm_reg(), decode_jarl(), decode_load_store(), and decode_reg_reg().

◆ get_reg2()

static ut8 get_reg2 ( const ut16  instr)
inlinestatic

Definition at line 192 of file v850_disas.h.

192  {
193  return instr >> 11;
194 }

Referenced by decode_3operands(), decode_extended(), decode_imm_reg(), decode_jarl(), decode_load_store(), and decode_reg_reg().

◆ get_subopcode()

static ut8 get_subopcode ( const ut16  instr)
inlinestatic

Definition at line 184 of file v850_disas.h.

184  {
185  return (instr & 0x7e00000) >> 21;
186 }

Referenced by decode_extended(), and v850_op().

◆ v850_decode_command()

int v850_decode_command ( const ut8 instr,
int  len,
struct v850_cmd cmd 
)

Definition at line 301 of file v850_disas.c.

301  {
302  int ret;
303 
304  if (len < 2) {
305  return -1;
306  }
307  ut16 in = rz_read_le16(instr);
308 
309  switch (get_opcode(in)) {
310  case V850_MOV:
311  case V850_NOT:
312  case V850_DIVH:
313  case V850_JMP:
314  case V850_SATSUBR:
315  case V850_SATSUB:
316  case V850_SATADD:
317  case V850_MULH:
318  case V850_OR:
319  case V850_XOR:
320  case V850_AND:
321  case V850_TST:
322  case V850_SUBR:
323  case V850_SUB:
324  case V850_ADD:
325  case V850_CMP:
326  ret = decode_reg_reg(in, cmd);
327  break;
328  case V850_MOV_IMM5:
329  case V850_SATADD_IMM5:
330  case V850_ADD_IMM5:
331  case V850_CMP_IMM5:
332  case V850_SHR_IMM5:
333  case V850_SAR_IMM5:
334  case V850_SHL_IMM5:
335  case V850_MULH_IMM5:
336  ret = decode_imm_reg(in, cmd);
337  break;
338  case V850_ADDI:
339  case V850_MOVEA:
340  case V850_MOVHI:
341  case V850_SATSUBI:
342  case V850_ORI:
343  case V850_XORI:
344  case V850_ANDI:
345  case V850_MULHI:
346  ret = decode_3operands(instr, len, cmd);
347  break;
348  case V850_JARL1:
349  case V850_JARL2:
350  ret = decode_jarl(instr, len, cmd);
351  break;
352  case V850_STB:
353  case V850_LDB:
354  case V850_LDHW:
355  case V850_STHW:
356  ret = decode_load_store(instr, len, cmd);
357  break;
358  case V850_BIT_MANIP:
359  ret = decode_bit_op(instr, len, cmd);
360  break;
361  case V850_EXT1:
362  ret = decode_extended(instr, len, cmd);
363  break;
364  default:
365  if ((get_opcode(in) >> 2) == 0xB) {
366  ret = decode_bcond(in, len, cmd);
367  } else {
368  ret = -1;
369  }
370  }
371 
372  return ret;
373 }
size_t len
Definition: 6502dis.c:15
const lzma_allocator const uint8_t * in
Definition: block.h:527
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
uint16_t ut16
#define get_opcode(insn)
Definition: libhppa.h:348
static ut16 rz_read_le16(const void *src)
Definition: rz_endian.h:206
static int decode_bit_op(const ut8 *instr, int len, struct v850_cmd *cmd)
Definition: v850_disas.c:237
static int decode_bcond(const ut16 instr, int len, struct v850_cmd *cmd)
Definition: v850_disas.c:154
static int decode_reg_reg(const ut16 instr, struct v850_cmd *cmd)
Definition: v850_disas.c:104
static int decode_extended(const ut8 *instr, int len, struct v850_cmd *cmd)
Definition: v850_disas.c:251
static int decode_load_store(const ut8 *instr, int len, struct v850_cmd *cmd)
Definition: v850_disas.c:201
static int decode_imm_reg(const ut16 instr, struct v850_cmd *cmd)
Definition: v850_disas.c:124
static int decode_jarl(const ut8 *instr, int len, struct v850_cmd *cmd)
Definition: v850_disas.c:171
static int decode_3operands(const ut8 *instr, int len, struct v850_cmd *cmd)
Definition: v850_disas.c:189

References cmd, decode_3operands(), decode_bcond(), decode_bit_op(), decode_extended(), decode_imm_reg(), decode_jarl(), decode_load_store(), decode_reg_reg(), get_opcode, in, len, rz_read_le16(), V850_ADD, V850_ADD_IMM5, V850_ADDI, V850_AND, V850_ANDI, V850_BIT_MANIP, V850_CMP, V850_CMP_IMM5, V850_DIVH, V850_EXT1, V850_JARL1, V850_JARL2, V850_JMP, V850_LDB, V850_LDHW, V850_MOV, V850_MOV_IMM5, V850_MOVEA, V850_MOVHI, V850_MULH, V850_MULH_IMM5, V850_MULHI, V850_NOT, V850_OR, V850_ORI, V850_SAR_IMM5, V850_SATADD, V850_SATADD_IMM5, V850_SATSUB, V850_SATSUBI, V850_SATSUBR, V850_SHL_IMM5, V850_SHR_IMM5, V850_STB, V850_STHW, V850_SUB, V850_SUBR, V850_TST, V850_XOR, and V850_XORI.

Referenced by disassemble(), and v850_op().