1 /* Target-dependent code for GDB, the GNU debugger.
3 Copyright (C) 2001-2015 Free Software Foundation, Inc.
5 Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
6 for IBM Deutschland Entwicklung GmbH, IBM Corporation.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "arch-utils.h"
33 #include "floatformat.h"
35 #include "trad-frame.h"
36 #include "frame-base.h"
37 #include "frame-unwind.h"
38 #include "dwarf2-frame.h"
39 #include "reggroups.h"
43 #include "solib-svr4.h"
44 #include "prologue-value.h"
45 #include "linux-tdep.h"
46 #include "s390-linux-tdep.h"
47 #include "linux-record.h"
48 #include "record-full.h"
50 #include "xml-syscall.h"
52 #include "stap-probe.h"
55 #include "user-regs.h"
56 #include "cli/cli-utils.h"
58 #include "elf/common.h"
62 #include "features/s390-linux32.c"
63 #include "features/s390-linux32v1.c"
64 #include "features/s390-linux32v2.c"
65 #include "features/s390-linux64.c"
66 #include "features/s390-linux64v1.c"
67 #include "features/s390-linux64v2.c"
68 #include "features/s390-te-linux64.c"
69 #include "features/s390-vx-linux64.c"
70 #include "features/s390-tevx-linux64.c"
71 #include "features/s390x-linux64.c"
72 #include "features/s390x-linux64v1.c"
73 #include "features/s390x-linux64v2.c"
74 #include "features/s390x-te-linux64.c"
75 #include "features/s390x-vx-linux64.c"
76 #include "features/s390x-tevx-linux64.c"
78 #define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml"
79 #define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml"
87 enum s390_vector_abi_kind
93 /* The tdep structure. */
98 enum s390_abi_kind abi
;
101 enum s390_vector_abi_kind vector_abi
;
103 /* Pseudo register numbers. */
115 /* ABI call-saved register information. */
118 s390_register_call_saved (struct gdbarch
*gdbarch
, int regnum
)
120 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
125 if ((regnum
>= S390_R6_REGNUM
&& regnum
<= S390_R15_REGNUM
)
126 || regnum
== S390_F4_REGNUM
|| regnum
== S390_F6_REGNUM
127 || regnum
== S390_A0_REGNUM
)
132 case ABI_LINUX_ZSERIES
:
133 if ((regnum
>= S390_R6_REGNUM
&& regnum
<= S390_R15_REGNUM
)
134 || (regnum
>= S390_F8_REGNUM
&& regnum
<= S390_F15_REGNUM
)
135 || (regnum
>= S390_A0_REGNUM
&& regnum
<= S390_A1_REGNUM
))
145 s390_cannot_store_register (struct gdbarch
*gdbarch
, int regnum
)
147 /* The last-break address is read-only. */
148 return regnum
== S390_LAST_BREAK_REGNUM
;
152 s390_write_pc (struct regcache
*regcache
, CORE_ADDR pc
)
154 struct gdbarch
*gdbarch
= get_regcache_arch (regcache
);
155 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
157 regcache_cooked_write_unsigned (regcache
, tdep
->pc_regnum
, pc
);
159 /* Set special SYSTEM_CALL register to 0 to prevent the kernel from
160 messing with the PC we just installed, if we happen to be within
161 an interrupted system call that the kernel wants to restart.
163 Note that after we return from the dummy call, the SYSTEM_CALL and
164 ORIG_R2 registers will be automatically restored, and the kernel
165 continues to restart the system call at this point. */
166 if (register_size (gdbarch
, S390_SYSTEM_CALL_REGNUM
) > 0)
167 regcache_cooked_write_unsigned (regcache
, S390_SYSTEM_CALL_REGNUM
, 0);
171 /* DWARF Register Mapping. */
173 static const short s390_dwarf_regmap
[] =
175 /* 0-15: General Purpose Registers. */
176 S390_R0_REGNUM
, S390_R1_REGNUM
, S390_R2_REGNUM
, S390_R3_REGNUM
,
177 S390_R4_REGNUM
, S390_R5_REGNUM
, S390_R6_REGNUM
, S390_R7_REGNUM
,
178 S390_R8_REGNUM
, S390_R9_REGNUM
, S390_R10_REGNUM
, S390_R11_REGNUM
,
179 S390_R12_REGNUM
, S390_R13_REGNUM
, S390_R14_REGNUM
, S390_R15_REGNUM
,
181 /* 16-31: Floating Point Registers / Vector Registers 0-15. */
182 S390_F0_REGNUM
, S390_F2_REGNUM
, S390_F4_REGNUM
, S390_F6_REGNUM
,
183 S390_F1_REGNUM
, S390_F3_REGNUM
, S390_F5_REGNUM
, S390_F7_REGNUM
,
184 S390_F8_REGNUM
, S390_F10_REGNUM
, S390_F12_REGNUM
, S390_F14_REGNUM
,
185 S390_F9_REGNUM
, S390_F11_REGNUM
, S390_F13_REGNUM
, S390_F15_REGNUM
,
187 /* 32-47: Control Registers (not mapped). */
188 -1, -1, -1, -1, -1, -1, -1, -1,
189 -1, -1, -1, -1, -1, -1, -1, -1,
191 /* 48-63: Access Registers. */
192 S390_A0_REGNUM
, S390_A1_REGNUM
, S390_A2_REGNUM
, S390_A3_REGNUM
,
193 S390_A4_REGNUM
, S390_A5_REGNUM
, S390_A6_REGNUM
, S390_A7_REGNUM
,
194 S390_A8_REGNUM
, S390_A9_REGNUM
, S390_A10_REGNUM
, S390_A11_REGNUM
,
195 S390_A12_REGNUM
, S390_A13_REGNUM
, S390_A14_REGNUM
, S390_A15_REGNUM
,
197 /* 64-65: Program Status Word. */
201 /* 66-67: Reserved. */
204 /* 68-83: Vector Registers 16-31. */
205 S390_V16_REGNUM
, S390_V18_REGNUM
, S390_V20_REGNUM
, S390_V22_REGNUM
,
206 S390_V17_REGNUM
, S390_V19_REGNUM
, S390_V21_REGNUM
, S390_V23_REGNUM
,
207 S390_V24_REGNUM
, S390_V26_REGNUM
, S390_V28_REGNUM
, S390_V30_REGNUM
,
208 S390_V25_REGNUM
, S390_V27_REGNUM
, S390_V29_REGNUM
, S390_V31_REGNUM
,
210 /* End of "official" DWARF registers. The remainder of the map is
211 for GDB internal use only. */
213 /* GPR Lower Half Access. */
214 S390_R0_REGNUM
, S390_R1_REGNUM
, S390_R2_REGNUM
, S390_R3_REGNUM
,
215 S390_R4_REGNUM
, S390_R5_REGNUM
, S390_R6_REGNUM
, S390_R7_REGNUM
,
216 S390_R8_REGNUM
, S390_R9_REGNUM
, S390_R10_REGNUM
, S390_R11_REGNUM
,
217 S390_R12_REGNUM
, S390_R13_REGNUM
, S390_R14_REGNUM
, S390_R15_REGNUM
,
220 enum { s390_dwarf_reg_r0l
= ARRAY_SIZE (s390_dwarf_regmap
) - 16 };
222 /* Convert DWARF register number REG to the appropriate register
223 number used by GDB. */
225 s390_dwarf_reg_to_regnum (struct gdbarch
*gdbarch
, int reg
)
227 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
230 /* In a 32-on-64 debug scenario, debug info refers to the full
231 64-bit GPRs. Note that call frame information still refers to
232 the 32-bit lower halves, because s390_adjust_frame_regnum uses
233 special register numbers to access GPRs. */
234 if (tdep
->gpr_full_regnum
!= -1 && reg
>= 0 && reg
< 16)
235 return tdep
->gpr_full_regnum
+ reg
;
237 if (reg
>= 0 && reg
< ARRAY_SIZE (s390_dwarf_regmap
))
238 gdb_reg
= s390_dwarf_regmap
[reg
];
240 if (tdep
->v0_full_regnum
== -1)
242 if (gdb_reg
>= S390_V16_REGNUM
&& gdb_reg
<= S390_V31_REGNUM
)
247 if (gdb_reg
>= S390_F0_REGNUM
&& gdb_reg
<= S390_F15_REGNUM
)
248 gdb_reg
= gdb_reg
- S390_F0_REGNUM
+ tdep
->v0_full_regnum
;
254 /* Translate a .eh_frame register to DWARF register, or adjust a
255 .debug_frame register. */
257 s390_adjust_frame_regnum (struct gdbarch
*gdbarch
, int num
, int eh_frame_p
)
259 /* See s390_dwarf_reg_to_regnum for comments. */
260 return (num
>= 0 && num
< 16) ? num
+ s390_dwarf_reg_r0l
: num
;
264 /* Pseudo registers. */
267 regnum_is_gpr_full (struct gdbarch_tdep
*tdep
, int regnum
)
269 return (tdep
->gpr_full_regnum
!= -1
270 && regnum
>= tdep
->gpr_full_regnum
271 && regnum
<= tdep
->gpr_full_regnum
+ 15);
274 /* Check whether REGNUM indicates a full vector register (v0-v15).
275 These pseudo-registers are composed of f0-f15 and v0l-v15l. */
278 regnum_is_vxr_full (struct gdbarch_tdep
*tdep
, int regnum
)
280 return (tdep
->v0_full_regnum
!= -1
281 && regnum
>= tdep
->v0_full_regnum
282 && regnum
<= tdep
->v0_full_regnum
+ 15);
285 /* Return the name of register REGNO. Return the empty string for
286 registers that shouldn't be visible. */
289 s390_register_name (struct gdbarch
*gdbarch
, int regnum
)
291 if (regnum
>= S390_V0_LOWER_REGNUM
292 && regnum
<= S390_V15_LOWER_REGNUM
)
294 return tdesc_register_name (gdbarch
, regnum
);
298 s390_pseudo_register_name (struct gdbarch
*gdbarch
, int regnum
)
300 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
302 if (regnum
== tdep
->pc_regnum
)
305 if (regnum
== tdep
->cc_regnum
)
308 if (regnum_is_gpr_full (tdep
, regnum
))
310 static const char *full_name
[] = {
311 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
312 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
314 return full_name
[regnum
- tdep
->gpr_full_regnum
];
317 if (regnum_is_vxr_full (tdep
, regnum
))
319 static const char *full_name
[] = {
320 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
321 "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15"
323 return full_name
[regnum
- tdep
->v0_full_regnum
];
326 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
330 s390_pseudo_register_type (struct gdbarch
*gdbarch
, int regnum
)
332 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
334 if (regnum
== tdep
->pc_regnum
)
335 return builtin_type (gdbarch
)->builtin_func_ptr
;
337 if (regnum
== tdep
->cc_regnum
)
338 return builtin_type (gdbarch
)->builtin_int
;
340 if (regnum_is_gpr_full (tdep
, regnum
))
341 return builtin_type (gdbarch
)->builtin_uint64
;
343 if (regnum_is_vxr_full (tdep
, regnum
))
344 return tdesc_find_type (gdbarch
, "vec128");
346 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
349 static enum register_status
350 s390_pseudo_register_read (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
351 int regnum
, gdb_byte
*buf
)
353 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
354 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
355 int regsize
= register_size (gdbarch
, regnum
);
358 if (regnum
== tdep
->pc_regnum
)
360 enum register_status status
;
362 status
= regcache_raw_read_unsigned (regcache
, S390_PSWA_REGNUM
, &val
);
363 if (status
== REG_VALID
)
365 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
367 store_unsigned_integer (buf
, regsize
, byte_order
, val
);
372 if (regnum
== tdep
->cc_regnum
)
374 enum register_status status
;
376 status
= regcache_raw_read_unsigned (regcache
, S390_PSWM_REGNUM
, &val
);
377 if (status
== REG_VALID
)
379 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
380 val
= (val
>> 12) & 3;
382 val
= (val
>> 44) & 3;
383 store_unsigned_integer (buf
, regsize
, byte_order
, val
);
388 if (regnum_is_gpr_full (tdep
, regnum
))
390 enum register_status status
;
393 regnum
-= tdep
->gpr_full_regnum
;
395 status
= regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ regnum
, &val
);
396 if (status
== REG_VALID
)
397 status
= regcache_raw_read_unsigned (regcache
, S390_R0_UPPER_REGNUM
+ regnum
,
399 if (status
== REG_VALID
)
401 val
|= val_upper
<< 32;
402 store_unsigned_integer (buf
, regsize
, byte_order
, val
);
407 if (regnum_is_vxr_full (tdep
, regnum
))
409 enum register_status status
;
411 regnum
-= tdep
->v0_full_regnum
;
413 status
= regcache_raw_read (regcache
, S390_F0_REGNUM
+ regnum
, buf
);
414 if (status
== REG_VALID
)
415 status
= regcache_raw_read (regcache
,
416 S390_V0_LOWER_REGNUM
+ regnum
, buf
+ 8);
420 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
424 s390_pseudo_register_write (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
425 int regnum
, const gdb_byte
*buf
)
427 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
428 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
429 int regsize
= register_size (gdbarch
, regnum
);
432 if (regnum
== tdep
->pc_regnum
)
434 val
= extract_unsigned_integer (buf
, regsize
, byte_order
);
435 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
437 regcache_raw_read_unsigned (regcache
, S390_PSWA_REGNUM
, &psw
);
438 val
= (psw
& 0x80000000) | (val
& 0x7fffffff);
440 regcache_raw_write_unsigned (regcache
, S390_PSWA_REGNUM
, val
);
444 if (regnum
== tdep
->cc_regnum
)
446 val
= extract_unsigned_integer (buf
, regsize
, byte_order
);
447 regcache_raw_read_unsigned (regcache
, S390_PSWM_REGNUM
, &psw
);
448 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
449 val
= (psw
& ~((ULONGEST
)3 << 12)) | ((val
& 3) << 12);
451 val
= (psw
& ~((ULONGEST
)3 << 44)) | ((val
& 3) << 44);
452 regcache_raw_write_unsigned (regcache
, S390_PSWM_REGNUM
, val
);
456 if (regnum_is_gpr_full (tdep
, regnum
))
458 regnum
-= tdep
->gpr_full_regnum
;
459 val
= extract_unsigned_integer (buf
, regsize
, byte_order
);
460 regcache_raw_write_unsigned (regcache
, S390_R0_REGNUM
+ regnum
,
462 regcache_raw_write_unsigned (regcache
, S390_R0_UPPER_REGNUM
+ regnum
,
467 if (regnum_is_vxr_full (tdep
, regnum
))
469 regnum
-= tdep
->v0_full_regnum
;
470 regcache_raw_write (regcache
, S390_F0_REGNUM
+ regnum
, buf
);
471 regcache_raw_write (regcache
, S390_V0_LOWER_REGNUM
+ regnum
, buf
+ 8);
475 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
478 /* 'float' values are stored in the upper half of floating-point
479 registers, even though we are otherwise a big-endian platform. The
480 same applies to a 'float' value within a vector. */
482 static struct value
*
483 s390_value_from_register (struct gdbarch
*gdbarch
, struct type
*type
,
484 int regnum
, struct frame_id frame_id
)
486 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
487 struct value
*value
= default_value_from_register (gdbarch
, type
,
489 check_typedef (type
);
491 if ((regnum
>= S390_F0_REGNUM
&& regnum
<= S390_F15_REGNUM
492 && TYPE_LENGTH (type
) < 8)
493 || regnum_is_vxr_full (tdep
, regnum
)
494 || (regnum
>= S390_V16_REGNUM
&& regnum
<= S390_V31_REGNUM
))
495 set_value_offset (value
, 0);
500 /* Register groups. */
503 s390_pseudo_register_reggroup_p (struct gdbarch
*gdbarch
, int regnum
,
504 struct reggroup
*group
)
506 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
508 /* We usually save/restore the whole PSW, which includes PC and CC.
509 However, some older gdbservers may not support saving/restoring
510 the whole PSW yet, and will return an XML register description
511 excluding those from the save/restore register groups. In those
512 cases, we still need to explicitly save/restore PC and CC in order
513 to push or pop frames. Since this doesn't hurt anything if we
514 already save/restore the whole PSW (it's just redundant), we add
515 PC and CC at this point unconditionally. */
516 if (group
== save_reggroup
|| group
== restore_reggroup
)
517 return regnum
== tdep
->pc_regnum
|| regnum
== tdep
->cc_regnum
;
519 if (group
== vector_reggroup
)
520 return regnum_is_vxr_full (tdep
, regnum
);
522 if (group
== general_reggroup
&& regnum_is_vxr_full (tdep
, regnum
))
525 return default_register_reggroup_p (gdbarch
, regnum
, group
);
529 /* A helper for s390_software_single_step, decides if an instruction
530 is a partial-execution instruction that needs to be executed until
531 completion when in record mode. If it is, returns 1 and writes
532 instruction length to a pointer. */
535 s390_is_partial_instruction (struct gdbarch
*gdbarch
, CORE_ADDR loc
, int *len
)
537 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
540 insn
= read_memory_integer (loc
, 2, byte_order
);
544 case 0xa8: /* MVCLE */
550 insn
= read_memory_integer (loc
+ 4, 2, byte_order
);
551 if ((insn
& 0xff) == 0x8e)
563 case 0xb255: /* MVST */
564 case 0xb263: /* CMPSC */
565 case 0xb2a5: /* TRE */
566 case 0xb2a6: /* CU21 */
567 case 0xb2a7: /* CU12 */
568 case 0xb9b0: /* CU14 */
569 case 0xb9b1: /* CU24 */
570 case 0xb9b2: /* CU41 */
571 case 0xb9b3: /* CU42 */
572 case 0xb92a: /* KMF */
573 case 0xb92b: /* KMO */
574 case 0xb92f: /* KMC */
575 case 0xb92d: /* KMCTR */
576 case 0xb92e: /* KM */
577 case 0xb93c: /* PPNO */
578 case 0xb990: /* TRTT */
579 case 0xb991: /* TRTO */
580 case 0xb992: /* TROT */
581 case 0xb993: /* TROO */
589 /* Implement the "software_single_step" gdbarch method, needed to single step
590 through instructions like MVCLE in record mode, to make sure they are
591 executed to completion. Without that, record will save the full length
592 of destination buffer on every iteration, even though the CPU will only
593 process about 4kiB of it each time, leading to O(n**2) memory and time
597 s390_software_single_step (struct frame_info
*frame
)
599 struct gdbarch
*gdbarch
= get_frame_arch (frame
);
600 struct address_space
*aspace
= get_frame_address_space (frame
);
601 CORE_ADDR loc
= get_frame_pc (frame
);
602 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
606 /* Special handling only if recording. */
607 if (!record_full_is_used ())
610 /* First, match a partial instruction. */
611 if (!s390_is_partial_instruction (gdbarch
, loc
, &len
))
616 /* Second, look for a branch back to it. */
617 insn
= read_memory_integer (loc
, 2, byte_order
);
618 if (insn
!= 0xa714) /* BRC with mask 1 */
621 insn
= read_memory_integer (loc
+ 2, 2, byte_order
);
622 if (insn
!= (uint16_t) -(len
/ 2))
627 /* Found it, step past the whole thing. */
629 insert_single_step_breakpoint (gdbarch
, aspace
, loc
);
635 s390_displaced_step_hw_singlestep (struct gdbarch
*gdbarch
,
636 struct displaced_step_closure
*closure
)
642 /* Maps for register sets. */
644 static const struct regcache_map_entry s390_gregmap
[] =
646 { 1, S390_PSWM_REGNUM
},
647 { 1, S390_PSWA_REGNUM
},
648 { 16, S390_R0_REGNUM
},
649 { 16, S390_A0_REGNUM
},
650 { 1, S390_ORIG_R2_REGNUM
},
654 static const struct regcache_map_entry s390_fpregmap
[] =
656 { 1, S390_FPC_REGNUM
, 8 },
657 { 16, S390_F0_REGNUM
, 8 },
661 static const struct regcache_map_entry s390_regmap_upper
[] =
663 { 16, S390_R0_UPPER_REGNUM
, 4 },
667 static const struct regcache_map_entry s390_regmap_last_break
[] =
669 { 1, REGCACHE_MAP_SKIP
, 4 },
670 { 1, S390_LAST_BREAK_REGNUM
, 4 },
674 static const struct regcache_map_entry s390x_regmap_last_break
[] =
676 { 1, S390_LAST_BREAK_REGNUM
, 8 },
680 static const struct regcache_map_entry s390_regmap_system_call
[] =
682 { 1, S390_SYSTEM_CALL_REGNUM
, 4 },
686 static const struct regcache_map_entry s390_regmap_tdb
[] =
688 { 1, S390_TDB_DWORD0_REGNUM
, 8 },
689 { 1, S390_TDB_ABORT_CODE_REGNUM
, 8 },
690 { 1, S390_TDB_CONFLICT_TOKEN_REGNUM
, 8 },
691 { 1, S390_TDB_ATIA_REGNUM
, 8 },
692 { 12, REGCACHE_MAP_SKIP
, 8 },
693 { 16, S390_TDB_R0_REGNUM
, 8 },
697 static const struct regcache_map_entry s390_regmap_vxrs_low
[] =
699 { 16, S390_V0_LOWER_REGNUM
, 8 },
703 static const struct regcache_map_entry s390_regmap_vxrs_high
[] =
705 { 16, S390_V16_REGNUM
, 16 },
710 /* Supply the TDB regset. Like regcache_supply_regset, but invalidate
711 the TDB registers unless the TDB format field is valid. */
714 s390_supply_tdb_regset (const struct regset
*regset
, struct regcache
*regcache
,
715 int regnum
, const void *regs
, size_t len
)
718 enum register_status ret
;
721 regcache_supply_regset (regset
, regcache
, regnum
, regs
, len
);
722 ret
= regcache_cooked_read_unsigned (regcache
, S390_TDB_DWORD0_REGNUM
, &tdw
);
723 if (ret
!= REG_VALID
|| (tdw
>> 56) != 1)
724 regcache_supply_regset (regset
, regcache
, regnum
, NULL
, len
);
727 const struct regset s390_gregset
= {
729 regcache_supply_regset
,
730 regcache_collect_regset
733 const struct regset s390_fpregset
= {
735 regcache_supply_regset
,
736 regcache_collect_regset
739 static const struct regset s390_upper_regset
= {
741 regcache_supply_regset
,
742 regcache_collect_regset
745 const struct regset s390_last_break_regset
= {
746 s390_regmap_last_break
,
747 regcache_supply_regset
,
748 regcache_collect_regset
751 const struct regset s390x_last_break_regset
= {
752 s390x_regmap_last_break
,
753 regcache_supply_regset
,
754 regcache_collect_regset
757 const struct regset s390_system_call_regset
= {
758 s390_regmap_system_call
,
759 regcache_supply_regset
,
760 regcache_collect_regset
763 const struct regset s390_tdb_regset
= {
765 s390_supply_tdb_regset
,
766 regcache_collect_regset
769 const struct regset s390_vxrs_low_regset
= {
770 s390_regmap_vxrs_low
,
771 regcache_supply_regset
,
772 regcache_collect_regset
775 const struct regset s390_vxrs_high_regset
= {
776 s390_regmap_vxrs_high
,
777 regcache_supply_regset
,
778 regcache_collect_regset
781 /* Iterate over supported core file register note sections. */
784 s390_iterate_over_regset_sections (struct gdbarch
*gdbarch
,
785 iterate_over_regset_sections_cb
*cb
,
787 const struct regcache
*regcache
)
789 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
790 const int gregset_size
= (tdep
->abi
== ABI_LINUX_S390
?
791 s390_sizeof_gregset
: s390x_sizeof_gregset
);
793 cb (".reg", gregset_size
, &s390_gregset
, NULL
, cb_data
);
794 cb (".reg2", s390_sizeof_fpregset
, &s390_fpregset
, NULL
, cb_data
);
796 if (tdep
->abi
== ABI_LINUX_S390
&& tdep
->gpr_full_regnum
!= -1)
797 cb (".reg-s390-high-gprs", 16 * 4, &s390_upper_regset
,
798 "s390 GPR upper halves", cb_data
);
800 if (tdep
->have_linux_v1
)
801 cb (".reg-s390-last-break", 8,
802 (gdbarch_ptr_bit (gdbarch
) == 32
803 ? &s390_last_break_regset
: &s390x_last_break_regset
),
804 "s930 last-break address", cb_data
);
806 if (tdep
->have_linux_v2
)
807 cb (".reg-s390-system-call", 4, &s390_system_call_regset
,
808 "s390 system-call", cb_data
);
810 /* If regcache is set, we are in "write" (gcore) mode. In this
811 case, don't iterate over the TDB unless its registers are
815 || REG_VALID
== regcache_register_status (regcache
,
816 S390_TDB_DWORD0_REGNUM
)))
817 cb (".reg-s390-tdb", s390_sizeof_tdbregset
, &s390_tdb_regset
,
818 "s390 TDB", cb_data
);
820 if (tdep
->v0_full_regnum
!= -1)
822 cb (".reg-s390-vxrs-low", 16 * 8, &s390_vxrs_low_regset
,
823 "s390 vector registers 0-15 lower half", cb_data
);
824 cb (".reg-s390-vxrs-high", 16 * 16, &s390_vxrs_high_regset
,
825 "s390 vector registers 16-31", cb_data
);
829 static const struct target_desc
*
830 s390_core_read_description (struct gdbarch
*gdbarch
,
831 struct target_ops
*target
, bfd
*abfd
)
833 asection
*section
= bfd_get_section_by_name (abfd
, ".reg");
835 int high_gprs
, v1
, v2
, te
, vx
;
837 target_auxv_search (target
, AT_HWCAP
, &hwcap
);
841 high_gprs
= (bfd_get_section_by_name (abfd
, ".reg-s390-high-gprs")
843 v1
= (bfd_get_section_by_name (abfd
, ".reg-s390-last-break") != NULL
);
844 v2
= (bfd_get_section_by_name (abfd
, ".reg-s390-system-call") != NULL
);
845 vx
= (hwcap
& HWCAP_S390_VX
);
846 te
= (hwcap
& HWCAP_S390_TE
);
848 switch (bfd_section_size (abfd
, section
))
850 case s390_sizeof_gregset
:
852 return (te
&& vx
? tdesc_s390_tevx_linux64
:
853 vx
? tdesc_s390_vx_linux64
:
854 te
? tdesc_s390_te_linux64
:
855 v2
? tdesc_s390_linux64v2
:
856 v1
? tdesc_s390_linux64v1
: tdesc_s390_linux64
);
858 return (v2
? tdesc_s390_linux32v2
:
859 v1
? tdesc_s390_linux32v1
: tdesc_s390_linux32
);
861 case s390x_sizeof_gregset
:
862 return (te
&& vx
? tdesc_s390x_tevx_linux64
:
863 vx
? tdesc_s390x_vx_linux64
:
864 te
? tdesc_s390x_te_linux64
:
865 v2
? tdesc_s390x_linux64v2
:
866 v1
? tdesc_s390x_linux64v1
: tdesc_s390x_linux64
);
874 /* Decoding S/390 instructions. */
876 /* Named opcode values for the S/390 instructions we recognize. Some
877 instructions have their opcode split across two fields; those are the
878 op1_* and op2_* enums. */
881 op1_lhi
= 0xa7, op2_lhi
= 0x08,
882 op1_lghi
= 0xa7, op2_lghi
= 0x09,
883 op1_lgfi
= 0xc0, op2_lgfi
= 0x01,
887 op1_ly
= 0xe3, op2_ly
= 0x58,
888 op1_lg
= 0xe3, op2_lg
= 0x04,
890 op1_lmy
= 0xeb, op2_lmy
= 0x98,
891 op1_lmg
= 0xeb, op2_lmg
= 0x04,
893 op1_sty
= 0xe3, op2_sty
= 0x50,
894 op1_stg
= 0xe3, op2_stg
= 0x24,
897 op1_stmy
= 0xeb, op2_stmy
= 0x90,
898 op1_stmg
= 0xeb, op2_stmg
= 0x24,
899 op1_aghi
= 0xa7, op2_aghi
= 0x0b,
900 op1_ahi
= 0xa7, op2_ahi
= 0x0a,
901 op1_agfi
= 0xc2, op2_agfi
= 0x08,
902 op1_afi
= 0xc2, op2_afi
= 0x09,
903 op1_algfi
= 0xc2, op2_algfi
= 0x0a,
904 op1_alfi
= 0xc2, op2_alfi
= 0x0b,
908 op1_ay
= 0xe3, op2_ay
= 0x5a,
909 op1_ag
= 0xe3, op2_ag
= 0x08,
910 op1_slgfi
= 0xc2, op2_slgfi
= 0x04,
911 op1_slfi
= 0xc2, op2_slfi
= 0x05,
915 op1_sy
= 0xe3, op2_sy
= 0x5b,
916 op1_sg
= 0xe3, op2_sg
= 0x09,
920 op1_lay
= 0xe3, op2_lay
= 0x71,
921 op1_larl
= 0xc0, op2_larl
= 0x00,
929 op1_bctg
= 0xe3, op2_bctg
= 0x46,
931 op1_bxhg
= 0xeb, op2_bxhg
= 0x44,
933 op1_bxleg
= 0xeb, op2_bxleg
= 0x45,
934 op1_bras
= 0xa7, op2_bras
= 0x05,
935 op1_brasl
= 0xc0, op2_brasl
= 0x05,
936 op1_brc
= 0xa7, op2_brc
= 0x04,
937 op1_brcl
= 0xc0, op2_brcl
= 0x04,
938 op1_brct
= 0xa7, op2_brct
= 0x06,
939 op1_brctg
= 0xa7, op2_brctg
= 0x07,
941 op1_brxhg
= 0xec, op2_brxhg
= 0x44,
943 op1_brxlg
= 0xec, op2_brxlg
= 0x45,
948 /* Read a single instruction from address AT. */
950 #define S390_MAX_INSTR_SIZE 6
952 s390_readinstruction (bfd_byte instr
[], CORE_ADDR at
)
954 static int s390_instrlen
[] = { 2, 4, 4, 6 };
957 if (target_read_memory (at
, &instr
[0], 2))
959 instrlen
= s390_instrlen
[instr
[0] >> 6];
962 if (target_read_memory (at
+ 2, &instr
[2], instrlen
- 2))
969 /* The functions below are for recognizing and decoding S/390
970 instructions of various formats. Each of them checks whether INSN
971 is an instruction of the given format, with the specified opcodes.
972 If it is, it sets the remaining arguments to the values of the
973 instruction's fields, and returns a non-zero value; otherwise, it
976 These functions' arguments appear in the order they appear in the
977 instruction, not in the machine-language form. So, opcodes always
978 come first, even though they're sometimes scattered around the
979 instructions. And displacements appear before base and extension
980 registers, as they do in the assembly syntax, not at the end, as
981 they do in the machine language. */
983 is_ri (bfd_byte
*insn
, int op1
, int op2
, unsigned int *r1
, int *i2
)
985 if (insn
[0] == op1
&& (insn
[1] & 0xf) == op2
)
987 *r1
= (insn
[1] >> 4) & 0xf;
988 /* i2 is a 16-bit signed quantity. */
989 *i2
= (((insn
[2] << 8) | insn
[3]) ^ 0x8000) - 0x8000;
998 is_ril (bfd_byte
*insn
, int op1
, int op2
,
999 unsigned int *r1
, int *i2
)
1001 if (insn
[0] == op1
&& (insn
[1] & 0xf) == op2
)
1003 *r1
= (insn
[1] >> 4) & 0xf;
1004 /* i2 is a signed quantity. If the host 'int' is 32 bits long,
1005 no sign extension is necessary, but we don't want to assume
1007 *i2
= (((insn
[2] << 24)
1010 | (insn
[5])) ^ 0x80000000) - 0x80000000;
1019 is_rr (bfd_byte
*insn
, int op
, unsigned int *r1
, unsigned int *r2
)
1023 *r1
= (insn
[1] >> 4) & 0xf;
1024 *r2
= insn
[1] & 0xf;
1033 is_rre (bfd_byte
*insn
, int op
, unsigned int *r1
, unsigned int *r2
)
1035 if (((insn
[0] << 8) | insn
[1]) == op
)
1037 /* Yes, insn[3]. insn[2] is unused in RRE format. */
1038 *r1
= (insn
[3] >> 4) & 0xf;
1039 *r2
= insn
[3] & 0xf;
1048 is_rs (bfd_byte
*insn
, int op
,
1049 unsigned int *r1
, unsigned int *r3
, int *d2
, unsigned int *b2
)
1053 *r1
= (insn
[1] >> 4) & 0xf;
1054 *r3
= insn
[1] & 0xf;
1055 *b2
= (insn
[2] >> 4) & 0xf;
1056 *d2
= ((insn
[2] & 0xf) << 8) | insn
[3];
1065 is_rsy (bfd_byte
*insn
, int op1
, int op2
,
1066 unsigned int *r1
, unsigned int *r3
, int *d2
, unsigned int *b2
)
1071 *r1
= (insn
[1] >> 4) & 0xf;
1072 *r3
= insn
[1] & 0xf;
1073 *b2
= (insn
[2] >> 4) & 0xf;
1074 /* The 'long displacement' is a 20-bit signed integer. */
1075 *d2
= ((((insn
[2] & 0xf) << 8) | insn
[3] | (insn
[4] << 12))
1076 ^ 0x80000) - 0x80000;
1085 is_rsi (bfd_byte
*insn
, int op
,
1086 unsigned int *r1
, unsigned int *r3
, int *i2
)
1090 *r1
= (insn
[1] >> 4) & 0xf;
1091 *r3
= insn
[1] & 0xf;
1092 /* i2 is a 16-bit signed quantity. */
1093 *i2
= (((insn
[2] << 8) | insn
[3]) ^ 0x8000) - 0x8000;
1102 is_rie (bfd_byte
*insn
, int op1
, int op2
,
1103 unsigned int *r1
, unsigned int *r3
, int *i2
)
1108 *r1
= (insn
[1] >> 4) & 0xf;
1109 *r3
= insn
[1] & 0xf;
1110 /* i2 is a 16-bit signed quantity. */
1111 *i2
= (((insn
[2] << 8) | insn
[3]) ^ 0x8000) - 0x8000;
1120 is_rx (bfd_byte
*insn
, int op
,
1121 unsigned int *r1
, int *d2
, unsigned int *x2
, unsigned int *b2
)
1125 *r1
= (insn
[1] >> 4) & 0xf;
1126 *x2
= insn
[1] & 0xf;
1127 *b2
= (insn
[2] >> 4) & 0xf;
1128 *d2
= ((insn
[2] & 0xf) << 8) | insn
[3];
1137 is_rxy (bfd_byte
*insn
, int op1
, int op2
,
1138 unsigned int *r1
, int *d2
, unsigned int *x2
, unsigned int *b2
)
1143 *r1
= (insn
[1] >> 4) & 0xf;
1144 *x2
= insn
[1] & 0xf;
1145 *b2
= (insn
[2] >> 4) & 0xf;
1146 /* The 'long displacement' is a 20-bit signed integer. */
1147 *d2
= ((((insn
[2] & 0xf) << 8) | insn
[3] | (insn
[4] << 12))
1148 ^ 0x80000) - 0x80000;
1156 /* Prologue analysis. */
1158 #define S390_NUM_GPRS 16
1159 #define S390_NUM_FPRS 16
1161 struct s390_prologue_data
{
1164 struct pv_area
*stack
;
1166 /* The size and byte-order of a GPR or FPR. */
1169 enum bfd_endian byte_order
;
1171 /* The general-purpose registers. */
1172 pv_t gpr
[S390_NUM_GPRS
];
1174 /* The floating-point registers. */
1175 pv_t fpr
[S390_NUM_FPRS
];
1177 /* The offset relative to the CFA where the incoming GPR N was saved
1178 by the function prologue. 0 if not saved or unknown. */
1179 int gpr_slot
[S390_NUM_GPRS
];
1181 /* Likewise for FPRs. */
1182 int fpr_slot
[S390_NUM_FPRS
];
1184 /* Nonzero if the backchain was saved. This is assumed to be the
1185 case when the incoming SP is saved at the current SP location. */
1186 int back_chain_saved_p
;
1189 /* Return the effective address for an X-style instruction, like:
1193 Here, X2 and B2 are registers, and D2 is a signed 20-bit
1194 constant; the effective address is the sum of all three. If either
1195 X2 or B2 are zero, then it doesn't contribute to the sum --- this
1196 means that r0 can't be used as either X2 or B2. */
1198 s390_addr (struct s390_prologue_data
*data
,
1199 int d2
, unsigned int x2
, unsigned int b2
)
1203 result
= pv_constant (d2
);
1205 result
= pv_add (result
, data
->gpr
[x2
]);
1207 result
= pv_add (result
, data
->gpr
[b2
]);
1212 /* Do a SIZE-byte store of VALUE to D2(X2,B2). */
1214 s390_store (struct s390_prologue_data
*data
,
1215 int d2
, unsigned int x2
, unsigned int b2
, CORE_ADDR size
,
1218 pv_t addr
= s390_addr (data
, d2
, x2
, b2
);
1221 /* Check whether we are storing the backchain. */
1222 offset
= pv_subtract (data
->gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
], addr
);
1224 if (pv_is_constant (offset
) && offset
.k
== 0)
1225 if (size
== data
->gpr_size
1226 && pv_is_register_k (value
, S390_SP_REGNUM
, 0))
1228 data
->back_chain_saved_p
= 1;
1233 /* Check whether we are storing a register into the stack. */
1234 if (!pv_area_store_would_trash (data
->stack
, addr
))
1235 pv_area_store (data
->stack
, addr
, size
, value
);
1238 /* Note: If this is some store we cannot identify, you might think we
1239 should forget our cached values, as any of those might have been hit.
1241 However, we make the assumption that the register save areas are only
1242 ever stored to once in any given function, and we do recognize these
1243 stores. Thus every store we cannot recognize does not hit our data. */
1246 /* Do a SIZE-byte load from D2(X2,B2). */
1248 s390_load (struct s390_prologue_data
*data
,
1249 int d2
, unsigned int x2
, unsigned int b2
, CORE_ADDR size
)
1252 pv_t addr
= s390_addr (data
, d2
, x2
, b2
);
1254 /* If it's a load from an in-line constant pool, then we can
1255 simulate that, under the assumption that the code isn't
1256 going to change between the time the processor actually
1257 executed it creating the current frame, and the time when
1258 we're analyzing the code to unwind past that frame. */
1259 if (pv_is_constant (addr
))
1261 struct target_section
*secp
;
1262 secp
= target_section_by_addr (¤t_target
, addr
.k
);
1264 && (bfd_get_section_flags (secp
->the_bfd_section
->owner
,
1265 secp
->the_bfd_section
)
1267 return pv_constant (read_memory_integer (addr
.k
, size
,
1271 /* Check whether we are accessing one of our save slots. */
1272 return pv_area_fetch (data
->stack
, addr
, size
);
1275 /* Function for finding saved registers in a 'struct pv_area'; we pass
1276 this to pv_area_scan.
1278 If VALUE is a saved register, ADDR says it was saved at a constant
1279 offset from the frame base, and SIZE indicates that the whole
1280 register was saved, record its offset in the reg_offset table in
1281 PROLOGUE_UNTYPED. */
1283 s390_check_for_saved (void *data_untyped
, pv_t addr
,
1284 CORE_ADDR size
, pv_t value
)
1286 struct s390_prologue_data
*data
= (struct s390_prologue_data
*) data_untyped
;
1289 if (!pv_is_register (addr
, S390_SP_REGNUM
))
1292 offset
= 16 * data
->gpr_size
+ 32 - addr
.k
;
1294 /* If we are storing the original value of a register, we want to
1295 record the CFA offset. If the same register is stored multiple
1296 times, the stack slot with the highest address counts. */
1298 for (i
= 0; i
< S390_NUM_GPRS
; i
++)
1299 if (size
== data
->gpr_size
1300 && pv_is_register_k (value
, S390_R0_REGNUM
+ i
, 0))
1301 if (data
->gpr_slot
[i
] == 0
1302 || data
->gpr_slot
[i
] > offset
)
1304 data
->gpr_slot
[i
] = offset
;
1308 for (i
= 0; i
< S390_NUM_FPRS
; i
++)
1309 if (size
== data
->fpr_size
1310 && pv_is_register_k (value
, S390_F0_REGNUM
+ i
, 0))
1311 if (data
->fpr_slot
[i
] == 0
1312 || data
->fpr_slot
[i
] > offset
)
1314 data
->fpr_slot
[i
] = offset
;
1319 /* Analyze the prologue of the function starting at START_PC,
1320 continuing at most until CURRENT_PC. Initialize DATA to
1321 hold all information we find out about the state of the registers
1322 and stack slots. Return the address of the instruction after
1323 the last one that changed the SP, FP, or back chain; or zero
1326 s390_analyze_prologue (struct gdbarch
*gdbarch
,
1328 CORE_ADDR current_pc
,
1329 struct s390_prologue_data
*data
)
1331 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
1333 /* Our return value:
1334 The address of the instruction after the last one that changed
1335 the SP, FP, or back chain; zero if we got an error trying to
1337 CORE_ADDR result
= start_pc
;
1339 /* The current PC for our abstract interpretation. */
1342 /* The address of the next instruction after that. */
1345 /* Set up everything's initial value. */
1349 data
->stack
= make_pv_area (S390_SP_REGNUM
, gdbarch_addr_bit (gdbarch
));
1351 /* For the purpose of prologue tracking, we consider the GPR size to
1352 be equal to the ABI word size, even if it is actually larger
1353 (i.e. when running a 32-bit binary under a 64-bit kernel). */
1354 data
->gpr_size
= word_size
;
1356 data
->byte_order
= gdbarch_byte_order (gdbarch
);
1358 for (i
= 0; i
< S390_NUM_GPRS
; i
++)
1359 data
->gpr
[i
] = pv_register (S390_R0_REGNUM
+ i
, 0);
1361 for (i
= 0; i
< S390_NUM_FPRS
; i
++)
1362 data
->fpr
[i
] = pv_register (S390_F0_REGNUM
+ i
, 0);
1364 for (i
= 0; i
< S390_NUM_GPRS
; i
++)
1365 data
->gpr_slot
[i
] = 0;
1367 for (i
= 0; i
< S390_NUM_FPRS
; i
++)
1368 data
->fpr_slot
[i
] = 0;
1370 data
->back_chain_saved_p
= 0;
1373 /* Start interpreting instructions, until we hit the frame's
1374 current PC or the first branch instruction. */
1375 for (pc
= start_pc
; pc
> 0 && pc
< current_pc
; pc
= next_pc
)
1377 bfd_byte insn
[S390_MAX_INSTR_SIZE
];
1378 int insn_len
= s390_readinstruction (insn
, pc
);
1380 bfd_byte dummy
[S390_MAX_INSTR_SIZE
] = { 0 };
1381 bfd_byte
*insn32
= word_size
== 4 ? insn
: dummy
;
1382 bfd_byte
*insn64
= word_size
== 8 ? insn
: dummy
;
1384 /* Fields for various kinds of instructions. */
1385 unsigned int b2
, r1
, r2
, x2
, r3
;
1388 /* The values of SP and FP before this instruction,
1389 for detecting instructions that change them. */
1390 pv_t pre_insn_sp
, pre_insn_fp
;
1391 /* Likewise for the flag whether the back chain was saved. */
1392 int pre_insn_back_chain_saved_p
;
1394 /* If we got an error trying to read the instruction, report it. */
1401 next_pc
= pc
+ insn_len
;
1403 pre_insn_sp
= data
->gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
1404 pre_insn_fp
= data
->gpr
[S390_FRAME_REGNUM
- S390_R0_REGNUM
];
1405 pre_insn_back_chain_saved_p
= data
->back_chain_saved_p
;
1408 /* LHI r1, i2 --- load halfword immediate. */
1409 /* LGHI r1, i2 --- load halfword immediate (64-bit version). */
1410 /* LGFI r1, i2 --- load fullword immediate. */
1411 if (is_ri (insn32
, op1_lhi
, op2_lhi
, &r1
, &i2
)
1412 || is_ri (insn64
, op1_lghi
, op2_lghi
, &r1
, &i2
)
1413 || is_ril (insn
, op1_lgfi
, op2_lgfi
, &r1
, &i2
))
1414 data
->gpr
[r1
] = pv_constant (i2
);
1416 /* LR r1, r2 --- load from register. */
1417 /* LGR r1, r2 --- load from register (64-bit version). */
1418 else if (is_rr (insn32
, op_lr
, &r1
, &r2
)
1419 || is_rre (insn64
, op_lgr
, &r1
, &r2
))
1420 data
->gpr
[r1
] = data
->gpr
[r2
];
1422 /* L r1, d2(x2, b2) --- load. */
1423 /* LY r1, d2(x2, b2) --- load (long-displacement version). */
1424 /* LG r1, d2(x2, b2) --- load (64-bit version). */
1425 else if (is_rx (insn32
, op_l
, &r1
, &d2
, &x2
, &b2
)
1426 || is_rxy (insn32
, op1_ly
, op2_ly
, &r1
, &d2
, &x2
, &b2
)
1427 || is_rxy (insn64
, op1_lg
, op2_lg
, &r1
, &d2
, &x2
, &b2
))
1428 data
->gpr
[r1
] = s390_load (data
, d2
, x2
, b2
, data
->gpr_size
);
1430 /* ST r1, d2(x2, b2) --- store. */
1431 /* STY r1, d2(x2, b2) --- store (long-displacement version). */
1432 /* STG r1, d2(x2, b2) --- store (64-bit version). */
1433 else if (is_rx (insn32
, op_st
, &r1
, &d2
, &x2
, &b2
)
1434 || is_rxy (insn32
, op1_sty
, op2_sty
, &r1
, &d2
, &x2
, &b2
)
1435 || is_rxy (insn64
, op1_stg
, op2_stg
, &r1
, &d2
, &x2
, &b2
))
1436 s390_store (data
, d2
, x2
, b2
, data
->gpr_size
, data
->gpr
[r1
]);
1438 /* STD r1, d2(x2,b2) --- store floating-point register. */
1439 else if (is_rx (insn
, op_std
, &r1
, &d2
, &x2
, &b2
))
1440 s390_store (data
, d2
, x2
, b2
, data
->fpr_size
, data
->fpr
[r1
]);
1442 /* STM r1, r3, d2(b2) --- store multiple. */
1443 /* STMY r1, r3, d2(b2) --- store multiple (long-displacement
1445 /* STMG r1, r3, d2(b2) --- store multiple (64-bit version). */
1446 else if (is_rs (insn32
, op_stm
, &r1
, &r3
, &d2
, &b2
)
1447 || is_rsy (insn32
, op1_stmy
, op2_stmy
, &r1
, &r3
, &d2
, &b2
)
1448 || is_rsy (insn64
, op1_stmg
, op2_stmg
, &r1
, &r3
, &d2
, &b2
))
1450 for (; r1
<= r3
; r1
++, d2
+= data
->gpr_size
)
1451 s390_store (data
, d2
, 0, b2
, data
->gpr_size
, data
->gpr
[r1
]);
1454 /* AHI r1, i2 --- add halfword immediate. */
1455 /* AGHI r1, i2 --- add halfword immediate (64-bit version). */
1456 /* AFI r1, i2 --- add fullword immediate. */
1457 /* AGFI r1, i2 --- add fullword immediate (64-bit version). */
1458 else if (is_ri (insn32
, op1_ahi
, op2_ahi
, &r1
, &i2
)
1459 || is_ri (insn64
, op1_aghi
, op2_aghi
, &r1
, &i2
)
1460 || is_ril (insn32
, op1_afi
, op2_afi
, &r1
, &i2
)
1461 || is_ril (insn64
, op1_agfi
, op2_agfi
, &r1
, &i2
))
1462 data
->gpr
[r1
] = pv_add_constant (data
->gpr
[r1
], i2
);
1464 /* ALFI r1, i2 --- add logical immediate. */
1465 /* ALGFI r1, i2 --- add logical immediate (64-bit version). */
1466 else if (is_ril (insn32
, op1_alfi
, op2_alfi
, &r1
, &i2
)
1467 || is_ril (insn64
, op1_algfi
, op2_algfi
, &r1
, &i2
))
1468 data
->gpr
[r1
] = pv_add_constant (data
->gpr
[r1
],
1469 (CORE_ADDR
)i2
& 0xffffffff);
1471 /* AR r1, r2 -- add register. */
1472 /* AGR r1, r2 -- add register (64-bit version). */
1473 else if (is_rr (insn32
, op_ar
, &r1
, &r2
)
1474 || is_rre (insn64
, op_agr
, &r1
, &r2
))
1475 data
->gpr
[r1
] = pv_add (data
->gpr
[r1
], data
->gpr
[r2
]);
1477 /* A r1, d2(x2, b2) -- add. */
1478 /* AY r1, d2(x2, b2) -- add (long-displacement version). */
1479 /* AG r1, d2(x2, b2) -- add (64-bit version). */
1480 else if (is_rx (insn32
, op_a
, &r1
, &d2
, &x2
, &b2
)
1481 || is_rxy (insn32
, op1_ay
, op2_ay
, &r1
, &d2
, &x2
, &b2
)
1482 || is_rxy (insn64
, op1_ag
, op2_ag
, &r1
, &d2
, &x2
, &b2
))
1483 data
->gpr
[r1
] = pv_add (data
->gpr
[r1
],
1484 s390_load (data
, d2
, x2
, b2
, data
->gpr_size
));
1486 /* SLFI r1, i2 --- subtract logical immediate. */
1487 /* SLGFI r1, i2 --- subtract logical immediate (64-bit version). */
1488 else if (is_ril (insn32
, op1_slfi
, op2_slfi
, &r1
, &i2
)
1489 || is_ril (insn64
, op1_slgfi
, op2_slgfi
, &r1
, &i2
))
1490 data
->gpr
[r1
] = pv_add_constant (data
->gpr
[r1
],
1491 -((CORE_ADDR
)i2
& 0xffffffff));
1493 /* SR r1, r2 -- subtract register. */
1494 /* SGR r1, r2 -- subtract register (64-bit version). */
1495 else if (is_rr (insn32
, op_sr
, &r1
, &r2
)
1496 || is_rre (insn64
, op_sgr
, &r1
, &r2
))
1497 data
->gpr
[r1
] = pv_subtract (data
->gpr
[r1
], data
->gpr
[r2
]);
1499 /* S r1, d2(x2, b2) -- subtract. */
1500 /* SY r1, d2(x2, b2) -- subtract (long-displacement version). */
1501 /* SG r1, d2(x2, b2) -- subtract (64-bit version). */
1502 else if (is_rx (insn32
, op_s
, &r1
, &d2
, &x2
, &b2
)
1503 || is_rxy (insn32
, op1_sy
, op2_sy
, &r1
, &d2
, &x2
, &b2
)
1504 || is_rxy (insn64
, op1_sg
, op2_sg
, &r1
, &d2
, &x2
, &b2
))
1505 data
->gpr
[r1
] = pv_subtract (data
->gpr
[r1
],
1506 s390_load (data
, d2
, x2
, b2
, data
->gpr_size
));
1508 /* LA r1, d2(x2, b2) --- load address. */
1509 /* LAY r1, d2(x2, b2) --- load address (long-displacement version). */
1510 else if (is_rx (insn
, op_la
, &r1
, &d2
, &x2
, &b2
)
1511 || is_rxy (insn
, op1_lay
, op2_lay
, &r1
, &d2
, &x2
, &b2
))
1512 data
->gpr
[r1
] = s390_addr (data
, d2
, x2
, b2
);
1514 /* LARL r1, i2 --- load address relative long. */
1515 else if (is_ril (insn
, op1_larl
, op2_larl
, &r1
, &i2
))
1516 data
->gpr
[r1
] = pv_constant (pc
+ i2
* 2);
1518 /* BASR r1, 0 --- branch and save.
1519 Since r2 is zero, this saves the PC in r1, but doesn't branch. */
1520 else if (is_rr (insn
, op_basr
, &r1
, &r2
)
1522 data
->gpr
[r1
] = pv_constant (next_pc
);
1524 /* BRAS r1, i2 --- branch relative and save. */
1525 else if (is_ri (insn
, op1_bras
, op2_bras
, &r1
, &i2
))
1527 data
->gpr
[r1
] = pv_constant (next_pc
);
1528 next_pc
= pc
+ i2
* 2;
1530 /* We'd better not interpret any backward branches. We'll
1536 /* Terminate search when hitting any other branch instruction. */
1537 else if (is_rr (insn
, op_basr
, &r1
, &r2
)
1538 || is_rx (insn
, op_bas
, &r1
, &d2
, &x2
, &b2
)
1539 || is_rr (insn
, op_bcr
, &r1
, &r2
)
1540 || is_rx (insn
, op_bc
, &r1
, &d2
, &x2
, &b2
)
1541 || is_ri (insn
, op1_brc
, op2_brc
, &r1
, &i2
)
1542 || is_ril (insn
, op1_brcl
, op2_brcl
, &r1
, &i2
)
1543 || is_ril (insn
, op1_brasl
, op2_brasl
, &r2
, &i2
))
1548 /* An instruction we don't know how to simulate. The only
1549 safe thing to do would be to set every value we're tracking
1550 to 'unknown'. Instead, we'll be optimistic: we assume that
1551 we *can* interpret every instruction that the compiler uses
1552 to manipulate any of the data we're interested in here --
1553 then we can just ignore anything else. */
1556 /* Record the address after the last instruction that changed
1557 the FP, SP, or backlink. Ignore instructions that changed
1558 them back to their original values --- those are probably
1559 restore instructions. (The back chain is never restored,
1562 pv_t sp
= data
->gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
1563 pv_t fp
= data
->gpr
[S390_FRAME_REGNUM
- S390_R0_REGNUM
];
1565 if ((! pv_is_identical (pre_insn_sp
, sp
)
1566 && ! pv_is_register_k (sp
, S390_SP_REGNUM
, 0)
1567 && sp
.kind
!= pvk_unknown
)
1568 || (! pv_is_identical (pre_insn_fp
, fp
)
1569 && ! pv_is_register_k (fp
, S390_FRAME_REGNUM
, 0)
1570 && fp
.kind
!= pvk_unknown
)
1571 || pre_insn_back_chain_saved_p
!= data
->back_chain_saved_p
)
1576 /* Record where all the registers were saved. */
1577 pv_area_scan (data
->stack
, s390_check_for_saved
, data
);
1579 free_pv_area (data
->stack
);
1585 /* Advance PC across any function entry prologue instructions to reach
1586 some "real" code. */
1588 s390_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
1590 struct s390_prologue_data data
;
1591 CORE_ADDR skip_pc
, func_addr
;
1593 if (find_pc_partial_function (pc
, NULL
, &func_addr
, NULL
))
1595 CORE_ADDR post_prologue_pc
1596 = skip_prologue_using_sal (gdbarch
, func_addr
);
1597 if (post_prologue_pc
!= 0)
1598 return max (pc
, post_prologue_pc
);
1601 skip_pc
= s390_analyze_prologue (gdbarch
, pc
, (CORE_ADDR
)-1, &data
);
1602 return skip_pc
? skip_pc
: pc
;
1605 /* Implmement the stack_frame_destroyed_p gdbarch method. */
1607 s390_stack_frame_destroyed_p (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
1609 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
1611 /* In frameless functions, there's not frame to destroy and thus
1612 we don't care about the epilogue.
1614 In functions with frame, the epilogue sequence is a pair of
1615 a LM-type instruction that restores (amongst others) the
1616 return register %r14 and the stack pointer %r15, followed
1617 by a branch 'br %r14' --or equivalent-- that effects the
1620 In that situation, this function needs to return 'true' in
1621 exactly one case: when pc points to that branch instruction.
1623 Thus we try to disassemble the one instructions immediately
1624 preceding pc and check whether it is an LM-type instruction
1625 modifying the stack pointer.
1627 Note that disassembling backwards is not reliable, so there
1628 is a slight chance of false positives here ... */
1631 unsigned int r1
, r3
, b2
;
1635 && !target_read_memory (pc
- 4, insn
, 4)
1636 && is_rs (insn
, op_lm
, &r1
, &r3
, &d2
, &b2
)
1637 && r3
== S390_SP_REGNUM
- S390_R0_REGNUM
)
1641 && !target_read_memory (pc
- 6, insn
, 6)
1642 && is_rsy (insn
, op1_lmy
, op2_lmy
, &r1
, &r3
, &d2
, &b2
)
1643 && r3
== S390_SP_REGNUM
- S390_R0_REGNUM
)
1647 && !target_read_memory (pc
- 6, insn
, 6)
1648 && is_rsy (insn
, op1_lmg
, op2_lmg
, &r1
, &r3
, &d2
, &b2
)
1649 && r3
== S390_SP_REGNUM
- S390_R0_REGNUM
)
1655 /* Displaced stepping. */
1657 /* Return true if INSN is a non-branch RIL-b or RIL-c format
1661 is_non_branch_ril (gdb_byte
*insn
)
1663 gdb_byte op1
= insn
[0];
1667 gdb_byte op2
= insn
[1] & 0x0f;
1671 case 0x02: /* llhrl */
1672 case 0x04: /* lghrl */
1673 case 0x05: /* lhrl */
1674 case 0x06: /* llghrl */
1675 case 0x07: /* sthrl */
1676 case 0x08: /* lgrl */
1677 case 0x0b: /* stgrl */
1678 case 0x0c: /* lgfrl */
1679 case 0x0d: /* lrl */
1680 case 0x0e: /* llgfrl */
1681 case 0x0f: /* strl */
1685 else if (op1
== 0xc6)
1687 gdb_byte op2
= insn
[1] & 0x0f;
1691 case 0x00: /* exrl */
1692 case 0x02: /* pfdrl */
1693 case 0x04: /* cghrl */
1694 case 0x05: /* chrl */
1695 case 0x06: /* clghrl */
1696 case 0x07: /* clhrl */
1697 case 0x08: /* cgrl */
1698 case 0x0a: /* clgrl */
1699 case 0x0c: /* cgfrl */
1700 case 0x0d: /* crl */
1701 case 0x0e: /* clgfrl */
1702 case 0x0f: /* clrl */
1710 /* Implementation of gdbarch_displaced_step_copy_insn. */
1712 static struct displaced_step_closure
*
1713 s390_displaced_step_copy_insn (struct gdbarch
*gdbarch
,
1714 CORE_ADDR from
, CORE_ADDR to
,
1715 struct regcache
*regs
)
1717 size_t len
= gdbarch_max_insn_length (gdbarch
);
1718 gdb_byte
*buf
= (gdb_byte
*) xmalloc (len
);
1719 struct cleanup
*old_chain
= make_cleanup (xfree
, buf
);
1721 read_memory (from
, buf
, len
);
1723 /* Adjust the displacement field of PC-relative RIL instructions,
1724 except branches. The latter are handled in the fixup hook. */
1725 if (is_non_branch_ril (buf
))
1729 offset
= extract_signed_integer (buf
+ 2, 4, BFD_ENDIAN_BIG
);
1730 offset
= (from
- to
+ offset
* 2) / 2;
1732 /* If the instruction is too far from the jump pad, punt. This
1733 will usually happen with instructions in shared libraries.
1734 We could probably support these by rewriting them to be
1735 absolute or fully emulating them. */
1736 if (offset
< INT32_MIN
|| offset
> INT32_MAX
)
1738 /* Let the core fall back to stepping over the breakpoint
1740 if (debug_displaced
)
1742 fprintf_unfiltered (gdb_stdlog
,
1743 "displaced: can't displaced step "
1744 "RIL instruction: offset %s out of range\n",
1747 do_cleanups (old_chain
);
1751 store_signed_integer (buf
+ 2, 4, BFD_ENDIAN_BIG
, offset
);
1754 write_memory (to
, buf
, len
);
1756 if (debug_displaced
)
1758 fprintf_unfiltered (gdb_stdlog
, "displaced: copy %s->%s: ",
1759 paddress (gdbarch
, from
), paddress (gdbarch
, to
));
1760 displaced_step_dump_bytes (gdb_stdlog
, buf
, len
);
1763 discard_cleanups (old_chain
);
1764 return (struct displaced_step_closure
*) buf
;
1767 /* Fix up the state of registers and memory after having single-stepped
1768 a displaced instruction. */
1770 s390_displaced_step_fixup (struct gdbarch
*gdbarch
,
1771 struct displaced_step_closure
*closure
,
1772 CORE_ADDR from
, CORE_ADDR to
,
1773 struct regcache
*regs
)
1775 /* Our closure is a copy of the instruction. */
1776 gdb_byte
*insn
= (gdb_byte
*) closure
;
1777 static int s390_instrlen
[] = { 2, 4, 4, 6 };
1778 int insnlen
= s390_instrlen
[insn
[0] >> 6];
1780 /* Fields for various kinds of instructions. */
1781 unsigned int b2
, r1
, r2
, x2
, r3
;
1784 /* Get current PC and addressing mode bit. */
1785 CORE_ADDR pc
= regcache_read_pc (regs
);
1788 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1790 regcache_cooked_read_unsigned (regs
, S390_PSWA_REGNUM
, &amode
);
1791 amode
&= 0x80000000;
1794 if (debug_displaced
)
1795 fprintf_unfiltered (gdb_stdlog
,
1796 "displaced: (s390) fixup (%s, %s) pc %s len %d amode 0x%x\n",
1797 paddress (gdbarch
, from
), paddress (gdbarch
, to
),
1798 paddress (gdbarch
, pc
), insnlen
, (int) amode
);
1800 /* Handle absolute branch and save instructions. */
1801 if (is_rr (insn
, op_basr
, &r1
, &r2
)
1802 || is_rx (insn
, op_bas
, &r1
, &d2
, &x2
, &b2
))
1804 /* Recompute saved return address in R1. */
1805 regcache_cooked_write_unsigned (regs
, S390_R0_REGNUM
+ r1
,
1806 amode
| (from
+ insnlen
));
1809 /* Handle absolute branch instructions. */
1810 else if (is_rr (insn
, op_bcr
, &r1
, &r2
)
1811 || is_rx (insn
, op_bc
, &r1
, &d2
, &x2
, &b2
)
1812 || is_rr (insn
, op_bctr
, &r1
, &r2
)
1813 || is_rre (insn
, op_bctgr
, &r1
, &r2
)
1814 || is_rx (insn
, op_bct
, &r1
, &d2
, &x2
, &b2
)
1815 || is_rxy (insn
, op1_bctg
, op2_brctg
, &r1
, &d2
, &x2
, &b2
)
1816 || is_rs (insn
, op_bxh
, &r1
, &r3
, &d2
, &b2
)
1817 || is_rsy (insn
, op1_bxhg
, op2_bxhg
, &r1
, &r3
, &d2
, &b2
)
1818 || is_rs (insn
, op_bxle
, &r1
, &r3
, &d2
, &b2
)
1819 || is_rsy (insn
, op1_bxleg
, op2_bxleg
, &r1
, &r3
, &d2
, &b2
))
1821 /* Update PC iff branch was *not* taken. */
1822 if (pc
== to
+ insnlen
)
1823 regcache_write_pc (regs
, from
+ insnlen
);
1826 /* Handle PC-relative branch and save instructions. */
1827 else if (is_ri (insn
, op1_bras
, op2_bras
, &r1
, &i2
)
1828 || is_ril (insn
, op1_brasl
, op2_brasl
, &r1
, &i2
))
1831 regcache_write_pc (regs
, pc
- to
+ from
);
1832 /* Recompute saved return address in R1. */
1833 regcache_cooked_write_unsigned (regs
, S390_R0_REGNUM
+ r1
,
1834 amode
| (from
+ insnlen
));
1837 /* Handle PC-relative branch instructions. */
1838 else if (is_ri (insn
, op1_brc
, op2_brc
, &r1
, &i2
)
1839 || is_ril (insn
, op1_brcl
, op2_brcl
, &r1
, &i2
)
1840 || is_ri (insn
, op1_brct
, op2_brct
, &r1
, &i2
)
1841 || is_ri (insn
, op1_brctg
, op2_brctg
, &r1
, &i2
)
1842 || is_rsi (insn
, op_brxh
, &r1
, &r3
, &i2
)
1843 || is_rie (insn
, op1_brxhg
, op2_brxhg
, &r1
, &r3
, &i2
)
1844 || is_rsi (insn
, op_brxle
, &r1
, &r3
, &i2
)
1845 || is_rie (insn
, op1_brxlg
, op2_brxlg
, &r1
, &r3
, &i2
))
1848 regcache_write_pc (regs
, pc
- to
+ from
);
1851 /* Handle LOAD ADDRESS RELATIVE LONG. */
1852 else if (is_ril (insn
, op1_larl
, op2_larl
, &r1
, &i2
))
1855 regcache_write_pc (regs
, from
+ insnlen
);
1856 /* Recompute output address in R1. */
1857 regcache_cooked_write_unsigned (regs
, S390_R0_REGNUM
+ r1
,
1858 amode
| (from
+ i2
* 2));
1861 /* If we executed a breakpoint instruction, point PC right back at it. */
1862 else if (insn
[0] == 0x0 && insn
[1] == 0x1)
1863 regcache_write_pc (regs
, from
);
1865 /* For any other insn, PC points right after the original instruction. */
1867 regcache_write_pc (regs
, from
+ insnlen
);
1869 if (debug_displaced
)
1870 fprintf_unfiltered (gdb_stdlog
,
1871 "displaced: (s390) pc is now %s\n",
1872 paddress (gdbarch
, regcache_read_pc (regs
)));
1876 /* Helper routine to unwind pseudo registers. */
1878 static struct value
*
1879 s390_unwind_pseudo_register (struct frame_info
*this_frame
, int regnum
)
1881 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
1882 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1883 struct type
*type
= register_type (gdbarch
, regnum
);
1885 /* Unwind PC via PSW address. */
1886 if (regnum
== tdep
->pc_regnum
)
1890 val
= frame_unwind_register_value (this_frame
, S390_PSWA_REGNUM
);
1891 if (!value_optimized_out (val
))
1893 LONGEST pswa
= value_as_long (val
);
1895 if (TYPE_LENGTH (type
) == 4)
1896 return value_from_pointer (type
, pswa
& 0x7fffffff);
1898 return value_from_pointer (type
, pswa
);
1902 /* Unwind CC via PSW mask. */
1903 if (regnum
== tdep
->cc_regnum
)
1907 val
= frame_unwind_register_value (this_frame
, S390_PSWM_REGNUM
);
1908 if (!value_optimized_out (val
))
1910 LONGEST pswm
= value_as_long (val
);
1912 if (TYPE_LENGTH (type
) == 4)
1913 return value_from_longest (type
, (pswm
>> 12) & 3);
1915 return value_from_longest (type
, (pswm
>> 44) & 3);
1919 /* Unwind full GPRs to show at least the lower halves (as the
1920 upper halves are undefined). */
1921 if (regnum_is_gpr_full (tdep
, regnum
))
1923 int reg
= regnum
- tdep
->gpr_full_regnum
;
1926 val
= frame_unwind_register_value (this_frame
, S390_R0_REGNUM
+ reg
);
1927 if (!value_optimized_out (val
))
1928 return value_cast (type
, val
);
1931 return allocate_optimized_out_value (type
);
1934 static struct value
*
1935 s390_trad_frame_prev_register (struct frame_info
*this_frame
,
1936 struct trad_frame_saved_reg saved_regs
[],
1939 if (regnum
< S390_NUM_REGS
)
1940 return trad_frame_get_prev_register (this_frame
, saved_regs
, regnum
);
1942 return s390_unwind_pseudo_register (this_frame
, regnum
);
1946 /* Normal stack frames. */
1948 struct s390_unwind_cache
{
1951 CORE_ADDR frame_base
;
1952 CORE_ADDR local_base
;
1954 struct trad_frame_saved_reg
*saved_regs
;
1958 s390_prologue_frame_unwind_cache (struct frame_info
*this_frame
,
1959 struct s390_unwind_cache
*info
)
1961 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
1962 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
1963 struct s390_prologue_data data
;
1964 pv_t
*fp
= &data
.gpr
[S390_FRAME_REGNUM
- S390_R0_REGNUM
];
1965 pv_t
*sp
= &data
.gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
1974 struct frame_info
*next_frame
;
1976 /* Try to find the function start address. If we can't find it, we don't
1977 bother searching for it -- with modern compilers this would be mostly
1978 pointless anyway. Trust that we'll either have valid DWARF-2 CFI data
1979 or else a valid backchain ... */
1980 func
= get_frame_func (this_frame
);
1984 /* Try to analyze the prologue. */
1985 result
= s390_analyze_prologue (gdbarch
, func
,
1986 get_frame_pc (this_frame
), &data
);
1990 /* If this was successful, we should have found the instruction that
1991 sets the stack pointer register to the previous value of the stack
1992 pointer minus the frame size. */
1993 if (!pv_is_register (*sp
, S390_SP_REGNUM
))
1996 /* A frame size of zero at this point can mean either a real
1997 frameless function, or else a failure to find the prologue.
1998 Perform some sanity checks to verify we really have a
1999 frameless function. */
2002 /* If the next frame is a NORMAL_FRAME, this frame *cannot* have frame
2003 size zero. This is only possible if the next frame is a sentinel
2004 frame, a dummy frame, or a signal trampoline frame. */
2005 /* FIXME: cagney/2004-05-01: This sanity check shouldn't be
2006 needed, instead the code should simpliy rely on its
2008 next_frame
= get_next_frame (this_frame
);
2009 while (next_frame
&& get_frame_type (next_frame
) == INLINE_FRAME
)
2010 next_frame
= get_next_frame (next_frame
);
2012 && get_frame_type (get_next_frame (this_frame
)) == NORMAL_FRAME
)
2015 /* If we really have a frameless function, %r14 must be valid
2016 -- in particular, it must point to a different function. */
2017 reg
= get_frame_register_unsigned (this_frame
, S390_RETADDR_REGNUM
);
2018 reg
= gdbarch_addr_bits_remove (gdbarch
, reg
) - 1;
2019 if (get_pc_function_start (reg
) == func
)
2021 /* However, there is one case where it *is* valid for %r14
2022 to point to the same function -- if this is a recursive
2023 call, and we have stopped in the prologue *before* the
2024 stack frame was allocated.
2026 Recognize this case by looking ahead a bit ... */
2028 struct s390_prologue_data data2
;
2029 pv_t
*sp
= &data2
.gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
2031 if (!(s390_analyze_prologue (gdbarch
, func
, (CORE_ADDR
)-1, &data2
)
2032 && pv_is_register (*sp
, S390_SP_REGNUM
)
2039 /* OK, we've found valid prologue data. */
2042 /* If the frame pointer originally also holds the same value
2043 as the stack pointer, we're probably using it. If it holds
2044 some other value -- even a constant offset -- it is most
2045 likely used as temp register. */
2046 if (pv_is_identical (*sp
, *fp
))
2047 frame_pointer
= S390_FRAME_REGNUM
;
2049 frame_pointer
= S390_SP_REGNUM
;
2051 /* If we've detected a function with stack frame, we'll still have to
2052 treat it as frameless if we're currently within the function epilog
2053 code at a point where the frame pointer has already been restored.
2054 This can only happen in an innermost frame. */
2055 /* FIXME: cagney/2004-05-01: This sanity check shouldn't be needed,
2056 instead the code should simpliy rely on its analysis. */
2057 next_frame
= get_next_frame (this_frame
);
2058 while (next_frame
&& get_frame_type (next_frame
) == INLINE_FRAME
)
2059 next_frame
= get_next_frame (next_frame
);
2061 && (next_frame
== NULL
2062 || get_frame_type (get_next_frame (this_frame
)) != NORMAL_FRAME
))
2064 /* See the comment in s390_stack_frame_destroyed_p on why this is
2065 not completely reliable ... */
2066 if (s390_stack_frame_destroyed_p (gdbarch
, get_frame_pc (this_frame
)))
2068 memset (&data
, 0, sizeof (data
));
2070 frame_pointer
= S390_SP_REGNUM
;
2074 /* Once we know the frame register and the frame size, we can unwind
2075 the current value of the frame register from the next frame, and
2076 add back the frame size to arrive that the previous frame's
2077 stack pointer value. */
2078 prev_sp
= get_frame_register_unsigned (this_frame
, frame_pointer
) + size
;
2079 cfa
= prev_sp
+ 16*word_size
+ 32;
2081 /* Set up ABI call-saved/call-clobbered registers. */
2082 for (i
= 0; i
< S390_NUM_REGS
; i
++)
2083 if (!s390_register_call_saved (gdbarch
, i
))
2084 trad_frame_set_unknown (info
->saved_regs
, i
);
2086 /* CC is always call-clobbered. */
2087 trad_frame_set_unknown (info
->saved_regs
, S390_PSWM_REGNUM
);
2089 /* Record the addresses of all register spill slots the prologue parser
2090 has recognized. Consider only registers defined as call-saved by the
2091 ABI; for call-clobbered registers the parser may have recognized
2094 for (i
= 0; i
< 16; i
++)
2095 if (s390_register_call_saved (gdbarch
, S390_R0_REGNUM
+ i
)
2096 && data
.gpr_slot
[i
] != 0)
2097 info
->saved_regs
[S390_R0_REGNUM
+ i
].addr
= cfa
- data
.gpr_slot
[i
];
2099 for (i
= 0; i
< 16; i
++)
2100 if (s390_register_call_saved (gdbarch
, S390_F0_REGNUM
+ i
)
2101 && data
.fpr_slot
[i
] != 0)
2102 info
->saved_regs
[S390_F0_REGNUM
+ i
].addr
= cfa
- data
.fpr_slot
[i
];
2104 /* Function return will set PC to %r14. */
2105 info
->saved_regs
[S390_PSWA_REGNUM
] = info
->saved_regs
[S390_RETADDR_REGNUM
];
2107 /* In frameless functions, we unwind simply by moving the return
2108 address to the PC. However, if we actually stored to the
2109 save area, use that -- we might only think the function frameless
2110 because we're in the middle of the prologue ... */
2112 && !trad_frame_addr_p (info
->saved_regs
, S390_PSWA_REGNUM
))
2114 info
->saved_regs
[S390_PSWA_REGNUM
].realreg
= S390_RETADDR_REGNUM
;
2117 /* Another sanity check: unless this is a frameless function,
2118 we should have found spill slots for SP and PC.
2119 If not, we cannot unwind further -- this happens e.g. in
2120 libc's thread_start routine. */
2123 if (!trad_frame_addr_p (info
->saved_regs
, S390_SP_REGNUM
)
2124 || !trad_frame_addr_p (info
->saved_regs
, S390_PSWA_REGNUM
))
2128 /* We use the current value of the frame register as local_base,
2129 and the top of the register save area as frame_base. */
2132 info
->frame_base
= prev_sp
+ 16*word_size
+ 32;
2133 info
->local_base
= prev_sp
- size
;
2141 s390_backchain_frame_unwind_cache (struct frame_info
*this_frame
,
2142 struct s390_unwind_cache
*info
)
2144 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2145 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2146 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2147 CORE_ADDR backchain
;
2152 /* Set up ABI call-saved/call-clobbered registers. */
2153 for (i
= 0; i
< S390_NUM_REGS
; i
++)
2154 if (!s390_register_call_saved (gdbarch
, i
))
2155 trad_frame_set_unknown (info
->saved_regs
, i
);
2157 /* CC is always call-clobbered. */
2158 trad_frame_set_unknown (info
->saved_regs
, S390_PSWM_REGNUM
);
2160 /* Get the backchain. */
2161 reg
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
2162 backchain
= read_memory_unsigned_integer (reg
, word_size
, byte_order
);
2164 /* A zero backchain terminates the frame chain. As additional
2165 sanity check, let's verify that the spill slot for SP in the
2166 save area pointed to by the backchain in fact links back to
2169 && safe_read_memory_integer (backchain
+ 15*word_size
,
2170 word_size
, byte_order
, &sp
)
2171 && (CORE_ADDR
)sp
== backchain
)
2173 /* We don't know which registers were saved, but it will have
2174 to be at least %r14 and %r15. This will allow us to continue
2175 unwinding, but other prev-frame registers may be incorrect ... */
2176 info
->saved_regs
[S390_SP_REGNUM
].addr
= backchain
+ 15*word_size
;
2177 info
->saved_regs
[S390_RETADDR_REGNUM
].addr
= backchain
+ 14*word_size
;
2179 /* Function return will set PC to %r14. */
2180 info
->saved_regs
[S390_PSWA_REGNUM
]
2181 = info
->saved_regs
[S390_RETADDR_REGNUM
];
2183 /* We use the current value of the frame register as local_base,
2184 and the top of the register save area as frame_base. */
2185 info
->frame_base
= backchain
+ 16*word_size
+ 32;
2186 info
->local_base
= reg
;
2189 info
->func
= get_frame_pc (this_frame
);
2192 static struct s390_unwind_cache
*
2193 s390_frame_unwind_cache (struct frame_info
*this_frame
,
2194 void **this_prologue_cache
)
2196 struct s390_unwind_cache
*info
;
2198 if (*this_prologue_cache
)
2199 return (struct s390_unwind_cache
*) *this_prologue_cache
;
2201 info
= FRAME_OBSTACK_ZALLOC (struct s390_unwind_cache
);
2202 *this_prologue_cache
= info
;
2203 info
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
2205 info
->frame_base
= -1;
2206 info
->local_base
= -1;
2210 /* Try to use prologue analysis to fill the unwind cache.
2211 If this fails, fall back to reading the stack backchain. */
2212 if (!s390_prologue_frame_unwind_cache (this_frame
, info
))
2213 s390_backchain_frame_unwind_cache (this_frame
, info
);
2215 CATCH (ex
, RETURN_MASK_ERROR
)
2217 if (ex
.error
!= NOT_AVAILABLE_ERROR
)
2218 throw_exception (ex
);
2226 s390_frame_this_id (struct frame_info
*this_frame
,
2227 void **this_prologue_cache
,
2228 struct frame_id
*this_id
)
2230 struct s390_unwind_cache
*info
2231 = s390_frame_unwind_cache (this_frame
, this_prologue_cache
);
2233 if (info
->frame_base
== -1)
2236 *this_id
= frame_id_build (info
->frame_base
, info
->func
);
2239 static struct value
*
2240 s390_frame_prev_register (struct frame_info
*this_frame
,
2241 void **this_prologue_cache
, int regnum
)
2243 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2244 struct s390_unwind_cache
*info
2245 = s390_frame_unwind_cache (this_frame
, this_prologue_cache
);
2247 return s390_trad_frame_prev_register (this_frame
, info
->saved_regs
, regnum
);
2250 static const struct frame_unwind s390_frame_unwind
= {
2252 default_frame_unwind_stop_reason
,
2254 s390_frame_prev_register
,
2256 default_frame_sniffer
2260 /* Code stubs and their stack frames. For things like PLTs and NULL
2261 function calls (where there is no true frame and the return address
2262 is in the RETADDR register). */
2264 struct s390_stub_unwind_cache
2266 CORE_ADDR frame_base
;
2267 struct trad_frame_saved_reg
*saved_regs
;
2270 static struct s390_stub_unwind_cache
*
2271 s390_stub_frame_unwind_cache (struct frame_info
*this_frame
,
2272 void **this_prologue_cache
)
2274 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2275 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2276 struct s390_stub_unwind_cache
*info
;
2279 if (*this_prologue_cache
)
2280 return (struct s390_stub_unwind_cache
*) *this_prologue_cache
;
2282 info
= FRAME_OBSTACK_ZALLOC (struct s390_stub_unwind_cache
);
2283 *this_prologue_cache
= info
;
2284 info
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
2286 /* The return address is in register %r14. */
2287 info
->saved_regs
[S390_PSWA_REGNUM
].realreg
= S390_RETADDR_REGNUM
;
2289 /* Retrieve stack pointer and determine our frame base. */
2290 reg
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
2291 info
->frame_base
= reg
+ 16*word_size
+ 32;
2297 s390_stub_frame_this_id (struct frame_info
*this_frame
,
2298 void **this_prologue_cache
,
2299 struct frame_id
*this_id
)
2301 struct s390_stub_unwind_cache
*info
2302 = s390_stub_frame_unwind_cache (this_frame
, this_prologue_cache
);
2303 *this_id
= frame_id_build (info
->frame_base
, get_frame_pc (this_frame
));
2306 static struct value
*
2307 s390_stub_frame_prev_register (struct frame_info
*this_frame
,
2308 void **this_prologue_cache
, int regnum
)
2310 struct s390_stub_unwind_cache
*info
2311 = s390_stub_frame_unwind_cache (this_frame
, this_prologue_cache
);
2312 return s390_trad_frame_prev_register (this_frame
, info
->saved_regs
, regnum
);
2316 s390_stub_frame_sniffer (const struct frame_unwind
*self
,
2317 struct frame_info
*this_frame
,
2318 void **this_prologue_cache
)
2320 CORE_ADDR addr_in_block
;
2321 bfd_byte insn
[S390_MAX_INSTR_SIZE
];
2323 /* If the current PC points to non-readable memory, we assume we
2324 have trapped due to an invalid function pointer call. We handle
2325 the non-existing current function like a PLT stub. */
2326 addr_in_block
= get_frame_address_in_block (this_frame
);
2327 if (in_plt_section (addr_in_block
)
2328 || s390_readinstruction (insn
, get_frame_pc (this_frame
)) < 0)
2333 static const struct frame_unwind s390_stub_frame_unwind
= {
2335 default_frame_unwind_stop_reason
,
2336 s390_stub_frame_this_id
,
2337 s390_stub_frame_prev_register
,
2339 s390_stub_frame_sniffer
2343 /* Signal trampoline stack frames. */
2345 struct s390_sigtramp_unwind_cache
{
2346 CORE_ADDR frame_base
;
2347 struct trad_frame_saved_reg
*saved_regs
;
2350 static struct s390_sigtramp_unwind_cache
*
2351 s390_sigtramp_frame_unwind_cache (struct frame_info
*this_frame
,
2352 void **this_prologue_cache
)
2354 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2355 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2356 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2357 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2358 struct s390_sigtramp_unwind_cache
*info
;
2359 ULONGEST this_sp
, prev_sp
;
2360 CORE_ADDR next_ra
, next_cfa
, sigreg_ptr
, sigreg_high_off
;
2363 if (*this_prologue_cache
)
2364 return (struct s390_sigtramp_unwind_cache
*) *this_prologue_cache
;
2366 info
= FRAME_OBSTACK_ZALLOC (struct s390_sigtramp_unwind_cache
);
2367 *this_prologue_cache
= info
;
2368 info
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
2370 this_sp
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
2371 next_ra
= get_frame_pc (this_frame
);
2372 next_cfa
= this_sp
+ 16*word_size
+ 32;
2374 /* New-style RT frame:
2375 retcode + alignment (8 bytes)
2377 ucontext (contains sigregs at offset 5 words). */
2378 if (next_ra
== next_cfa
)
2380 sigreg_ptr
= next_cfa
+ 8 + 128 + align_up (5*word_size
, 8);
2381 /* sigregs are followed by uc_sigmask (8 bytes), then by the
2382 upper GPR halves if present. */
2383 sigreg_high_off
= 8;
2386 /* Old-style RT frame and all non-RT frames:
2387 old signal mask (8 bytes)
2388 pointer to sigregs. */
2391 sigreg_ptr
= read_memory_unsigned_integer (next_cfa
+ 8,
2392 word_size
, byte_order
);
2393 /* sigregs are followed by signo (4 bytes), then by the
2394 upper GPR halves if present. */
2395 sigreg_high_off
= 4;
2398 /* The sigregs structure looks like this:
2407 /* PSW mask and address. */
2408 info
->saved_regs
[S390_PSWM_REGNUM
].addr
= sigreg_ptr
;
2409 sigreg_ptr
+= word_size
;
2410 info
->saved_regs
[S390_PSWA_REGNUM
].addr
= sigreg_ptr
;
2411 sigreg_ptr
+= word_size
;
2413 /* Then the GPRs. */
2414 for (i
= 0; i
< 16; i
++)
2416 info
->saved_regs
[S390_R0_REGNUM
+ i
].addr
= sigreg_ptr
;
2417 sigreg_ptr
+= word_size
;
2420 /* Then the ACRs. */
2421 for (i
= 0; i
< 16; i
++)
2423 info
->saved_regs
[S390_A0_REGNUM
+ i
].addr
= sigreg_ptr
;
2427 /* The floating-point control word. */
2428 info
->saved_regs
[S390_FPC_REGNUM
].addr
= sigreg_ptr
;
2431 /* And finally the FPRs. */
2432 for (i
= 0; i
< 16; i
++)
2434 info
->saved_regs
[S390_F0_REGNUM
+ i
].addr
= sigreg_ptr
;
2438 /* If we have them, the GPR upper halves are appended at the end. */
2439 sigreg_ptr
+= sigreg_high_off
;
2440 if (tdep
->gpr_full_regnum
!= -1)
2441 for (i
= 0; i
< 16; i
++)
2443 info
->saved_regs
[S390_R0_UPPER_REGNUM
+ i
].addr
= sigreg_ptr
;
2447 /* Restore the previous frame's SP. */
2448 prev_sp
= read_memory_unsigned_integer (
2449 info
->saved_regs
[S390_SP_REGNUM
].addr
,
2450 word_size
, byte_order
);
2452 /* Determine our frame base. */
2453 info
->frame_base
= prev_sp
+ 16*word_size
+ 32;
2459 s390_sigtramp_frame_this_id (struct frame_info
*this_frame
,
2460 void **this_prologue_cache
,
2461 struct frame_id
*this_id
)
2463 struct s390_sigtramp_unwind_cache
*info
2464 = s390_sigtramp_frame_unwind_cache (this_frame
, this_prologue_cache
);
2465 *this_id
= frame_id_build (info
->frame_base
, get_frame_pc (this_frame
));
2468 static struct value
*
2469 s390_sigtramp_frame_prev_register (struct frame_info
*this_frame
,
2470 void **this_prologue_cache
, int regnum
)
2472 struct s390_sigtramp_unwind_cache
*info
2473 = s390_sigtramp_frame_unwind_cache (this_frame
, this_prologue_cache
);
2474 return s390_trad_frame_prev_register (this_frame
, info
->saved_regs
, regnum
);
2478 s390_sigtramp_frame_sniffer (const struct frame_unwind
*self
,
2479 struct frame_info
*this_frame
,
2480 void **this_prologue_cache
)
2482 CORE_ADDR pc
= get_frame_pc (this_frame
);
2483 bfd_byte sigreturn
[2];
2485 if (target_read_memory (pc
, sigreturn
, 2))
2488 if (sigreturn
[0] != op_svc
)
2491 if (sigreturn
[1] != 119 /* sigreturn */
2492 && sigreturn
[1] != 173 /* rt_sigreturn */)
2498 static const struct frame_unwind s390_sigtramp_frame_unwind
= {
2500 default_frame_unwind_stop_reason
,
2501 s390_sigtramp_frame_this_id
,
2502 s390_sigtramp_frame_prev_register
,
2504 s390_sigtramp_frame_sniffer
2507 /* Retrieve the syscall number at a ptrace syscall-stop. Return -1
2511 s390_linux_get_syscall_number (struct gdbarch
*gdbarch
,
2514 struct regcache
*regs
= get_thread_regcache (ptid
);
2515 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2516 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2518 ULONGEST svc_number
= -1;
2521 /* Assume that the PC points after the 2-byte SVC instruction. We
2522 don't currently support SVC via EXECUTE. */
2523 regcache_cooked_read_unsigned (regs
, tdep
->pc_regnum
, &pc
);
2525 opcode
= read_memory_unsigned_integer ((CORE_ADDR
) pc
, 1, byte_order
);
2526 if (opcode
!= op_svc
)
2529 svc_number
= read_memory_unsigned_integer ((CORE_ADDR
) pc
+ 1, 1,
2531 if (svc_number
== 0)
2532 regcache_cooked_read_unsigned (regs
, S390_R1_REGNUM
, &svc_number
);
2537 /* Process record-replay */
2539 static struct linux_record_tdep s390_linux_record_tdep
;
2540 static struct linux_record_tdep s390x_linux_record_tdep
;
2542 /* Record all registers but PC register for process-record. */
2545 s390_all_but_pc_registers_record (struct regcache
*regcache
)
2547 struct gdbarch
*gdbarch
= get_regcache_arch (regcache
);
2548 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2551 for (i
= 0; i
< 16; i
++)
2553 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
2555 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
2557 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ i
))
2559 if (tdep
->gpr_full_regnum
!= -1)
2560 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
2562 if (tdep
->v0_full_regnum
!= -1)
2564 if (record_full_arch_list_add_reg (regcache
, S390_V0_LOWER_REGNUM
+ i
))
2566 if (record_full_arch_list_add_reg (regcache
, S390_V16_REGNUM
+ i
))
2570 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
2572 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
2578 static enum gdb_syscall
2579 s390_canonicalize_syscall (int syscall
, enum s390_abi_kind abi
)
2583 /* s390 syscall numbers < 222 are mostly the same as x86, so just list
2586 return gdb_sys_no_syscall
;
2588 return gdb_sys_restart_syscall
;
2589 /* These syscalls work only on 31-bit. */
2591 case 16: /* lchown[16] */
2592 case 23: /* setuid[16] */
2593 case 24: /* getuid[16] */
2594 case 25: /* stime */
2595 case 46: /* setgid[16] */
2596 case 47: /* getgid[16] */
2597 case 49: /* seteuid[16] */
2598 case 50: /* getegid[16] */
2599 case 70: /* setreuid[16] */
2600 case 71: /* setregid[16] */
2601 case 76: /* [old_]getrlimit */
2602 case 80: /* getgroups[16] */
2603 case 81: /* setgroups[16] */
2604 case 95: /* fchown[16] */
2605 case 101: /* ioperm */
2606 case 138: /* setfsuid[16] */
2607 case 139: /* setfsgid[16] */
2608 case 140: /* _llseek */
2609 case 164: /* setresuid[16] */
2610 case 165: /* getresuid[16] */
2611 case 170: /* setresgid[16] */
2612 case 171: /* getresgid[16] */
2613 case 182: /* chown[16] */
2614 case 192: /* mmap2 */
2615 case 193: /* truncate64 */
2616 case 194: /* ftruncate64 */
2617 case 195: /* stat64 */
2618 case 196: /* lstat64 */
2619 case 197: /* fstat64 */
2620 case 221: /* fcntl64 */
2621 if (abi
== ABI_LINUX_S390
)
2622 return (enum gdb_syscall
) syscall
;
2623 return gdb_sys_no_syscall
;
2624 /* These syscalls don't exist on s390. */
2625 case 17: /* break */
2626 case 18: /* oldstat */
2627 case 28: /* oldfstat */
2630 case 35: /* ftime */
2634 case 58: /* ulimit */
2635 case 59: /* oldolduname */
2636 case 68: /* sgetmask */
2637 case 69: /* ssetmask */
2638 case 82: /* [old_]select */
2639 case 84: /* oldlstat */
2640 case 98: /* profil */
2641 case 109: /* olduname */
2642 case 113: /* vm86old */
2643 case 123: /* modify_ldt */
2644 case 166: /* vm86 */
2645 return gdb_sys_no_syscall
;
2647 return gdb_sys_lookup_dcookie
;
2648 /* Here come the differences. */
2650 return gdb_sys_readahead
;
2652 if (abi
== ABI_LINUX_S390
)
2653 return gdb_sys_sendfile64
;
2654 return gdb_sys_no_syscall
;
2655 /* 224-235 handled below */
2657 return gdb_sys_gettid
;
2659 return gdb_sys_tkill
;
2661 return gdb_sys_futex
;
2663 return gdb_sys_sched_setaffinity
;
2665 return gdb_sys_sched_getaffinity
;
2667 return gdb_sys_tgkill
;
2670 return gdb_sys_io_setup
;
2672 return gdb_sys_io_destroy
;
2674 return gdb_sys_io_getevents
;
2676 return gdb_sys_io_submit
;
2678 return gdb_sys_io_cancel
;
2680 return gdb_sys_exit_group
;
2682 return gdb_sys_epoll_create
;
2684 return gdb_sys_epoll_ctl
;
2686 return gdb_sys_epoll_wait
;
2688 return gdb_sys_set_tid_address
;
2690 return gdb_sys_fadvise64
;
2691 /* 254-262 handled below */
2694 if (abi
== ABI_LINUX_S390
)
2695 return gdb_sys_fadvise64_64
;
2696 return gdb_sys_no_syscall
;
2698 return gdb_sys_statfs64
;
2700 return gdb_sys_fstatfs64
;
2702 return gdb_sys_remap_file_pages
;
2703 /* 268-270 reserved */
2704 /* 271-277 handled below */
2706 return gdb_sys_add_key
;
2708 return gdb_sys_request_key
;
2710 return gdb_sys_keyctl
;
2712 return gdb_sys_waitid
;
2713 /* 282-312 handled below */
2715 if (abi
== ABI_LINUX_S390
)
2716 return gdb_sys_fstatat64
;
2717 return gdb_sys_newfstatat
;
2718 /* 313+ not yet supported */
2723 /* Most "old" syscalls copied from i386. */
2726 /* xattr syscalls. */
2727 else if (syscall
>= 224 && syscall
<= 235)
2729 /* timer syscalls. */
2730 else if (syscall
>= 254 && syscall
<= 262)
2732 /* mq_* and kexec_load */
2733 else if (syscall
>= 271 && syscall
<= 277)
2735 /* ioprio_set .. epoll_pwait */
2736 else if (syscall
>= 282 && syscall
<= 312)
2739 ret
= gdb_sys_no_syscall
;
2741 return (enum gdb_syscall
) ret
;
2747 s390_linux_syscall_record (struct regcache
*regcache
, LONGEST syscall_native
)
2749 struct gdbarch
*gdbarch
= get_regcache_arch (regcache
);
2750 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2752 enum gdb_syscall syscall_gdb
;
2754 /* On s390, syscall number can be passed either as immediate field of svc
2755 instruction, or in %r1 (with svc 0). */
2756 if (syscall_native
== 0)
2757 regcache_raw_read_signed (regcache
, S390_R1_REGNUM
, &syscall_native
);
2759 syscall_gdb
= s390_canonicalize_syscall (syscall_native
, tdep
->abi
);
2761 if (syscall_gdb
< 0)
2763 printf_unfiltered (_("Process record and replay target doesn't "
2764 "support syscall number %s\n"),
2765 plongest (syscall_native
));
2769 if (syscall_gdb
== gdb_sys_sigreturn
2770 || syscall_gdb
== gdb_sys_rt_sigreturn
)
2772 if (s390_all_but_pc_registers_record (regcache
))
2777 if (tdep
->abi
== ABI_LINUX_ZSERIES
)
2778 ret
= record_linux_system_call (syscall_gdb
, regcache
,
2779 &s390x_linux_record_tdep
);
2781 ret
= record_linux_system_call (syscall_gdb
, regcache
,
2782 &s390_linux_record_tdep
);
2787 /* Record the return value of the system call. */
2788 if (record_full_arch_list_add_reg (regcache
, S390_R2_REGNUM
))
2795 s390_linux_record_signal (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2796 enum gdb_signal signal
)
2798 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2799 /* There are two kinds of signal frames on s390. rt_sigframe is always
2800 the larger one, so don't even bother with sigframe. */
2801 const int sizeof_rt_sigframe
= (tdep
->abi
== ABI_LINUX_ZSERIES
?
2802 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
2806 for (i
= 0; i
< 16; i
++)
2808 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
2810 if (tdep
->gpr_full_regnum
!= -1)
2811 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
2814 if (record_full_arch_list_add_reg (regcache
, S390_PSWA_REGNUM
))
2816 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
2819 /* Record the change in the stack.
2820 frame-size = sizeof (struct rt_sigframe) + SIGNAL_FRAMESIZE */
2821 regcache_raw_read_unsigned (regcache
, S390_SP_REGNUM
, &sp
);
2822 sp
-= sizeof_rt_sigframe
;
2824 if (record_full_arch_list_add_mem (sp
, sizeof_rt_sigframe
))
2827 if (record_full_arch_list_add_end ())
2833 /* Frame base handling. */
2836 s390_frame_base_address (struct frame_info
*this_frame
, void **this_cache
)
2838 struct s390_unwind_cache
*info
2839 = s390_frame_unwind_cache (this_frame
, this_cache
);
2840 return info
->frame_base
;
2844 s390_local_base_address (struct frame_info
*this_frame
, void **this_cache
)
2846 struct s390_unwind_cache
*info
2847 = s390_frame_unwind_cache (this_frame
, this_cache
);
2848 return info
->local_base
;
2851 static const struct frame_base s390_frame_base
= {
2853 s390_frame_base_address
,
2854 s390_local_base_address
,
2855 s390_local_base_address
2859 s390_unwind_pc (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
2861 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2863 pc
= frame_unwind_register_unsigned (next_frame
, tdep
->pc_regnum
);
2864 return gdbarch_addr_bits_remove (gdbarch
, pc
);
2868 s390_unwind_sp (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
2871 sp
= frame_unwind_register_unsigned (next_frame
, S390_SP_REGNUM
);
2872 return gdbarch_addr_bits_remove (gdbarch
, sp
);
2876 /* DWARF-2 frame support. */
2878 static struct value
*
2879 s390_dwarf2_prev_register (struct frame_info
*this_frame
, void **this_cache
,
2882 return s390_unwind_pseudo_register (this_frame
, regnum
);
2886 s390_dwarf2_frame_init_reg (struct gdbarch
*gdbarch
, int regnum
,
2887 struct dwarf2_frame_state_reg
*reg
,
2888 struct frame_info
*this_frame
)
2890 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2892 /* The condition code (and thus PSW mask) is call-clobbered. */
2893 if (regnum
== S390_PSWM_REGNUM
)
2894 reg
->how
= DWARF2_FRAME_REG_UNDEFINED
;
2896 /* The PSW address unwinds to the return address. */
2897 else if (regnum
== S390_PSWA_REGNUM
)
2898 reg
->how
= DWARF2_FRAME_REG_RA
;
2900 /* Fixed registers are call-saved or call-clobbered
2901 depending on the ABI in use. */
2902 else if (regnum
< S390_NUM_REGS
)
2904 if (s390_register_call_saved (gdbarch
, regnum
))
2905 reg
->how
= DWARF2_FRAME_REG_SAME_VALUE
;
2907 reg
->how
= DWARF2_FRAME_REG_UNDEFINED
;
2910 /* We install a special function to unwind pseudos. */
2913 reg
->how
= DWARF2_FRAME_REG_FN
;
2914 reg
->loc
.fn
= s390_dwarf2_prev_register
;
2919 /* Dummy function calls. */
2921 /* Unwrap any single-field structs in TYPE and return the effective
2922 "inner" type. E.g., yield "float" for all these cases:
2926 struct { struct { float x; } x; };
2927 struct { struct { struct { float x; } x; } x; };
2929 However, if an inner type is smaller than MIN_SIZE, abort the
2932 static struct type
*
2933 s390_effective_inner_type (struct type
*type
, unsigned int min_size
)
2935 while (TYPE_CODE (type
) == TYPE_CODE_STRUCT
2936 && TYPE_NFIELDS (type
) == 1)
2938 struct type
*inner
= check_typedef (TYPE_FIELD_TYPE (type
, 0));
2940 if (TYPE_LENGTH (inner
) < min_size
)
2948 /* Return non-zero if TYPE should be passed like "float" or
2952 s390_function_arg_float (struct type
*type
)
2954 /* Note that long double as well as complex types are intentionally
2956 if (TYPE_LENGTH (type
) > 8)
2959 /* A struct containing just a float or double is passed like a float
2961 type
= s390_effective_inner_type (type
, 0);
2963 return (TYPE_CODE (type
) == TYPE_CODE_FLT
2964 || TYPE_CODE (type
) == TYPE_CODE_DECFLOAT
);
2967 /* Return non-zero if TYPE should be passed like a vector. */
2970 s390_function_arg_vector (struct type
*type
)
2972 if (TYPE_LENGTH (type
) > 16)
2975 /* Structs containing just a vector are passed like a vector. */
2976 type
= s390_effective_inner_type (type
, TYPE_LENGTH (type
));
2978 return TYPE_CODE (type
) == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type
);
2981 /* Determine whether N is a power of two. */
2984 is_power_of_two (unsigned int n
)
2986 return n
&& ((n
& (n
- 1)) == 0);
2989 /* For an argument whose type is TYPE and which is not passed like a
2990 float or vector, return non-zero if it should be passed like "int"
2994 s390_function_arg_integer (struct type
*type
)
2996 enum type_code code
= TYPE_CODE (type
);
2998 if (TYPE_LENGTH (type
) > 8)
3001 if (code
== TYPE_CODE_INT
3002 || code
== TYPE_CODE_ENUM
3003 || code
== TYPE_CODE_RANGE
3004 || code
== TYPE_CODE_CHAR
3005 || code
== TYPE_CODE_BOOL
3006 || code
== TYPE_CODE_PTR
3007 || code
== TYPE_CODE_REF
)
3010 return ((code
== TYPE_CODE_UNION
|| code
== TYPE_CODE_STRUCT
)
3011 && is_power_of_two (TYPE_LENGTH (type
)));
3014 /* Argument passing state: Internal data structure passed to helper
3015 routines of s390_push_dummy_call. */
3017 struct s390_arg_state
3019 /* Register cache, or NULL, if we are in "preparation mode". */
3020 struct regcache
*regcache
;
3021 /* Next available general/floating-point/vector register for
3022 argument passing. */
3024 /* Current pointer to copy area (grows downwards). */
3026 /* Current pointer to parameter area (grows upwards). */
3030 /* Prepare one argument ARG for a dummy call and update the argument
3031 passing state AS accordingly. If the regcache field in AS is set,
3032 operate in "write mode" and write ARG into the inferior. Otherwise
3033 run "preparation mode" and skip all updates to the inferior. */
3036 s390_handle_arg (struct s390_arg_state
*as
, struct value
*arg
,
3037 struct gdbarch_tdep
*tdep
, int word_size
,
3038 enum bfd_endian byte_order
, int is_unnamed
)
3040 struct type
*type
= check_typedef (value_type (arg
));
3041 unsigned int length
= TYPE_LENGTH (type
);
3042 int write_mode
= as
->regcache
!= NULL
;
3044 if (s390_function_arg_float (type
))
3046 /* The GNU/Linux for S/390 ABI uses FPRs 0 and 2 to pass
3047 arguments. The GNU/Linux for zSeries ABI uses 0, 2, 4, and
3049 if (as
->fr
<= (tdep
->abi
== ABI_LINUX_S390
? 2 : 6))
3051 /* When we store a single-precision value in an FP register,
3052 it occupies the leftmost bits. */
3054 regcache_cooked_write_part (as
->regcache
,
3055 S390_F0_REGNUM
+ as
->fr
,
3057 value_contents (arg
));
3062 /* When we store a single-precision value in a stack slot,
3063 it occupies the rightmost bits. */
3064 as
->argp
= align_up (as
->argp
+ length
, word_size
);
3066 write_memory (as
->argp
- length
, value_contents (arg
),
3070 else if (tdep
->vector_abi
== S390_VECTOR_ABI_128
3071 && s390_function_arg_vector (type
))
3073 static const char use_vr
[] = {24, 26, 28, 30, 25, 27, 29, 31};
3075 if (!is_unnamed
&& as
->vr
< ARRAY_SIZE (use_vr
))
3077 int regnum
= S390_V24_REGNUM
+ use_vr
[as
->vr
] - 24;
3080 regcache_cooked_write_part (as
->regcache
, regnum
,
3082 value_contents (arg
));
3088 write_memory (as
->argp
, value_contents (arg
), length
);
3089 as
->argp
= align_up (as
->argp
+ length
, word_size
);
3092 else if (s390_function_arg_integer (type
) && length
<= word_size
)
3094 /* Initialize it just to avoid a GCC false warning. */
3099 /* Place value in least significant bits of the register or
3100 memory word and sign- or zero-extend to full word size.
3101 This also applies to a struct or union. */
3102 val
= TYPE_UNSIGNED (type
)
3103 ? extract_unsigned_integer (value_contents (arg
),
3105 : extract_signed_integer (value_contents (arg
),
3106 length
, byte_order
);
3112 regcache_cooked_write_unsigned (as
->regcache
,
3113 S390_R0_REGNUM
+ as
->gr
,
3120 write_memory_unsigned_integer (as
->argp
, word_size
,
3122 as
->argp
+= word_size
;
3125 else if (s390_function_arg_integer (type
) && length
== 8)
3131 regcache_cooked_write (as
->regcache
,
3132 S390_R0_REGNUM
+ as
->gr
,
3133 value_contents (arg
));
3134 regcache_cooked_write (as
->regcache
,
3135 S390_R0_REGNUM
+ as
->gr
+ 1,
3136 value_contents (arg
) + word_size
);
3142 /* If we skipped r6 because we couldn't fit a DOUBLE_ARG
3143 in it, then don't go back and use it again later. */
3147 write_memory (as
->argp
, value_contents (arg
), length
);
3153 /* This argument type is never passed in registers. Place the
3154 value in the copy area and pass a pointer to it. Use 8-byte
3155 alignment as a conservative assumption. */
3156 as
->copy
= align_down (as
->copy
- length
, 8);
3158 write_memory (as
->copy
, value_contents (arg
), length
);
3163 regcache_cooked_write_unsigned (as
->regcache
,
3164 S390_R0_REGNUM
+ as
->gr
,
3171 write_memory_unsigned_integer (as
->argp
, word_size
,
3172 byte_order
, as
->copy
);
3173 as
->argp
+= word_size
;
3178 /* Put the actual parameter values pointed to by ARGS[0..NARGS-1] in
3179 place to be passed to a function, as specified by the "GNU/Linux
3180 for S/390 ELF Application Binary Interface Supplement".
3182 SP is the current stack pointer. We must put arguments, links,
3183 padding, etc. whereever they belong, and return the new stack
3186 If STRUCT_RETURN is non-zero, then the function we're calling is
3187 going to return a structure by value; STRUCT_ADDR is the address of
3188 a block we've allocated for it on the stack.
3190 Our caller has taken care of any type promotions needed to satisfy
3191 prototypes or the old K&R argument-passing rules. */
3194 s390_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
3195 struct regcache
*regcache
, CORE_ADDR bp_addr
,
3196 int nargs
, struct value
**args
, CORE_ADDR sp
,
3197 int struct_return
, CORE_ADDR struct_addr
)
3199 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3200 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
3201 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3203 struct s390_arg_state arg_state
, arg_prep
;
3204 CORE_ADDR param_area_start
, new_sp
;
3205 struct type
*ftype
= check_typedef (value_type (function
));
3207 if (TYPE_CODE (ftype
) == TYPE_CODE_PTR
)
3208 ftype
= check_typedef (TYPE_TARGET_TYPE (ftype
));
3211 arg_prep
.gr
= struct_return
? 3 : 2;
3215 arg_prep
.regcache
= NULL
;
3217 /* Initialize arg_state for "preparation mode". */
3218 arg_state
= arg_prep
;
3220 /* Update arg_state.copy with the start of the reference-to-copy area
3221 and arg_state.argp with the size of the parameter area. */
3222 for (i
= 0; i
< nargs
; i
++)
3223 s390_handle_arg (&arg_state
, args
[i
], tdep
, word_size
, byte_order
,
3224 TYPE_VARARGS (ftype
) && i
>= TYPE_NFIELDS (ftype
));
3226 param_area_start
= align_down (arg_state
.copy
- arg_state
.argp
, 8);
3228 /* Allocate the standard frame areas: the register save area, the
3229 word reserved for the compiler, and the back chain pointer. */
3230 new_sp
= param_area_start
- (16 * word_size
+ 32);
3232 /* Now we have the final stack pointer. Make sure we didn't
3233 underflow; on 31-bit, this would result in addresses with the
3234 high bit set, which causes confusion elsewhere. Note that if we
3235 error out here, stack and registers remain untouched. */
3236 if (gdbarch_addr_bits_remove (gdbarch
, new_sp
) != new_sp
)
3237 error (_("Stack overflow"));
3239 /* Pass the structure return address in general register 2. */
3241 regcache_cooked_write_unsigned (regcache
, S390_R2_REGNUM
, struct_addr
);
3243 /* Initialize arg_state for "write mode". */
3244 arg_state
= arg_prep
;
3245 arg_state
.argp
= param_area_start
;
3246 arg_state
.regcache
= regcache
;
3248 /* Write all parameters. */
3249 for (i
= 0; i
< nargs
; i
++)
3250 s390_handle_arg (&arg_state
, args
[i
], tdep
, word_size
, byte_order
,
3251 TYPE_VARARGS (ftype
) && i
>= TYPE_NFIELDS (ftype
));
3253 /* Store return PSWA. In 31-bit mode, keep addressing mode bit. */
3257 regcache_cooked_read_unsigned (regcache
, S390_PSWA_REGNUM
, &pswa
);
3258 bp_addr
= (bp_addr
& 0x7fffffff) | (pswa
& 0x80000000);
3260 regcache_cooked_write_unsigned (regcache
, S390_RETADDR_REGNUM
, bp_addr
);
3262 /* Store updated stack pointer. */
3263 regcache_cooked_write_unsigned (regcache
, S390_SP_REGNUM
, new_sp
);
3265 /* We need to return the 'stack part' of the frame ID,
3266 which is actually the top of the register save area. */
3267 return param_area_start
;
3270 /* Assuming THIS_FRAME is a dummy, return the frame ID of that
3271 dummy frame. The frame ID's base needs to match the TOS value
3272 returned by push_dummy_call, and the PC match the dummy frame's
3274 static struct frame_id
3275 s390_dummy_id (struct gdbarch
*gdbarch
, struct frame_info
*this_frame
)
3277 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
3278 CORE_ADDR sp
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
3279 sp
= gdbarch_addr_bits_remove (gdbarch
, sp
);
3281 return frame_id_build (sp
+ 16*word_size
+ 32,
3282 get_frame_pc (this_frame
));
3286 s390_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
3288 /* Both the 32- and 64-bit ABI's say that the stack pointer should
3289 always be aligned on an eight-byte boundary. */
3294 /* Helper for s390_return_value: Set or retrieve a function return
3295 value if it resides in a register. */
3298 s390_register_return_value (struct gdbarch
*gdbarch
, struct type
*type
,
3299 struct regcache
*regcache
,
3300 gdb_byte
*out
, const gdb_byte
*in
)
3302 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3303 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
3304 int length
= TYPE_LENGTH (type
);
3305 int code
= TYPE_CODE (type
);
3307 if (code
== TYPE_CODE_FLT
|| code
== TYPE_CODE_DECFLOAT
)
3309 /* Float-like value: left-aligned in f0. */
3311 regcache_cooked_write_part (regcache
, S390_F0_REGNUM
,
3314 regcache_cooked_read_part (regcache
, S390_F0_REGNUM
,
3317 else if (code
== TYPE_CODE_ARRAY
)
3319 /* Vector: left-aligned in v24. */
3321 regcache_cooked_write_part (regcache
, S390_V24_REGNUM
,
3324 regcache_cooked_read_part (regcache
, S390_V24_REGNUM
,
3327 else if (length
<= word_size
)
3329 /* Integer: zero- or sign-extended in r2. */
3331 regcache_cooked_read_part (regcache
, S390_R2_REGNUM
,
3332 word_size
- length
, length
, out
);
3333 else if (TYPE_UNSIGNED (type
))
3334 regcache_cooked_write_unsigned
3335 (regcache
, S390_R2_REGNUM
,
3336 extract_unsigned_integer (in
, length
, byte_order
));
3338 regcache_cooked_write_signed
3339 (regcache
, S390_R2_REGNUM
,
3340 extract_signed_integer (in
, length
, byte_order
));
3342 else if (length
== 2 * word_size
)
3344 /* Double word: in r2 and r3. */
3347 regcache_cooked_write (regcache
, S390_R2_REGNUM
, in
);
3348 regcache_cooked_write (regcache
, S390_R3_REGNUM
,
3353 regcache_cooked_read (regcache
, S390_R2_REGNUM
, out
);
3354 regcache_cooked_read (regcache
, S390_R3_REGNUM
,
3359 internal_error (__FILE__
, __LINE__
, _("invalid return type"));
3363 /* Implement the 'return_value' gdbarch method. */
3365 static enum return_value_convention
3366 s390_return_value (struct gdbarch
*gdbarch
, struct value
*function
,
3367 struct type
*type
, struct regcache
*regcache
,
3368 gdb_byte
*out
, const gdb_byte
*in
)
3370 enum return_value_convention rvc
;
3372 type
= check_typedef (type
);
3374 switch (TYPE_CODE (type
))
3376 case TYPE_CODE_STRUCT
:
3377 case TYPE_CODE_UNION
:
3378 case TYPE_CODE_COMPLEX
:
3379 rvc
= RETURN_VALUE_STRUCT_CONVENTION
;
3381 case TYPE_CODE_ARRAY
:
3382 rvc
= (gdbarch_tdep (gdbarch
)->vector_abi
== S390_VECTOR_ABI_128
3383 && TYPE_LENGTH (type
) <= 16 && TYPE_VECTOR (type
))
3384 ? RETURN_VALUE_REGISTER_CONVENTION
3385 : RETURN_VALUE_STRUCT_CONVENTION
;
3388 rvc
= TYPE_LENGTH (type
) <= 8
3389 ? RETURN_VALUE_REGISTER_CONVENTION
3390 : RETURN_VALUE_STRUCT_CONVENTION
;
3393 if (in
!= NULL
|| out
!= NULL
)
3395 if (rvc
== RETURN_VALUE_REGISTER_CONVENTION
)
3396 s390_register_return_value (gdbarch
, type
, regcache
, out
, in
);
3397 else if (in
!= NULL
)
3398 error (_("Cannot set function return value."));
3400 error (_("Function return value unknown."));
3409 static const gdb_byte
*
3410 s390_breakpoint_from_pc (struct gdbarch
*gdbarch
,
3411 CORE_ADDR
*pcptr
, int *lenptr
)
3413 static const gdb_byte breakpoint
[] = { 0x0, 0x1 };
3415 *lenptr
= sizeof (breakpoint
);
3420 /* Address handling. */
3423 s390_addr_bits_remove (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
3425 return addr
& 0x7fffffff;
3429 s390_address_class_type_flags (int byte_size
, int dwarf2_addr_class
)
3432 return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
;
3438 s390_address_class_type_flags_to_name (struct gdbarch
*gdbarch
, int type_flags
)
3440 if (type_flags
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
)
3447 s390_address_class_name_to_type_flags (struct gdbarch
*gdbarch
,
3449 int *type_flags_ptr
)
3451 if (strcmp (name
, "mode32") == 0)
3453 *type_flags_ptr
= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
;
3460 /* Implement gdbarch_gcc_target_options. GCC does not know "-m32" or
3461 "-mcmodel=large". */
3464 s390_gcc_target_options (struct gdbarch
*gdbarch
)
3466 return xstrdup (gdbarch_ptr_bit (gdbarch
) == 64 ? "-m64" : "-m31");
3469 /* Implement gdbarch_gnu_triplet_regexp. Target triplets are "s390-*"
3470 for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
3471 always "s390". Note that an s390x compiler supports "-m31" as
3475 s390_gnu_triplet_regexp (struct gdbarch
*gdbarch
)
3480 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
3484 s390_stap_is_single_operand (struct gdbarch
*gdbarch
, const char *s
)
3486 return ((isdigit (*s
) && s
[1] == '(' && s
[2] == '%') /* Displacement
3488 || *s
== '%' /* Register access. */
3489 || isdigit (*s
)); /* Literal number. */
3492 /* Process record and replay helpers. */
3494 /* Takes the intermediate sum of address calculations and masks off upper
3495 bits according to current addressing mode. */
3498 s390_record_address_mask (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3500 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3501 ULONGEST pswm
, pswa
;
3503 if (tdep
->abi
== ABI_LINUX_S390
)
3505 regcache_raw_read_unsigned (regcache
, S390_PSWA_REGNUM
, &pswa
);
3506 am
= pswa
>> 31 & 1;
3510 regcache_raw_read_unsigned (regcache
, S390_PSWM_REGNUM
, &pswm
);
3511 am
= pswm
>> 31 & 3;
3516 return val
& 0xffffff;
3518 return val
& 0x7fffffff;
3522 fprintf_unfiltered (gdb_stdlog
, "Warning: Addressing mode %d used.", am
);
3527 /* Calculates memory address using pre-calculated index, raw instruction word
3528 with b and d/dl fields, and raw instruction byte with dh field. Index and
3529 dh should be set to 0 if unused. */
3532 s390_record_calc_disp_common (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3533 ULONGEST x
, uint16_t bd
, int8_t dh
)
3535 uint8_t rb
= bd
>> 12 & 0xf;
3536 int32_t d
= (bd
& 0xfff) | ((int32_t)dh
<< 12);
3538 CORE_ADDR res
= d
+ x
;
3541 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ rb
, &b
);
3544 return s390_record_address_mask (gdbarch
, regcache
, res
);
3547 /* Calculates memory address using raw x, b + d/dl, dh fields from
3548 instruction. rx and dh should be set to 0 if unused. */
3551 s390_record_calc_disp (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3552 uint8_t rx
, uint16_t bd
, int8_t dh
)
3556 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ rx
, &x
);
3557 return s390_record_calc_disp_common (gdbarch
, regcache
, x
, bd
, dh
);
3560 /* Calculates memory address for VSCE[GF] instructions. */
3563 s390_record_calc_disp_vsce (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3564 uint8_t vx
, uint8_t el
, uint8_t es
, uint16_t bd
,
3565 int8_t dh
, CORE_ADDR
*res
)
3567 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3568 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3571 if (tdep
->v0_full_regnum
== -1 || el
* es
>= 16)
3574 regcache_cooked_read (regcache
, tdep
->v0_full_regnum
+ vx
, buf
);
3576 regcache_raw_read (regcache
, S390_V16_REGNUM
+ vx
- 16, buf
);
3577 x
= extract_unsigned_integer (buf
+ el
* es
, es
, byte_order
);
3578 *res
= s390_record_calc_disp_common (gdbarch
, regcache
, x
, bd
, dh
);
3582 /* Calculates memory address for instructions with relative long addressing. */
3585 s390_record_calc_rl (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3586 CORE_ADDR addr
, uint16_t i1
, uint16_t i2
)
3588 int32_t ri
= i1
<< 16 | i2
;
3589 return s390_record_address_mask (gdbarch
, regcache
, addr
+ (LONGEST
)ri
* 2);
3592 /* Population count helper. */
3594 static int s390_popcnt (unsigned int x
) {
3605 /* Record 64-bit register. */
3608 s390_record_gpr_g (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
3610 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3611 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
3613 if (tdep
->abi
== ABI_LINUX_S390
)
3614 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
3619 /* Record high 32 bits of a register. */
3622 s390_record_gpr_h (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
3624 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3625 if (tdep
->abi
== ABI_LINUX_S390
)
3627 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
3632 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
3638 /* Record vector register. */
3641 s390_record_vr (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
3643 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3646 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ i
))
3648 if (record_full_arch_list_add_reg (regcache
, S390_V0_LOWER_REGNUM
+ i
))
3653 if (record_full_arch_list_add_reg (regcache
, S390_V16_REGNUM
+ i
- 16))
3660 s390_process_record (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3663 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3664 uint16_t insn
[3] = {0};
3665 /* Instruction as bytes. */
3667 /* Instruction as nibbles. */
3669 /* Instruction vector registers. */
3671 CORE_ADDR oaddr
, oaddr2
, oaddr3
;
3674 /* if EX/EXRL instruction used, here's the reg parameter */
3676 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3678 /* Attempting to use EX or EXRL jumps back here */
3681 /* Read instruction. */
3682 insn
[0] = read_memory_unsigned_integer (addr
, 2, byte_order
);
3683 /* If execute was involved, do the adjustment. */
3685 insn
[0] |= ex
& 0xff;
3686 /* Two highest bits determine instruction size. */
3687 if (insn
[0] >= 0x4000)
3688 insn
[1] = read_memory_unsigned_integer (addr
+2, 2, byte_order
);
3690 /* Not necessary, but avoids uninitialized variable warnings. */
3692 if (insn
[0] >= 0xc000)
3693 insn
[2] = read_memory_unsigned_integer (addr
+4, 2, byte_order
);
3696 /* Split instruction into bytes and nibbles. */
3697 for (i
= 0; i
< 3; i
++)
3699 ibyte
[i
*2] = insn
[i
] >> 8 & 0xff;
3700 ibyte
[i
*2+1] = insn
[i
] & 0xff;
3702 for (i
= 0; i
< 6; i
++)
3704 inib
[i
*2] = ibyte
[i
] >> 4 & 0xf;
3705 inib
[i
*2+1] = ibyte
[i
] & 0xf;
3707 /* Compute vector registers, if applicable. */
3708 ivec
[0] = (inib
[9] >> 3 & 1) << 4 | inib
[2];
3709 ivec
[1] = (inib
[9] >> 2 & 1) << 4 | inib
[3];
3710 ivec
[2] = (inib
[9] >> 1 & 1) << 4 | inib
[4];
3711 ivec
[3] = (inib
[9] >> 0 & 1) << 4 | inib
[8];
3715 /* 0x00 undefined */
3718 /* E-format instruction */
3721 /* 0x00 undefined */
3722 /* 0x01 unsupported: PR - program return */
3723 /* 0x02 unsupported: UPT */
3724 /* 0x03 undefined */
3725 /* 0x04 privileged: PTFF - perform timing facility function */
3726 /* 0x05-0x06 undefined */
3727 /* 0x07 privileged: SCKPF - set clock programmable field */
3728 /* 0x08-0x09 undefined */
3730 case 0x0a: /* PFPO - perform floating point operation */
3731 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
3732 if (!(tmp
& 0x80000000u
))
3734 uint8_t ofc
= tmp
>> 16 & 0xff;
3737 case 0x00: /* HFP32 */
3738 case 0x01: /* HFP64 */
3739 case 0x05: /* BFP32 */
3740 case 0x06: /* BFP64 */
3741 case 0x08: /* DFP32 */
3742 case 0x09: /* DFP64 */
3743 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
))
3746 case 0x02: /* HFP128 */
3747 case 0x07: /* BFP128 */
3748 case 0x0a: /* DFP128 */
3749 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
))
3751 if (record_full_arch_list_add_reg (regcache
, S390_F2_REGNUM
))
3755 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PFPO OFC %02x at %s.\n",
3756 ofc
, paddress (gdbarch
, addr
));
3760 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3763 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
3765 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3769 case 0x0b: /* TAM - test address mode */
3770 case 0x0c: /* SAM24 - set address mode 24 */
3771 case 0x0d: /* SAM31 - set address mode 31 */
3772 case 0x0e: /* SAM64 - set address mode 64 */
3773 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3777 /* 0x0f-0xfe undefined */
3779 /* 0xff unsupported: TRAP */
3786 /* 0x02 undefined */
3787 /* 0x03 undefined */
3789 case 0x04: /* SPM - set program mask */
3790 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3794 case 0x05: /* BALR - branch and link */
3795 case 0x45: /* BAL - branch and link */
3796 case 0x06: /* BCTR - branch on count */
3797 case 0x46: /* BCT - branch on count */
3798 case 0x0d: /* BASR - branch and save */
3799 case 0x4d: /* BAS - branch and save */
3800 case 0x84: /* BRXH - branch relative on index high */
3801 case 0x85: /* BRXLE - branch relative on index low or equal */
3802 case 0x86: /* BXH - branch on index high */
3803 case 0x87: /* BXLE - branch on index low or equal */
3804 /* BA[SL]* use native-size destination for linkage info, BCT*, BRX*, BX*
3805 use 32-bit destination as counter. */
3806 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3810 case 0x07: /* BCR - branch on condition */
3811 case 0x47: /* BC - branch on condition */
3812 /* No effect other than PC transfer. */
3815 /* 0x08 undefined */
3816 /* 0x09 undefined */
3819 /* SVC - supervisor call */
3820 if (s390_linux_syscall_record (regcache
, ibyte
[1]))
3824 case 0x0b: /* BSM - branch and set mode */
3826 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3828 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3832 case 0x0c: /* BASSM - branch and save and set mode */
3833 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3835 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3839 case 0x0e: /* MVCL - move long [interruptible] */
3840 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
3841 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3842 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
3844 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3846 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3848 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3850 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3852 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3854 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3858 case 0x0f: /* CLCL - compare logical long [interruptible] */
3859 case 0xa9: /* CLCLE - compare logical long extended [partial] */
3860 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3862 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3864 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3866 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3868 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3872 case 0x10: /* LPR - load positive */
3873 case 0x11: /* LNR - load negative */
3874 case 0x12: /* LTR - load and test */
3875 case 0x13: /* LCR - load complement */
3876 case 0x14: /* NR - and */
3877 case 0x16: /* OR - or */
3878 case 0x17: /* XR - xor */
3879 case 0x1a: /* AR - add */
3880 case 0x1b: /* SR - subtract */
3881 case 0x1e: /* ALR - add logical */
3882 case 0x1f: /* SLR - subtract logical */
3883 case 0x54: /* N - and */
3884 case 0x56: /* O - or */
3885 case 0x57: /* X - xor */
3886 case 0x5a: /* A - add */
3887 case 0x5b: /* S - subtract */
3888 case 0x5e: /* AL - add logical */
3889 case 0x5f: /* SL - subtract logical */
3890 case 0x4a: /* AH - add halfword */
3891 case 0x4b: /* SH - subtract halfword */
3892 case 0x8a: /* SRA - shift right single */
3893 case 0x8b: /* SLA - shift left single */
3894 case 0xbf: /* ICM - insert characters under mask */
3895 /* 32-bit destination + flags */
3896 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3898 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3902 case 0x15: /* CLR - compare logical */
3903 case 0x55: /* CL - compare logical */
3904 case 0x19: /* CR - compare */
3905 case 0x29: /* CDR - compare */
3906 case 0x39: /* CER - compare */
3907 case 0x49: /* CH - compare halfword */
3908 case 0x59: /* C - compare */
3909 case 0x69: /* CD - compare */
3910 case 0x79: /* CE - compare */
3911 case 0x91: /* TM - test under mask */
3912 case 0x95: /* CLI - compare logical */
3913 case 0xbd: /* CLM - compare logical under mask */
3914 case 0xd5: /* CLC - compare logical */
3915 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3919 case 0x18: /* LR - load */
3920 case 0x48: /* LH - load halfword */
3921 case 0x58: /* L - load */
3922 case 0x41: /* LA - load address */
3923 case 0x43: /* IC - insert character */
3924 case 0x4c: /* MH - multiply halfword */
3925 case 0x71: /* MS - multiply single */
3926 case 0x88: /* SRL - shift right single logical */
3927 case 0x89: /* SLL - shift left single logical */
3928 /* 32-bit, 8-bit (IC), or native width (LA) destination, no flags */
3929 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3933 case 0x1c: /* MR - multiply */
3934 case 0x5c: /* M - multiply */
3935 case 0x1d: /* DR - divide */
3936 case 0x5d: /* D - divide */
3937 case 0x8c: /* SRDL - shift right double logical */
3938 case 0x8d: /* SLDL - shift left double logical */
3939 /* 32-bit pair destination, no flags */
3940 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3942 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3946 case 0x20: /* LPDR - load positive */
3947 case 0x30: /* LPER - load positive */
3948 case 0x21: /* LNDR - load negative */
3949 case 0x31: /* LNER - load negative */
3950 case 0x22: /* LTDR - load and test */
3951 case 0x32: /* LTER - load and test */
3952 case 0x23: /* LCDR - load complement */
3953 case 0x33: /* LCER - load complement */
3954 case 0x2a: /* ADR - add */
3955 case 0x3a: /* AER - add */
3956 case 0x6a: /* AD - add */
3957 case 0x7a: /* AE - add */
3958 case 0x2b: /* SDR - subtract */
3959 case 0x3b: /* SER - subtract */
3960 case 0x6b: /* SD - subtract */
3961 case 0x7b: /* SE - subtract */
3962 case 0x2e: /* AWR - add unnormalized */
3963 case 0x3e: /* AUR - add unnormalized */
3964 case 0x6e: /* AW - add unnormalized */
3965 case 0x7e: /* AU - add unnormalized */
3966 case 0x2f: /* SWR - subtract unnormalized */
3967 case 0x3f: /* SUR - subtract unnormalized */
3968 case 0x6f: /* SW - subtract unnormalized */
3969 case 0x7f: /* SU - subtract unnormalized */
3970 /* float destination + flags */
3971 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3973 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3977 case 0x24: /* HDR - halve */
3978 case 0x34: /* HER - halve */
3979 case 0x25: /* LDXR - load rounded */
3980 case 0x35: /* LEDR - load rounded */
3981 case 0x28: /* LDR - load */
3982 case 0x38: /* LER - load */
3983 case 0x68: /* LD - load */
3984 case 0x78: /* LE - load */
3985 case 0x2c: /* MDR - multiply */
3986 case 0x3c: /* MDER - multiply */
3987 case 0x6c: /* MD - multiply */
3988 case 0x7c: /* MDE - multiply */
3989 case 0x2d: /* DDR - divide */
3990 case 0x3d: /* DER - divide */
3991 case 0x6d: /* DD - divide */
3992 case 0x7d: /* DE - divide */
3993 /* float destination, no flags */
3994 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3998 case 0x26: /* MXR - multiply */
3999 case 0x27: /* MXDR - multiply */
4000 case 0x67: /* MXD - multiply */
4001 /* float pair destination, no flags */
4002 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
4004 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
4008 case 0x36: /* AXR - add */
4009 case 0x37: /* SXR - subtract */
4010 /* float pair destination + flags */
4011 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
4013 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
4015 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4019 case 0x40: /* STH - store halfword */
4020 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4021 if (record_full_arch_list_add_mem (oaddr
, 2))
4025 case 0x42: /* STC - store character */
4026 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4027 if (record_full_arch_list_add_mem (oaddr
, 1))
4031 case 0x44: /* EX - execute */
4034 fprintf_unfiltered (gdb_stdlog
, "Warning: Double execute at %s.\n",
4035 paddress (gdbarch
, addr
));
4038 addr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4041 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
4050 case 0x4e: /* CVD - convert to decimal */
4051 case 0x60: /* STD - store */
4052 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4053 if (record_full_arch_list_add_mem (oaddr
, 8))
4057 case 0x4f: /* CVB - convert to binary */
4058 /* 32-bit gpr destination + FPC (DXC write) */
4059 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4061 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4065 case 0x50: /* ST - store */
4066 case 0x70: /* STE - store */
4067 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4068 if (record_full_arch_list_add_mem (oaddr
, 4))
4072 case 0x51: /* LAE - load address extended */
4073 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4075 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[2]))
4079 /* 0x52 undefined */
4080 /* 0x53 undefined */
4082 /* 0x61-0x66 undefined */
4084 /* 0x72-0x77 undefined */
4086 /* 0x80 privileged: SSM - set system mask */
4087 /* 0x81 undefined */
4088 /* 0x82 privileged: LPSW - load PSW */
4089 /* 0x83 privileged: diagnose */
4091 case 0x8e: /* SRDA - shift right double */
4092 case 0x8f: /* SLDA - shift left double */
4093 /* 32-bit pair destination + flags */
4094 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4096 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
4098 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4102 case 0x90: /* STM - store multiple */
4103 case 0x9b: /* STAM - store access multiple */
4104 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4105 if (inib
[2] <= inib
[3])
4106 n
= inib
[3] - inib
[2] + 1;
4108 n
= inib
[3] + 0x10 - inib
[2] + 1;
4109 if (record_full_arch_list_add_mem (oaddr
, n
* 4))
4113 case 0x92: /* MVI - move */
4114 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4115 if (record_full_arch_list_add_mem (oaddr
, 1))
4119 case 0x93: /* TS - test and set */
4120 case 0x94: /* NI - and */
4121 case 0x96: /* OI - or */
4122 case 0x97: /* XI - xor */
4123 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4124 if (record_full_arch_list_add_mem (oaddr
, 1))
4126 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4130 case 0x98: /* LM - load multiple */
4131 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
4132 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
4134 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
4138 /* 0x99 privileged: TRACE */
4140 case 0x9a: /* LAM - load access multiple */
4141 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
4142 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
4144 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[3]))
4148 /* 0x9c-0x9f privileged and obsolete (old I/O) */
4149 /* 0xa0-0xa4 undefined */
4153 /* RI-format instruction */
4154 switch (ibyte
[0] << 4 | inib
[3])
4156 case 0xa50: /* IIHH - insert immediate */
4157 case 0xa51: /* IIHL - insert immediate */
4158 /* high 32-bit destination */
4159 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
4163 case 0xa52: /* IILH - insert immediate */
4164 case 0xa53: /* IILL - insert immediate */
4165 case 0xa75: /* BRAS - branch relative and save */
4166 case 0xa76: /* BRCT - branch relative on count */
4167 case 0xa78: /* LHI - load halfword immediate */
4168 case 0xa7c: /* MHI - multiply halfword immediate */
4169 /* 32-bit or native destination */
4170 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4174 case 0xa54: /* NIHH - and immediate */
4175 case 0xa55: /* NIHL - and immediate */
4176 case 0xa58: /* OIHH - or immediate */
4177 case 0xa59: /* OIHL - or immediate */
4178 /* high 32-bit destination + flags */
4179 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
4181 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4185 case 0xa56: /* NILH - and immediate */
4186 case 0xa57: /* NILL - and immediate */
4187 case 0xa5a: /* OILH - or immediate */
4188 case 0xa5b: /* OILL - or immediate */
4189 case 0xa7a: /* AHI - add halfword immediate */
4190 /* 32-bit destination + flags */
4191 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4193 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4197 case 0xa5c: /* LLIHH - load logical immediate */
4198 case 0xa5d: /* LLIHL - load logical immediate */
4199 case 0xa5e: /* LLILH - load logical immediate */
4200 case 0xa5f: /* LLILL - load logical immediate */
4201 case 0xa77: /* BRCTG - branch relative on count */
4202 case 0xa79: /* LGHI - load halfword immediate */
4203 case 0xa7d: /* MGHI - multiply halfword immediate */
4204 /* 64-bit destination */
4205 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4209 case 0xa70: /* TMLH - test under mask */
4210 case 0xa71: /* TMLL - test under mask */
4211 case 0xa72: /* TMHH - test under mask */
4212 case 0xa73: /* TMHL - test under mask */
4213 case 0xa7e: /* CHI - compare halfword immediate */
4214 case 0xa7f: /* CGHI - compare halfword immediate */
4216 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4220 case 0xa74: /* BRC - branch relative on condition */
4221 /* no register change */
4224 case 0xa7b: /* AGHI - add halfword immediate */
4225 /* 64-bit destination + flags */
4226 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4228 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4237 /* 0xa6 undefined */
4239 case 0xa8: /* MVCLE - move long extended [partial] */
4240 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
4241 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4242 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
4243 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4245 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4247 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
4249 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
4251 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
4253 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4257 /* 0xaa-0xab undefined */
4258 /* 0xac privileged: STNSM - store then and system mask */
4259 /* 0xad privileged: STOSM - store then or system mask */
4260 /* 0xae privileged: SIGP - signal processor */
4261 /* 0xaf unsupported: MC - monitor call */
4262 /* 0xb0 undefined */
4263 /* 0xb1 privileged: LRA - load real address */
4268 /* S/RRD/RRE/RRF/IE-format instruction */
4271 /* 0xb200-0xb204 undefined or privileged */
4273 case 0xb205: /* STCK - store clock */
4274 case 0xb27c: /* STCKF - store clock fast */
4275 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4276 if (record_full_arch_list_add_mem (oaddr
, 8))
4278 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4282 /* 0xb206-0xb219 undefined, privileged, or unsupported */
4283 /* 0xb21a unsupported: CFC */
4284 /* 0xb21b-0xb221 undefined or privileged */
4286 case 0xb222: /* IPM - insert program mask */
4287 case 0xb24f: /* EAR - extract access */
4288 case 0xb252: /* MSR - multiply single */
4289 case 0xb2ec: /* ETND - extract transaction nesting depth */
4290 case 0xb38c: /* EFPC - extract fpc */
4291 case 0xb91f: /* LRVR - load reversed */
4292 case 0xb926: /* LBR - load byte */
4293 case 0xb927: /* LHR - load halfword */
4294 case 0xb994: /* LLCR - load logical character */
4295 case 0xb995: /* LLHR - load logical halfword */
4296 case 0xb9f2: /* LOCR - load on condition */
4297 /* 32-bit gpr destination */
4298 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4302 /* 0xb223-0xb22c privileged or unsupported */
4304 case 0xb22d: /* DXR - divide */
4305 case 0xb325: /* LXDR - load lengthened */
4306 case 0xb326: /* LXER - load lengthened */
4307 case 0xb336: /* SQXR - square root */
4308 case 0xb365: /* LXR - load */
4309 case 0xb367: /* FIXR - load fp integer */
4310 case 0xb376: /* LZXR - load zero */
4311 case 0xb3b6: /* CXFR - convert from fixed */
4312 case 0xb3c6: /* CXGR - convert from fixed */
4313 case 0xb3fe: /* IEXTR - insert biased exponent */
4314 /* float pair destination */
4315 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4317 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4321 /* 0xb22e-0xb240 undefined, privileged, or unsupported */
4323 case 0xb241: /* CKSM - checksum [partial] */
4324 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4326 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4328 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4330 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4334 /* 0xb242-0xb243 undefined */
4336 case 0xb244: /* SQDR - square root */
4337 case 0xb245: /* SQER - square root */
4338 case 0xb324: /* LDER - load lengthened */
4339 case 0xb337: /* MEER - multiply */
4340 case 0xb366: /* LEXR - load rounded */
4341 case 0xb370: /* LPDFR - load positive */
4342 case 0xb371: /* LNDFR - load negative */
4343 case 0xb372: /* CSDFR - copy sign */
4344 case 0xb373: /* LCDFR - load complement */
4345 case 0xb374: /* LZER - load zero */
4346 case 0xb375: /* LZDR - load zero */
4347 case 0xb377: /* FIER - load fp integer */
4348 case 0xb37f: /* FIDR - load fp integer */
4349 case 0xb3b4: /* CEFR - convert from fixed */
4350 case 0xb3b5: /* CDFR - convert from fixed */
4351 case 0xb3c1: /* LDGR - load fpr from gr */
4352 case 0xb3c4: /* CEGR - convert from fixed */
4353 case 0xb3c5: /* CDGR - convert from fixed */
4354 case 0xb3f6: /* IEDTR - insert biased exponent */
4355 /* float destination */
4356 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4360 /* 0xb246-0xb24c: privileged or unsupported */
4362 case 0xb24d: /* CPYA - copy access */
4363 case 0xb24e: /* SAR - set access */
4364 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[6]))
4368 /* 0xb250-0xb251 undefined or privileged */
4369 /* 0xb253-0xb254 undefined or privileged */
4371 case 0xb255: /* MVST - move string [partial] */
4376 /* Read ending byte. */
4377 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4379 /* Get address of second operand. */
4380 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[7], &tmp
);
4381 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4382 /* Search for ending byte and compute length. */
4385 if (target_read_memory (oaddr
, &cur
, 1))
4388 } while (cur
!= end
);
4389 /* Get address of first operand and record it. */
4390 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4391 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4392 if (record_full_arch_list_add_mem (oaddr
, num
))
4394 /* Record the registers. */
4395 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4397 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4399 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4404 /* 0xb256 undefined */
4406 case 0xb257: /* CUSE - compare until substring equal [interruptible] */
4407 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4409 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4411 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4413 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4415 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4419 /* 0xb258-0xb25c undefined, privileged, or unsupported */
4421 case 0xb25d: /* CLST - compare logical string [partial] */
4422 case 0xb25e: /* SRST - search string [partial] */
4423 case 0xb9be: /* SRSTU - search string unicode [partial] */
4424 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4426 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4428 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4432 /* 0xb25f-0xb262 undefined */
4434 case 0xb263: /* CMPSC - compression call [interruptible] */
4435 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4436 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4437 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4438 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4440 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4442 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4444 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4446 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4448 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
4450 /* DXC may be written */
4451 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4453 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4457 /* 0xb264-0xb277 undefined, privileged, or unsupported */
4459 case 0xb278: /* STCKE - store clock extended */
4460 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4461 if (record_full_arch_list_add_mem (oaddr
, 16))
4463 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4467 /* 0xb279-0xb27b undefined or unsupported */
4468 /* 0xb27d-0xb298 undefined or privileged */
4470 case 0xb299: /* SRNM - set rounding mode */
4471 case 0xb2b8: /* SRNMB - set bfp rounding mode */
4472 case 0xb2b9: /* SRNMT - set dfp rounding mode */
4473 case 0xb29d: /* LFPC - load fpc */
4474 case 0xb2bd: /* LFAS - load fpc and signal */
4475 case 0xb384: /* SFPC - set fpc */
4476 case 0xb385: /* SFASR - set fpc and signal */
4477 case 0xb960: /* CGRT - compare and trap */
4478 case 0xb961: /* CLGRT - compare logical and trap */
4479 case 0xb972: /* CRT - compare and trap */
4480 case 0xb973: /* CLRT - compare logical and trap */
4481 /* fpc only - including possible DXC write for trapping insns */
4482 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4486 /* 0xb29a-0xb29b undefined */
4488 case 0xb29c: /* STFPC - store fpc */
4489 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4490 if (record_full_arch_list_add_mem (oaddr
, 4))
4494 /* 0xb29e-0xb2a4 undefined */
4496 case 0xb2a5: /* TRE - translate extended [partial] */
4497 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4498 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4499 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4500 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4502 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4504 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4506 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4510 case 0xb2a6: /* CU21 - convert UTF-16 to UTF-8 [partial] */
4511 case 0xb2a7: /* CU12 - convert UTF-8 to UTF-16 [partial] */
4512 case 0xb9b0: /* CU14 - convert UTF-8 to UTF-32 [partial] */
4513 case 0xb9b1: /* CU24 - convert UTF-16 to UTF-32 [partial] */
4514 case 0xb9b2: /* CU41 - convert UTF-32 to UTF-8 [partial] */
4515 case 0xb9b3: /* CU42 - convert UTF-32 to UTF-16 [partial] */
4516 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4517 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4518 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4519 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4521 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4523 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4525 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4527 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4529 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4533 /* 0xb2a8-0xb2af undefined */
4535 case 0xb2b0: /* STFLE - store facility list extended */
4536 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4537 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4539 if (record_full_arch_list_add_mem (oaddr
, 8 * (tmp
+ 1)))
4541 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
))
4543 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4547 /* 0xb2b1-0xb2b7 undefined or privileged */
4548 /* 0xb2ba-0xb2bc undefined */
4549 /* 0xb2be-0xb2e7 undefined */
4550 /* 0xb2e9-0xb2eb undefined */
4551 /* 0xb2ed-0xb2f7 undefined */
4552 /* 0xb2f8 unsupported: TEND */
4553 /* 0xb2f9 undefined */
4555 case 0xb2e8: /* PPA - perform processor assist */
4556 case 0xb2fa: /* NIAI - next instruction access intent */
4557 /* no visible effects */
4560 /* 0xb2fb undefined */
4561 /* 0xb2fc unsupported: TABORT */
4562 /* 0xb2fd-0xb2fe undefined */
4563 /* 0xb2ff unsupported: TRAP */
4565 case 0xb300: /* LPEBR - load positive */
4566 case 0xb301: /* LNEBR - load negative */
4567 case 0xb303: /* LCEBR - load complement */
4568 case 0xb310: /* LPDBR - load positive */
4569 case 0xb311: /* LNDBR - load negative */
4570 case 0xb313: /* LCDBR - load complement */
4571 case 0xb350: /* TBEDR - convert hfp to bfp */
4572 case 0xb351: /* TBDR - convert hfp to bfp */
4573 case 0xb358: /* THDER - convert bfp to hfp */
4574 case 0xb359: /* THDR - convert bfp to hfp */
4575 /* float destination + flags */
4576 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4578 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4582 case 0xb304: /* LDEBR - load lengthened */
4583 case 0xb30c: /* MDEBR - multiply */
4584 case 0xb30d: /* DEBR - divide */
4585 case 0xb314: /* SQEBR - square root */
4586 case 0xb315: /* SQDBR - square root */
4587 case 0xb317: /* MEEBR - multiply */
4588 case 0xb31c: /* MDBR - multiply */
4589 case 0xb31d: /* DDBR - divide */
4590 case 0xb344: /* LEDBRA - load rounded */
4591 case 0xb345: /* LDXBRA - load rounded */
4592 case 0xb346: /* LEXBRA - load rounded */
4593 case 0xb357: /* FIEBRA - load fp integer */
4594 case 0xb35f: /* FIDBRA - load fp integer */
4595 case 0xb390: /* CELFBR - convert from logical */
4596 case 0xb391: /* CDLFBR - convert from logical */
4597 case 0xb394: /* CEFBR - convert from fixed */
4598 case 0xb395: /* CDFBR - convert from fixed */
4599 case 0xb3a0: /* CELGBR - convert from logical */
4600 case 0xb3a1: /* CDLGBR - convert from logical */
4601 case 0xb3a4: /* CEGBR - convert from fixed */
4602 case 0xb3a5: /* CDGBR - convert from fixed */
4603 case 0xb3d0: /* MDTR - multiply */
4604 case 0xb3d1: /* DDTR - divide */
4605 case 0xb3d4: /* LDETR - load lengthened */
4606 case 0xb3d5: /* LEDTR - load lengthened */
4607 case 0xb3d7: /* FIDTR - load fp integer */
4608 case 0xb3dd: /* LDXTR - load lengthened */
4609 case 0xb3f1: /* CDGTR - convert from fixed */
4610 case 0xb3f2: /* CDUTR - convert from unsigned packed */
4611 case 0xb3f3: /* CDSTR - convert from signed packed */
4612 case 0xb3f5: /* QADTR - quantize */
4613 case 0xb3f7: /* RRDTR - reround */
4614 case 0xb951: /* CDFTR - convert from fixed */
4615 case 0xb952: /* CDLGTR - convert from logical */
4616 case 0xb953: /* CDLFTR - convert from logical */
4617 /* float destination + fpc */
4618 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4620 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4624 case 0xb305: /* LXDBR - load lengthened */
4625 case 0xb306: /* LXEBR - load lengthened */
4626 case 0xb307: /* MXDBR - multiply */
4627 case 0xb316: /* SQXBR - square root */
4628 case 0xb34c: /* MXBR - multiply */
4629 case 0xb34d: /* DXBR - divide */
4630 case 0xb347: /* FIXBRA - load fp integer */
4631 case 0xb392: /* CXLFBR - convert from logical */
4632 case 0xb396: /* CXFBR - convert from fixed */
4633 case 0xb3a2: /* CXLGBR - convert from logical */
4634 case 0xb3a6: /* CXGBR - convert from fixed */
4635 case 0xb3d8: /* MXTR - multiply */
4636 case 0xb3d9: /* DXTR - divide */
4637 case 0xb3dc: /* LXDTR - load lengthened */
4638 case 0xb3df: /* FIXTR - load fp integer */
4639 case 0xb3f9: /* CXGTR - convert from fixed */
4640 case 0xb3fa: /* CXUTR - convert from unsigned packed */
4641 case 0xb3fb: /* CXSTR - convert from signed packed */
4642 case 0xb3fd: /* QAXTR - quantize */
4643 case 0xb3ff: /* RRXTR - reround */
4644 case 0xb959: /* CXFTR - convert from fixed */
4645 case 0xb95a: /* CXLGTR - convert from logical */
4646 case 0xb95b: /* CXLFTR - convert from logical */
4647 /* float pair destination + fpc */
4648 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4650 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4652 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4656 case 0xb308: /* KEBR - compare and signal */
4657 case 0xb309: /* CEBR - compare */
4658 case 0xb318: /* KDBR - compare and signal */
4659 case 0xb319: /* CDBR - compare */
4660 case 0xb348: /* KXBR - compare and signal */
4661 case 0xb349: /* CXBR - compare */
4662 case 0xb3e0: /* KDTR - compare and signal */
4663 case 0xb3e4: /* CDTR - compare */
4664 case 0xb3e8: /* KXTR - compare and signal */
4665 case 0xb3ec: /* CXTR - compare */
4666 /* flags + fpc only */
4667 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4669 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4673 case 0xb302: /* LTEBR - load and test */
4674 case 0xb312: /* LTDBR - load and test */
4675 case 0xb30a: /* AEBR - add */
4676 case 0xb30b: /* SEBR - subtract */
4677 case 0xb31a: /* ADBR - add */
4678 case 0xb31b: /* SDBR - subtract */
4679 case 0xb3d2: /* ADTR - add */
4680 case 0xb3d3: /* SDTR - subtract */
4681 case 0xb3d6: /* LTDTR - load and test */
4682 /* float destination + flags + fpc */
4683 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4685 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4687 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4691 case 0xb30e: /* MAEBR - multiply and add */
4692 case 0xb30f: /* MSEBR - multiply and subtract */
4693 case 0xb31e: /* MADBR - multiply and add */
4694 case 0xb31f: /* MSDBR - multiply and subtract */
4695 /* float destination [RRD] + fpc */
4696 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4698 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4702 /* 0xb320-0xb323 undefined */
4703 /* 0xb327-0xb32d undefined */
4705 case 0xb32e: /* MAER - multiply and add */
4706 case 0xb32f: /* MSER - multiply and subtract */
4707 case 0xb338: /* MAYLR - multiply and add unnormalized */
4708 case 0xb339: /* MYLR - multiply unnormalized */
4709 case 0xb33c: /* MAYHR - multiply and add unnormalized */
4710 case 0xb33d: /* MYHR - multiply unnormalized */
4711 case 0xb33e: /* MADR - multiply and add */
4712 case 0xb33f: /* MSDR - multiply and subtract */
4713 /* float destination [RRD] */
4714 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4718 /* 0xb330-0xb335 undefined */
4720 case 0xb33a: /* MAYR - multiply and add unnormalized */
4721 case 0xb33b: /* MYR - multiply unnormalized */
4722 /* float pair destination [RRD] */
4723 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4725 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[4] | 2)))
4729 case 0xb340: /* LPXBR - load positive */
4730 case 0xb341: /* LNXBR - load negative */
4731 case 0xb343: /* LCXBR - load complement */
4732 case 0xb360: /* LPXR - load positive */
4733 case 0xb361: /* LNXR - load negative */
4734 case 0xb362: /* LTXR - load and test */
4735 case 0xb363: /* LCXR - load complement */
4736 /* float pair destination + flags */
4737 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4739 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4741 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4745 case 0xb342: /* LTXBR - load and test */
4746 case 0xb34a: /* AXBR - add */
4747 case 0xb34b: /* SXBR - subtract */
4748 case 0xb3da: /* AXTR - add */
4749 case 0xb3db: /* SXTR - subtract */
4750 case 0xb3de: /* LTXTR - load and test */
4751 /* float pair destination + flags + fpc */
4752 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4754 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4756 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4758 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4762 /* 0xb34e-0xb34f undefined */
4763 /* 0xb352 undefined */
4765 case 0xb353: /* DIEBR - divide to integer */
4766 case 0xb35b: /* DIDBR - divide to integer */
4767 /* two float destinations + flags + fpc */
4768 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4770 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4772 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4774 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4778 /* 0xb354-0xb356 undefined */
4779 /* 0xb35a undefined */
4781 /* 0xb35c-0xb35e undefined */
4782 /* 0xb364 undefined */
4783 /* 0xb368 undefined */
4785 case 0xb369: /* CXR - compare */
4786 case 0xb3f4: /* CEDTR - compare biased exponent */
4787 case 0xb3fc: /* CEXTR - compare biased exponent */
4788 case 0xb920: /* CGR - compare */
4789 case 0xb921: /* CLGR - compare logical */
4790 case 0xb930: /* CGFR - compare */
4791 case 0xb931: /* CLGFR - compare logical */
4792 case 0xb9cd: /* CHHR - compare high */
4793 case 0xb9cf: /* CLHHR - compare logical high */
4794 case 0xb9dd: /* CHLR - compare high */
4795 case 0xb9df: /* CLHLR - compare logical high */
4797 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4801 /* 0xb36a-0xb36f undefined */
4802 /* 0xb377-0xb37e undefined */
4803 /* 0xb380-0xb383 undefined */
4804 /* 0xb386-0xb38b undefined */
4805 /* 0xb38d-0xb38f undefined */
4806 /* 0xb393 undefined */
4807 /* 0xb397 undefined */
4809 case 0xb398: /* CFEBR - convert to fixed */
4810 case 0xb399: /* CFDBR - convert to fixed */
4811 case 0xb39a: /* CFXBR - convert to fixed */
4812 case 0xb39c: /* CLFEBR - convert to logical */
4813 case 0xb39d: /* CLFDBR - convert to logical */
4814 case 0xb39e: /* CLFXBR - convert to logical */
4815 case 0xb941: /* CFDTR - convert to fixed */
4816 case 0xb949: /* CFXTR - convert to fixed */
4817 case 0xb943: /* CLFDTR - convert to logical */
4818 case 0xb94b: /* CLFXTR - convert to logical */
4819 /* 32-bit gpr destination + flags + fpc */
4820 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4822 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4824 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4828 /* 0xb39b undefined */
4829 /* 0xb39f undefined */
4831 /* 0xb3a3 undefined */
4832 /* 0xb3a7 undefined */
4834 case 0xb3a8: /* CGEBR - convert to fixed */
4835 case 0xb3a9: /* CGDBR - convert to fixed */
4836 case 0xb3aa: /* CGXBR - convert to fixed */
4837 case 0xb3ac: /* CLGEBR - convert to logical */
4838 case 0xb3ad: /* CLGDBR - convert to logical */
4839 case 0xb3ae: /* CLGXBR - convert to logical */
4840 case 0xb3e1: /* CGDTR - convert to fixed */
4841 case 0xb3e9: /* CGXTR - convert to fixed */
4842 case 0xb942: /* CLGDTR - convert to logical */
4843 case 0xb94a: /* CLGXTR - convert to logical */
4844 /* 64-bit gpr destination + flags + fpc */
4845 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4847 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4849 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4853 /* 0xb3ab undefined */
4854 /* 0xb3af-0xb3b3 undefined */
4855 /* 0xb3b7 undefined */
4857 case 0xb3b8: /* CFER - convert to fixed */
4858 case 0xb3b9: /* CFDR - convert to fixed */
4859 case 0xb3ba: /* CFXR - convert to fixed */
4860 case 0xb998: /* ALCR - add logical with carry */
4861 case 0xb999: /* SLBR - subtract logical with borrow */
4862 case 0xb9f4: /* NRK - and */
4863 case 0xb9f6: /* ORK - or */
4864 case 0xb9f7: /* XRK - xor */
4865 case 0xb9f8: /* ARK - add */
4866 case 0xb9f9: /* SRK - subtract */
4867 case 0xb9fa: /* ALRK - add logical */
4868 case 0xb9fb: /* SLRK - subtract logical */
4869 /* 32-bit gpr destination + flags */
4870 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4872 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4876 case 0xb3c8: /* CGER - convert to fixed */
4877 case 0xb3c9: /* CGDR - convert to fixed */
4878 case 0xb3ca: /* CGXR - convert to fixed */
4879 case 0xb900: /* LPGR - load positive */
4880 case 0xb901: /* LNGR - load negative */
4881 case 0xb902: /* LTGR - load and test */
4882 case 0xb903: /* LCGR - load complement */
4883 case 0xb908: /* AGR - add */
4884 case 0xb909: /* SGR - subtract */
4885 case 0xb90a: /* ALGR - add logical */
4886 case 0xb90b: /* SLGR - subtract logical */
4887 case 0xb910: /* LPGFR - load positive */
4888 case 0xb911: /* LNGFR - load negative */
4889 case 0xb912: /* LTGFR - load and test */
4890 case 0xb913: /* LCGFR - load complement */
4891 case 0xb918: /* AGFR - add */
4892 case 0xb919: /* SGFR - subtract */
4893 case 0xb91a: /* ALGFR - add logical */
4894 case 0xb91b: /* SLGFR - subtract logical */
4895 case 0xb980: /* NGR - and */
4896 case 0xb981: /* OGR - or */
4897 case 0xb982: /* XGR - xor */
4898 case 0xb988: /* ALCGR - add logical with carry */
4899 case 0xb989: /* SLBGR - subtract logical with borrow */
4900 case 0xb9e1: /* POPCNT - population count */
4901 case 0xb9e4: /* NGRK - and */
4902 case 0xb9e6: /* OGRK - or */
4903 case 0xb9e7: /* XGRK - xor */
4904 case 0xb9e8: /* AGRK - add */
4905 case 0xb9e9: /* SGRK - subtract */
4906 case 0xb9ea: /* ALGRK - add logical */
4907 case 0xb9eb: /* SLGRK - subtract logical */
4908 /* 64-bit gpr destination + flags */
4909 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4911 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4915 /* 0xb3bb-0xb3c0 undefined */
4916 /* 0xb3c2-0xb3c3 undefined */
4917 /* 0xb3c7 undefined */
4918 /* 0xb3cb-0xb3cc undefined */
4920 case 0xb3cd: /* LGDR - load gr from fpr */
4921 case 0xb3e2: /* CUDTR - convert to unsigned packed */
4922 case 0xb3e3: /* CSDTR - convert to signed packed */
4923 case 0xb3e5: /* EEDTR - extract biased exponent */
4924 case 0xb3e7: /* ESDTR - extract significance */
4925 case 0xb3ed: /* EEXTR - extract biased exponent */
4926 case 0xb3ef: /* ESXTR - extract significance */
4927 case 0xb904: /* LGR - load */
4928 case 0xb906: /* LGBR - load byte */
4929 case 0xb907: /* LGHR - load halfword */
4930 case 0xb90c: /* MSGR - multiply single */
4931 case 0xb90f: /* LRVGR - load reversed */
4932 case 0xb914: /* LGFR - load */
4933 case 0xb916: /* LLGFR - load logical */
4934 case 0xb917: /* LLGTR - load logical thirty one bits */
4935 case 0xb91c: /* MSGFR - load */
4936 case 0xb946: /* BCTGR - branch on count */
4937 case 0xb984: /* LLGCR - load logical character */
4938 case 0xb985: /* LLGHR - load logical halfword */
4939 case 0xb9e2: /* LOCGR - load on condition */
4940 /* 64-bit gpr destination */
4941 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4945 /* 0xb3ce-0xb3cf undefined */
4946 /* 0xb3e6 undefined */
4948 case 0xb3ea: /* CUXTR - convert to unsigned packed */
4949 case 0xb3eb: /* CSXTR - convert to signed packed */
4950 case 0xb90d: /* DSGR - divide single */
4951 case 0xb91d: /* DSGFR - divide single */
4952 case 0xb986: /* MLGR - multiply logical */
4953 case 0xb987: /* DLGR - divide logical */
4954 /* 64-bit gpr pair destination */
4955 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4957 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6] | 1))
4961 /* 0xb3ee undefined */
4962 /* 0xb3f0 undefined */
4963 /* 0xb3f8 undefined */
4965 /* 0xb905 privileged */
4967 /* 0xb90e unsupported: EREGG */
4969 /* 0xb915 undefined */
4971 case 0xb91e: /* KMAC - compute message authentication code [partial] */
4972 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4973 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4974 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4978 case 0x00: /* KMAC-Query */
4979 if (record_full_arch_list_add_mem (oaddr
, 16))
4983 case 0x01: /* KMAC-DEA */
4984 case 0x02: /* KMAC-TDEA-128 */
4985 case 0x03: /* KMAC-TDEA-192 */
4986 case 0x09: /* KMAC-Encrypted-DEA */
4987 case 0x0a: /* KMAC-Encrypted-TDEA-128 */
4988 case 0x0b: /* KMAC-Encrypted-TDEA-192 */
4989 if (record_full_arch_list_add_mem (oaddr
, 8))
4993 case 0x12: /* KMAC-AES-128 */
4994 case 0x13: /* KMAC-AES-192 */
4995 case 0x14: /* KMAC-AES-256 */
4996 case 0x1a: /* KMAC-Encrypted-AES-128 */
4997 case 0x1b: /* KMAC-Encrypted-AES-192 */
4998 case 0x1c: /* KMAC-Encrypted-AES-256 */
4999 if (record_full_arch_list_add_mem (oaddr
, 16))
5004 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMAC function %02x at %s.\n",
5005 (int)tmp
, paddress (gdbarch
, addr
));
5010 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5012 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5015 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5019 /* 0xb922-0xb924 undefined */
5020 /* 0xb925 privileged */
5021 /* 0xb928 privileged */
5022 /* 0xb929 undefined */
5024 case 0xb92a: /* KMF - cipher message with cipher feedback [partial] */
5025 case 0xb92b: /* KMO - cipher message with output feedback [partial] */
5026 case 0xb92f: /* KMC - cipher message with chaining [partial] */
5027 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5028 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5029 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5033 case 0x00: /* KM*-Query */
5034 if (record_full_arch_list_add_mem (oaddr
, 16))
5038 case 0x01: /* KM*-DEA */
5039 case 0x02: /* KM*-TDEA-128 */
5040 case 0x03: /* KM*-TDEA-192 */
5041 case 0x09: /* KM*-Encrypted-DEA */
5042 case 0x0a: /* KM*-Encrypted-TDEA-128 */
5043 case 0x0b: /* KM*-Encrypted-TDEA-192 */
5044 if (record_full_arch_list_add_mem (oaddr
, 8))
5048 case 0x12: /* KM*-AES-128 */
5049 case 0x13: /* KM*-AES-192 */
5050 case 0x14: /* KM*-AES-256 */
5051 case 0x1a: /* KM*-Encrypted-AES-128 */
5052 case 0x1b: /* KM*-Encrypted-AES-192 */
5053 case 0x1c: /* KM*-Encrypted-AES-256 */
5054 if (record_full_arch_list_add_mem (oaddr
, 16))
5058 case 0x43: /* KMC-PRNG */
5059 /* Only valid for KMC. */
5060 if (insn
[0] == 0xb92f)
5062 if (record_full_arch_list_add_mem (oaddr
, 8))
5066 /* For other instructions, fallthru. */
5068 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KM* function %02x at %s.\n",
5069 (int)tmp
, paddress (gdbarch
, addr
));
5074 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5075 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5076 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
5077 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5079 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5081 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5083 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5086 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5090 case 0xb92c: /* PCC - perform cryptographic computation [partial] */
5091 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5092 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5093 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5097 case 0x00: /* PCC-Query */
5098 if (record_full_arch_list_add_mem (oaddr
, 16))
5102 case 0x01: /* PCC-Compute-Last-Block-CMAC-Using-DEA */
5103 case 0x02: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-128 */
5104 case 0x03: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-192 */
5105 case 0x09: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-DEA */
5106 case 0x0a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-128 */
5107 case 0x0b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-192 */
5108 if (record_full_arch_list_add_mem (oaddr
+ 0x10, 8))
5112 case 0x12: /* PCC-Compute-Last-Block-CMAC-Using-AES-128 */
5113 case 0x13: /* PCC-Compute-Last-Block-CMAC-Using-AES-192 */
5114 case 0x14: /* PCC-Compute-Last-Block-CMAC-Using-AES-256 */
5115 case 0x1a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-128 */
5116 case 0x1b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-192 */
5117 case 0x1c: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-256 */
5118 if (record_full_arch_list_add_mem (oaddr
+ 0x18, 16))
5122 case 0x32: /* PCC-Compute-XTS-Parameter-Using-AES-128 */
5123 if (record_full_arch_list_add_mem (oaddr
+ 0x30, 32))
5127 case 0x34: /* PCC-Compute-XTS-Parameter-Using-AES-256 */
5128 if (record_full_arch_list_add_mem (oaddr
+ 0x40, 32))
5132 case 0x3a: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-128 */
5133 if (record_full_arch_list_add_mem (oaddr
+ 0x50, 32))
5137 case 0x3c: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-256 */
5138 if (record_full_arch_list_add_mem (oaddr
+ 0x60, 32))
5143 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PCC function %02x at %s.\n",
5144 (int)tmp
, paddress (gdbarch
, addr
));
5147 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5151 case 0xb92d: /* KMCTR - cipher message with counter [partial] */
5152 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5153 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5154 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5158 case 0x00: /* KMCTR-Query */
5159 if (record_full_arch_list_add_mem (oaddr
, 16))
5163 case 0x01: /* KMCTR-DEA */
5164 case 0x02: /* KMCTR-TDEA-128 */
5165 case 0x03: /* KMCTR-TDEA-192 */
5166 case 0x09: /* KMCTR-Encrypted-DEA */
5167 case 0x0a: /* KMCTR-Encrypted-TDEA-128 */
5168 case 0x0b: /* KMCTR-Encrypted-TDEA-192 */
5169 case 0x12: /* KMCTR-AES-128 */
5170 case 0x13: /* KMCTR-AES-192 */
5171 case 0x14: /* KMCTR-AES-256 */
5172 case 0x1a: /* KMCTR-Encrypted-AES-128 */
5173 case 0x1b: /* KMCTR-Encrypted-AES-192 */
5174 case 0x1c: /* KMCTR-Encrypted-AES-256 */
5178 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMCTR function %02x at %s.\n",
5179 (int)tmp
, paddress (gdbarch
, addr
));
5184 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5185 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5186 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
5187 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5189 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5191 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5193 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5195 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[4]))
5198 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5202 case 0xb92e: /* KM - cipher message [partial] */
5203 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5204 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5205 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5209 case 0x00: /* KM-Query */
5210 if (record_full_arch_list_add_mem (oaddr
, 16))
5214 case 0x01: /* KM-DEA */
5215 case 0x02: /* KM-TDEA-128 */
5216 case 0x03: /* KM-TDEA-192 */
5217 case 0x09: /* KM-Encrypted-DEA */
5218 case 0x0a: /* KM-Encrypted-TDEA-128 */
5219 case 0x0b: /* KM-Encrypted-TDEA-192 */
5220 case 0x12: /* KM-AES-128 */
5221 case 0x13: /* KM-AES-192 */
5222 case 0x14: /* KM-AES-256 */
5223 case 0x1a: /* KM-Encrypted-AES-128 */
5224 case 0x1b: /* KM-Encrypted-AES-192 */
5225 case 0x1c: /* KM-Encrypted-AES-256 */
5228 case 0x32: /* KM-XTS-AES-128 */
5229 if (record_full_arch_list_add_mem (oaddr
+ 0x10, 16))
5233 case 0x34: /* KM-XTS-AES-256 */
5234 if (record_full_arch_list_add_mem (oaddr
+ 0x20, 16))
5238 case 0x3a: /* KM-XTS-Encrypted-AES-128 */
5239 if (record_full_arch_list_add_mem (oaddr
+ 0x30, 16))
5243 case 0x3c: /* KM-XTS-Encrypted-AES-256 */
5244 if (record_full_arch_list_add_mem (oaddr
+ 0x40, 16))
5249 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KM function %02x at %s.\n",
5250 (int)tmp
, paddress (gdbarch
, addr
));
5255 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5256 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5257 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
5258 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5260 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5262 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5264 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5267 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5271 /* 0xb932-0xb93b undefined */
5273 case 0xb93c: /* PPNO - perform pseudorandom number operation [partial] */
5274 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5275 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5276 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5280 case 0x00: /* PPNO-Query */
5281 case 0x80: /* PPNO-Query */
5282 if (record_full_arch_list_add_mem (oaddr
, 16))
5286 case 0x03: /* PPNO-SHA-512-DRNG - generate */
5287 if (record_full_arch_list_add_mem (oaddr
, 240))
5289 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5290 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5291 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
5292 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5294 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5296 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5300 case 0x83: /* PPNO-SHA-512-DRNG - seed */
5301 if (record_full_arch_list_add_mem (oaddr
, 240))
5303 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5305 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5310 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PPNO function %02x at %s.\n",
5311 (int)tmp
, paddress (gdbarch
, addr
));
5314 /* DXC may be written */
5315 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5317 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5321 /* 0xb93d undefined */
5323 case 0xb93e: /* KIMD - compute intermediate message digest [partial] */
5324 case 0xb93f: /* KLMD - compute last message digest [partial] */
5325 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5326 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5327 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5331 case 0x00: /* K*MD-Query */
5332 if (record_full_arch_list_add_mem (oaddr
, 16))
5336 case 0x01: /* K*MD-SHA-1 */
5337 if (record_full_arch_list_add_mem (oaddr
, 20))
5341 case 0x02: /* K*MD-SHA-256 */
5342 if (record_full_arch_list_add_mem (oaddr
, 32))
5346 case 0x03: /* K*MD-SHA-512 */
5347 if (record_full_arch_list_add_mem (oaddr
, 64))
5351 case 0x41: /* KIMD-GHASH */
5352 /* Only valid for KIMD. */
5353 if (insn
[0] == 0xb93e)
5355 if (record_full_arch_list_add_mem (oaddr
, 16))
5359 /* For KLMD, fallthru. */
5361 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMAC function %02x at %s.\n",
5362 (int)tmp
, paddress (gdbarch
, addr
));
5367 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5369 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5372 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5376 /* 0xb940 undefined */
5377 /* 0xb944-0xb945 undefined */
5378 /* 0xb947-0xb948 undefined */
5379 /* 0xb94c-0xb950 undefined */
5380 /* 0xb954-0xb958 undefined */
5381 /* 0xb95c-0xb95f undefined */
5382 /* 0xb962-0xb971 undefined */
5383 /* 0xb974-0xb97f undefined */
5385 case 0xb983: /* FLOGR - find leftmost one */
5386 /* 64-bit gpr pair destination + flags */
5387 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
5389 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6] | 1))
5391 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5395 /* 0xb98a privileged */
5396 /* 0xb98b-0xb98c undefined */
5398 case 0xb98d: /* EPSW - extract psw */
5399 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5402 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5406 /* 0xb98e-0xb98f privileged */
5408 case 0xb990: /* TRTT - translate two to two [partial] */
5409 case 0xb991: /* TRTO - translate two to one [partial] */
5410 case 0xb992: /* TROT - translate one to two [partial] */
5411 case 0xb993: /* TROO - translate one to one [partial] */
5412 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5413 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5414 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
5415 /* tmp is source length, we want destination length. Adjust. */
5416 if (insn
[0] == 0xb991)
5418 if (insn
[0] == 0xb992)
5420 if (record_full_arch_list_add_mem (oaddr
, tmp
))
5422 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5424 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5426 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5428 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5432 case 0xb996: /* MLR - multiply logical */
5433 case 0xb997: /* DLR - divide logical */
5434 /* 32-bit gpr pair destination */
5435 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5437 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5441 /* 0xb99a-0xb9af unsupported, privileged, or undefined */
5442 /* 0xb9b4-0xb9bc undefined */
5444 case 0xb9bd: /* TRTRE - translate and test reverse extended [partial] */
5445 case 0xb9bf: /* TRTE - translate and test extended [partial] */
5446 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5448 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5450 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5452 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5456 /* 0xb9c0-0xb9c7 undefined */
5458 case 0xb9c8: /* AHHHR - add high */
5459 case 0xb9c9: /* SHHHR - subtract high */
5460 case 0xb9ca: /* ALHHHR - add logical high */
5461 case 0xb9cb: /* SLHHHR - subtract logical high */
5462 case 0xb9d8: /* AHHLR - add high */
5463 case 0xb9d9: /* SHHLR - subtract high */
5464 case 0xb9da: /* ALHHLR - add logical high */
5465 case 0xb9db: /* SLHHLR - subtract logical high */
5466 /* 32-bit high gpr destination + flags */
5467 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[6]))
5469 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5473 /* 0xb9cc undefined */
5474 /* 0xb9ce undefined */
5475 /* 0xb9d0-0xb9d7 undefined */
5476 /* 0xb9dc undefined */
5477 /* 0xb9de undefined */
5479 case 0xb9e0: /* LOCFHR - load high on condition */
5480 /* 32-bit high gpr destination */
5481 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[6]))
5485 /* 0xb9e3 undefined */
5486 /* 0xb9e5 undefined */
5487 /* 0xb9ec-0xb9f1 undefined */
5488 /* 0xb9f3 undefined */
5489 /* 0xb9f5 undefined */
5490 /* 0xb9fc-0xb9ff undefined */
5497 /* 0xb4-0xb5 undefined */
5498 /* 0xb6 privileged: STCTL - store control */
5499 /* 0xb7 privileged: LCTL - load control */
5500 /* 0xb8 undefined */
5502 case 0xba: /* CS - compare and swap */
5503 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5504 if (record_full_arch_list_add_mem (oaddr
, 4))
5506 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5508 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5512 case 0xbb: /* CDS - compare double and swap */
5513 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5514 if (record_full_arch_list_add_mem (oaddr
, 8))
5516 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5518 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5520 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5524 /* 0xbc undefined */
5526 case 0xbe: /* STCM - store characters under mask */
5527 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5528 if (record_full_arch_list_add_mem (oaddr
, s390_popcnt (inib
[3])))
5537 /* RIL-format instruction */
5538 switch (ibyte
[0] << 4 | inib
[3])
5540 case 0xc00: /* LARL - load address relative long */
5541 case 0xc05: /* BRASL - branch relative and save long */
5542 case 0xc09: /* IILF - insert immediate */
5543 case 0xc21: /* MSFI - multiply single immediate */
5544 case 0xc42: /* LLHRL - load logical halfword relative long */
5545 case 0xc45: /* LHRL - load halfword relative long */
5546 case 0xc4d: /* LRL - load relative long */
5547 /* 32-bit or native gpr destination */
5548 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5552 case 0xc01: /* LGFI - load immediate */
5553 case 0xc0e: /* LLIHF - load logical immediate */
5554 case 0xc0f: /* LLILF - load logical immediate */
5555 case 0xc20: /* MSGFI - multiply single immediate */
5556 case 0xc44: /* LGHRL - load halfword relative long */
5557 case 0xc46: /* LLGHRL - load logical halfword relative long */
5558 case 0xc48: /* LGRL - load relative long */
5559 case 0xc4c: /* LGFRL - load relative long */
5560 case 0xc4e: /* LLGFRL - load logical relative long */
5561 /* 64-bit gpr destination */
5562 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5566 /* 0xc02-0xc03 undefined */
5568 case 0xc04: /* BRCL - branch relative on condition long */
5569 case 0xc62: /* PFDRL - prefetch data relative long */
5572 case 0xc06: /* XIHF - xor immediate */
5573 case 0xc0a: /* NIHF - and immediate */
5574 case 0xc0c: /* OIHF - or immediate */
5575 case 0xcc8: /* AIH - add immediate high */
5576 case 0xcca: /* ALSIH - add logical with signed immediate high */
5577 /* 32-bit high gpr destination + flags */
5578 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5580 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5584 case 0xc07: /* XILF - xor immediate */
5585 case 0xc0b: /* NILF - and immediate */
5586 case 0xc0d: /* OILF - or immediate */
5587 case 0xc25: /* SLFI - subtract logical immediate */
5588 case 0xc29: /* AFI - add immediate */
5589 case 0xc2b: /* ALFI - add logical immediate */
5590 /* 32-bit gpr destination + flags */
5591 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5593 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5597 case 0xc08: /* IIHF - insert immediate */
5598 case 0xcc6: /* BRCTH - branch relative on count high */
5599 case 0xccb: /* ALSIHN - add logical with signed immediate high */
5600 /* 32-bit high gpr destination */
5601 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5605 /* 0xc22-0xc23 undefined */
5607 case 0xc24: /* SLGFI - subtract logical immediate */
5608 case 0xc28: /* AGFI - add immediate */
5609 case 0xc2a: /* ALGFI - add logical immediate */
5610 /* 64-bit gpr destination + flags */
5611 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5613 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5617 /* 0xc26-0xc27 undefined */
5619 case 0xc2c: /* CGFI - compare immediate */
5620 case 0xc2d: /* CFI - compare immediate */
5621 case 0xc2e: /* CLGFI - compare logical immediate */
5622 case 0xc2f: /* CLFI - compare logical immediate */
5623 case 0xc64: /* CGHRL - compare halfword relative long */
5624 case 0xc65: /* CHRL - compare halfword relative long */
5625 case 0xc66: /* CLGHRL - compare logical halfword relative long */
5626 case 0xc67: /* CLHRL - compare logical halfword relative long */
5627 case 0xc68: /* CGRL - compare relative long */
5628 case 0xc6a: /* CLGRL - compare logical relative long */
5629 case 0xc6c: /* CGFRL - compare relative long */
5630 case 0xc6d: /* CRL - compare relative long */
5631 case 0xc6e: /* CLGFRL - compare logical relative long */
5632 case 0xc6f: /* CLRL - compare logical relative long */
5633 case 0xccd: /* CIH - compare immediate high */
5634 case 0xccf: /* CLIH - compare logical immediate high */
5636 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5640 /* 0xc40-0xc41 undefined */
5641 /* 0xc43 undefined */
5643 case 0xc47: /* STHRL - store halfword relative long */
5644 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5645 if (record_full_arch_list_add_mem (oaddr
, 2))
5649 /* 0xc49-0xc4a undefined */
5651 case 0xc4b: /* STGRL - store relative long */
5652 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5653 if (record_full_arch_list_add_mem (oaddr
, 8))
5657 case 0xc4f: /* STRL - store relative long */
5658 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5659 if (record_full_arch_list_add_mem (oaddr
, 4))
5663 case 0xc60: /* EXRL - execute relative long */
5666 fprintf_unfiltered (gdb_stdlog
, "Warning: Double execute at %s.\n",
5667 paddress (gdbarch
, addr
));
5670 addr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5673 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
5682 /* 0xc61 undefined */
5683 /* 0xc63 undefined */
5684 /* 0xc69 undefined */
5685 /* 0xc6b undefined */
5686 /* 0xcc0-0xcc5 undefined */
5687 /* 0xcc7 undefined */
5688 /* 0xcc9 undefined */
5689 /* 0xccc undefined */
5690 /* 0xcce undefined */
5697 /* 0xc1 undefined */
5698 /* 0xc3 undefined */
5700 case 0xc5: /* BPRP - branch prediction relative preload */
5701 case 0xc7: /* BPP - branch prediction preload */
5702 /* no visible effect */
5706 /* SSF-format instruction */
5707 switch (ibyte
[0] << 4 | inib
[3])
5709 /* 0xc80 unsupported */
5711 case 0xc81: /* ECTG - extract cpu time */
5712 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5714 if (s390_record_gpr_g (gdbarch
, regcache
, 0))
5716 if (s390_record_gpr_g (gdbarch
, regcache
, 1))
5720 case 0xc82: /* CSST - compare and swap and store */
5723 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5725 sc
= tmp
>> 8 & 0xff;
5727 /* First and third operands. */
5728 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5731 case 0x00: /* 32-bit */
5732 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5734 if (record_full_arch_list_add_mem (oaddr
, 4))
5738 case 0x01: /* 64-bit */
5739 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5741 if (record_full_arch_list_add_mem (oaddr
, 8))
5745 case 0x02: /* 128-bit */
5746 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5748 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5750 if (record_full_arch_list_add_mem (oaddr
, 16))
5755 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown CSST FC %02x at %s.\n",
5756 fc
, paddress (gdbarch
, addr
));
5760 /* Second operand. */
5761 oaddr2
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[2], 0);
5764 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown CSST FC %02x at %s.\n",
5765 sc
, paddress (gdbarch
, addr
));
5769 if (record_full_arch_list_add_mem (oaddr2
, 1 << sc
))
5773 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5778 /* 0xc83 undefined */
5780 case 0xc84: /* LPD - load pair disjoint */
5781 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5783 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5785 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5789 case 0xc85: /* LPDG - load pair disjoint */
5790 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5792 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5794 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5798 /* 0xc86-0xc8f undefined */
5805 /* 0xc9-0xcb undefined */
5806 /* 0xcd-0xcf undefined */
5808 case 0xd0: /* TRTR - translate and test reversed */
5809 case 0xdd: /* TRT - translate and test */
5810 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
5812 if (record_full_arch_list_add_reg (regcache
, S390_R2_REGNUM
))
5814 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5818 case 0xd1: /* MVN - move numbers */
5819 case 0xd2: /* MVC - move */
5820 case 0xd3: /* MVZ - move zones */
5821 case 0xdc: /* TR - translate */
5822 case 0xe8: /* MVCIN - move inverse */
5823 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5824 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5828 case 0xd4: /* NC - and */
5829 case 0xd6: /* OC - or*/
5830 case 0xd7: /* XC - xor */
5831 case 0xe2: /* UNPKU - unpack unicode */
5832 case 0xea: /* UNPKA - unpack ASCII */
5833 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5834 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5836 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5840 case 0xde: /* ED - edit */
5841 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5842 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5844 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5846 /* DXC may be written */
5847 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5851 case 0xdf: /* EDMK - edit and mark */
5852 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5853 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5855 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
5857 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5859 /* DXC may be written */
5860 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5864 /* 0xd8 undefined */
5865 /* 0xd9 unsupported: MVCK - move with key */
5866 /* 0xda unsupported: MVCP - move to primary */
5867 /* 0xdb unsupported: MVCS - move to secondary */
5868 /* 0xe0 undefined */
5870 case 0xe1: /* PKU - pack unicode */
5871 case 0xe9: /* PKA - pack ASCII */
5872 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5873 if (record_full_arch_list_add_mem (oaddr
, 16))
5881 /* RXY/RXE/RXF/RSL/RSY/SIY/V*-format instruction */
5882 switch (ibyte
[0] << 8 | ibyte
[5])
5884 /* 0xe300-0xe301 undefined */
5886 case 0xe302: /* LTG - load and test */
5887 case 0xe308: /* AG - add */
5888 case 0xe309: /* SG - subtract */
5889 case 0xe30a: /* ALG - add logical */
5890 case 0xe30b: /* SLG - subtract logical */
5891 case 0xe318: /* AGF - add */
5892 case 0xe319: /* SGF - subtract */
5893 case 0xe31a: /* ALGF - add logical */
5894 case 0xe31b: /* SLGF - subtract logical */
5895 case 0xe332: /* LTGF - load and test */
5896 case 0xe380: /* NG - and */
5897 case 0xe381: /* OG - or */
5898 case 0xe382: /* XG - xor */
5899 case 0xe388: /* ALCG - add logical with carry */
5900 case 0xe389: /* SLBG - subtract logical with borrow */
5901 case 0xeb0a: /* SRAG - shift right single */
5902 case 0xeb0b: /* SLAG - shift left single */
5903 /* 64-bit gpr destination + flags */
5904 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5906 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5910 /* 0xe303 privileged */
5912 case 0xe304: /* LG - load */
5913 case 0xe30c: /* MSG - multiply single */
5914 case 0xe30f: /* LRVG - load reversed */
5915 case 0xe314: /* LGF - load */
5916 case 0xe315: /* LGH - load halfword */
5917 case 0xe316: /* LLGF - load logical */
5918 case 0xe317: /* LLGT - load logical thirty one bits */
5919 case 0xe31c: /* MSGF - multiply single */
5920 case 0xe32a: /* LZRG - load and zero rightmost byte */
5921 case 0xe33a: /* LLZRGF - load logical and zero rightmost byte */
5922 case 0xe346: /* BCTG - branch on count */
5923 case 0xe377: /* LGB - load byte */
5924 case 0xe390: /* LLGC - load logical character */
5925 case 0xe391: /* LLGH - load logical halfword */
5926 case 0xeb0c: /* SRLG - shift right single logical */
5927 case 0xeb0d: /* SLLG - shift left single logical */
5928 case 0xeb1c: /* RLLG - rotate left single logical */
5929 case 0xeb44: /* BXHG - branch on index high */
5930 case 0xeb45: /* BXLEG - branch on index low or equal */
5931 case 0xeb4c: /* ECAG - extract cpu attribute */
5932 case 0xebe2: /* LOCG - load on condition */
5933 /* 64-bit gpr destination */
5934 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5938 /* 0xe305 undefined */
5940 case 0xe306: /* CVBY - convert to binary */
5941 /* 32-bit or native gpr destination + FPC (DXC write) */
5942 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5944 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5948 /* 0xe307 undefined */
5950 case 0xe30d: /* DSG - divide single */
5951 case 0xe31d: /* DSGF - divide single */
5952 case 0xe386: /* MLG - multiply logical */
5953 case 0xe387: /* DLG - divide logical */
5954 case 0xe38f: /* LPQ - load pair from quadword */
5955 /* 64-bit gpr pair destination */
5956 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5958 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5962 case 0xe30e: /* CVBG - convert to binary */
5963 /* 64-bit gpr destination + FPC (DXC write) */
5964 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5966 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5970 /* 0xe310-0xe311 undefined */
5972 case 0xe312: /* LT - load and test */
5973 case 0xe354: /* NY - and */
5974 case 0xe356: /* OY - or */
5975 case 0xe357: /* XY - xor */
5976 case 0xe35a: /* AY - add */
5977 case 0xe35b: /* SY - subtract */
5978 case 0xe35e: /* ALY - add logical */
5979 case 0xe35f: /* SLY - subtract logical */
5980 case 0xe37a: /* AHY - add halfword */
5981 case 0xe37b: /* SHY - subtract halfword */
5982 case 0xe398: /* ALC - add logical with carry */
5983 case 0xe399: /* SLB - subtract logical with borrow */
5984 case 0xe727: /* LCBB - load count to block bounduary */
5985 case 0xeb81: /* ICMY - insert characters under mask */
5986 case 0xebdc: /* SRAK - shift left single */
5987 case 0xebdd: /* SLAK - shift left single */
5988 /* 32-bit gpr destination + flags */
5989 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5991 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5995 /* 0xe313 privileged */
5997 case 0xe31e: /* LRV - load reversed */
5998 case 0xe31f: /* LRVH - load reversed */
5999 case 0xe33b: /* LZRF - load and zero rightmost byte */
6000 case 0xe351: /* MSY - multiply single */
6001 case 0xe358: /* LY - load */
6002 case 0xe371: /* LAY - load address */
6003 case 0xe373: /* ICY - insert character */
6004 case 0xe376: /* LB - load byte */
6005 case 0xe378: /* LHY - load */
6006 case 0xe37c: /* MHY - multiply halfword */
6007 case 0xe394: /* LLC - load logical character */
6008 case 0xe395: /* LLH - load logical halfword */
6009 case 0xeb1d: /* RLL - rotate left single logical */
6010 case 0xebde: /* SRLK - shift left single logical */
6011 case 0xebdf: /* SLLK - shift left single logical */
6012 case 0xebf2: /* LOC - load on condition */
6013 /* 32-bit or native gpr destination */
6014 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6018 case 0xe320: /* CG - compare */
6019 case 0xe321: /* CLG - compare logical */
6020 case 0xe330: /* CGF - compare */
6021 case 0xe331: /* CLGF - compare logical */
6022 case 0xe334: /* CGH - compare halfword */
6023 case 0xe355: /* CLY - compare logical */
6024 case 0xe359: /* CY - compare */
6025 case 0xe379: /* CHY - compare halfword */
6026 case 0xe3cd: /* CHF - compare high */
6027 case 0xe3cf: /* CLHF - compare logical high */
6028 case 0xeb20: /* CLMH - compare logical under mask high */
6029 case 0xeb21: /* CLMY - compare logical under mask */
6030 case 0xeb51: /* TMY - test under mask */
6031 case 0xeb55: /* CLIY - compare logical */
6032 case 0xebc0: /* TP - test decimal */
6033 case 0xed10: /* TCEB - test data class */
6034 case 0xed11: /* TCDB - test data class */
6035 case 0xed12: /* TCXB - test data class */
6036 case 0xed50: /* TDCET - test data class */
6037 case 0xed51: /* TDGET - test data group */
6038 case 0xed54: /* TDCDT - test data class */
6039 case 0xed55: /* TDGDT - test data group */
6040 case 0xed58: /* TDCXT - test data class */
6041 case 0xed59: /* TDGXT - test data group */
6043 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6047 /* 0xe322-0xe323 undefined */
6049 case 0xe324: /* STG - store */
6050 case 0xe325: /* NTSTG - nontransactional store */
6051 case 0xe326: /* CVDY - convert to decimal */
6052 case 0xe32f: /* STRVG - store reversed */
6053 case 0xebe3: /* STOCG - store on condition */
6054 case 0xed67: /* STDY - store */
6055 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6056 if (record_full_arch_list_add_mem (oaddr
, 8))
6060 /* 0xe327-0xe329 undefined */
6061 /* 0xe32b-0xe32d undefined */
6063 case 0xe32e: /* CVDG - convert to decimal */
6064 case 0xe38e: /* STPQ - store pair to quadword */
6065 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6066 if (record_full_arch_list_add_mem (oaddr
, 16))
6070 /* 0xe333 undefined */
6071 /* 0xe335 undefined */
6073 case 0xe336: /* PFD - prefetch data */
6076 /* 0xe337-0xe339 undefined */
6077 /* 0xe33c-0xe33d undefined */
6079 case 0xe33e: /* STRV - store reversed */
6080 case 0xe350: /* STY - store */
6081 case 0xe3cb: /* STFH - store high */
6082 case 0xebe1: /* STOCFH - store high on condition */
6083 case 0xebf3: /* STOC - store on condition */
6084 case 0xed66: /* STEY - store */
6085 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6086 if (record_full_arch_list_add_mem (oaddr
, 4))
6090 case 0xe33f: /* STRVH - store reversed */
6091 case 0xe370: /* STHY - store halfword */
6092 case 0xe3c7: /* STHH - store halfword high */
6093 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6094 if (record_full_arch_list_add_mem (oaddr
, 2))
6098 /* 0xe340-0xe345 undefined */
6099 /* 0xe347-0xe34f undefined */
6100 /* 0xe352-0xe353 undefined */
6102 case 0xe35c: /* MFY - multiply */
6103 case 0xe396: /* ML - multiply logical */
6104 case 0xe397: /* DL - divide logical */
6105 /* 32-bit gpr pair destination */
6106 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6108 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6112 /* 0xe35d undefined */
6113 /* 0xe360-0xe36f undefined */
6115 case 0xe372: /* STCY - store character */
6116 case 0xe3c3: /* STCH - store character high */
6117 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6118 if (record_full_arch_list_add_mem (oaddr
, 1))
6122 /* 0xe374 undefined */
6124 case 0xe375: /* LAEY - load address extended */
6125 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6127 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[2]))
6131 /* 0xe37d-0xe37f undefined */
6132 /* 0xe383-0xe384 undefined */
6134 case 0xe385: /* LGAT - load and trap */
6135 case 0xe39c: /* LLGTAT - load logical thirty one bits and trap */
6136 case 0xe39d: /* LLGFAT - load logical and trap */
6137 case 0xe721: /* VLGV - vector load gr from vr element */
6138 /* 64-bit gpr destination + fpc for possible DXC write */
6139 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6141 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6145 /* 0xe38a-0xe38d undefined */
6146 /* 0xe392-0xe393 undefined */
6147 /* 0xe39a-0xe39b undefined */
6148 /* 0xe39e undefined */
6150 case 0xe39f: /* LAT - load and trap */
6151 /* 32-bit gpr destination + fpc for possible DXC write */
6152 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6154 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6158 /* 0xe3a0-0xe3bf undefined */
6160 case 0xe3c0: /* LBH - load byte high */
6161 case 0xe3c2: /* LLCH - load logical character high */
6162 case 0xe3c4: /* LHH - load halfword high */
6163 case 0xe3c6: /* LLHH - load logical halfword high */
6164 case 0xe3ca: /* LFH - load high */
6165 case 0xebe0: /* LOCFH - load high on condition */
6166 /* 32-bit high gpr destination */
6167 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6171 /* 0xe3c1 undefined */
6172 /* 0xe3c5 undefined */
6174 case 0xe3c8: /* LFHAT - load high and trap */
6175 /* 32-bit high gpr destination + fpc for possible DXC write */
6176 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6178 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6182 /* 0xe3c9 undefined */
6183 /* 0xe3cc undefined */
6184 /* 0xe3ce undefined */
6185 /* 0xe3d0-0xe3ff undefined */
6187 case 0xe700: /* VLEB - vector load element */
6188 case 0xe701: /* VLEH - vector load element */
6189 case 0xe702: /* VLEG - vector load element */
6190 case 0xe703: /* VLEF - vector load element */
6191 case 0xe704: /* VLLEZ - vector load logical element and zero */
6192 case 0xe705: /* VLREP - vector load and replicate */
6193 case 0xe706: /* VL - vector load */
6194 case 0xe707: /* VLBB - vector load to block bounduary */
6195 case 0xe712: /* VGEG - vector gather element */
6196 case 0xe713: /* VGEF - vector gather element */
6197 case 0xe722: /* VLVG - vector load vr element from gr */
6198 case 0xe730: /* VESL - vector element shift left */
6199 case 0xe733: /* VERLL - vector element rotate left logical */
6200 case 0xe737: /* VLL - vector load with length */
6201 case 0xe738: /* VESRL - vector element shift right logical */
6202 case 0xe73a: /* VESRA - vector element shift right arithmetic */
6203 case 0xe740: /* VLEIB - vector load element immediate */
6204 case 0xe741: /* VLEIH - vector load element immediate */
6205 case 0xe742: /* VLEIG - vector load element immediate */
6206 case 0xe743: /* VLEIF - vector load element immediate */
6207 case 0xe744: /* VGBM - vector generate byte mask */
6208 case 0xe745: /* VREPI - vector replicate immediate */
6209 case 0xe746: /* VGM - vector generate mask */
6210 case 0xe74d: /* VREP - vector replicate */
6211 case 0xe750: /* VPOPCT - vector population count */
6212 case 0xe752: /* VCTZ - vector count trailing zeros */
6213 case 0xe753: /* VCLZ - vector count leading zeros */
6214 case 0xe756: /* VLR - vector load */
6215 case 0xe75f: /* VSEG -vector sign extend to doubleword */
6216 case 0xe760: /* VMRL - vector merge low */
6217 case 0xe761: /* VMRH - vector merge high */
6218 case 0xe762: /* VLVGP - vector load vr from grs disjoint */
6219 case 0xe764: /* VSUM - vector sum across word */
6220 case 0xe765: /* VSUMG - vector sum across doubleword */
6221 case 0xe766: /* VCKSM - vector checksum */
6222 case 0xe767: /* VSUMQ - vector sum across quadword */
6223 case 0xe768: /* VN - vector and */
6224 case 0xe769: /* VNC - vector and with complement */
6225 case 0xe76a: /* VO - vector or */
6226 case 0xe76b: /* VNO - vector nor */
6227 case 0xe76d: /* VX - vector xor */
6228 case 0xe770: /* VESLV - vector element shift left */
6229 case 0xe772: /* VERIM - vector element rotate and insert under mask */
6230 case 0xe773: /* VERLLV - vector element rotate left logical */
6231 case 0xe774: /* VSL - vector shift left */
6232 case 0xe775: /* VSLB - vector shift left by byte */
6233 case 0xe777: /* VSLDB - vector shift left double by byte */
6234 case 0xe778: /* VESRLV - vector element shift right logical */
6235 case 0xe77a: /* VESRAV - vector element shift right arithmetic */
6236 case 0xe77c: /* VSRL - vector shift right logical */
6237 case 0xe77d: /* VSRLB - vector shift right logical by byte */
6238 case 0xe77e: /* VSRA - vector shift right arithmetic */
6239 case 0xe77f: /* VSRAB - vector shift right arithmetic by byte */
6240 case 0xe784: /* VPDI - vector permute doubleword immediate */
6241 case 0xe78c: /* VPERM - vector permute */
6242 case 0xe78d: /* VSEL - vector select */
6243 case 0xe78e: /* VFMS - vector fp multiply and subtract */
6244 case 0xe78f: /* VFMA - vector fp multiply and add */
6245 case 0xe794: /* VPK - vector pack */
6246 case 0xe7a1: /* VMLH - vector multiply logical high */
6247 case 0xe7a2: /* VML - vector multiply low */
6248 case 0xe7a3: /* VMH - vector multiply high */
6249 case 0xe7a4: /* VMLE - vector multiply logical even */
6250 case 0xe7a5: /* VMLO - vector multiply logical odd */
6251 case 0xe7a6: /* VME - vector multiply even */
6252 case 0xe7a7: /* VMO - vector multiply odd */
6253 case 0xe7a9: /* VMALH - vector multiply and add logical high */
6254 case 0xe7aa: /* VMAL - vector multiply and add low */
6255 case 0xe7ab: /* VMAH - vector multiply and add high */
6256 case 0xe7ac: /* VMALE - vector multiply and add logical even */
6257 case 0xe7ad: /* VMALO - vector multiply and add logical odd */
6258 case 0xe7ae: /* VMAE - vector multiply and add even */
6259 case 0xe7af: /* VMAO - vector multiply and add odd */
6260 case 0xe7b4: /* VGFM - vector Galois field multiply sum */
6261 case 0xe7b9: /* VACCC - vector add with carry compute carry */
6262 case 0xe7bb: /* VAC - vector add with carry */
6263 case 0xe7bc: /* VGFMA - vector Galois field multiply sum and accumulate */
6264 case 0xe7bd: /* VSBCBI - vector subtract with borrow compute borrow indication */
6265 case 0xe7bf: /* VSBI - vector subtract with borrow indication */
6266 case 0xe7c0: /* VCLGD - vector convert to logical 64-bit */
6267 case 0xe7c1: /* VCDLG - vector convert from logical 64-bit */
6268 case 0xe7c2: /* VCGD - vector convert to fixed 64-bit */
6269 case 0xe7c3: /* VCDG - vector convert from fixed 64-bit */
6270 case 0xe7c4: /* VLDE - vector fp load lengthened */
6271 case 0xe7c5: /* VLED - vector fp load rounded */
6272 case 0xe7c7: /* VFI - vector load fp integer */
6273 case 0xe7cc: /* VFPSO - vector fp perform sign operation */
6274 case 0xe7ce: /* VFSQ - vector fp square root */
6275 case 0xe7d4: /* VUPLL - vector unpack logical low */
6276 case 0xe7d6: /* VUPL - vector unpack low */
6277 case 0xe7d5: /* VUPLH - vector unpack logical high */
6278 case 0xe7d7: /* VUPH - vector unpack high */
6279 case 0xe7de: /* VLC - vector load complement */
6280 case 0xe7df: /* VLP - vector load positive */
6281 case 0xe7e2: /* VFA - vector fp subtract */
6282 case 0xe7e3: /* VFA - vector fp add */
6283 case 0xe7e5: /* VFD - vector fp divide */
6284 case 0xe7e7: /* VFM - vector fp multiply */
6285 case 0xe7f0: /* VAVGL - vector average logical */
6286 case 0xe7f1: /* VACC - vector add and compute carry */
6287 case 0xe7f2: /* VAVG - vector average */
6288 case 0xe7f3: /* VA - vector add */
6289 case 0xe7f5: /* VSCBI - vector subtract compute borrow indication */
6290 case 0xe7f7: /* VS - vector subtract */
6291 case 0xe7fc: /* VMNL - vector minimum logical */
6292 case 0xe7fd: /* VMXL - vector maximum logical */
6293 case 0xe7fe: /* VMN - vector minimum */
6294 case 0xe7ff: /* VMX - vector maximum */
6295 /* vector destination + FPC */
6296 if (s390_record_vr (gdbarch
, regcache
, ivec
[0]))
6298 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6302 case 0xe708: /* VSTEB - vector store element */
6303 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6304 if (record_full_arch_list_add_mem (oaddr
, 1))
6306 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6310 case 0xe709: /* VSTEH - vector store element */
6311 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6312 if (record_full_arch_list_add_mem (oaddr
, 2))
6314 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6318 case 0xe70a: /* VSTEG - vector store element */
6319 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6320 if (record_full_arch_list_add_mem (oaddr
, 8))
6322 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6326 case 0xe70b: /* VSTEF - vector store element */
6327 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6328 if (record_full_arch_list_add_mem (oaddr
, 4))
6330 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6334 /* 0xe70c-0xe70d undefined */
6336 case 0xe70e: /* VST - vector store */
6337 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6338 if (record_full_arch_list_add_mem (oaddr
, 16))
6340 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6344 /* 0xe70f-0xe711 undefined */
6345 /* 0xe714-0xe719 undefined */
6347 case 0xe71a: /* VSCEG - vector scatter element */
6348 if (s390_record_calc_disp_vsce (gdbarch
, regcache
, ivec
[1], inib
[8], 8, insn
[1], 0, &oaddr
))
6350 if (record_full_arch_list_add_mem (oaddr
, 8))
6352 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6356 case 0xe71b: /* VSCEF - vector scatter element */
6357 if (s390_record_calc_disp_vsce (gdbarch
, regcache
, ivec
[1], inib
[8], 4, insn
[1], 0, &oaddr
))
6359 if (record_full_arch_list_add_mem (oaddr
, 4))
6361 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6365 /* 0xe71c-0xe720 undefined */
6366 /* 0xe723-0xe726 undefined */
6367 /* 0xe728-0xe72f undefined */
6368 /* 0xe731-0xe732 undefined */
6369 /* 0xe734-0xe735 undefined */
6371 case 0xe736: /* VLM - vector load multiple */
6372 for (i
= ivec
[0]; i
!= ivec
[1]; i
++, i
&= 0x1f)
6373 if (s390_record_vr (gdbarch
, regcache
, i
))
6375 if (s390_record_vr (gdbarch
, regcache
, ivec
[1]))
6377 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6381 /* 0xe739 undefined */
6382 /* 0xe73b-0xe73d undefined */
6384 case 0xe73e: /* VSTM - vector store multiple */
6385 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6386 if (ivec
[0] <= ivec
[1])
6387 n
= ivec
[1] - ivec
[0] + 1;
6389 n
= ivec
[1] + 0x20 - ivec
[0] + 1;
6390 if (record_full_arch_list_add_mem (oaddr
, n
* 16))
6392 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6396 case 0xe73f: /* VSTL - vector store with length */
6397 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6398 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[3], &tmp
);
6402 if (record_full_arch_list_add_mem (oaddr
, tmp
))
6404 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6408 /* 0xe747-0xe749 undefined */
6410 case 0xe74a: /* VFTCI - vector fp test data class immediate */
6411 case 0xe75c: /* VISTR - vector isolate string */
6412 case 0xe780: /* VFEE - vector find element equal */
6413 case 0xe781: /* VFENE - vector find element not equal */
6414 case 0xe782: /* VFA - vector find any element equal */
6415 case 0xe78a: /* VSTRC - vector string range compare */
6416 case 0xe795: /* VPKLS - vector pack logical saturate */
6417 case 0xe797: /* VPKS - vector pack saturate */
6418 case 0xe7e8: /* VFCE - vector fp compare equal */
6419 case 0xe7ea: /* VFCHE - vector fp compare high or equal */
6420 case 0xe7eb: /* VFCE - vector fp compare high */
6421 case 0xe7f8: /* VCEQ - vector compare equal */
6422 case 0xe7f9: /* VCHL - vector compare high logical */
6423 case 0xe7fb: /* VCH - vector compare high */
6424 /* vector destination + flags + FPC */
6425 if (s390_record_vr (gdbarch
, regcache
, ivec
[0]))
6427 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6429 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6433 /* 0xe74b-0xe74c undefined */
6434 /* 0xe74e-0xe74f undefined */
6435 /* 0xe751 undefined */
6436 /* 0xe754-0xe755 undefined */
6437 /* 0xe757-0xe75b undefined */
6438 /* 0xe75d-0xe75e undefined */
6439 /* 0xe763 undefined */
6440 /* 0xe76c undefined */
6441 /* 0xe76e-0xe76f undefined */
6442 /* 0xe771 undefined */
6443 /* 0xe776 undefined */
6444 /* 0xe779 undefined */
6445 /* 0xe77b undefined */
6446 /* 0xe783 undefined */
6447 /* 0xe785-0xe789 undefined */
6448 /* 0xe78b undefined */
6449 /* 0xe790-0xe793 undefined */
6450 /* 0xe796 undefined */
6451 /* 0xe798-0xe7a0 undefined */
6452 /* 0xe7a8 undefined */
6453 /* 0xe7b0-0xe7b3 undefined */
6454 /* 0xe7b5-0xe7b8 undefined */
6455 /* 0xe7ba undefined */
6456 /* 0xe7be undefined */
6457 /* 0xe7c6 undefined */
6458 /* 0xe7c8-0xe7c9 undefined */
6460 case 0xe7ca: /* WFK - vector fp compare and signal scalar */
6461 case 0xe7cb: /* WFC - vector fp compare scalar */
6462 case 0xe7d8: /* VTM - vector test under mask */
6463 case 0xe7d9: /* VECL - vector element compare logical */
6464 case 0xe7db: /* VEC - vector element compare */
6465 case 0xed08: /* KEB - compare and signal */
6466 case 0xed09: /* CEB - compare */
6467 case 0xed18: /* KDB - compare and signal */
6468 case 0xed19: /* CDB - compare */
6469 /* flags + fpc only */
6470 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6472 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6476 /* 0xe7cd undefined */
6477 /* 0xe7cf-0xe7d3 undefined */
6478 /* 0xe7da undefined */
6479 /* 0xe7dc-0xe7dd undefined */
6480 /* 0xe7e0-0xe7e1 undefined */
6481 /* 0xe7e4 undefined */
6482 /* 0xe7e6 undefined */
6483 /* 0xe7e9 undefined */
6484 /* 0xe7ec-0xe7ef undefined */
6485 /* 0xe7f4 undefined */
6486 /* 0xe7f6 undefined */
6487 /* 0xe7fa undefined */
6489 /* 0xeb00-0xeb03 undefined */
6491 case 0xeb04: /* LMG - load multiple */
6492 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6493 if (s390_record_gpr_g (gdbarch
, regcache
, i
))
6495 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
6499 /* 0xeb05-0xeb09 undefined */
6500 /* 0xeb0e undefined */
6501 /* 0xeb0f privileged: TRACG */
6502 /* 0xeb10-0xeb13 undefined */
6504 case 0xeb14: /* CSY - compare and swap */
6505 case 0xebf4: /* LAN - load and and */
6506 case 0xebf6: /* LAO - load and or */
6507 case 0xebf7: /* LAX - load and xor */
6508 case 0xebf8: /* LAA - load and add */
6509 case 0xebfa: /* LAAL - load and add logical */
6510 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6511 if (record_full_arch_list_add_mem (oaddr
, 4))
6513 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6515 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6519 /* 0xeb15-0xeb1b undefined */
6520 /* 0xeb1e-0xeb1f undefined */
6521 /* 0xeb22 undefined */
6523 case 0xeb23: /* CLT - compare logical and trap */
6524 case 0xeb2b: /* CLGT - compare logical and trap */
6525 /* fpc only - including possible DXC write for trapping insns */
6526 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6530 case 0xeb24: /* STMG - store multiple */
6531 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6532 if (inib
[2] <= inib
[3])
6533 n
= inib
[3] - inib
[2] + 1;
6535 n
= inib
[3] + 0x10 - inib
[2] + 1;
6536 if (record_full_arch_list_add_mem (oaddr
, n
* 8))
6540 /* 0xeb25 privileged */
6542 case 0xeb26: /* STMH - store multiple high */
6543 case 0xeb90: /* STMY - store multiple */
6544 case 0xeb9b: /* STAMY - store access multiple */
6545 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6546 if (inib
[2] <= inib
[3])
6547 n
= inib
[3] - inib
[2] + 1;
6549 n
= inib
[3] + 0x10 - inib
[2] + 1;
6550 if (record_full_arch_list_add_mem (oaddr
, n
* 4))
6554 /* 0xeb27-0xeb2a undefined */
6556 case 0xeb2c: /* STCMH - store characters under mask */
6557 case 0xeb2d: /* STCMY - store characters under mask */
6558 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6559 if (record_full_arch_list_add_mem (oaddr
, s390_popcnt (inib
[3])))
6563 /* 0xeb2e undefined */
6564 /* 0xeb2f privileged */
6566 case 0xeb30: /* CSG - compare and swap */
6567 case 0xebe4: /* LANG - load and and */
6568 case 0xebe6: /* LAOG - load and or */
6569 case 0xebe7: /* LAXG - load and xor */
6570 case 0xebe8: /* LAAG - load and add */
6571 case 0xebea: /* LAALG - load and add logical */
6572 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6573 if (record_full_arch_list_add_mem (oaddr
, 8))
6575 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6577 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6581 case 0xeb31: /* CDSY - compare double and swap */
6582 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6583 if (record_full_arch_list_add_mem (oaddr
, 8))
6585 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6587 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6589 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6593 /* 0xeb32-0xeb3d undefined */
6595 case 0xeb3e: /* CDSG - compare double and swap */
6596 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6597 if (record_full_arch_list_add_mem (oaddr
, 16))
6599 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6601 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
6603 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6607 /* 0xeb3f-0xeb43 undefined */
6608 /* 0xeb46-0xeb4b undefined */
6609 /* 0xeb4d-0xeb50 undefined */
6611 case 0xeb52: /* MVIY - move */
6612 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6613 if (record_full_arch_list_add_mem (oaddr
, 1))
6617 case 0xeb54: /* NIY - and */
6618 case 0xeb56: /* OIY - or */
6619 case 0xeb57: /* XIY - xor */
6620 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6621 if (record_full_arch_list_add_mem (oaddr
, 1))
6623 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6627 /* 0xeb53 undefined */
6628 /* 0xeb58-0xeb69 undefined */
6630 case 0xeb6a: /* ASI - add immediate */
6631 case 0xeb6e: /* ALSI - add immediate */
6632 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6633 if (record_full_arch_list_add_mem (oaddr
, 4))
6635 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6639 /* 0xeb6b-0xeb6d undefined */
6640 /* 0xeb6f-0xeb79 undefined */
6642 case 0xeb7a: /* AGSI - add immediate */
6643 case 0xeb7e: /* ALGSI - add immediate */
6644 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6645 if (record_full_arch_list_add_mem (oaddr
, 8))
6647 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6651 /* 0xeb7b-0xeb7d undefined */
6652 /* 0xeb7f undefined */
6654 case 0xeb80: /* ICMH - insert characters under mask */
6655 /* 32-bit high gpr destination + flags */
6656 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6658 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6662 /* 0xeb82-0xeb8d undefined */
6664 case 0xeb8e: /* MVCLU - move long unicode [partial] */
6665 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
6666 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
6667 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
6668 if (record_full_arch_list_add_mem (oaddr
, tmp
))
6670 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6672 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6674 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6676 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
6678 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6682 case 0xeb8f: /* CLCLU - compare logical long unicode [partial] */
6683 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6685 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6687 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6689 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
6691 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6695 /* 0xeb91-0xeb95 undefined */
6697 case 0xeb96: /* LMH - load multiple high */
6698 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6699 if (s390_record_gpr_h (gdbarch
, regcache
, i
))
6701 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[3]))
6705 /* 0xeb97 undefined */
6707 case 0xeb98: /* LMY - load multiple */
6708 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6709 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
6711 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6715 /* 0xeb99 undefined */
6717 case 0xeb9a: /* LAMY - load access multiple */
6718 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6719 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
6721 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[3]))
6725 /* 0xeb9c-0xebbf undefined */
6726 /* 0xebc1-0xebdb undefined */
6727 /* 0xebe5 undefined */
6728 /* 0xebe9 undefined */
6729 /* 0xebeb-0xebf1 undefined */
6730 /* 0xebf5 undefined */
6731 /* 0xebf9 undefined */
6732 /* 0xebfb-0xebff undefined */
6734 /* 0xed00-0xed03 undefined */
6736 case 0xed04: /* LDEB - load lengthened */
6737 case 0xed0c: /* MDEB - multiply */
6738 case 0xed0d: /* DEB - divide */
6739 case 0xed14: /* SQEB - square root */
6740 case 0xed15: /* SQDB - square root */
6741 case 0xed17: /* MEEB - multiply */
6742 case 0xed1c: /* MDB - multiply */
6743 case 0xed1d: /* DDB - divide */
6744 /* float destination + fpc */
6745 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6747 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6751 case 0xed05: /* LXDB - load lengthened */
6752 case 0xed06: /* LXEB - load lengthened */
6753 case 0xed07: /* MXDB - multiply */
6754 /* float pair destination + fpc */
6755 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6757 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
6759 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6763 case 0xed0a: /* AEB - add */
6764 case 0xed0b: /* SEB - subtract */
6765 case 0xed1a: /* ADB - add */
6766 case 0xed1b: /* SDB - subtract */
6767 /* float destination + flags + fpc */
6768 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6770 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6772 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6776 case 0xed0e: /* MAEB - multiply and add */
6777 case 0xed0f: /* MSEB - multiply and subtract */
6778 case 0xed1e: /* MADB - multiply and add */
6779 case 0xed1f: /* MSDB - multiply and subtract */
6780 case 0xed40: /* SLDT - shift significand left */
6781 case 0xed41: /* SRDT - shift significand right */
6782 case 0xedaa: /* CDZT - convert from zoned */
6783 case 0xedae: /* CDPT - convert from packed */
6784 /* float destination [RXF] + fpc */
6785 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6787 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6791 /* 0xed13 undefined */
6792 /* 0xed16 undefined */
6793 /* 0xed20-0xed23 undefined */
6795 case 0xed24: /* LDE - load lengthened */
6796 case 0xed34: /* SQE - square root */
6797 case 0xed35: /* SQD - square root */
6798 case 0xed37: /* MEE - multiply */
6799 case 0xed64: /* LEY - load */
6800 case 0xed65: /* LDY - load */
6801 /* float destination */
6802 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6806 case 0xed25: /* LXD - load lengthened */
6807 case 0xed26: /* LXE - load lengthened */
6808 /* float pair destination */
6809 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6811 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
6815 /* 0xed27-0xed2d undefined */
6817 case 0xed2e: /* MAE - multiply and add */
6818 case 0xed2f: /* MSE - multiply and subtract */
6819 case 0xed38: /* MAYL - multiply and add unnormalized */
6820 case 0xed39: /* MYL - multiply unnormalized */
6821 case 0xed3c: /* MAYH - multiply and add unnormalized */
6822 case 0xed3d: /* MYH - multiply unnormalized */
6823 case 0xed3e: /* MAD - multiply and add */
6824 case 0xed3f: /* MSD - multiply and subtract */
6825 /* float destination [RXF] */
6826 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6830 /* 0xed30-0xed33 undefined */
6831 /* 0xed36 undefined */
6833 case 0xed3a: /* MAY - multiply and add unnormalized */
6834 case 0xed3b: /* MY - multiply unnormalized */
6835 /* float pair destination [RXF] */
6836 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6838 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[8] | 2)))
6842 /* 0xed42-0xed47 undefind */
6844 case 0xed48: /* SLXT - shift significand left */
6845 case 0xed49: /* SRXT - shift significand right */
6846 case 0xedab: /* CXZT - convert from zoned */
6847 case 0xedaf: /* CXPT - convert from packed */
6848 /* float pair destination [RXF] + fpc */
6849 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6851 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[8] | 2)))
6853 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6857 /* 0xed4a-0xed4f undefind */
6858 /* 0xed52-0xed53 undefind */
6859 /* 0xed56-0xed57 undefind */
6860 /* 0xed5a-0xed63 undefind */
6861 /* 0xed68-0xeda7 undefined */
6863 case 0xeda8: /* CZDT - convert to zoned */
6864 case 0xeda9: /* CZXT - convert to zoned */
6865 case 0xedac: /* CPDT - convert to packed */
6866 case 0xedad: /* CPXT - convert to packed */
6867 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6868 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
6870 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6874 /* 0xedb0-0xedff undefined */
6881 /* 0xe4 undefined */
6884 /* SSE/SIL-format instruction */
6887 /* 0xe500-0xe543 undefined, privileged, or unsupported */
6889 case 0xe544: /* MVHHI - move */
6890 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6891 if (record_full_arch_list_add_mem (oaddr
, 2))
6895 /* 0xe545-0xe547 undefined */
6897 case 0xe548: /* MVGHI - move */
6898 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6899 if (record_full_arch_list_add_mem (oaddr
, 8))
6903 /* 0xe549-0xe54b undefined */
6905 case 0xe54c: /* MVHI - move */
6906 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6907 if (record_full_arch_list_add_mem (oaddr
, 4))
6911 /* 0xe54d-0xe553 undefined */
6913 case 0xe554: /* CHHSI - compare halfword immediate */
6914 case 0xe555: /* CLHHSI - compare logical immediate */
6915 case 0xe558: /* CGHSI - compare halfword immediate */
6916 case 0xe559: /* CLGHSI - compare logical immediate */
6917 case 0xe55c: /* CHSI - compare halfword immediate */
6918 case 0xe55d: /* CLFHSI - compare logical immediate */
6919 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6923 /* 0xe556-0xe557 undefined */
6924 /* 0xe55a-0xe55b undefined */
6925 /* 0xe55e-0xe55f undefined */
6927 case 0xe560: /* TBEGIN - transaction begin */
6928 /* The transaction will be immediately aborted after this
6929 instruction, due to single-stepping. This instruction is
6930 only supported so that the program can fail a few times
6931 and go to the non-transactional fallback. */
6934 /* Transaction diagnostic block - user. */
6935 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6936 if (record_full_arch_list_add_mem (oaddr
, 256))
6939 /* Transaction diagnostic block - supervisor. */
6940 if (record_full_arch_list_add_reg (regcache
, S390_TDB_DWORD0_REGNUM
))
6942 if (record_full_arch_list_add_reg (regcache
, S390_TDB_ABORT_CODE_REGNUM
))
6944 if (record_full_arch_list_add_reg (regcache
, S390_TDB_CONFLICT_TOKEN_REGNUM
))
6946 if (record_full_arch_list_add_reg (regcache
, S390_TDB_ATIA_REGNUM
))
6948 for (i
= 0; i
< 16; i
++)
6949 if (record_full_arch_list_add_reg (regcache
, S390_TDB_R0_REGNUM
+ i
))
6952 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6956 /* 0xe561 unsupported: TBEGINC */
6957 /* 0xe562-0xe5ff undefined */
6964 /* 0xe6 undefined */
6967 /* RIE/RIS/RRS-format instruction */
6968 switch (ibyte
[0] << 8 | ibyte
[5])
6970 /* 0xec00-0xec41 undefined */
6972 case 0xec42: /* LOCHI - load halfword immediate on condition */
6973 case 0xec51: /* RISBLG - rotate then insert selected bits low */
6974 /* 32-bit or native gpr destination */
6975 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6979 /* 0xec43 undefined */
6981 case 0xec44: /* BRXHG - branch relative on index high */
6982 case 0xec45: /* BRXLG - branch relative on index low or equal */
6983 case 0xec46: /* LOCGHI - load halfword immediate on condition */
6984 case 0xec59: /* RISBGN - rotate then insert selected bits */
6985 /* 64-bit gpr destination */
6986 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6990 /* 0xec47-0xec4d undefined */
6992 case 0xec4e: /* LOCHHI - load halfword immediate on condition */
6993 case 0xec5d: /* RISBHG - rotate then insert selected bits high */
6994 /* 32-bit high gpr destination */
6995 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6999 /* 0xec4f-0xec50 undefined */
7000 /* 0xec52-0xec53 undefined */
7002 case 0xec54: /* RNSBG - rotate then and selected bits */
7003 case 0xec55: /* RISBG - rotate then insert selected bits */
7004 case 0xec56: /* ROSBG - rotate then or selected bits */
7005 case 0xec57: /* RXSBG - rotate then xor selected bits */
7006 case 0xecd9: /* AGHIK - add immediate */
7007 case 0xecdb: /* ALGHSIK - add logical immediate */
7008 /* 64-bit gpr destination + flags */
7009 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
7011 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7015 /* 0xec58 undefined */
7016 /* 0xec5a-0xec5c undefined */
7017 /* 0xec5e-0xec63 undefined */
7019 case 0xec64: /* CGRJ - compare and branch relative */
7020 case 0xec65: /* CLGRJ - compare logical and branch relative */
7021 case 0xec76: /* CRJ - compare and branch relative */
7022 case 0xec77: /* CLRJ - compare logical and branch relative */
7023 case 0xec7c: /* CGIJ - compare immediate and branch relative */
7024 case 0xec7d: /* CLGIJ - compare logical immediate and branch relative */
7025 case 0xec7e: /* CIJ - compare immediate and branch relative */
7026 case 0xec7f: /* CLIJ - compare logical immediate and branch relative */
7027 case 0xece4: /* CGRB - compare and branch */
7028 case 0xece5: /* CLGRB - compare logical and branch */
7029 case 0xecf6: /* CRB - compare and branch */
7030 case 0xecf7: /* CLRB - compare logical and branch */
7031 case 0xecfc: /* CGIB - compare immediate and branch */
7032 case 0xecfd: /* CLGIB - compare logical immediate and branch */
7033 case 0xecfe: /* CIB - compare immediate and branch */
7034 case 0xecff: /* CLIB - compare logical immediate and branch */
7037 /* 0xec66-0xec6f undefined */
7039 case 0xec70: /* CGIT - compare immediate and trap */
7040 case 0xec71: /* CLGIT - compare logical immediate and trap */
7041 case 0xec72: /* CIT - compare immediate and trap */
7042 case 0xec73: /* CLFIT - compare logical immediate and trap */
7043 /* fpc only - including possible DXC write for trapping insns */
7044 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7048 /* 0xec74-0xec75 undefined */
7049 /* 0xec78-0xec7b undefined */
7051 /* 0xec80-0xecd7 undefined */
7053 case 0xecd8: /* AHIK - add immediate */
7054 case 0xecda: /* ALHSIK - add logical immediate */
7055 /* 32-bit gpr destination + flags */
7056 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
7058 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7062 /* 0xecdc-0xece3 undefined */
7063 /* 0xece6-0xecf5 undefined */
7064 /* 0xecf8-0xecfb undefined */
7071 case 0xee: /* PLO - perform locked operation */
7072 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
7073 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7074 oaddr2
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[2], 0);
7077 uint8_t fc
= tmp
& 0xff;
7083 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
7086 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
7090 case 0x01: /* CLG */
7092 if (record_full_arch_list_add_mem (oaddr2
+ 0x08, 8))
7095 if (record_full_arch_list_add_mem (oaddr2
+ 0x28, 8))
7099 case 0x02: /* CLGR */
7101 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
7104 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
7108 case 0x03: /* CLX */
7110 if (record_full_arch_list_add_mem (oaddr2
+ 0x00, 16))
7113 if (record_full_arch_list_add_mem (oaddr2
+ 0x20, 16))
7117 case 0x08: /* DCS */
7119 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
7122 case 0x0c: /* CSST */
7124 if (record_full_arch_list_add_mem (oaddr2
, 4))
7128 case 0x14: /* CSTST */
7130 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7132 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7133 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7134 if (record_full_arch_list_add_mem (oaddr3
, 4))
7137 case 0x10: /* CSDST */
7139 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7141 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7142 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7143 if (record_full_arch_list_add_mem (oaddr3
, 4))
7146 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
7148 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7149 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7150 if (record_full_arch_list_add_mem (oaddr3
, 4))
7156 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
7159 if (record_full_arch_list_add_mem (oaddr
, 4))
7163 case 0x09: /* DCSG */
7165 if (record_full_arch_list_add_mem (oaddr2
+ 0x28, 8))
7169 case 0x15: /* CSTSTG */
7171 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7173 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7174 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7175 if (record_full_arch_list_add_mem (oaddr3
, 8))
7178 case 0x11: /* CSDSTG */
7180 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7182 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7183 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7184 if (record_full_arch_list_add_mem (oaddr3
, 8))
7187 case 0x0d: /* CSSTG */
7190 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
7192 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7193 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7194 if (record_full_arch_list_add_mem (oaddr3
, 8))
7197 case 0x05: /* CSG */
7199 if (record_full_arch_list_add_mem (oaddr2
+ 0x08, 8))
7202 if (record_full_arch_list_add_mem (oaddr
, 8))
7206 case 0x0a: /* DCSGR */
7208 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
7211 case 0x0e: /* CSSTGR */
7213 if (record_full_arch_list_add_mem (oaddr2
, 8))
7217 case 0x16: /* CSTSTGR */
7219 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7221 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7222 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7223 if (record_full_arch_list_add_mem (oaddr3
, 8))
7226 case 0x12: /* CSDSTGR */
7228 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7230 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7231 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7232 if (record_full_arch_list_add_mem (oaddr3
, 8))
7235 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
7237 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7238 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7239 if (record_full_arch_list_add_mem (oaddr3
, 8))
7242 case 0x06: /* CSGR */
7245 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
7248 if (record_full_arch_list_add_mem (oaddr
, 8))
7252 case 0x0b: /* DCSX */
7254 if (record_full_arch_list_add_mem (oaddr2
+ 0x20, 16))
7258 case 0x17: /* CSTSTX */
7260 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7262 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7263 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7264 if (record_full_arch_list_add_mem (oaddr3
, 16))
7267 case 0x13: /* CSDSTX */
7269 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7271 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7272 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7273 if (record_full_arch_list_add_mem (oaddr3
, 16))
7276 case 0x0f: /* CSSTX */
7279 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
7281 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7282 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7283 if (record_full_arch_list_add_mem (oaddr3
, 16))
7286 case 0x07: /* CSX */
7288 if (record_full_arch_list_add_mem (oaddr2
+ 0x00, 16))
7291 if (record_full_arch_list_add_mem (oaddr
, 16))
7296 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PLO FC %02x at %s.\n",
7297 fc
, paddress (gdbarch
, addr
));
7301 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7305 case 0xef: /* LMD - load multiple disjoint */
7306 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
7307 if (s390_record_gpr_g (gdbarch
, regcache
, i
))
7309 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
7313 case 0xf0: /* SRP - shift and round decimal */
7314 case 0xf8: /* ZAP - zero and add */
7315 case 0xfa: /* AP - add decimal */
7316 case 0xfb: /* SP - subtract decimal */
7317 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7318 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
7320 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7322 /* DXC may be written */
7323 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7327 case 0xf1: /* MVO - move with offset */
7328 case 0xf2: /* PACK - pack */
7329 case 0xf3: /* UNPK - unpack */
7330 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7331 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
7335 /* 0xf4-0xf7 undefined */
7337 case 0xf9: /* CP - compare decimal */
7338 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7340 /* DXC may be written */
7341 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7345 case 0xfc: /* MP - multiply decimal */
7346 case 0xfd: /* DP - divide decimal */
7347 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7348 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
7350 /* DXC may be written */
7351 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7355 /* 0xfe-0xff undefined */
7359 fprintf_unfiltered (gdb_stdlog
, "Warning: Don't know how to record %04x "
7360 "at %s.\n", insn
[0], paddress (gdbarch
, addr
));
7364 if (record_full_arch_list_add_reg (regcache
, S390_PSWA_REGNUM
))
7366 if (record_full_arch_list_add_end ())
7371 /* Initialize linux_record_tdep if not initialized yet. */
7374 s390_init_linux_record_tdep (struct linux_record_tdep
*record_tdep
,
7375 enum s390_abi_kind abi
)
7377 /* These values are the size of the type that will be used in a system
7378 call. They are obtained from Linux Kernel source. */
7380 if (abi
== ABI_LINUX_ZSERIES
)
7382 record_tdep
->size_pointer
= 8;
7383 /* no _old_kernel_stat */
7384 record_tdep
->size_tms
= 32;
7385 record_tdep
->size_loff_t
= 8;
7386 record_tdep
->size_flock
= 32;
7387 record_tdep
->size_ustat
= 32;
7388 record_tdep
->size_old_sigaction
= 32;
7389 record_tdep
->size_old_sigset_t
= 8;
7390 record_tdep
->size_rlimit
= 16;
7391 record_tdep
->size_rusage
= 144;
7392 record_tdep
->size_timeval
= 16;
7393 record_tdep
->size_timezone
= 8;
7394 /* old_[ug]id_t never used */
7395 record_tdep
->size_fd_set
= 128;
7396 record_tdep
->size_old_dirent
= 280;
7397 record_tdep
->size_statfs
= 88;
7398 record_tdep
->size_statfs64
= 88;
7399 record_tdep
->size_sockaddr
= 16;
7400 record_tdep
->size_int
= 4;
7401 record_tdep
->size_long
= 8;
7402 record_tdep
->size_ulong
= 8;
7403 record_tdep
->size_msghdr
= 56;
7404 record_tdep
->size_itimerval
= 32;
7405 record_tdep
->size_stat
= 144;
7406 /* old_utsname unused */
7407 record_tdep
->size_sysinfo
= 112;
7408 record_tdep
->size_msqid_ds
= 120;
7409 record_tdep
->size_shmid_ds
= 112;
7410 record_tdep
->size_new_utsname
= 390;
7411 record_tdep
->size_timex
= 208;
7412 record_tdep
->size_mem_dqinfo
= 24;
7413 record_tdep
->size_if_dqblk
= 72;
7414 record_tdep
->size_fs_quota_stat
= 80;
7415 record_tdep
->size_timespec
= 16;
7416 record_tdep
->size_pollfd
= 8;
7417 record_tdep
->size_NFS_FHSIZE
= 32;
7418 record_tdep
->size_knfsd_fh
= 132;
7419 record_tdep
->size_TASK_COMM_LEN
= 16;
7420 record_tdep
->size_sigaction
= 32;
7421 record_tdep
->size_sigset_t
= 8;
7422 record_tdep
->size_siginfo_t
= 128;
7423 record_tdep
->size_cap_user_data_t
= 12;
7424 record_tdep
->size_stack_t
= 24;
7425 record_tdep
->size_off_t
= 8;
7427 record_tdep
->size_gid_t
= 4;
7428 record_tdep
->size_uid_t
= 4;
7429 record_tdep
->size_PAGE_SIZE
= 0x1000; /* 4KB */
7430 record_tdep
->size_flock64
= 32;
7431 record_tdep
->size_io_event
= 32;
7432 record_tdep
->size_iocb
= 64;
7433 record_tdep
->size_epoll_event
= 16;
7434 record_tdep
->size_itimerspec
= 32;
7435 record_tdep
->size_mq_attr
= 64;
7436 record_tdep
->size_termios
= 36;
7437 record_tdep
->size_termios2
= 44;
7438 record_tdep
->size_pid_t
= 4;
7439 record_tdep
->size_winsize
= 8;
7440 record_tdep
->size_serial_struct
= 72;
7441 record_tdep
->size_serial_icounter_struct
= 80;
7442 record_tdep
->size_size_t
= 8;
7443 record_tdep
->size_iovec
= 16;
7444 record_tdep
->size_time_t
= 8;
7446 else if (abi
== ABI_LINUX_S390
)
7448 record_tdep
->size_pointer
= 4;
7449 record_tdep
->size__old_kernel_stat
= 32;
7450 record_tdep
->size_tms
= 16;
7451 record_tdep
->size_loff_t
= 8;
7452 record_tdep
->size_flock
= 16;
7453 record_tdep
->size_ustat
= 20;
7454 record_tdep
->size_old_sigaction
= 16;
7455 record_tdep
->size_old_sigset_t
= 4;
7456 record_tdep
->size_rlimit
= 8;
7457 record_tdep
->size_rusage
= 72;
7458 record_tdep
->size_timeval
= 8;
7459 record_tdep
->size_timezone
= 8;
7460 record_tdep
->size_old_gid_t
= 2;
7461 record_tdep
->size_old_uid_t
= 2;
7462 record_tdep
->size_fd_set
= 128;
7463 record_tdep
->size_old_dirent
= 268;
7464 record_tdep
->size_statfs
= 64;
7465 record_tdep
->size_statfs64
= 88;
7466 record_tdep
->size_sockaddr
= 16;
7467 record_tdep
->size_int
= 4;
7468 record_tdep
->size_long
= 4;
7469 record_tdep
->size_ulong
= 4;
7470 record_tdep
->size_msghdr
= 28;
7471 record_tdep
->size_itimerval
= 16;
7472 record_tdep
->size_stat
= 64;
7473 /* old_utsname unused */
7474 record_tdep
->size_sysinfo
= 64;
7475 record_tdep
->size_msqid_ds
= 88;
7476 record_tdep
->size_shmid_ds
= 84;
7477 record_tdep
->size_new_utsname
= 390;
7478 record_tdep
->size_timex
= 128;
7479 record_tdep
->size_mem_dqinfo
= 24;
7480 record_tdep
->size_if_dqblk
= 72;
7481 record_tdep
->size_fs_quota_stat
= 80;
7482 record_tdep
->size_timespec
= 8;
7483 record_tdep
->size_pollfd
= 8;
7484 record_tdep
->size_NFS_FHSIZE
= 32;
7485 record_tdep
->size_knfsd_fh
= 132;
7486 record_tdep
->size_TASK_COMM_LEN
= 16;
7487 record_tdep
->size_sigaction
= 20;
7488 record_tdep
->size_sigset_t
= 8;
7489 record_tdep
->size_siginfo_t
= 128;
7490 record_tdep
->size_cap_user_data_t
= 12;
7491 record_tdep
->size_stack_t
= 12;
7492 record_tdep
->size_off_t
= 4;
7493 record_tdep
->size_stat64
= 104;
7494 record_tdep
->size_gid_t
= 4;
7495 record_tdep
->size_uid_t
= 4;
7496 record_tdep
->size_PAGE_SIZE
= 0x1000; /* 4KB */
7497 record_tdep
->size_flock64
= 32;
7498 record_tdep
->size_io_event
= 32;
7499 record_tdep
->size_iocb
= 64;
7500 record_tdep
->size_epoll_event
= 16;
7501 record_tdep
->size_itimerspec
= 16;
7502 record_tdep
->size_mq_attr
= 32;
7503 record_tdep
->size_termios
= 36;
7504 record_tdep
->size_termios2
= 44;
7505 record_tdep
->size_pid_t
= 4;
7506 record_tdep
->size_winsize
= 8;
7507 record_tdep
->size_serial_struct
= 60;
7508 record_tdep
->size_serial_icounter_struct
= 80;
7509 record_tdep
->size_size_t
= 4;
7510 record_tdep
->size_iovec
= 8;
7511 record_tdep
->size_time_t
= 4;
7514 /* These values are the second argument of system call "sys_fcntl"
7515 and "sys_fcntl64". They are obtained from Linux Kernel source. */
7516 record_tdep
->fcntl_F_GETLK
= 5;
7517 record_tdep
->fcntl_F_GETLK64
= 12;
7518 record_tdep
->fcntl_F_SETLK64
= 13;
7519 record_tdep
->fcntl_F_SETLKW64
= 14;
7521 record_tdep
->arg1
= S390_R2_REGNUM
;
7522 record_tdep
->arg2
= S390_R3_REGNUM
;
7523 record_tdep
->arg3
= S390_R4_REGNUM
;
7524 record_tdep
->arg4
= S390_R5_REGNUM
;
7525 record_tdep
->arg5
= S390_R6_REGNUM
;
7527 /* These values are the second argument of system call "sys_ioctl".
7528 They are obtained from Linux Kernel source.
7529 See arch/s390/include/uapi/asm/ioctls.h. */
7531 record_tdep
->ioctl_TCGETS
= 0x5401;
7532 record_tdep
->ioctl_TCSETS
= 0x5402;
7533 record_tdep
->ioctl_TCSETSW
= 0x5403;
7534 record_tdep
->ioctl_TCSETSF
= 0x5404;
7535 record_tdep
->ioctl_TCGETA
= 0x5405;
7536 record_tdep
->ioctl_TCSETA
= 0x5406;
7537 record_tdep
->ioctl_TCSETAW
= 0x5407;
7538 record_tdep
->ioctl_TCSETAF
= 0x5408;
7539 record_tdep
->ioctl_TCSBRK
= 0x5409;
7540 record_tdep
->ioctl_TCXONC
= 0x540a;
7541 record_tdep
->ioctl_TCFLSH
= 0x540b;
7542 record_tdep
->ioctl_TIOCEXCL
= 0x540c;
7543 record_tdep
->ioctl_TIOCNXCL
= 0x540d;
7544 record_tdep
->ioctl_TIOCSCTTY
= 0x540e;
7545 record_tdep
->ioctl_TIOCGPGRP
= 0x540f;
7546 record_tdep
->ioctl_TIOCSPGRP
= 0x5410;
7547 record_tdep
->ioctl_TIOCOUTQ
= 0x5411;
7548 record_tdep
->ioctl_TIOCSTI
= 0x5412;
7549 record_tdep
->ioctl_TIOCGWINSZ
= 0x5413;
7550 record_tdep
->ioctl_TIOCSWINSZ
= 0x5414;
7551 record_tdep
->ioctl_TIOCMGET
= 0x5415;
7552 record_tdep
->ioctl_TIOCMBIS
= 0x5416;
7553 record_tdep
->ioctl_TIOCMBIC
= 0x5417;
7554 record_tdep
->ioctl_TIOCMSET
= 0x5418;
7555 record_tdep
->ioctl_TIOCGSOFTCAR
= 0x5419;
7556 record_tdep
->ioctl_TIOCSSOFTCAR
= 0x541a;
7557 record_tdep
->ioctl_FIONREAD
= 0x541b;
7558 record_tdep
->ioctl_TIOCINQ
= 0x541b; /* alias */
7559 record_tdep
->ioctl_TIOCLINUX
= 0x541c;
7560 record_tdep
->ioctl_TIOCCONS
= 0x541d;
7561 record_tdep
->ioctl_TIOCGSERIAL
= 0x541e;
7562 record_tdep
->ioctl_TIOCSSERIAL
= 0x541f;
7563 record_tdep
->ioctl_TIOCPKT
= 0x5420;
7564 record_tdep
->ioctl_FIONBIO
= 0x5421;
7565 record_tdep
->ioctl_TIOCNOTTY
= 0x5422;
7566 record_tdep
->ioctl_TIOCSETD
= 0x5423;
7567 record_tdep
->ioctl_TIOCGETD
= 0x5424;
7568 record_tdep
->ioctl_TCSBRKP
= 0x5425;
7569 record_tdep
->ioctl_TIOCSBRK
= 0x5427;
7570 record_tdep
->ioctl_TIOCCBRK
= 0x5428;
7571 record_tdep
->ioctl_TIOCGSID
= 0x5429;
7572 record_tdep
->ioctl_TCGETS2
= 0x802c542a;
7573 record_tdep
->ioctl_TCSETS2
= 0x402c542b;
7574 record_tdep
->ioctl_TCSETSW2
= 0x402c542c;
7575 record_tdep
->ioctl_TCSETSF2
= 0x402c542d;
7576 record_tdep
->ioctl_TIOCGPTN
= 0x80045430;
7577 record_tdep
->ioctl_TIOCSPTLCK
= 0x40045431;
7578 record_tdep
->ioctl_FIONCLEX
= 0x5450;
7579 record_tdep
->ioctl_FIOCLEX
= 0x5451;
7580 record_tdep
->ioctl_FIOASYNC
= 0x5452;
7581 record_tdep
->ioctl_TIOCSERCONFIG
= 0x5453;
7582 record_tdep
->ioctl_TIOCSERGWILD
= 0x5454;
7583 record_tdep
->ioctl_TIOCSERSWILD
= 0x5455;
7584 record_tdep
->ioctl_TIOCGLCKTRMIOS
= 0x5456;
7585 record_tdep
->ioctl_TIOCSLCKTRMIOS
= 0x5457;
7586 record_tdep
->ioctl_TIOCSERGSTRUCT
= 0x5458;
7587 record_tdep
->ioctl_TIOCSERGETLSR
= 0x5459;
7588 record_tdep
->ioctl_TIOCSERGETMULTI
= 0x545a;
7589 record_tdep
->ioctl_TIOCSERSETMULTI
= 0x545b;
7590 record_tdep
->ioctl_TIOCMIWAIT
= 0x545c;
7591 record_tdep
->ioctl_TIOCGICOUNT
= 0x545d;
7592 record_tdep
->ioctl_FIOQSIZE
= 0x545e;
7595 /* Set up gdbarch struct. */
7597 static struct gdbarch
*
7598 s390_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
7600 const struct target_desc
*tdesc
= info
.target_desc
;
7601 struct tdesc_arch_data
*tdesc_data
= NULL
;
7602 struct gdbarch
*gdbarch
;
7603 struct gdbarch_tdep
*tdep
;
7604 enum s390_abi_kind tdep_abi
;
7605 enum s390_vector_abi_kind vector_abi
;
7607 int have_linux_v1
= 0;
7608 int have_linux_v2
= 0;
7611 int first_pseudo_reg
, last_pseudo_reg
;
7612 static const char *const stap_register_prefixes
[] = { "%", NULL
};
7613 static const char *const stap_register_indirection_prefixes
[] = { "(",
7615 static const char *const stap_register_indirection_suffixes
[] = { ")",
7618 /* Default ABI and register size. */
7619 switch (info
.bfd_arch_info
->mach
)
7621 case bfd_mach_s390_31
:
7622 tdep_abi
= ABI_LINUX_S390
;
7625 case bfd_mach_s390_64
:
7626 tdep_abi
= ABI_LINUX_ZSERIES
;
7633 /* Use default target description if none provided by the target. */
7634 if (!tdesc_has_registers (tdesc
))
7636 if (tdep_abi
== ABI_LINUX_S390
)
7637 tdesc
= tdesc_s390_linux32
;
7639 tdesc
= tdesc_s390x_linux64
;
7642 /* Check any target description for validity. */
7643 if (tdesc_has_registers (tdesc
))
7645 static const char *const gprs
[] = {
7646 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
7647 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
7649 static const char *const fprs
[] = {
7650 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
7651 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
7653 static const char *const acrs
[] = {
7654 "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
7655 "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15"
7657 static const char *const gprs_lower
[] = {
7658 "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l",
7659 "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
7661 static const char *const gprs_upper
[] = {
7662 "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
7663 "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
7665 static const char *const tdb_regs
[] = {
7666 "tdb0", "tac", "tct", "atia",
7667 "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
7668 "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
7670 static const char *const vxrs_low
[] = {
7671 "v0l", "v1l", "v2l", "v3l", "v4l", "v5l", "v6l", "v7l", "v8l",
7672 "v9l", "v10l", "v11l", "v12l", "v13l", "v14l", "v15l",
7674 static const char *const vxrs_high
[] = {
7675 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24",
7676 "v25", "v26", "v27", "v28", "v29", "v30", "v31",
7678 const struct tdesc_feature
*feature
;
7681 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.core");
7682 if (feature
== NULL
)
7685 tdesc_data
= tdesc_data_alloc ();
7687 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7688 S390_PSWM_REGNUM
, "pswm");
7689 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7690 S390_PSWA_REGNUM
, "pswa");
7692 if (tdesc_unnumbered_register (feature
, "r0"))
7694 for (i
= 0; i
< 16; i
++)
7695 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7696 S390_R0_REGNUM
+ i
, gprs
[i
]);
7702 for (i
= 0; i
< 16; i
++)
7703 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7706 for (i
= 0; i
< 16; i
++)
7707 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7708 S390_R0_UPPER_REGNUM
+ i
,
7712 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.fpr");
7713 if (feature
== NULL
)
7715 tdesc_data_cleanup (tdesc_data
);
7719 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7720 S390_FPC_REGNUM
, "fpc");
7721 for (i
= 0; i
< 16; i
++)
7722 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7723 S390_F0_REGNUM
+ i
, fprs
[i
]);
7725 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.acr");
7726 if (feature
== NULL
)
7728 tdesc_data_cleanup (tdesc_data
);
7732 for (i
= 0; i
< 16; i
++)
7733 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7734 S390_A0_REGNUM
+ i
, acrs
[i
]);
7736 /* Optional GNU/Linux-specific "registers". */
7737 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.linux");
7740 tdesc_numbered_register (feature
, tdesc_data
,
7741 S390_ORIG_R2_REGNUM
, "orig_r2");
7743 if (tdesc_numbered_register (feature
, tdesc_data
,
7744 S390_LAST_BREAK_REGNUM
, "last_break"))
7747 if (tdesc_numbered_register (feature
, tdesc_data
,
7748 S390_SYSTEM_CALL_REGNUM
, "system_call"))
7751 if (have_linux_v2
> have_linux_v1
)
7755 /* Transaction diagnostic block. */
7756 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.tdb");
7759 for (i
= 0; i
< ARRAY_SIZE (tdb_regs
); i
++)
7760 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7761 S390_TDB_DWORD0_REGNUM
+ i
,
7766 /* Vector registers. */
7767 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.vx");
7770 for (i
= 0; i
< 16; i
++)
7771 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7772 S390_V0_LOWER_REGNUM
+ i
,
7774 for (i
= 0; i
< 16; i
++)
7775 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7776 S390_V16_REGNUM
+ i
,
7783 tdesc_data_cleanup (tdesc_data
);
7788 /* Determine vector ABI. */
7789 vector_abi
= S390_VECTOR_ABI_NONE
;
7792 && info
.abfd
!= NULL
7793 && info
.abfd
->format
== bfd_object
7794 && bfd_get_flavour (info
.abfd
) == bfd_target_elf_flavour
7795 && bfd_elf_get_obj_attr_int (info
.abfd
, OBJ_ATTR_GNU
,
7796 Tag_GNU_S390_ABI_Vector
) == 2)
7797 vector_abi
= S390_VECTOR_ABI_128
;
7800 /* Find a candidate among extant architectures. */
7801 for (arches
= gdbarch_list_lookup_by_info (arches
, &info
);
7803 arches
= gdbarch_list_lookup_by_info (arches
->next
, &info
))
7805 tdep
= gdbarch_tdep (arches
->gdbarch
);
7808 if (tdep
->abi
!= tdep_abi
)
7810 if (tdep
->vector_abi
!= vector_abi
)
7812 if ((tdep
->gpr_full_regnum
!= -1) != have_upper
)
7814 if (tdesc_data
!= NULL
)
7815 tdesc_data_cleanup (tdesc_data
);
7816 return arches
->gdbarch
;
7819 /* Otherwise create a new gdbarch for the specified machine type. */
7820 tdep
= XCNEW (struct gdbarch_tdep
);
7821 tdep
->abi
= tdep_abi
;
7822 tdep
->vector_abi
= vector_abi
;
7823 tdep
->have_linux_v1
= have_linux_v1
;
7824 tdep
->have_linux_v2
= have_linux_v2
;
7825 tdep
->have_tdb
= have_tdb
;
7826 gdbarch
= gdbarch_alloc (&info
, tdep
);
7828 set_gdbarch_believe_pcc_promotion (gdbarch
, 0);
7829 set_gdbarch_char_signed (gdbarch
, 0);
7831 /* S/390 GNU/Linux uses either 64-bit or 128-bit long doubles.
7832 We can safely let them default to 128-bit, since the debug info
7833 will give the size of type actually used in each case. */
7834 set_gdbarch_long_double_bit (gdbarch
, 128);
7835 set_gdbarch_long_double_format (gdbarch
, floatformats_ia64_quad
);
7837 /* Amount PC must be decremented by after a breakpoint. This is
7838 often the number of bytes returned by gdbarch_breakpoint_from_pc but not
7840 set_gdbarch_decr_pc_after_break (gdbarch
, 2);
7841 /* Stack grows downward. */
7842 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
7843 set_gdbarch_breakpoint_from_pc (gdbarch
, s390_breakpoint_from_pc
);
7844 set_gdbarch_software_single_step (gdbarch
, s390_software_single_step
);
7845 set_gdbarch_displaced_step_hw_singlestep (gdbarch
, s390_displaced_step_hw_singlestep
);
7846 set_gdbarch_skip_prologue (gdbarch
, s390_skip_prologue
);
7847 set_gdbarch_stack_frame_destroyed_p (gdbarch
, s390_stack_frame_destroyed_p
);
7849 set_gdbarch_num_regs (gdbarch
, S390_NUM_REGS
);
7850 set_gdbarch_sp_regnum (gdbarch
, S390_SP_REGNUM
);
7851 set_gdbarch_fp0_regnum (gdbarch
, S390_F0_REGNUM
);
7852 set_gdbarch_stab_reg_to_regnum (gdbarch
, s390_dwarf_reg_to_regnum
);
7853 set_gdbarch_dwarf2_reg_to_regnum (gdbarch
, s390_dwarf_reg_to_regnum
);
7854 set_gdbarch_value_from_register (gdbarch
, s390_value_from_register
);
7855 set_gdbarch_core_read_description (gdbarch
, s390_core_read_description
);
7856 set_gdbarch_iterate_over_regset_sections (gdbarch
,
7857 s390_iterate_over_regset_sections
);
7858 set_gdbarch_cannot_store_register (gdbarch
, s390_cannot_store_register
);
7859 set_gdbarch_write_pc (gdbarch
, s390_write_pc
);
7860 set_gdbarch_pseudo_register_read (gdbarch
, s390_pseudo_register_read
);
7861 set_gdbarch_pseudo_register_write (gdbarch
, s390_pseudo_register_write
);
7862 set_tdesc_pseudo_register_name (gdbarch
, s390_pseudo_register_name
);
7863 set_tdesc_pseudo_register_type (gdbarch
, s390_pseudo_register_type
);
7864 set_tdesc_pseudo_register_reggroup_p (gdbarch
,
7865 s390_pseudo_register_reggroup_p
);
7866 tdesc_use_registers (gdbarch
, tdesc
, tdesc_data
);
7867 set_gdbarch_register_name (gdbarch
, s390_register_name
);
7869 /* Assign pseudo register numbers. */
7870 first_pseudo_reg
= gdbarch_num_regs (gdbarch
);
7871 last_pseudo_reg
= first_pseudo_reg
;
7872 tdep
->gpr_full_regnum
= -1;
7875 tdep
->gpr_full_regnum
= last_pseudo_reg
;
7876 last_pseudo_reg
+= 16;
7878 tdep
->v0_full_regnum
= -1;
7881 tdep
->v0_full_regnum
= last_pseudo_reg
;
7882 last_pseudo_reg
+= 16;
7884 tdep
->pc_regnum
= last_pseudo_reg
++;
7885 tdep
->cc_regnum
= last_pseudo_reg
++;
7886 set_gdbarch_pc_regnum (gdbarch
, tdep
->pc_regnum
);
7887 set_gdbarch_num_pseudo_regs (gdbarch
, last_pseudo_reg
- first_pseudo_reg
);
7889 /* Inferior function calls. */
7890 set_gdbarch_push_dummy_call (gdbarch
, s390_push_dummy_call
);
7891 set_gdbarch_dummy_id (gdbarch
, s390_dummy_id
);
7892 set_gdbarch_frame_align (gdbarch
, s390_frame_align
);
7893 set_gdbarch_return_value (gdbarch
, s390_return_value
);
7895 /* Syscall handling. */
7896 set_gdbarch_get_syscall_number (gdbarch
, s390_linux_get_syscall_number
);
7898 /* Frame handling. */
7899 dwarf2_frame_set_init_reg (gdbarch
, s390_dwarf2_frame_init_reg
);
7900 dwarf2_frame_set_adjust_regnum (gdbarch
, s390_adjust_frame_regnum
);
7901 dwarf2_append_unwinders (gdbarch
);
7902 frame_base_append_sniffer (gdbarch
, dwarf2_frame_base_sniffer
);
7903 frame_unwind_append_unwinder (gdbarch
, &s390_stub_frame_unwind
);
7904 frame_unwind_append_unwinder (gdbarch
, &s390_sigtramp_frame_unwind
);
7905 frame_unwind_append_unwinder (gdbarch
, &s390_frame_unwind
);
7906 frame_base_set_default (gdbarch
, &s390_frame_base
);
7907 set_gdbarch_unwind_pc (gdbarch
, s390_unwind_pc
);
7908 set_gdbarch_unwind_sp (gdbarch
, s390_unwind_sp
);
7910 /* Displaced stepping. */
7911 set_gdbarch_displaced_step_copy_insn (gdbarch
,
7912 s390_displaced_step_copy_insn
);
7913 set_gdbarch_displaced_step_fixup (gdbarch
, s390_displaced_step_fixup
);
7914 set_gdbarch_displaced_step_free_closure (gdbarch
,
7915 simple_displaced_step_free_closure
);
7916 set_gdbarch_displaced_step_location (gdbarch
, linux_displaced_step_location
);
7917 set_gdbarch_max_insn_length (gdbarch
, S390_MAX_INSTR_SIZE
);
7919 /* Note that GNU/Linux is the only OS supported on this
7921 linux_init_abi (info
, gdbarch
);
7925 case ABI_LINUX_S390
:
7926 set_gdbarch_addr_bits_remove (gdbarch
, s390_addr_bits_remove
);
7927 set_solib_svr4_fetch_link_map_offsets
7928 (gdbarch
, svr4_ilp32_fetch_link_map_offsets
);
7930 set_xml_syscall_file_name (gdbarch
, XML_SYSCALL_FILENAME_S390
);
7933 case ABI_LINUX_ZSERIES
:
7934 set_gdbarch_long_bit (gdbarch
, 64);
7935 set_gdbarch_long_long_bit (gdbarch
, 64);
7936 set_gdbarch_ptr_bit (gdbarch
, 64);
7937 set_solib_svr4_fetch_link_map_offsets
7938 (gdbarch
, svr4_lp64_fetch_link_map_offsets
);
7939 set_gdbarch_address_class_type_flags (gdbarch
,
7940 s390_address_class_type_flags
);
7941 set_gdbarch_address_class_type_flags_to_name (gdbarch
,
7942 s390_address_class_type_flags_to_name
);
7943 set_gdbarch_address_class_name_to_type_flags (gdbarch
,
7944 s390_address_class_name_to_type_flags
);
7945 set_xml_syscall_file_name (gdbarch
, XML_SYSCALL_FILENAME_S390X
);
7949 set_gdbarch_print_insn (gdbarch
, print_insn_s390
);
7951 set_gdbarch_skip_trampoline_code (gdbarch
, find_solib_trampoline_target
);
7953 /* Enable TLS support. */
7954 set_gdbarch_fetch_tls_load_module_address (gdbarch
,
7955 svr4_fetch_objfile_link_map
);
7957 /* SystemTap functions. */
7958 set_gdbarch_stap_register_prefixes (gdbarch
, stap_register_prefixes
);
7959 set_gdbarch_stap_register_indirection_prefixes (gdbarch
,
7960 stap_register_indirection_prefixes
);
7961 set_gdbarch_stap_register_indirection_suffixes (gdbarch
,
7962 stap_register_indirection_suffixes
);
7963 set_gdbarch_stap_is_single_operand (gdbarch
, s390_stap_is_single_operand
);
7964 set_gdbarch_gcc_target_options (gdbarch
, s390_gcc_target_options
);
7965 set_gdbarch_gnu_triplet_regexp (gdbarch
, s390_gnu_triplet_regexp
);
7967 /* Support reverse debugging. */
7969 set_gdbarch_process_record (gdbarch
, s390_process_record
);
7970 set_gdbarch_process_record_signal (gdbarch
, s390_linux_record_signal
);
7972 s390_init_linux_record_tdep (&s390_linux_record_tdep
, ABI_LINUX_S390
);
7973 s390_init_linux_record_tdep (&s390x_linux_record_tdep
, ABI_LINUX_ZSERIES
);
7979 extern initialize_file_ftype _initialize_s390_tdep
; /* -Wmissing-prototypes */
7982 _initialize_s390_tdep (void)
7984 /* Hook us into the gdbarch mechanism. */
7985 register_gdbarch_init (bfd_arch_s390
, s390_gdbarch_init
);
7987 /* Initialize the GNU/Linux target descriptions. */
7988 initialize_tdesc_s390_linux32 ();
7989 initialize_tdesc_s390_linux32v1 ();
7990 initialize_tdesc_s390_linux32v2 ();
7991 initialize_tdesc_s390_linux64 ();
7992 initialize_tdesc_s390_linux64v1 ();
7993 initialize_tdesc_s390_linux64v2 ();
7994 initialize_tdesc_s390_te_linux64 ();
7995 initialize_tdesc_s390_vx_linux64 ();
7996 initialize_tdesc_s390_tevx_linux64 ();
7997 initialize_tdesc_s390x_linux64 ();
7998 initialize_tdesc_s390x_linux64v1 ();
7999 initialize_tdesc_s390x_linux64v2 ();
8000 initialize_tdesc_s390x_te_linux64 ();
8001 initialize_tdesc_s390x_vx_linux64 ();
8002 initialize_tdesc_s390x_tevx_linux64 ();