]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/s390-tdep.h
gdb: Convert language la_emitchar field to a method
[thirdparty/binutils-gdb.git] / gdb / s390-tdep.h
1 /* Target-dependent code for s390.
2
3 Copyright (C) 2003-2020 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef S390_TDEP_H
21 #define S390_TDEP_H
22
23 #include "prologue-value.h"
24
25 enum s390_abi_kind
26 {
27 ABI_NONE,
28 ABI_LINUX_S390,
29 ABI_LINUX_ZSERIES
30 };
31
32 enum s390_vector_abi_kind
33 {
34 S390_VECTOR_ABI_NONE,
35 S390_VECTOR_ABI_128
36 };
37
38 /* The tdep structure. */
39
40 struct gdbarch_tdep
41 {
42 /* Target description. */
43 const struct target_desc *tdesc;
44
45 /* ABI version. */
46 enum s390_abi_kind abi;
47
48 /* Vector ABI. */
49 enum s390_vector_abi_kind vector_abi;
50
51 /* Pseudo register numbers. */
52 int gpr_full_regnum;
53 int pc_regnum;
54 int cc_regnum;
55 int v0_full_regnum;
56
57 bool have_upper;
58 bool have_linux_v1;
59 bool have_linux_v2;
60 bool have_tdb;
61 bool have_vx;
62 bool have_gs;
63
64 /* Hook to record OS specific systemcall. */
65 int (*s390_syscall_record) (struct regcache *regcache, LONGEST svc_number);
66 };
67
68 /* Decoding S/390 instructions. */
69
70 /* Named opcode values for the S/390 instructions we recognize. Some
71 instructions have their opcode split across two fields; those are the
72 op1_* and op2_* enums. */
73
74 enum
75 {
76 op1_lhi = 0xa7, op2_lhi = 0x08,
77 op1_lghi = 0xa7, op2_lghi = 0x09,
78 op1_lgfi = 0xc0, op2_lgfi = 0x01,
79 op_lr = 0x18,
80 op_lgr = 0xb904,
81 op_l = 0x58,
82 op1_ly = 0xe3, op2_ly = 0x58,
83 op1_lg = 0xe3, op2_lg = 0x04,
84 op_lm = 0x98,
85 op1_lmy = 0xeb, op2_lmy = 0x98,
86 op1_lmg = 0xeb, op2_lmg = 0x04,
87 op_st = 0x50,
88 op1_sty = 0xe3, op2_sty = 0x50,
89 op1_stg = 0xe3, op2_stg = 0x24,
90 op_std = 0x60,
91 op_stm = 0x90,
92 op1_stmy = 0xeb, op2_stmy = 0x90,
93 op1_stmg = 0xeb, op2_stmg = 0x24,
94 op1_aghi = 0xa7, op2_aghi = 0x0b,
95 op1_ahi = 0xa7, op2_ahi = 0x0a,
96 op1_agfi = 0xc2, op2_agfi = 0x08,
97 op1_afi = 0xc2, op2_afi = 0x09,
98 op1_algfi= 0xc2, op2_algfi= 0x0a,
99 op1_alfi = 0xc2, op2_alfi = 0x0b,
100 op_ar = 0x1a,
101 op_agr = 0xb908,
102 op_a = 0x5a,
103 op1_ay = 0xe3, op2_ay = 0x5a,
104 op1_ag = 0xe3, op2_ag = 0x08,
105 op1_slgfi= 0xc2, op2_slgfi= 0x04,
106 op1_slfi = 0xc2, op2_slfi = 0x05,
107 op_sr = 0x1b,
108 op_sgr = 0xb909,
109 op_s = 0x5b,
110 op1_sy = 0xe3, op2_sy = 0x5b,
111 op1_sg = 0xe3, op2_sg = 0x09,
112 op_nr = 0x14,
113 op_ngr = 0xb980,
114 op_la = 0x41,
115 op1_lay = 0xe3, op2_lay = 0x71,
116 op1_larl = 0xc0, op2_larl = 0x00,
117 op_basr = 0x0d,
118 op_bas = 0x4d,
119 op_bcr = 0x07,
120 op_bc = 0x0d,
121 op_bctr = 0x06,
122 op_bctgr = 0xb946,
123 op_bct = 0x46,
124 op1_bctg = 0xe3, op2_bctg = 0x46,
125 op_bxh = 0x86,
126 op1_bxhg = 0xeb, op2_bxhg = 0x44,
127 op_bxle = 0x87,
128 op1_bxleg= 0xeb, op2_bxleg= 0x45,
129 op1_bras = 0xa7, op2_bras = 0x05,
130 op1_brasl= 0xc0, op2_brasl= 0x05,
131 op1_brc = 0xa7, op2_brc = 0x04,
132 op1_brcl = 0xc0, op2_brcl = 0x04,
133 op1_brct = 0xa7, op2_brct = 0x06,
134 op1_brctg= 0xa7, op2_brctg= 0x07,
135 op_brxh = 0x84,
136 op1_brxhg= 0xec, op2_brxhg= 0x44,
137 op_brxle = 0x85,
138 op1_brxlg= 0xec, op2_brxlg= 0x45,
139 op_svc = 0x0a,
140 };
141
142 /* Hardware capabilities. */
143
144 #ifndef HWCAP_S390_HIGH_GPRS
145 #define HWCAP_S390_HIGH_GPRS 512
146 #endif
147
148 #ifndef HWCAP_S390_TE
149 #define HWCAP_S390_TE 1024
150 #endif
151
152 #ifndef HWCAP_S390_VX
153 #define HWCAP_S390_VX 2048
154 #endif
155
156 #ifndef HWCAP_S390_GS
157 #define HWCAP_S390_GS 16384
158 #endif
159
160 /* Register information. */
161
162 /* Program Status Word. */
163 #define S390_PSWM_REGNUM 0
164 #define S390_PSWA_REGNUM 1
165 /* General Purpose Registers. */
166 #define S390_R0_REGNUM 2
167 #define S390_R1_REGNUM 3
168 #define S390_R2_REGNUM 4
169 #define S390_R3_REGNUM 5
170 #define S390_R4_REGNUM 6
171 #define S390_R5_REGNUM 7
172 #define S390_R6_REGNUM 8
173 #define S390_R7_REGNUM 9
174 #define S390_R8_REGNUM 10
175 #define S390_R9_REGNUM 11
176 #define S390_R10_REGNUM 12
177 #define S390_R11_REGNUM 13
178 #define S390_R12_REGNUM 14
179 #define S390_R13_REGNUM 15
180 #define S390_R14_REGNUM 16
181 #define S390_R15_REGNUM 17
182 /* Access Registers. */
183 #define S390_A0_REGNUM 18
184 #define S390_A1_REGNUM 19
185 #define S390_A2_REGNUM 20
186 #define S390_A3_REGNUM 21
187 #define S390_A4_REGNUM 22
188 #define S390_A5_REGNUM 23
189 #define S390_A6_REGNUM 24
190 #define S390_A7_REGNUM 25
191 #define S390_A8_REGNUM 26
192 #define S390_A9_REGNUM 27
193 #define S390_A10_REGNUM 28
194 #define S390_A11_REGNUM 29
195 #define S390_A12_REGNUM 30
196 #define S390_A13_REGNUM 31
197 #define S390_A14_REGNUM 32
198 #define S390_A15_REGNUM 33
199 /* Floating Point Control Word. */
200 #define S390_FPC_REGNUM 34
201 /* Floating Point Registers. */
202 #define S390_F0_REGNUM 35
203 #define S390_F1_REGNUM 36
204 #define S390_F2_REGNUM 37
205 #define S390_F3_REGNUM 38
206 #define S390_F4_REGNUM 39
207 #define S390_F5_REGNUM 40
208 #define S390_F6_REGNUM 41
209 #define S390_F7_REGNUM 42
210 #define S390_F8_REGNUM 43
211 #define S390_F9_REGNUM 44
212 #define S390_F10_REGNUM 45
213 #define S390_F11_REGNUM 46
214 #define S390_F12_REGNUM 47
215 #define S390_F13_REGNUM 48
216 #define S390_F14_REGNUM 49
217 #define S390_F15_REGNUM 50
218 /* General Purpose Register Upper Halves. */
219 #define S390_R0_UPPER_REGNUM 51
220 #define S390_R1_UPPER_REGNUM 52
221 #define S390_R2_UPPER_REGNUM 53
222 #define S390_R3_UPPER_REGNUM 54
223 #define S390_R4_UPPER_REGNUM 55
224 #define S390_R5_UPPER_REGNUM 56
225 #define S390_R6_UPPER_REGNUM 57
226 #define S390_R7_UPPER_REGNUM 58
227 #define S390_R8_UPPER_REGNUM 59
228 #define S390_R9_UPPER_REGNUM 60
229 #define S390_R10_UPPER_REGNUM 61
230 #define S390_R11_UPPER_REGNUM 62
231 #define S390_R12_UPPER_REGNUM 63
232 #define S390_R13_UPPER_REGNUM 64
233 #define S390_R14_UPPER_REGNUM 65
234 #define S390_R15_UPPER_REGNUM 66
235 /* GNU/Linux-specific optional registers. */
236 #define S390_ORIG_R2_REGNUM 67
237 #define S390_LAST_BREAK_REGNUM 68
238 #define S390_SYSTEM_CALL_REGNUM 69
239 /* Transaction diagnostic block. */
240 #define S390_TDB_DWORD0_REGNUM 70
241 #define S390_TDB_ABORT_CODE_REGNUM 71
242 #define S390_TDB_CONFLICT_TOKEN_REGNUM 72
243 #define S390_TDB_ATIA_REGNUM 73
244 #define S390_TDB_R0_REGNUM 74
245 #define S390_TDB_R1_REGNUM 75
246 #define S390_TDB_R2_REGNUM 76
247 #define S390_TDB_R3_REGNUM 77
248 #define S390_TDB_R4_REGNUM 78
249 #define S390_TDB_R5_REGNUM 79
250 #define S390_TDB_R6_REGNUM 80
251 #define S390_TDB_R7_REGNUM 81
252 #define S390_TDB_R8_REGNUM 82
253 #define S390_TDB_R9_REGNUM 83
254 #define S390_TDB_R10_REGNUM 84
255 #define S390_TDB_R11_REGNUM 85
256 #define S390_TDB_R12_REGNUM 86
257 #define S390_TDB_R13_REGNUM 87
258 #define S390_TDB_R14_REGNUM 88
259 #define S390_TDB_R15_REGNUM 89
260 /* Vector registers. */
261 #define S390_V0_LOWER_REGNUM 90
262 #define S390_V1_LOWER_REGNUM 91
263 #define S390_V2_LOWER_REGNUM 92
264 #define S390_V3_LOWER_REGNUM 93
265 #define S390_V4_LOWER_REGNUM 94
266 #define S390_V5_LOWER_REGNUM 95
267 #define S390_V6_LOWER_REGNUM 96
268 #define S390_V7_LOWER_REGNUM 97
269 #define S390_V8_LOWER_REGNUM 98
270 #define S390_V9_LOWER_REGNUM 99
271 #define S390_V10_LOWER_REGNUM 100
272 #define S390_V11_LOWER_REGNUM 101
273 #define S390_V12_LOWER_REGNUM 102
274 #define S390_V13_LOWER_REGNUM 103
275 #define S390_V14_LOWER_REGNUM 104
276 #define S390_V15_LOWER_REGNUM 105
277 #define S390_V16_REGNUM 106
278 #define S390_V17_REGNUM 107
279 #define S390_V18_REGNUM 108
280 #define S390_V19_REGNUM 109
281 #define S390_V20_REGNUM 110
282 #define S390_V21_REGNUM 111
283 #define S390_V22_REGNUM 112
284 #define S390_V23_REGNUM 113
285 #define S390_V24_REGNUM 114
286 #define S390_V25_REGNUM 115
287 #define S390_V26_REGNUM 116
288 #define S390_V27_REGNUM 117
289 #define S390_V28_REGNUM 118
290 #define S390_V29_REGNUM 119
291 #define S390_V30_REGNUM 120
292 #define S390_V31_REGNUM 121
293 #define S390_GSD_REGNUM 122
294 #define S390_GSSM_REGNUM 123
295 #define S390_GSEPLA_REGNUM 124
296 #define S390_BC_GSD_REGNUM 125
297 #define S390_BC_GSSM_REGNUM 126
298 #define S390_BC_GSEPLA_REGNUM 127
299 /* Total. */
300 #define S390_NUM_REGS 128
301
302 #define S390_NUM_GPRS 16
303 #define S390_NUM_FPRS 16
304
305 #define S390_MAX_INSTR_SIZE 6
306
307 /* Special register usage. */
308 #define S390_SP_REGNUM S390_R15_REGNUM
309 #define S390_RETADDR_REGNUM S390_R14_REGNUM
310 #define S390_FRAME_REGNUM S390_R11_REGNUM
311
312 /* Frame unwinding. */
313
314 extern struct value *s390_trad_frame_prev_register
315 (struct frame_info *this_frame, struct trad_frame_saved_reg saved_regs[],
316 int regnum);
317
318 extern struct target_desc *tdesc_s390_linux32;
319 extern struct target_desc *tdesc_s390x_linux64;
320
321 #endif /* S390_TDEP_H */