summaryrefslogtreecommitdiff
path: root/sys/arch/sh/include/sh_opcode.h
blob: 3fad67a443ca923f2ab53daca35e22cd8876d433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*	$OpenBSD: sh_opcode.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $	*/
/*	$NetBSD: sh_opcode.h,v 1.3 2002/04/28 17:10:36 uch Exp $ */

typedef union {
	unsigned word;

#if _BYTE_ORDER == BIG_ENDIAN
	struct {
		unsigned op: 16;
	} oType;

	struct {
		unsigned op1: 4;
		unsigned n: 4;
		unsigned op2: 8;
	} nType;

	struct {
		unsigned op1: 4;
		unsigned m: 4;
		unsigned op2: 8;
	} mType;

	struct {
		unsigned op1: 4;
		unsigned n: 4;
		unsigned m: 4;
		unsigned op2: 4;
	} nmType;

	struct {
		unsigned op: 8;
		unsigned m: 4;
		unsigned d: 4;
	} mdType;

	struct {
		unsigned op: 8;
		unsigned n: 4;
		unsigned d: 4;
	} nd4Type;

	struct {
		unsigned op: 4;
		unsigned n: 4;
		unsigned m: 4;
		unsigned d: 4;
	} nmdType;

	struct {
		unsigned op: 8;
		unsigned d: 8;
	} dType;

	struct {
		unsigned op: 4;
		unsigned d: 12;
	} d12Type;

	struct {
		unsigned op: 4;
		unsigned n: 4;
		unsigned d: 8;
	} nd8Type;

	struct {
		unsigned op: 8;
		unsigned i: 8;
	} iType;

	struct {
		unsigned op: 4;
		unsigned n: 4;
		unsigned i: 8;
	} niType;
#endif
#if _BYTE_ORDER == LITTLE_ENDIAN
struct {
		unsigned op: 16;
	} oType;

	struct {
		unsigned op2: 8;
		unsigned n: 4;
		unsigned op1: 4;
	} nType;

	struct {
		unsigned op2: 8;
		unsigned m: 4;
		unsigned op1: 4;
	} mType;

	struct {
		unsigned op2: 4;
		unsigned m: 4;
		unsigned n: 4;
		unsigned op1: 4;
	} nmType;

	struct {
		unsigned d: 4;
		unsigned m: 4;
		unsigned op: 8;
	} mdType;

	struct {
		unsigned d: 4;
		unsigned n: 4;
		unsigned op: 8;
	} nd4Type;

	struct {
		unsigned d: 4;
		unsigned m: 4;
		unsigned n: 4;
		unsigned op: 4;
	} nmdType;

	struct {
		unsigned d: 8;
		unsigned op: 8;
	} dType;

	struct {
		unsigned d: 12;
		unsigned op: 4;
	} d12Type;

	struct {
		unsigned d: 8;
		unsigned n: 4;
		unsigned op: 4;
	} nd8Type;

	struct {
		unsigned i: 8;
		unsigned op: 8;
	} iType;

	struct {
		unsigned i: 8;
		unsigned n: 4;
		unsigned op: 4;
	} niType;
#endif
} InstFmt;

#define	OP_BF	0x8b
#define	OP_BFS	0x8f
#define	OP_BT	0x89
#define	OP_BTS	0x8d
#define	OP_BRA	0xa
#define	OP_BSR	0xb
#define	OP1_BRAF	0x0
#define	OP2_BRAF	0x23
#define	OP1_BSRF	0x0
#define	OP2_BSRF	0x03
#define	OP1_JMP	0x4
#define	OP2_JMP	0x2b
#define	OP1_JSR	0x4
#define	OP2_JSR	0x0b
#define	OP_RTS	0xffff