aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc-opcode.h
blob: f20a209c5936c603c9b5bb2bad2f37020d056021 (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
/* Sparc opcde list for GDB, the GNU debugger.
   Copyright (C) 1986, 1987 Free Software Foundation, Inc.
   Contributed by Michael Tiemann (tiemann@mcc.com)

GDB is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY.  No author or distributor accepts responsibility to anyone
for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing.
Refer to the GDB General Public License for full details.

Everyone is granted permission to copy, modify and redistribute GDB,
but only under the conditions described in the GDB General Public
License.  A copy of this license is supposed to have been given to you
along with GDB so you can know your rights and responsibilities.  It
should be in a file named COPYING.  Among other things, the copyright
notice and this notice must be preserved on all copies.

In other words, go ahead and share GDB, but don't try to stop
anyone else from sharing it farther.  Help stamp out software hoarding!
*/

struct op1_fmt
{
  unsigned op1 : 2;
  unsigned dummy : 30;
};

struct op2_fmt
{
  unsigned dummy1 : 7;
  unsigned op2 : 3;
  unsigned dummy2 : 22;
};

struct op3_fmt
{
  unsigned dummy1 : 7;
  unsigned op3 : 6;
  unsigned dummy2 : 19;
};

struct call_fmt
{
  unsigned op : 2;
  unsigned disp : 30;
};

struct sethi_fmt
{
  unsigned op : 2;
  unsigned rd : 5;
  unsigned op2 : 3;
  unsigned imm : 22;
};

struct branch_fmt
{
  unsigned op : 2;
  unsigned a : 1;
  unsigned cond : 4;
  unsigned op2 : 3;
  unsigned disp : 22;		/* this should really be signed.  */
};

struct ldst_fmt
{
  unsigned op : 2;
  unsigned rd : 5;
  unsigned op3 : 6;
  unsigned rs1 : 5;
  unsigned i : 1;
  unsigned asi : 8;
  unsigned rs2 : 5;
};

struct arith_imm_fmt
{
  unsigned op : 2;
  unsigned rd : 5;
  unsigned op3 : 6;
  unsigned rs1 : 5;
  unsigned i : 1;
  int simm : 13;		/* Hopefully signed, but . . . */
};

struct arith_fmt
{
  unsigned op : 2;
  unsigned rd : 5;
  unsigned op3 : 6;
  unsigned rs1 : 5;
  unsigned i : 1;
  unsigned opf : 8;
  unsigned rs2 : 5;
};

union insn_fmt
{
  struct op1_fmt op1;
  struct op2_fmt op2;
  struct op3_fmt op3;
  struct call_fmt call;
  struct sethi_fmt sethi;
  struct branch_fmt branch;
  struct ldst_fmt ldst;
  struct arith_imm_fmt arith_imm;
  struct arith_fmt arith;
  int intval;
  float floatval;		/* ?? */
};

typedef enum
{
  Error, not_branch, bicc, bicca, ba, baa, ticc, ta,
} branch_type;