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
)
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 */
2720 /* Most "old" syscalls copied from i386. */
2723 /* xattr syscalls. */
2724 if (syscall
>= 224 && syscall
<= 235)
2726 /* timer syscalls. */
2727 if (syscall
>= 254 && syscall
<= 262)
2729 /* mq_* and kexec_load */
2730 if (syscall
>= 271 && syscall
<= 277)
2732 /* ioprio_set .. epoll_pwait */
2733 if (syscall
>= 282 && syscall
<= 312)
2735 return gdb_sys_no_syscall
;
2740 s390_linux_syscall_record (struct regcache
*regcache
, LONGEST syscall_native
)
2742 struct gdbarch
*gdbarch
= get_regcache_arch (regcache
);
2743 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2745 enum gdb_syscall syscall_gdb
;
2747 /* On s390, syscall number can be passed either as immediate field of svc
2748 instruction, or in %r1 (with svc 0). */
2749 if (syscall_native
== 0)
2750 regcache_raw_read_signed (regcache
, S390_R1_REGNUM
, &syscall_native
);
2752 syscall_gdb
= s390_canonicalize_syscall (syscall_native
, tdep
->abi
);
2754 if (syscall_gdb
< 0)
2756 printf_unfiltered (_("Process record and replay target doesn't "
2757 "support syscall number %s\n"),
2758 plongest (syscall_native
));
2762 if (syscall_gdb
== gdb_sys_sigreturn
2763 || syscall_gdb
== gdb_sys_rt_sigreturn
)
2765 if (s390_all_but_pc_registers_record (regcache
))
2770 if (tdep
->abi
== ABI_LINUX_ZSERIES
)
2771 ret
= record_linux_system_call (syscall_gdb
, regcache
,
2772 &s390x_linux_record_tdep
);
2774 ret
= record_linux_system_call (syscall_gdb
, regcache
,
2775 &s390_linux_record_tdep
);
2780 /* Record the return value of the system call. */
2781 if (record_full_arch_list_add_reg (regcache
, S390_R2_REGNUM
))
2788 s390_linux_record_signal (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2789 enum gdb_signal signal
)
2791 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2792 /* There are two kinds of signal frames on s390. rt_sigframe is always
2793 the larger one, so don't even bother with sigframe. */
2794 const int sizeof_rt_sigframe
= (tdep
->abi
== ABI_LINUX_ZSERIES
?
2795 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
2799 for (i
= 0; i
< 16; i
++)
2801 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
2803 if (tdep
->gpr_full_regnum
!= -1)
2804 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
2807 if (record_full_arch_list_add_reg (regcache
, S390_PSWA_REGNUM
))
2809 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
2812 /* Record the change in the stack.
2813 frame-size = sizeof (struct rt_sigframe) + SIGNAL_FRAMESIZE */
2814 regcache_raw_read_unsigned (regcache
, S390_SP_REGNUM
, &sp
);
2815 sp
-= sizeof_rt_sigframe
;
2817 if (record_full_arch_list_add_mem (sp
, sizeof_rt_sigframe
))
2820 if (record_full_arch_list_add_end ())
2826 /* Frame base handling. */
2829 s390_frame_base_address (struct frame_info
*this_frame
, void **this_cache
)
2831 struct s390_unwind_cache
*info
2832 = s390_frame_unwind_cache (this_frame
, this_cache
);
2833 return info
->frame_base
;
2837 s390_local_base_address (struct frame_info
*this_frame
, void **this_cache
)
2839 struct s390_unwind_cache
*info
2840 = s390_frame_unwind_cache (this_frame
, this_cache
);
2841 return info
->local_base
;
2844 static const struct frame_base s390_frame_base
= {
2846 s390_frame_base_address
,
2847 s390_local_base_address
,
2848 s390_local_base_address
2852 s390_unwind_pc (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
2854 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2856 pc
= frame_unwind_register_unsigned (next_frame
, tdep
->pc_regnum
);
2857 return gdbarch_addr_bits_remove (gdbarch
, pc
);
2861 s390_unwind_sp (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
2864 sp
= frame_unwind_register_unsigned (next_frame
, S390_SP_REGNUM
);
2865 return gdbarch_addr_bits_remove (gdbarch
, sp
);
2869 /* DWARF-2 frame support. */
2871 static struct value
*
2872 s390_dwarf2_prev_register (struct frame_info
*this_frame
, void **this_cache
,
2875 return s390_unwind_pseudo_register (this_frame
, regnum
);
2879 s390_dwarf2_frame_init_reg (struct gdbarch
*gdbarch
, int regnum
,
2880 struct dwarf2_frame_state_reg
*reg
,
2881 struct frame_info
*this_frame
)
2883 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2885 /* The condition code (and thus PSW mask) is call-clobbered. */
2886 if (regnum
== S390_PSWM_REGNUM
)
2887 reg
->how
= DWARF2_FRAME_REG_UNDEFINED
;
2889 /* The PSW address unwinds to the return address. */
2890 else if (regnum
== S390_PSWA_REGNUM
)
2891 reg
->how
= DWARF2_FRAME_REG_RA
;
2893 /* Fixed registers are call-saved or call-clobbered
2894 depending on the ABI in use. */
2895 else if (regnum
< S390_NUM_REGS
)
2897 if (s390_register_call_saved (gdbarch
, regnum
))
2898 reg
->how
= DWARF2_FRAME_REG_SAME_VALUE
;
2900 reg
->how
= DWARF2_FRAME_REG_UNDEFINED
;
2903 /* We install a special function to unwind pseudos. */
2906 reg
->how
= DWARF2_FRAME_REG_FN
;
2907 reg
->loc
.fn
= s390_dwarf2_prev_register
;
2912 /* Dummy function calls. */
2914 /* Unwrap any single-field structs in TYPE and return the effective
2915 "inner" type. E.g., yield "float" for all these cases:
2919 struct { struct { float x; } x; };
2920 struct { struct { struct { float x; } x; } x; };
2922 However, if an inner type is smaller than MIN_SIZE, abort the
2925 static struct type
*
2926 s390_effective_inner_type (struct type
*type
, unsigned int min_size
)
2928 while (TYPE_CODE (type
) == TYPE_CODE_STRUCT
2929 && TYPE_NFIELDS (type
) == 1)
2931 struct type
*inner
= check_typedef (TYPE_FIELD_TYPE (type
, 0));
2933 if (TYPE_LENGTH (inner
) < min_size
)
2941 /* Return non-zero if TYPE should be passed like "float" or
2945 s390_function_arg_float (struct type
*type
)
2947 /* Note that long double as well as complex types are intentionally
2949 if (TYPE_LENGTH (type
) > 8)
2952 /* A struct containing just a float or double is passed like a float
2954 type
= s390_effective_inner_type (type
, 0);
2956 return (TYPE_CODE (type
) == TYPE_CODE_FLT
2957 || TYPE_CODE (type
) == TYPE_CODE_DECFLOAT
);
2960 /* Return non-zero if TYPE should be passed like a vector. */
2963 s390_function_arg_vector (struct type
*type
)
2965 if (TYPE_LENGTH (type
) > 16)
2968 /* Structs containing just a vector are passed like a vector. */
2969 type
= s390_effective_inner_type (type
, TYPE_LENGTH (type
));
2971 return TYPE_CODE (type
) == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type
);
2974 /* Determine whether N is a power of two. */
2977 is_power_of_two (unsigned int n
)
2979 return n
&& ((n
& (n
- 1)) == 0);
2982 /* For an argument whose type is TYPE and which is not passed like a
2983 float or vector, return non-zero if it should be passed like "int"
2987 s390_function_arg_integer (struct type
*type
)
2989 enum type_code code
= TYPE_CODE (type
);
2991 if (TYPE_LENGTH (type
) > 8)
2994 if (code
== TYPE_CODE_INT
2995 || code
== TYPE_CODE_ENUM
2996 || code
== TYPE_CODE_RANGE
2997 || code
== TYPE_CODE_CHAR
2998 || code
== TYPE_CODE_BOOL
2999 || code
== TYPE_CODE_PTR
3000 || code
== TYPE_CODE_REF
)
3003 return ((code
== TYPE_CODE_UNION
|| code
== TYPE_CODE_STRUCT
)
3004 && is_power_of_two (TYPE_LENGTH (type
)));
3007 /* Argument passing state: Internal data structure passed to helper
3008 routines of s390_push_dummy_call. */
3010 struct s390_arg_state
3012 /* Register cache, or NULL, if we are in "preparation mode". */
3013 struct regcache
*regcache
;
3014 /* Next available general/floating-point/vector register for
3015 argument passing. */
3017 /* Current pointer to copy area (grows downwards). */
3019 /* Current pointer to parameter area (grows upwards). */
3023 /* Prepare one argument ARG for a dummy call and update the argument
3024 passing state AS accordingly. If the regcache field in AS is set,
3025 operate in "write mode" and write ARG into the inferior. Otherwise
3026 run "preparation mode" and skip all updates to the inferior. */
3029 s390_handle_arg (struct s390_arg_state
*as
, struct value
*arg
,
3030 struct gdbarch_tdep
*tdep
, int word_size
,
3031 enum bfd_endian byte_order
, int is_unnamed
)
3033 struct type
*type
= check_typedef (value_type (arg
));
3034 unsigned int length
= TYPE_LENGTH (type
);
3035 int write_mode
= as
->regcache
!= NULL
;
3037 if (s390_function_arg_float (type
))
3039 /* The GNU/Linux for S/390 ABI uses FPRs 0 and 2 to pass
3040 arguments. The GNU/Linux for zSeries ABI uses 0, 2, 4, and
3042 if (as
->fr
<= (tdep
->abi
== ABI_LINUX_S390
? 2 : 6))
3044 /* When we store a single-precision value in an FP register,
3045 it occupies the leftmost bits. */
3047 regcache_cooked_write_part (as
->regcache
,
3048 S390_F0_REGNUM
+ as
->fr
,
3050 value_contents (arg
));
3055 /* When we store a single-precision value in a stack slot,
3056 it occupies the rightmost bits. */
3057 as
->argp
= align_up (as
->argp
+ length
, word_size
);
3059 write_memory (as
->argp
- length
, value_contents (arg
),
3063 else if (tdep
->vector_abi
== S390_VECTOR_ABI_128
3064 && s390_function_arg_vector (type
))
3066 static const char use_vr
[] = {24, 26, 28, 30, 25, 27, 29, 31};
3068 if (!is_unnamed
&& as
->vr
< ARRAY_SIZE (use_vr
))
3070 int regnum
= S390_V24_REGNUM
+ use_vr
[as
->vr
] - 24;
3073 regcache_cooked_write_part (as
->regcache
, regnum
,
3075 value_contents (arg
));
3081 write_memory (as
->argp
, value_contents (arg
), length
);
3082 as
->argp
= align_up (as
->argp
+ length
, word_size
);
3085 else if (s390_function_arg_integer (type
) && length
<= word_size
)
3087 /* Initialize it just to avoid a GCC false warning. */
3092 /* Place value in least significant bits of the register or
3093 memory word and sign- or zero-extend to full word size.
3094 This also applies to a struct or union. */
3095 val
= TYPE_UNSIGNED (type
)
3096 ? extract_unsigned_integer (value_contents (arg
),
3098 : extract_signed_integer (value_contents (arg
),
3099 length
, byte_order
);
3105 regcache_cooked_write_unsigned (as
->regcache
,
3106 S390_R0_REGNUM
+ as
->gr
,
3113 write_memory_unsigned_integer (as
->argp
, word_size
,
3115 as
->argp
+= word_size
;
3118 else if (s390_function_arg_integer (type
) && length
== 8)
3124 regcache_cooked_write (as
->regcache
,
3125 S390_R0_REGNUM
+ as
->gr
,
3126 value_contents (arg
));
3127 regcache_cooked_write (as
->regcache
,
3128 S390_R0_REGNUM
+ as
->gr
+ 1,
3129 value_contents (arg
) + word_size
);
3135 /* If we skipped r6 because we couldn't fit a DOUBLE_ARG
3136 in it, then don't go back and use it again later. */
3140 write_memory (as
->argp
, value_contents (arg
), length
);
3146 /* This argument type is never passed in registers. Place the
3147 value in the copy area and pass a pointer to it. Use 8-byte
3148 alignment as a conservative assumption. */
3149 as
->copy
= align_down (as
->copy
- length
, 8);
3151 write_memory (as
->copy
, value_contents (arg
), length
);
3156 regcache_cooked_write_unsigned (as
->regcache
,
3157 S390_R0_REGNUM
+ as
->gr
,
3164 write_memory_unsigned_integer (as
->argp
, word_size
,
3165 byte_order
, as
->copy
);
3166 as
->argp
+= word_size
;
3171 /* Put the actual parameter values pointed to by ARGS[0..NARGS-1] in
3172 place to be passed to a function, as specified by the "GNU/Linux
3173 for S/390 ELF Application Binary Interface Supplement".
3175 SP is the current stack pointer. We must put arguments, links,
3176 padding, etc. whereever they belong, and return the new stack
3179 If STRUCT_RETURN is non-zero, then the function we're calling is
3180 going to return a structure by value; STRUCT_ADDR is the address of
3181 a block we've allocated for it on the stack.
3183 Our caller has taken care of any type promotions needed to satisfy
3184 prototypes or the old K&R argument-passing rules. */
3187 s390_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
3188 struct regcache
*regcache
, CORE_ADDR bp_addr
,
3189 int nargs
, struct value
**args
, CORE_ADDR sp
,
3190 int struct_return
, CORE_ADDR struct_addr
)
3192 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3193 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
3194 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3196 struct s390_arg_state arg_state
, arg_prep
;
3197 CORE_ADDR param_area_start
, new_sp
;
3198 struct type
*ftype
= check_typedef (value_type (function
));
3200 if (TYPE_CODE (ftype
) == TYPE_CODE_PTR
)
3201 ftype
= check_typedef (TYPE_TARGET_TYPE (ftype
));
3204 arg_prep
.gr
= struct_return
? 3 : 2;
3208 arg_prep
.regcache
= NULL
;
3210 /* Initialize arg_state for "preparation mode". */
3211 arg_state
= arg_prep
;
3213 /* Update arg_state.copy with the start of the reference-to-copy area
3214 and arg_state.argp with the size of the parameter area. */
3215 for (i
= 0; i
< nargs
; i
++)
3216 s390_handle_arg (&arg_state
, args
[i
], tdep
, word_size
, byte_order
,
3217 TYPE_VARARGS (ftype
) && i
>= TYPE_NFIELDS (ftype
));
3219 param_area_start
= align_down (arg_state
.copy
- arg_state
.argp
, 8);
3221 /* Allocate the standard frame areas: the register save area, the
3222 word reserved for the compiler, and the back chain pointer. */
3223 new_sp
= param_area_start
- (16 * word_size
+ 32);
3225 /* Now we have the final stack pointer. Make sure we didn't
3226 underflow; on 31-bit, this would result in addresses with the
3227 high bit set, which causes confusion elsewhere. Note that if we
3228 error out here, stack and registers remain untouched. */
3229 if (gdbarch_addr_bits_remove (gdbarch
, new_sp
) != new_sp
)
3230 error (_("Stack overflow"));
3232 /* Pass the structure return address in general register 2. */
3234 regcache_cooked_write_unsigned (regcache
, S390_R2_REGNUM
, struct_addr
);
3236 /* Initialize arg_state for "write mode". */
3237 arg_state
= arg_prep
;
3238 arg_state
.argp
= param_area_start
;
3239 arg_state
.regcache
= regcache
;
3241 /* Write all parameters. */
3242 for (i
= 0; i
< nargs
; i
++)
3243 s390_handle_arg (&arg_state
, args
[i
], tdep
, word_size
, byte_order
,
3244 TYPE_VARARGS (ftype
) && i
>= TYPE_NFIELDS (ftype
));
3246 /* Store return PSWA. In 31-bit mode, keep addressing mode bit. */
3250 regcache_cooked_read_unsigned (regcache
, S390_PSWA_REGNUM
, &pswa
);
3251 bp_addr
= (bp_addr
& 0x7fffffff) | (pswa
& 0x80000000);
3253 regcache_cooked_write_unsigned (regcache
, S390_RETADDR_REGNUM
, bp_addr
);
3255 /* Store updated stack pointer. */
3256 regcache_cooked_write_unsigned (regcache
, S390_SP_REGNUM
, new_sp
);
3258 /* We need to return the 'stack part' of the frame ID,
3259 which is actually the top of the register save area. */
3260 return param_area_start
;
3263 /* Assuming THIS_FRAME is a dummy, return the frame ID of that
3264 dummy frame. The frame ID's base needs to match the TOS value
3265 returned by push_dummy_call, and the PC match the dummy frame's
3267 static struct frame_id
3268 s390_dummy_id (struct gdbarch
*gdbarch
, struct frame_info
*this_frame
)
3270 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
3271 CORE_ADDR sp
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
3272 sp
= gdbarch_addr_bits_remove (gdbarch
, sp
);
3274 return frame_id_build (sp
+ 16*word_size
+ 32,
3275 get_frame_pc (this_frame
));
3279 s390_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
3281 /* Both the 32- and 64-bit ABI's say that the stack pointer should
3282 always be aligned on an eight-byte boundary. */
3287 /* Helper for s390_return_value: Set or retrieve a function return
3288 value if it resides in a register. */
3291 s390_register_return_value (struct gdbarch
*gdbarch
, struct type
*type
,
3292 struct regcache
*regcache
,
3293 gdb_byte
*out
, const gdb_byte
*in
)
3295 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3296 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
3297 int length
= TYPE_LENGTH (type
);
3298 int code
= TYPE_CODE (type
);
3300 if (code
== TYPE_CODE_FLT
|| code
== TYPE_CODE_DECFLOAT
)
3302 /* Float-like value: left-aligned in f0. */
3304 regcache_cooked_write_part (regcache
, S390_F0_REGNUM
,
3307 regcache_cooked_read_part (regcache
, S390_F0_REGNUM
,
3310 else if (code
== TYPE_CODE_ARRAY
)
3312 /* Vector: left-aligned in v24. */
3314 regcache_cooked_write_part (regcache
, S390_V24_REGNUM
,
3317 regcache_cooked_read_part (regcache
, S390_V24_REGNUM
,
3320 else if (length
<= word_size
)
3322 /* Integer: zero- or sign-extended in r2. */
3324 regcache_cooked_read_part (regcache
, S390_R2_REGNUM
,
3325 word_size
- length
, length
, out
);
3326 else if (TYPE_UNSIGNED (type
))
3327 regcache_cooked_write_unsigned
3328 (regcache
, S390_R2_REGNUM
,
3329 extract_unsigned_integer (in
, length
, byte_order
));
3331 regcache_cooked_write_signed
3332 (regcache
, S390_R2_REGNUM
,
3333 extract_signed_integer (in
, length
, byte_order
));
3335 else if (length
== 2 * word_size
)
3337 /* Double word: in r2 and r3. */
3340 regcache_cooked_write (regcache
, S390_R2_REGNUM
, in
);
3341 regcache_cooked_write (regcache
, S390_R3_REGNUM
,
3346 regcache_cooked_read (regcache
, S390_R2_REGNUM
, out
);
3347 regcache_cooked_read (regcache
, S390_R3_REGNUM
,
3352 internal_error (__FILE__
, __LINE__
, _("invalid return type"));
3356 /* Implement the 'return_value' gdbarch method. */
3358 static enum return_value_convention
3359 s390_return_value (struct gdbarch
*gdbarch
, struct value
*function
,
3360 struct type
*type
, struct regcache
*regcache
,
3361 gdb_byte
*out
, const gdb_byte
*in
)
3363 enum return_value_convention rvc
;
3365 type
= check_typedef (type
);
3367 switch (TYPE_CODE (type
))
3369 case TYPE_CODE_STRUCT
:
3370 case TYPE_CODE_UNION
:
3371 case TYPE_CODE_COMPLEX
:
3372 rvc
= RETURN_VALUE_STRUCT_CONVENTION
;
3374 case TYPE_CODE_ARRAY
:
3375 rvc
= (gdbarch_tdep (gdbarch
)->vector_abi
== S390_VECTOR_ABI_128
3376 && TYPE_LENGTH (type
) <= 16 && TYPE_VECTOR (type
))
3377 ? RETURN_VALUE_REGISTER_CONVENTION
3378 : RETURN_VALUE_STRUCT_CONVENTION
;
3381 rvc
= TYPE_LENGTH (type
) <= 8
3382 ? RETURN_VALUE_REGISTER_CONVENTION
3383 : RETURN_VALUE_STRUCT_CONVENTION
;
3386 if (in
!= NULL
|| out
!= NULL
)
3388 if (rvc
== RETURN_VALUE_REGISTER_CONVENTION
)
3389 s390_register_return_value (gdbarch
, type
, regcache
, out
, in
);
3390 else if (in
!= NULL
)
3391 error (_("Cannot set function return value."));
3393 error (_("Function return value unknown."));
3402 static const gdb_byte
*
3403 s390_breakpoint_from_pc (struct gdbarch
*gdbarch
,
3404 CORE_ADDR
*pcptr
, int *lenptr
)
3406 static const gdb_byte breakpoint
[] = { 0x0, 0x1 };
3408 *lenptr
= sizeof (breakpoint
);
3413 /* Address handling. */
3416 s390_addr_bits_remove (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
3418 return addr
& 0x7fffffff;
3422 s390_address_class_type_flags (int byte_size
, int dwarf2_addr_class
)
3425 return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
;
3431 s390_address_class_type_flags_to_name (struct gdbarch
*gdbarch
, int type_flags
)
3433 if (type_flags
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
)
3440 s390_address_class_name_to_type_flags (struct gdbarch
*gdbarch
,
3442 int *type_flags_ptr
)
3444 if (strcmp (name
, "mode32") == 0)
3446 *type_flags_ptr
= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
;
3453 /* Implement gdbarch_gcc_target_options. GCC does not know "-m32" or
3454 "-mcmodel=large". */
3457 s390_gcc_target_options (struct gdbarch
*gdbarch
)
3459 return xstrdup (gdbarch_ptr_bit (gdbarch
) == 64 ? "-m64" : "-m31");
3462 /* Implement gdbarch_gnu_triplet_regexp. Target triplets are "s390-*"
3463 for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
3464 always "s390". Note that an s390x compiler supports "-m31" as
3468 s390_gnu_triplet_regexp (struct gdbarch
*gdbarch
)
3473 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
3477 s390_stap_is_single_operand (struct gdbarch
*gdbarch
, const char *s
)
3479 return ((isdigit (*s
) && s
[1] == '(' && s
[2] == '%') /* Displacement
3481 || *s
== '%' /* Register access. */
3482 || isdigit (*s
)); /* Literal number. */
3485 /* Process record and replay helpers. */
3487 /* Takes the intermediate sum of address calculations and masks off upper
3488 bits according to current addressing mode. */
3491 s390_record_address_mask (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3493 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3494 ULONGEST pswm
, pswa
;
3496 if (tdep
->abi
== ABI_LINUX_S390
)
3498 regcache_raw_read_unsigned (regcache
, S390_PSWA_REGNUM
, &pswa
);
3499 am
= pswa
>> 31 & 1;
3503 regcache_raw_read_unsigned (regcache
, S390_PSWM_REGNUM
, &pswm
);
3504 am
= pswm
>> 31 & 3;
3509 return val
& 0xffffff;
3511 return val
& 0x7fffffff;
3515 fprintf_unfiltered (gdb_stdlog
, "Warning: Addressing mode %d used.", am
);
3520 /* Calculates memory address using pre-calculated index, raw instruction word
3521 with b and d/dl fields, and raw instruction byte with dh field. Index and
3522 dh should be set to 0 if unused. */
3525 s390_record_calc_disp_common (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3526 ULONGEST x
, uint16_t bd
, int8_t dh
)
3528 uint8_t rb
= bd
>> 12 & 0xf;
3529 int32_t d
= (bd
& 0xfff) | ((int32_t)dh
<< 12);
3531 CORE_ADDR res
= d
+ x
;
3534 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ rb
, &b
);
3537 return s390_record_address_mask (gdbarch
, regcache
, res
);
3540 /* Calculates memory address using raw x, b + d/dl, dh fields from
3541 instruction. rx and dh should be set to 0 if unused. */
3544 s390_record_calc_disp (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3545 uint8_t rx
, uint16_t bd
, int8_t dh
)
3549 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ rx
, &x
);
3550 return s390_record_calc_disp_common (gdbarch
, regcache
, x
, bd
, dh
);
3553 /* Calculates memory address for VSCE[GF] instructions. */
3556 s390_record_calc_disp_vsce (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3557 uint8_t vx
, uint8_t el
, uint8_t es
, uint16_t bd
,
3558 int8_t dh
, CORE_ADDR
*res
)
3560 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3561 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3564 if (tdep
->v0_full_regnum
== -1 || el
* es
>= 16)
3567 regcache_cooked_read (regcache
, tdep
->v0_full_regnum
+ vx
, buf
);
3569 regcache_raw_read (regcache
, S390_V16_REGNUM
+ vx
- 16, buf
);
3570 x
= extract_unsigned_integer (buf
+ el
* es
, es
, byte_order
);
3571 *res
= s390_record_calc_disp_common (gdbarch
, regcache
, x
, bd
, dh
);
3575 /* Calculates memory address for instructions with relative long addressing. */
3578 s390_record_calc_rl (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3579 CORE_ADDR addr
, uint16_t i1
, uint16_t i2
)
3581 int32_t ri
= i1
<< 16 | i2
;
3582 return s390_record_address_mask (gdbarch
, regcache
, addr
+ (LONGEST
)ri
* 2);
3585 /* Population count helper. */
3587 static int s390_popcnt (unsigned int x
) {
3598 /* Record 64-bit register. */
3601 s390_record_gpr_g (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
3603 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3604 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
3606 if (tdep
->abi
== ABI_LINUX_S390
)
3607 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
3612 /* Record high 32 bits of a register. */
3615 s390_record_gpr_h (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
3617 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3618 if (tdep
->abi
== ABI_LINUX_S390
)
3620 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
3625 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
3631 /* Record vector register. */
3634 s390_record_vr (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
3636 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3639 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ i
))
3641 if (record_full_arch_list_add_reg (regcache
, S390_V0_LOWER_REGNUM
+ i
))
3646 if (record_full_arch_list_add_reg (regcache
, S390_V16_REGNUM
+ i
- 16))
3653 s390_process_record (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
3656 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
3657 uint16_t insn
[3] = {0};
3658 /* Instruction as bytes. */
3660 /* Instruction as nibbles. */
3662 /* Instruction vector registers. */
3664 CORE_ADDR oaddr
, oaddr2
, oaddr3
;
3667 /* if EX/EXRL instruction used, here's the reg parameter */
3669 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
3671 /* Attempting to use EX or EXRL jumps back here */
3674 /* Read instruction. */
3675 insn
[0] = read_memory_unsigned_integer (addr
, 2, byte_order
);
3676 /* If execute was involved, do the adjustment. */
3678 insn
[0] |= ex
& 0xff;
3679 /* Two highest bits determine instruction size. */
3680 if (insn
[0] >= 0x4000)
3681 insn
[1] = read_memory_unsigned_integer (addr
+2, 2, byte_order
);
3683 /* Not necessary, but avoids uninitialized variable warnings. */
3685 if (insn
[0] >= 0xc000)
3686 insn
[2] = read_memory_unsigned_integer (addr
+4, 2, byte_order
);
3689 /* Split instruction into bytes and nibbles. */
3690 for (i
= 0; i
< 3; i
++)
3692 ibyte
[i
*2] = insn
[i
] >> 8 & 0xff;
3693 ibyte
[i
*2+1] = insn
[i
] & 0xff;
3695 for (i
= 0; i
< 6; i
++)
3697 inib
[i
*2] = ibyte
[i
] >> 4 & 0xf;
3698 inib
[i
*2+1] = ibyte
[i
] & 0xf;
3700 /* Compute vector registers, if applicable. */
3701 ivec
[0] = (inib
[9] >> 3 & 1) << 4 | inib
[2];
3702 ivec
[1] = (inib
[9] >> 2 & 1) << 4 | inib
[3];
3703 ivec
[2] = (inib
[9] >> 1 & 1) << 4 | inib
[4];
3704 ivec
[3] = (inib
[9] >> 0 & 1) << 4 | inib
[8];
3708 /* 0x00 undefined */
3711 /* E-format instruction */
3714 /* 0x00 undefined */
3715 /* 0x01 unsupported: PR - program return */
3716 /* 0x02 unsupported: UPT */
3717 /* 0x03 undefined */
3718 /* 0x04 privileged: PTFF - perform timing facility function */
3719 /* 0x05-0x06 undefined */
3720 /* 0x07 privileged: SCKPF - set clock programmable field */
3721 /* 0x08-0x09 undefined */
3723 case 0x0a: /* PFPO - perform floating point operation */
3724 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
3725 if (!(tmp
& 0x80000000u
))
3727 uint8_t ofc
= tmp
>> 16 & 0xff;
3730 case 0x00: /* HFP32 */
3731 case 0x01: /* HFP64 */
3732 case 0x05: /* BFP32 */
3733 case 0x06: /* BFP64 */
3734 case 0x08: /* DFP32 */
3735 case 0x09: /* DFP64 */
3736 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
))
3739 case 0x02: /* HFP128 */
3740 case 0x07: /* BFP128 */
3741 case 0x0a: /* DFP128 */
3742 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
))
3744 if (record_full_arch_list_add_reg (regcache
, S390_F2_REGNUM
))
3748 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PFPO OFC %02x at %s.\n",
3749 ofc
, paddress (gdbarch
, addr
));
3753 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3756 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
3758 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3762 case 0x0b: /* TAM - test address mode */
3763 case 0x0c: /* SAM24 - set address mode 24 */
3764 case 0x0d: /* SAM31 - set address mode 31 */
3765 case 0x0e: /* SAM64 - set address mode 64 */
3766 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3770 /* 0x0f-0xfe undefined */
3772 /* 0xff unsupported: TRAP */
3779 /* 0x02 undefined */
3780 /* 0x03 undefined */
3782 case 0x04: /* SPM - set program mask */
3783 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3787 case 0x05: /* BALR - branch and link */
3788 case 0x45: /* BAL - branch and link */
3789 case 0x06: /* BCTR - branch on count */
3790 case 0x46: /* BCT - branch on count */
3791 case 0x0d: /* BASR - branch and save */
3792 case 0x4d: /* BAS - branch and save */
3793 case 0x84: /* BRXH - branch relative on index high */
3794 case 0x85: /* BRXLE - branch relative on index low or equal */
3795 case 0x86: /* BXH - branch on index high */
3796 case 0x87: /* BXLE - branch on index low or equal */
3797 /* BA[SL]* use native-size destination for linkage info, BCT*, BRX*, BX*
3798 use 32-bit destination as counter. */
3799 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3803 case 0x07: /* BCR - branch on condition */
3804 case 0x47: /* BC - branch on condition */
3805 /* No effect other than PC transfer. */
3808 /* 0x08 undefined */
3809 /* 0x09 undefined */
3812 /* SVC - supervisor call */
3813 if (s390_linux_syscall_record (regcache
, ibyte
[1]))
3817 case 0x0b: /* BSM - branch and set mode */
3819 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3821 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3825 case 0x0c: /* BASSM - branch and save 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 0x0e: /* MVCL - move long [interruptible] */
3833 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
3834 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3835 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
3837 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3839 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3841 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3843 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3845 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3847 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3851 case 0x0f: /* CLCL - compare logical long [interruptible] */
3852 case 0xa9: /* CLCLE - compare logical long extended [partial] */
3853 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3855 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3857 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3859 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3861 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3865 case 0x10: /* LPR - load positive */
3866 case 0x11: /* LNR - load negative */
3867 case 0x12: /* LTR - load and test */
3868 case 0x13: /* LCR - load complement */
3869 case 0x14: /* NR - and */
3870 case 0x16: /* OR - or */
3871 case 0x17: /* XR - xor */
3872 case 0x1a: /* AR - add */
3873 case 0x1b: /* SR - subtract */
3874 case 0x1e: /* ALR - add logical */
3875 case 0x1f: /* SLR - subtract logical */
3876 case 0x54: /* N - and */
3877 case 0x56: /* O - or */
3878 case 0x57: /* X - xor */
3879 case 0x5a: /* A - add */
3880 case 0x5b: /* S - subtract */
3881 case 0x5e: /* AL - add logical */
3882 case 0x5f: /* SL - subtract logical */
3883 case 0x4a: /* AH - add halfword */
3884 case 0x4b: /* SH - subtract halfword */
3885 case 0x8a: /* SRA - shift right single */
3886 case 0x8b: /* SLA - shift left single */
3887 case 0xbf: /* ICM - insert characters under mask */
3888 /* 32-bit destination + flags */
3889 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3891 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3895 case 0x15: /* CLR - compare logical */
3896 case 0x55: /* CL - compare logical */
3897 case 0x19: /* CR - compare */
3898 case 0x29: /* CDR - compare */
3899 case 0x39: /* CER - compare */
3900 case 0x49: /* CH - compare halfword */
3901 case 0x59: /* C - compare */
3902 case 0x69: /* CD - compare */
3903 case 0x79: /* CE - compare */
3904 case 0x91: /* TM - test under mask */
3905 case 0x95: /* CLI - compare logical */
3906 case 0xbd: /* CLM - compare logical under mask */
3907 case 0xd5: /* CLC - compare logical */
3908 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3912 case 0x18: /* LR - load */
3913 case 0x48: /* LH - load halfword */
3914 case 0x58: /* L - load */
3915 case 0x41: /* LA - load address */
3916 case 0x43: /* IC - insert character */
3917 case 0x4c: /* MH - multiply halfword */
3918 case 0x71: /* MS - multiply single */
3919 case 0x88: /* SRL - shift right single logical */
3920 case 0x89: /* SLL - shift left single logical */
3921 /* 32-bit, 8-bit (IC), or native width (LA) destination, no flags */
3922 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3926 case 0x1c: /* MR - multiply */
3927 case 0x5c: /* M - multiply */
3928 case 0x1d: /* DR - divide */
3929 case 0x5d: /* D - divide */
3930 case 0x8c: /* SRDL - shift right double logical */
3931 case 0x8d: /* SLDL - shift left double logical */
3932 /* 32-bit pair destination, no flags */
3933 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3935 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3939 case 0x20: /* LPDR - load positive */
3940 case 0x30: /* LPER - load positive */
3941 case 0x21: /* LNDR - load negative */
3942 case 0x31: /* LNER - load negative */
3943 case 0x22: /* LTDR - load and test */
3944 case 0x32: /* LTER - load and test */
3945 case 0x23: /* LCDR - load complement */
3946 case 0x33: /* LCER - load complement */
3947 case 0x2a: /* ADR - add */
3948 case 0x3a: /* AER - add */
3949 case 0x6a: /* AD - add */
3950 case 0x7a: /* AE - add */
3951 case 0x2b: /* SDR - subtract */
3952 case 0x3b: /* SER - subtract */
3953 case 0x6b: /* SD - subtract */
3954 case 0x7b: /* SE - subtract */
3955 case 0x2e: /* AWR - add unnormalized */
3956 case 0x3e: /* AUR - add unnormalized */
3957 case 0x6e: /* AW - add unnormalized */
3958 case 0x7e: /* AU - add unnormalized */
3959 case 0x2f: /* SWR - subtract unnormalized */
3960 case 0x3f: /* SUR - subtract unnormalized */
3961 case 0x6f: /* SW - subtract unnormalized */
3962 case 0x7f: /* SU - subtract unnormalized */
3963 /* float destination + flags */
3964 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3966 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3970 case 0x24: /* HDR - halve */
3971 case 0x34: /* HER - halve */
3972 case 0x25: /* LDXR - load rounded */
3973 case 0x35: /* LEDR - load rounded */
3974 case 0x28: /* LDR - load */
3975 case 0x38: /* LER - load */
3976 case 0x68: /* LD - load */
3977 case 0x78: /* LE - load */
3978 case 0x2c: /* MDR - multiply */
3979 case 0x3c: /* MDER - multiply */
3980 case 0x6c: /* MD - multiply */
3981 case 0x7c: /* MDE - multiply */
3982 case 0x2d: /* DDR - divide */
3983 case 0x3d: /* DER - divide */
3984 case 0x6d: /* DD - divide */
3985 case 0x7d: /* DE - divide */
3986 /* float destination, no flags */
3987 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3991 case 0x26: /* MXR - multiply */
3992 case 0x27: /* MXDR - multiply */
3993 case 0x67: /* MXD - multiply */
3994 /* float pair destination, no flags */
3995 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3997 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
4001 case 0x36: /* AXR - add */
4002 case 0x37: /* SXR - subtract */
4003 /* float pair destination + flags */
4004 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
4006 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
4008 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4012 case 0x40: /* STH - store halfword */
4013 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4014 if (record_full_arch_list_add_mem (oaddr
, 2))
4018 case 0x42: /* STC - store character */
4019 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4020 if (record_full_arch_list_add_mem (oaddr
, 1))
4024 case 0x44: /* EX - execute */
4027 fprintf_unfiltered (gdb_stdlog
, "Warning: Double execute at %s.\n",
4028 paddress (gdbarch
, addr
));
4031 addr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4034 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
4043 case 0x4e: /* CVD - convert to decimal */
4044 case 0x60: /* STD - store */
4045 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4046 if (record_full_arch_list_add_mem (oaddr
, 8))
4050 case 0x4f: /* CVB - convert to binary */
4051 /* 32-bit gpr destination + FPC (DXC write) */
4052 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4054 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4058 case 0x50: /* ST - store */
4059 case 0x70: /* STE - store */
4060 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
4061 if (record_full_arch_list_add_mem (oaddr
, 4))
4065 case 0x51: /* LAE - load address extended */
4066 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4068 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[2]))
4072 /* 0x52 undefined */
4073 /* 0x53 undefined */
4075 /* 0x61-0x66 undefined */
4077 /* 0x72-0x77 undefined */
4079 /* 0x80 privileged: SSM - set system mask */
4080 /* 0x81 undefined */
4081 /* 0x82 privileged: LPSW - load PSW */
4082 /* 0x83 privileged: diagnose */
4084 case 0x8e: /* SRDA - shift right double */
4085 case 0x8f: /* SLDA - shift left double */
4086 /* 32-bit pair destination + flags */
4087 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4089 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
4091 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4095 case 0x90: /* STM - store multiple */
4096 case 0x9b: /* STAM - store access multiple */
4097 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4098 if (inib
[2] <= inib
[3])
4099 n
= inib
[3] - inib
[2] + 1;
4101 n
= inib
[3] + 0x10 - inib
[2] + 1;
4102 if (record_full_arch_list_add_mem (oaddr
, n
* 4))
4106 case 0x92: /* MVI - move */
4107 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4108 if (record_full_arch_list_add_mem (oaddr
, 1))
4112 case 0x93: /* TS - test and set */
4113 case 0x94: /* NI - and */
4114 case 0x96: /* OI - or */
4115 case 0x97: /* XI - xor */
4116 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4117 if (record_full_arch_list_add_mem (oaddr
, 1))
4119 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4123 case 0x98: /* LM - load multiple */
4124 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
4125 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
4127 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
4131 /* 0x99 privileged: TRACE */
4133 case 0x9a: /* LAM - load access multiple */
4134 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
4135 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
4137 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[3]))
4141 /* 0x9c-0x9f privileged and obsolete (old I/O) */
4142 /* 0xa0-0xa4 undefined */
4146 /* RI-format instruction */
4147 switch (ibyte
[0] << 4 | inib
[3])
4149 case 0xa50: /* IIHH - insert immediate */
4150 case 0xa51: /* IIHL - insert immediate */
4151 /* high 32-bit destination */
4152 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
4156 case 0xa52: /* IILH - insert immediate */
4157 case 0xa53: /* IILL - insert immediate */
4158 case 0xa75: /* BRAS - branch relative and save */
4159 case 0xa76: /* BRCT - branch relative on count */
4160 case 0xa78: /* LHI - load halfword immediate */
4161 case 0xa7c: /* MHI - multiply halfword immediate */
4162 /* 32-bit or native destination */
4163 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4167 case 0xa54: /* NIHH - and immediate */
4168 case 0xa55: /* NIHL - and immediate */
4169 case 0xa58: /* OIHH - or immediate */
4170 case 0xa59: /* OIHL - or immediate */
4171 /* high 32-bit destination + flags */
4172 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
4174 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4178 case 0xa56: /* NILH - and immediate */
4179 case 0xa57: /* NILL - and immediate */
4180 case 0xa5a: /* OILH - or immediate */
4181 case 0xa5b: /* OILL - or immediate */
4182 case 0xa7a: /* AHI - add halfword immediate */
4183 /* 32-bit destination + flags */
4184 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4186 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4190 case 0xa5c: /* LLIHH - load logical immediate */
4191 case 0xa5d: /* LLIHL - load logical immediate */
4192 case 0xa5e: /* LLILH - load logical immediate */
4193 case 0xa5f: /* LLILL - load logical immediate */
4194 case 0xa77: /* BRCTG - branch relative on count */
4195 case 0xa79: /* LGHI - load halfword immediate */
4196 case 0xa7d: /* MGHI - multiply halfword immediate */
4197 /* 64-bit destination */
4198 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4202 case 0xa70: /* TMLH - test under mask */
4203 case 0xa71: /* TMLL - test under mask */
4204 case 0xa72: /* TMHH - test under mask */
4205 case 0xa73: /* TMHL - test under mask */
4206 case 0xa7e: /* CHI - compare halfword immediate */
4207 case 0xa7f: /* CGHI - compare halfword immediate */
4209 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4213 case 0xa74: /* BRC - branch relative on condition */
4214 /* no register change */
4217 case 0xa7b: /* AGHI - add halfword immediate */
4218 /* 64-bit destination + flags */
4219 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4221 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4230 /* 0xa6 undefined */
4232 case 0xa8: /* MVCLE - move long extended [partial] */
4233 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
4234 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4235 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
4236 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4238 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4240 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
4242 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
4244 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
4246 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4250 /* 0xaa-0xab undefined */
4251 /* 0xac privileged: STNSM - store then and system mask */
4252 /* 0xad privileged: STOSM - store then or system mask */
4253 /* 0xae privileged: SIGP - signal processor */
4254 /* 0xaf unsupported: MC - monitor call */
4255 /* 0xb0 undefined */
4256 /* 0xb1 privileged: LRA - load real address */
4261 /* S/RRD/RRE/RRF/IE-format instruction */
4264 /* 0xb200-0xb204 undefined or privileged */
4266 case 0xb205: /* STCK - store clock */
4267 case 0xb27c: /* STCKF - store clock fast */
4268 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4269 if (record_full_arch_list_add_mem (oaddr
, 8))
4271 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4275 /* 0xb206-0xb219 undefined, privileged, or unsupported */
4276 /* 0xb21a unsupported: CFC */
4277 /* 0xb21b-0xb221 undefined or privileged */
4279 case 0xb222: /* IPM - insert program mask */
4280 case 0xb24f: /* EAR - extract access */
4281 case 0xb252: /* MSR - multiply single */
4282 case 0xb2ec: /* ETND - extract transaction nesting depth */
4283 case 0xb38c: /* EFPC - extract fpc */
4284 case 0xb91f: /* LRVR - load reversed */
4285 case 0xb926: /* LBR - load byte */
4286 case 0xb927: /* LHR - load halfword */
4287 case 0xb994: /* LLCR - load logical character */
4288 case 0xb995: /* LLHR - load logical halfword */
4289 case 0xb9f2: /* LOCR - load on condition */
4290 /* 32-bit gpr destination */
4291 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4295 /* 0xb223-0xb22c privileged or unsupported */
4297 case 0xb22d: /* DXR - divide */
4298 case 0xb325: /* LXDR - load lengthened */
4299 case 0xb326: /* LXER - load lengthened */
4300 case 0xb336: /* SQXR - square root */
4301 case 0xb365: /* LXR - load */
4302 case 0xb367: /* FIXR - load fp integer */
4303 case 0xb376: /* LZXR - load zero */
4304 case 0xb3b6: /* CXFR - convert from fixed */
4305 case 0xb3c6: /* CXGR - convert from fixed */
4306 case 0xb3fe: /* IEXTR - insert biased exponent */
4307 /* float pair destination */
4308 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4310 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4314 /* 0xb22e-0xb240 undefined, privileged, or unsupported */
4316 case 0xb241: /* CKSM - checksum [partial] */
4317 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4319 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4321 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4323 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4327 /* 0xb242-0xb243 undefined */
4329 case 0xb244: /* SQDR - square root */
4330 case 0xb245: /* SQER - square root */
4331 case 0xb324: /* LDER - load lengthened */
4332 case 0xb337: /* MEER - multiply */
4333 case 0xb366: /* LEXR - load rounded */
4334 case 0xb370: /* LPDFR - load positive */
4335 case 0xb371: /* LNDFR - load negative */
4336 case 0xb372: /* CSDFR - copy sign */
4337 case 0xb373: /* LCDFR - load complement */
4338 case 0xb374: /* LZER - load zero */
4339 case 0xb375: /* LZDR - load zero */
4340 case 0xb377: /* FIER - load fp integer */
4341 case 0xb37f: /* FIDR - load fp integer */
4342 case 0xb3b4: /* CEFR - convert from fixed */
4343 case 0xb3b5: /* CDFR - convert from fixed */
4344 case 0xb3c1: /* LDGR - load fpr from gr */
4345 case 0xb3c4: /* CEGR - convert from fixed */
4346 case 0xb3c5: /* CDGR - convert from fixed */
4347 case 0xb3f6: /* IEDTR - insert biased exponent */
4348 /* float destination */
4349 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4353 /* 0xb246-0xb24c: privileged or unsupported */
4355 case 0xb24d: /* CPYA - copy access */
4356 case 0xb24e: /* SAR - set access */
4357 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[6]))
4361 /* 0xb250-0xb251 undefined or privileged */
4362 /* 0xb253-0xb254 undefined or privileged */
4364 case 0xb255: /* MVST - move string [partial] */
4369 /* Read ending byte. */
4370 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4372 /* Get address of second operand. */
4373 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[7], &tmp
);
4374 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4375 /* Search for ending byte and compute length. */
4378 if (target_read_memory (oaddr
, &cur
, 1))
4381 } while (cur
!= end
);
4382 /* Get address of first operand and record it. */
4383 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4384 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4385 if (record_full_arch_list_add_mem (oaddr
, num
))
4387 /* Record the registers. */
4388 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4390 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4392 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4397 /* 0xb256 undefined */
4399 case 0xb257: /* CUSE - compare until substring equal [interruptible] */
4400 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4402 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4404 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4406 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4408 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4412 /* 0xb258-0xb25c undefined, privileged, or unsupported */
4414 case 0xb25d: /* CLST - compare logical string [partial] */
4415 case 0xb25e: /* SRST - search string [partial] */
4416 case 0xb9be: /* SRSTU - search string unicode [partial] */
4417 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4419 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4421 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4425 /* 0xb25f-0xb262 undefined */
4427 case 0xb263: /* CMPSC - compression call [interruptible] */
4428 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4429 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4430 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4431 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4433 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4435 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4437 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4439 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4441 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
4443 /* DXC may be written */
4444 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4446 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4450 /* 0xb264-0xb277 undefined, privileged, or unsupported */
4452 case 0xb278: /* STCKE - store clock extended */
4453 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4454 if (record_full_arch_list_add_mem (oaddr
, 16))
4456 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4460 /* 0xb279-0xb27b undefined or unsupported */
4461 /* 0xb27d-0xb298 undefined or privileged */
4463 case 0xb299: /* SRNM - set rounding mode */
4464 case 0xb2b8: /* SRNMB - set bfp rounding mode */
4465 case 0xb2b9: /* SRNMT - set dfp rounding mode */
4466 case 0xb29d: /* LFPC - load fpc */
4467 case 0xb2bd: /* LFAS - load fpc and signal */
4468 case 0xb384: /* SFPC - set fpc */
4469 case 0xb385: /* SFASR - set fpc and signal */
4470 case 0xb960: /* CGRT - compare and trap */
4471 case 0xb961: /* CLGRT - compare logical and trap */
4472 case 0xb972: /* CRT - compare and trap */
4473 case 0xb973: /* CLRT - compare logical and trap */
4474 /* fpc only - including possible DXC write for trapping insns */
4475 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4479 /* 0xb29a-0xb29b undefined */
4481 case 0xb29c: /* STFPC - store fpc */
4482 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4483 if (record_full_arch_list_add_mem (oaddr
, 4))
4487 /* 0xb29e-0xb2a4 undefined */
4489 case 0xb2a5: /* TRE - translate extended [partial] */
4490 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4491 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4492 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4493 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4495 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4497 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4499 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4503 case 0xb2a6: /* CU21 - convert UTF-16 to UTF-8 [partial] */
4504 case 0xb2a7: /* CU12 - convert UTF-8 to UTF-16 [partial] */
4505 case 0xb9b0: /* CU14 - convert UTF-8 to UTF-32 [partial] */
4506 case 0xb9b1: /* CU24 - convert UTF-16 to UTF-32 [partial] */
4507 case 0xb9b2: /* CU41 - convert UTF-32 to UTF-8 [partial] */
4508 case 0xb9b3: /* CU42 - convert UTF-32 to UTF-16 [partial] */
4509 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4510 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4511 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4512 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4514 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4516 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4518 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4520 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4522 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4526 /* 0xb2a8-0xb2af undefined */
4528 case 0xb2b0: /* STFLE - store facility list extended */
4529 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4530 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4532 if (record_full_arch_list_add_mem (oaddr
, 8 * (tmp
+ 1)))
4534 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
))
4536 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4540 /* 0xb2b1-0xb2b7 undefined or privileged */
4541 /* 0xb2ba-0xb2bc undefined */
4542 /* 0xb2be-0xb2e7 undefined */
4543 /* 0xb2e9-0xb2eb undefined */
4544 /* 0xb2ed-0xb2f7 undefined */
4545 /* 0xb2f8 unsupported: TEND */
4546 /* 0xb2f9 undefined */
4548 case 0xb2e8: /* PPA - perform processor assist */
4549 case 0xb2fa: /* NIAI - next instruction access intent */
4550 /* no visible effects */
4553 /* 0xb2fb undefined */
4554 /* 0xb2fc unsupported: TABORT */
4555 /* 0xb2fd-0xb2fe undefined */
4556 /* 0xb2ff unsupported: TRAP */
4558 case 0xb300: /* LPEBR - load positive */
4559 case 0xb301: /* LNEBR - load negative */
4560 case 0xb303: /* LCEBR - load complement */
4561 case 0xb310: /* LPDBR - load positive */
4562 case 0xb311: /* LNDBR - load negative */
4563 case 0xb313: /* LCDBR - load complement */
4564 case 0xb350: /* TBEDR - convert hfp to bfp */
4565 case 0xb351: /* TBDR - convert hfp to bfp */
4566 case 0xb358: /* THDER - convert bfp to hfp */
4567 case 0xb359: /* THDR - convert bfp to hfp */
4568 /* float destination + flags */
4569 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4571 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4575 case 0xb304: /* LDEBR - load lengthened */
4576 case 0xb30c: /* MDEBR - multiply */
4577 case 0xb30d: /* DEBR - divide */
4578 case 0xb314: /* SQEBR - square root */
4579 case 0xb315: /* SQDBR - square root */
4580 case 0xb317: /* MEEBR - multiply */
4581 case 0xb31c: /* MDBR - multiply */
4582 case 0xb31d: /* DDBR - divide */
4583 case 0xb344: /* LEDBRA - load rounded */
4584 case 0xb345: /* LDXBRA - load rounded */
4585 case 0xb346: /* LEXBRA - load rounded */
4586 case 0xb357: /* FIEBRA - load fp integer */
4587 case 0xb35f: /* FIDBRA - load fp integer */
4588 case 0xb390: /* CELFBR - convert from logical */
4589 case 0xb391: /* CDLFBR - convert from logical */
4590 case 0xb394: /* CEFBR - convert from fixed */
4591 case 0xb395: /* CDFBR - convert from fixed */
4592 case 0xb3a0: /* CELGBR - convert from logical */
4593 case 0xb3a1: /* CDLGBR - convert from logical */
4594 case 0xb3a4: /* CEGBR - convert from fixed */
4595 case 0xb3a5: /* CDGBR - convert from fixed */
4596 case 0xb3d0: /* MDTR - multiply */
4597 case 0xb3d1: /* DDTR - divide */
4598 case 0xb3d4: /* LDETR - load lengthened */
4599 case 0xb3d5: /* LEDTR - load lengthened */
4600 case 0xb3d7: /* FIDTR - load fp integer */
4601 case 0xb3dd: /* LDXTR - load lengthened */
4602 case 0xb3f1: /* CDGTR - convert from fixed */
4603 case 0xb3f2: /* CDUTR - convert from unsigned packed */
4604 case 0xb3f3: /* CDSTR - convert from signed packed */
4605 case 0xb3f5: /* QADTR - quantize */
4606 case 0xb3f7: /* RRDTR - reround */
4607 case 0xb951: /* CDFTR - convert from fixed */
4608 case 0xb952: /* CDLGTR - convert from logical */
4609 case 0xb953: /* CDLFTR - convert from logical */
4610 /* float destination + fpc */
4611 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4613 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4617 case 0xb305: /* LXDBR - load lengthened */
4618 case 0xb306: /* LXEBR - load lengthened */
4619 case 0xb307: /* MXDBR - multiply */
4620 case 0xb316: /* SQXBR - square root */
4621 case 0xb34c: /* MXBR - multiply */
4622 case 0xb34d: /* DXBR - divide */
4623 case 0xb347: /* FIXBRA - load fp integer */
4624 case 0xb392: /* CXLFBR - convert from logical */
4625 case 0xb396: /* CXFBR - convert from fixed */
4626 case 0xb3a2: /* CXLGBR - convert from logical */
4627 case 0xb3a6: /* CXGBR - convert from fixed */
4628 case 0xb3d8: /* MXTR - multiply */
4629 case 0xb3d9: /* DXTR - divide */
4630 case 0xb3dc: /* LXDTR - load lengthened */
4631 case 0xb3df: /* FIXTR - load fp integer */
4632 case 0xb3f9: /* CXGTR - convert from fixed */
4633 case 0xb3fa: /* CXUTR - convert from unsigned packed */
4634 case 0xb3fb: /* CXSTR - convert from signed packed */
4635 case 0xb3fd: /* QAXTR - quantize */
4636 case 0xb3ff: /* RRXTR - reround */
4637 case 0xb959: /* CXFTR - convert from fixed */
4638 case 0xb95a: /* CXLGTR - convert from logical */
4639 case 0xb95b: /* CXLFTR - convert from logical */
4640 /* float pair destination + fpc */
4641 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4643 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4645 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4649 case 0xb308: /* KEBR - compare and signal */
4650 case 0xb309: /* CEBR - compare */
4651 case 0xb318: /* KDBR - compare and signal */
4652 case 0xb319: /* CDBR - compare */
4653 case 0xb348: /* KXBR - compare and signal */
4654 case 0xb349: /* CXBR - compare */
4655 case 0xb3e0: /* KDTR - compare and signal */
4656 case 0xb3e4: /* CDTR - compare */
4657 case 0xb3e8: /* KXTR - compare and signal */
4658 case 0xb3ec: /* CXTR - compare */
4659 /* flags + fpc only */
4660 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4662 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4666 case 0xb302: /* LTEBR - load and test */
4667 case 0xb312: /* LTDBR - load and test */
4668 case 0xb30a: /* AEBR - add */
4669 case 0xb30b: /* SEBR - subtract */
4670 case 0xb31a: /* ADBR - add */
4671 case 0xb31b: /* SDBR - subtract */
4672 case 0xb3d2: /* ADTR - add */
4673 case 0xb3d3: /* SDTR - subtract */
4674 case 0xb3d6: /* LTDTR - load and test */
4675 /* float destination + flags + fpc */
4676 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4678 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4680 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4684 case 0xb30e: /* MAEBR - multiply and add */
4685 case 0xb30f: /* MSEBR - multiply and subtract */
4686 case 0xb31e: /* MADBR - multiply and add */
4687 case 0xb31f: /* MSDBR - multiply and subtract */
4688 /* float destination [RRD] + fpc */
4689 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4691 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4695 /* 0xb320-0xb323 undefined */
4696 /* 0xb327-0xb32d undefined */
4698 case 0xb32e: /* MAER - multiply and add */
4699 case 0xb32f: /* MSER - multiply and subtract */
4700 case 0xb338: /* MAYLR - multiply and add unnormalized */
4701 case 0xb339: /* MYLR - multiply unnormalized */
4702 case 0xb33c: /* MAYHR - multiply and add unnormalized */
4703 case 0xb33d: /* MYHR - multiply unnormalized */
4704 case 0xb33e: /* MADR - multiply and add */
4705 case 0xb33f: /* MSDR - multiply and subtract */
4706 /* float destination [RRD] */
4707 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4711 /* 0xb330-0xb335 undefined */
4713 case 0xb33a: /* MAYR - multiply and add unnormalized */
4714 case 0xb33b: /* MYR - multiply unnormalized */
4715 /* float pair destination [RRD] */
4716 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4718 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[4] | 2)))
4722 case 0xb340: /* LPXBR - load positive */
4723 case 0xb341: /* LNXBR - load negative */
4724 case 0xb343: /* LCXBR - load complement */
4725 case 0xb360: /* LPXR - load positive */
4726 case 0xb361: /* LNXR - load negative */
4727 case 0xb362: /* LTXR - load and test */
4728 case 0xb363: /* LCXR - load complement */
4729 /* float pair destination + flags */
4730 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4732 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4734 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4738 case 0xb342: /* LTXBR - load and test */
4739 case 0xb34a: /* AXBR - add */
4740 case 0xb34b: /* SXBR - subtract */
4741 case 0xb3da: /* AXTR - add */
4742 case 0xb3db: /* SXTR - subtract */
4743 case 0xb3de: /* LTXTR - load and test */
4744 /* float pair destination + flags + fpc */
4745 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4747 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4749 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4751 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4755 /* 0xb34e-0xb34f undefined */
4756 /* 0xb352 undefined */
4758 case 0xb353: /* DIEBR - divide to integer */
4759 case 0xb35b: /* DIDBR - divide to integer */
4760 /* two float destinations + flags + fpc */
4761 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4763 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4765 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4767 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4771 /* 0xb354-0xb356 undefined */
4772 /* 0xb35a undefined */
4774 /* 0xb35c-0xb35e undefined */
4775 /* 0xb364 undefined */
4776 /* 0xb368 undefined */
4778 case 0xb369: /* CXR - compare */
4779 case 0xb3f4: /* CEDTR - compare biased exponent */
4780 case 0xb3fc: /* CEXTR - compare biased exponent */
4781 case 0xb920: /* CGR - compare */
4782 case 0xb921: /* CLGR - compare logical */
4783 case 0xb930: /* CGFR - compare */
4784 case 0xb931: /* CLGFR - compare logical */
4785 case 0xb9cd: /* CHHR - compare high */
4786 case 0xb9cf: /* CLHHR - compare logical high */
4787 case 0xb9dd: /* CHLR - compare high */
4788 case 0xb9df: /* CLHLR - compare logical high */
4790 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4794 /* 0xb36a-0xb36f undefined */
4795 /* 0xb377-0xb37e undefined */
4796 /* 0xb380-0xb383 undefined */
4797 /* 0xb386-0xb38b undefined */
4798 /* 0xb38d-0xb38f undefined */
4799 /* 0xb393 undefined */
4800 /* 0xb397 undefined */
4802 case 0xb398: /* CFEBR - convert to fixed */
4803 case 0xb399: /* CFDBR - convert to fixed */
4804 case 0xb39a: /* CFXBR - convert to fixed */
4805 case 0xb39c: /* CLFEBR - convert to logical */
4806 case 0xb39d: /* CLFDBR - convert to logical */
4807 case 0xb39e: /* CLFXBR - convert to logical */
4808 case 0xb941: /* CFDTR - convert to fixed */
4809 case 0xb949: /* CFXTR - convert to fixed */
4810 case 0xb943: /* CLFDTR - convert to logical */
4811 case 0xb94b: /* CLFXTR - convert to logical */
4812 /* 32-bit gpr destination + flags + fpc */
4813 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4815 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4817 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4821 /* 0xb39b undefined */
4822 /* 0xb39f undefined */
4824 /* 0xb3a3 undefined */
4825 /* 0xb3a7 undefined */
4827 case 0xb3a8: /* CGEBR - convert to fixed */
4828 case 0xb3a9: /* CGDBR - convert to fixed */
4829 case 0xb3aa: /* CGXBR - convert to fixed */
4830 case 0xb3ac: /* CLGEBR - convert to logical */
4831 case 0xb3ad: /* CLGDBR - convert to logical */
4832 case 0xb3ae: /* CLGXBR - convert to logical */
4833 case 0xb3e1: /* CGDTR - convert to fixed */
4834 case 0xb3e9: /* CGXTR - convert to fixed */
4835 case 0xb942: /* CLGDTR - convert to logical */
4836 case 0xb94a: /* CLGXTR - convert to logical */
4837 /* 64-bit gpr destination + flags + fpc */
4838 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4840 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4842 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4846 /* 0xb3ab undefined */
4847 /* 0xb3af-0xb3b3 undefined */
4848 /* 0xb3b7 undefined */
4850 case 0xb3b8: /* CFER - convert to fixed */
4851 case 0xb3b9: /* CFDR - convert to fixed */
4852 case 0xb3ba: /* CFXR - convert to fixed */
4853 case 0xb998: /* ALCR - add logical with carry */
4854 case 0xb999: /* SLBR - subtract logical with borrow */
4855 case 0xb9f4: /* NRK - and */
4856 case 0xb9f6: /* ORK - or */
4857 case 0xb9f7: /* XRK - xor */
4858 case 0xb9f8: /* ARK - add */
4859 case 0xb9f9: /* SRK - subtract */
4860 case 0xb9fa: /* ALRK - add logical */
4861 case 0xb9fb: /* SLRK - subtract logical */
4862 /* 32-bit gpr destination + flags */
4863 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4865 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4869 case 0xb3c8: /* CGER - convert to fixed */
4870 case 0xb3c9: /* CGDR - convert to fixed */
4871 case 0xb3ca: /* CGXR - convert to fixed */
4872 case 0xb900: /* LPGR - load positive */
4873 case 0xb901: /* LNGR - load negative */
4874 case 0xb902: /* LTGR - load and test */
4875 case 0xb903: /* LCGR - load complement */
4876 case 0xb908: /* AGR - add */
4877 case 0xb909: /* SGR - subtract */
4878 case 0xb90a: /* ALGR - add logical */
4879 case 0xb90b: /* SLGR - subtract logical */
4880 case 0xb910: /* LPGFR - load positive */
4881 case 0xb911: /* LNGFR - load negative */
4882 case 0xb912: /* LTGFR - load and test */
4883 case 0xb913: /* LCGFR - load complement */
4884 case 0xb918: /* AGFR - add */
4885 case 0xb919: /* SGFR - subtract */
4886 case 0xb91a: /* ALGFR - add logical */
4887 case 0xb91b: /* SLGFR - subtract logical */
4888 case 0xb980: /* NGR - and */
4889 case 0xb981: /* OGR - or */
4890 case 0xb982: /* XGR - xor */
4891 case 0xb988: /* ALCGR - add logical with carry */
4892 case 0xb989: /* SLBGR - subtract logical with borrow */
4893 case 0xb9e1: /* POPCNT - population count */
4894 case 0xb9e4: /* NGRK - and */
4895 case 0xb9e6: /* OGRK - or */
4896 case 0xb9e7: /* XGRK - xor */
4897 case 0xb9e8: /* AGRK - add */
4898 case 0xb9e9: /* SGRK - subtract */
4899 case 0xb9ea: /* ALGRK - add logical */
4900 case 0xb9eb: /* SLGRK - subtract logical */
4901 /* 64-bit gpr destination + flags */
4902 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4904 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4908 /* 0xb3bb-0xb3c0 undefined */
4909 /* 0xb3c2-0xb3c3 undefined */
4910 /* 0xb3c7 undefined */
4911 /* 0xb3cb-0xb3cc undefined */
4913 case 0xb3cd: /* LGDR - load gr from fpr */
4914 case 0xb3e2: /* CUDTR - convert to unsigned packed */
4915 case 0xb3e3: /* CSDTR - convert to signed packed */
4916 case 0xb3e5: /* EEDTR - extract biased exponent */
4917 case 0xb3e7: /* ESDTR - extract significance */
4918 case 0xb3ed: /* EEXTR - extract biased exponent */
4919 case 0xb3ef: /* ESXTR - extract significance */
4920 case 0xb904: /* LGR - load */
4921 case 0xb906: /* LGBR - load byte */
4922 case 0xb907: /* LGHR - load halfword */
4923 case 0xb90c: /* MSGR - multiply single */
4924 case 0xb90f: /* LRVGR - load reversed */
4925 case 0xb914: /* LGFR - load */
4926 case 0xb916: /* LLGFR - load logical */
4927 case 0xb917: /* LLGTR - load logical thirty one bits */
4928 case 0xb91c: /* MSGFR - load */
4929 case 0xb946: /* BCTGR - branch on count */
4930 case 0xb984: /* LLGCR - load logical character */
4931 case 0xb985: /* LLGHR - load logical halfword */
4932 case 0xb9e2: /* LOCGR - load on condition */
4933 /* 64-bit gpr destination */
4934 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4938 /* 0xb3ce-0xb3cf undefined */
4939 /* 0xb3e6 undefined */
4941 case 0xb3ea: /* CUXTR - convert to unsigned packed */
4942 case 0xb3eb: /* CSXTR - convert to signed packed */
4943 case 0xb90d: /* DSGR - divide single */
4944 case 0xb91d: /* DSGFR - divide single */
4945 case 0xb986: /* MLGR - multiply logical */
4946 case 0xb987: /* DLGR - divide logical */
4947 /* 64-bit gpr pair destination */
4948 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4950 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6] | 1))
4954 /* 0xb3ee undefined */
4955 /* 0xb3f0 undefined */
4956 /* 0xb3f8 undefined */
4958 /* 0xb905 privileged */
4960 /* 0xb90e unsupported: EREGG */
4962 /* 0xb915 undefined */
4964 case 0xb91e: /* KMAC - compute message authentication code [partial] */
4965 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4966 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4967 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4971 case 0x00: /* KMAC-Query */
4972 if (record_full_arch_list_add_mem (oaddr
, 16))
4976 case 0x01: /* KMAC-DEA */
4977 case 0x02: /* KMAC-TDEA-128 */
4978 case 0x03: /* KMAC-TDEA-192 */
4979 case 0x09: /* KMAC-Encrypted-DEA */
4980 case 0x0a: /* KMAC-Encrypted-TDEA-128 */
4981 case 0x0b: /* KMAC-Encrypted-TDEA-192 */
4982 if (record_full_arch_list_add_mem (oaddr
, 8))
4986 case 0x12: /* KMAC-AES-128 */
4987 case 0x13: /* KMAC-AES-192 */
4988 case 0x14: /* KMAC-AES-256 */
4989 case 0x1a: /* KMAC-Encrypted-AES-128 */
4990 case 0x1b: /* KMAC-Encrypted-AES-192 */
4991 case 0x1c: /* KMAC-Encrypted-AES-256 */
4992 if (record_full_arch_list_add_mem (oaddr
, 16))
4997 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMAC function %02x at %s.\n",
4998 (int)tmp
, paddress (gdbarch
, addr
));
5003 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5005 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5008 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5012 /* 0xb922-0xb924 undefined */
5013 /* 0xb925 privileged */
5014 /* 0xb928 privileged */
5015 /* 0xb929 undefined */
5017 case 0xb92a: /* KMF - cipher message with cipher feedback [partial] */
5018 case 0xb92b: /* KMO - cipher message with output feedback [partial] */
5019 case 0xb92f: /* KMC - cipher message with chaining [partial] */
5020 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5021 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5022 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5026 case 0x00: /* KM*-Query */
5027 if (record_full_arch_list_add_mem (oaddr
, 16))
5031 case 0x01: /* KM*-DEA */
5032 case 0x02: /* KM*-TDEA-128 */
5033 case 0x03: /* KM*-TDEA-192 */
5034 case 0x09: /* KM*-Encrypted-DEA */
5035 case 0x0a: /* KM*-Encrypted-TDEA-128 */
5036 case 0x0b: /* KM*-Encrypted-TDEA-192 */
5037 if (record_full_arch_list_add_mem (oaddr
, 8))
5041 case 0x12: /* KM*-AES-128 */
5042 case 0x13: /* KM*-AES-192 */
5043 case 0x14: /* KM*-AES-256 */
5044 case 0x1a: /* KM*-Encrypted-AES-128 */
5045 case 0x1b: /* KM*-Encrypted-AES-192 */
5046 case 0x1c: /* KM*-Encrypted-AES-256 */
5047 if (record_full_arch_list_add_mem (oaddr
, 16))
5051 case 0x43: /* KMC-PRNG */
5052 /* Only valid for KMC. */
5053 if (insn
[0] == 0xb92f)
5055 if (record_full_arch_list_add_mem (oaddr
, 8))
5059 /* For other instructions, fallthru. */
5061 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KM* function %02x at %s.\n",
5062 (int)tmp
, paddress (gdbarch
, addr
));
5067 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5068 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5069 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
5070 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5072 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5074 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5076 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5079 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5083 case 0xb92c: /* PCC - perform cryptographic computation [partial] */
5084 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5085 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5086 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5090 case 0x00: /* PCC-Query */
5091 if (record_full_arch_list_add_mem (oaddr
, 16))
5095 case 0x01: /* PCC-Compute-Last-Block-CMAC-Using-DEA */
5096 case 0x02: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-128 */
5097 case 0x03: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-192 */
5098 case 0x09: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-DEA */
5099 case 0x0a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-128 */
5100 case 0x0b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-192 */
5101 if (record_full_arch_list_add_mem (oaddr
+ 0x10, 8))
5105 case 0x12: /* PCC-Compute-Last-Block-CMAC-Using-AES-128 */
5106 case 0x13: /* PCC-Compute-Last-Block-CMAC-Using-AES-192 */
5107 case 0x14: /* PCC-Compute-Last-Block-CMAC-Using-AES-256 */
5108 case 0x1a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-128 */
5109 case 0x1b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-192 */
5110 case 0x1c: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-256 */
5111 if (record_full_arch_list_add_mem (oaddr
+ 0x18, 16))
5115 case 0x32: /* PCC-Compute-XTS-Parameter-Using-AES-128 */
5116 if (record_full_arch_list_add_mem (oaddr
+ 0x30, 32))
5120 case 0x34: /* PCC-Compute-XTS-Parameter-Using-AES-256 */
5121 if (record_full_arch_list_add_mem (oaddr
+ 0x40, 32))
5125 case 0x3a: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-128 */
5126 if (record_full_arch_list_add_mem (oaddr
+ 0x50, 32))
5130 case 0x3c: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-256 */
5131 if (record_full_arch_list_add_mem (oaddr
+ 0x60, 32))
5136 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PCC function %02x at %s.\n",
5137 (int)tmp
, paddress (gdbarch
, addr
));
5140 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5144 case 0xb92d: /* KMCTR - cipher message with counter [partial] */
5145 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5146 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5147 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5151 case 0x00: /* KMCTR-Query */
5152 if (record_full_arch_list_add_mem (oaddr
, 16))
5156 case 0x01: /* KMCTR-DEA */
5157 case 0x02: /* KMCTR-TDEA-128 */
5158 case 0x03: /* KMCTR-TDEA-192 */
5159 case 0x09: /* KMCTR-Encrypted-DEA */
5160 case 0x0a: /* KMCTR-Encrypted-TDEA-128 */
5161 case 0x0b: /* KMCTR-Encrypted-TDEA-192 */
5162 case 0x12: /* KMCTR-AES-128 */
5163 case 0x13: /* KMCTR-AES-192 */
5164 case 0x14: /* KMCTR-AES-256 */
5165 case 0x1a: /* KMCTR-Encrypted-AES-128 */
5166 case 0x1b: /* KMCTR-Encrypted-AES-192 */
5167 case 0x1c: /* KMCTR-Encrypted-AES-256 */
5171 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMCTR function %02x at %s.\n",
5172 (int)tmp
, paddress (gdbarch
, addr
));
5177 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5178 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5179 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
5180 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5182 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5184 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5186 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5188 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[4]))
5191 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5195 case 0xb92e: /* KM - cipher message [partial] */
5196 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5197 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5198 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5202 case 0x00: /* KM-Query */
5203 if (record_full_arch_list_add_mem (oaddr
, 16))
5207 case 0x01: /* KM-DEA */
5208 case 0x02: /* KM-TDEA-128 */
5209 case 0x03: /* KM-TDEA-192 */
5210 case 0x09: /* KM-Encrypted-DEA */
5211 case 0x0a: /* KM-Encrypted-TDEA-128 */
5212 case 0x0b: /* KM-Encrypted-TDEA-192 */
5213 case 0x12: /* KM-AES-128 */
5214 case 0x13: /* KM-AES-192 */
5215 case 0x14: /* KM-AES-256 */
5216 case 0x1a: /* KM-Encrypted-AES-128 */
5217 case 0x1b: /* KM-Encrypted-AES-192 */
5218 case 0x1c: /* KM-Encrypted-AES-256 */
5221 case 0x32: /* KM-XTS-AES-128 */
5222 if (record_full_arch_list_add_mem (oaddr
+ 0x10, 16))
5226 case 0x34: /* KM-XTS-AES-256 */
5227 if (record_full_arch_list_add_mem (oaddr
+ 0x20, 16))
5231 case 0x3a: /* KM-XTS-Encrypted-AES-128 */
5232 if (record_full_arch_list_add_mem (oaddr
+ 0x30, 16))
5236 case 0x3c: /* KM-XTS-Encrypted-AES-256 */
5237 if (record_full_arch_list_add_mem (oaddr
+ 0x40, 16))
5242 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KM function %02x at %s.\n",
5243 (int)tmp
, paddress (gdbarch
, addr
));
5248 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5249 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5250 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
5251 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5253 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5255 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5257 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5260 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5264 /* 0xb932-0xb93b undefined */
5266 case 0xb93c: /* PPNO - perform pseudorandom number operation [partial] */
5267 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5268 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5269 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5273 case 0x00: /* PPNO-Query */
5274 case 0x80: /* PPNO-Query */
5275 if (record_full_arch_list_add_mem (oaddr
, 16))
5279 case 0x03: /* PPNO-SHA-512-DRNG - generate */
5280 if (record_full_arch_list_add_mem (oaddr
, 240))
5282 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5283 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5284 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
5285 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
5287 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5289 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5293 case 0x83: /* PPNO-SHA-512-DRNG - seed */
5294 if (record_full_arch_list_add_mem (oaddr
, 240))
5296 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5298 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5303 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PPNO function %02x at %s.\n",
5304 (int)tmp
, paddress (gdbarch
, addr
));
5307 /* DXC may be written */
5308 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5310 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5314 /* 0xb93d undefined */
5316 case 0xb93e: /* KIMD - compute intermediate message digest [partial] */
5317 case 0xb93f: /* KLMD - compute last message digest [partial] */
5318 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
5319 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5320 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5324 case 0x00: /* K*MD-Query */
5325 if (record_full_arch_list_add_mem (oaddr
, 16))
5329 case 0x01: /* K*MD-SHA-1 */
5330 if (record_full_arch_list_add_mem (oaddr
, 20))
5334 case 0x02: /* K*MD-SHA-256 */
5335 if (record_full_arch_list_add_mem (oaddr
, 32))
5339 case 0x03: /* K*MD-SHA-512 */
5340 if (record_full_arch_list_add_mem (oaddr
, 64))
5344 case 0x41: /* KIMD-GHASH */
5345 /* Only valid for KIMD. */
5346 if (insn
[0] == 0xb93e)
5348 if (record_full_arch_list_add_mem (oaddr
, 16))
5352 /* For KLMD, fallthru. */
5354 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMAC function %02x at %s.\n",
5355 (int)tmp
, paddress (gdbarch
, addr
));
5360 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5362 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
5365 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5369 /* 0xb940 undefined */
5370 /* 0xb944-0xb945 undefined */
5371 /* 0xb947-0xb948 undefined */
5372 /* 0xb94c-0xb950 undefined */
5373 /* 0xb954-0xb958 undefined */
5374 /* 0xb95c-0xb95f undefined */
5375 /* 0xb962-0xb971 undefined */
5376 /* 0xb974-0xb97f undefined */
5378 case 0xb983: /* FLOGR - find leftmost one */
5379 /* 64-bit gpr pair destination + flags */
5380 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
5382 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6] | 1))
5384 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5388 /* 0xb98a privileged */
5389 /* 0xb98b-0xb98c undefined */
5391 case 0xb98d: /* EPSW - extract psw */
5392 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5395 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5399 /* 0xb98e-0xb98f privileged */
5401 case 0xb990: /* TRTT - translate two to two [partial] */
5402 case 0xb991: /* TRTO - translate two to one [partial] */
5403 case 0xb992: /* TROT - translate one to two [partial] */
5404 case 0xb993: /* TROO - translate one to one [partial] */
5405 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
5406 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5407 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
5408 /* tmp is source length, we want destination length. Adjust. */
5409 if (insn
[0] == 0xb991)
5411 if (insn
[0] == 0xb992)
5413 if (record_full_arch_list_add_mem (oaddr
, tmp
))
5415 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5417 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5419 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5421 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5425 case 0xb996: /* MLR - multiply logical */
5426 case 0xb997: /* DLR - divide logical */
5427 /* 32-bit gpr pair destination */
5428 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5430 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5434 /* 0xb99a-0xb9af unsupported, privileged, or undefined */
5435 /* 0xb9b4-0xb9bc undefined */
5437 case 0xb9bd: /* TRTRE - translate and test reverse extended [partial] */
5438 case 0xb9bf: /* TRTE - translate and test extended [partial] */
5439 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
5441 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
5443 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
5445 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5449 /* 0xb9c0-0xb9c7 undefined */
5451 case 0xb9c8: /* AHHHR - add high */
5452 case 0xb9c9: /* SHHHR - subtract high */
5453 case 0xb9ca: /* ALHHHR - add logical high */
5454 case 0xb9cb: /* SLHHHR - subtract logical high */
5455 case 0xb9d8: /* AHHLR - add high */
5456 case 0xb9d9: /* SHHLR - subtract high */
5457 case 0xb9da: /* ALHHLR - add logical high */
5458 case 0xb9db: /* SLHHLR - subtract logical high */
5459 /* 32-bit high gpr destination + flags */
5460 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[6]))
5462 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5466 /* 0xb9cc undefined */
5467 /* 0xb9ce undefined */
5468 /* 0xb9d0-0xb9d7 undefined */
5469 /* 0xb9dc undefined */
5470 /* 0xb9de undefined */
5472 case 0xb9e0: /* LOCFHR - load high on condition */
5473 /* 32-bit high gpr destination */
5474 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[6]))
5478 /* 0xb9e3 undefined */
5479 /* 0xb9e5 undefined */
5480 /* 0xb9ec-0xb9f1 undefined */
5481 /* 0xb9f3 undefined */
5482 /* 0xb9f5 undefined */
5483 /* 0xb9fc-0xb9ff undefined */
5490 /* 0xb4-0xb5 undefined */
5491 /* 0xb6 privileged: STCTL - store control */
5492 /* 0xb7 privileged: LCTL - load control */
5493 /* 0xb8 undefined */
5495 case 0xba: /* CS - compare and swap */
5496 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5497 if (record_full_arch_list_add_mem (oaddr
, 4))
5499 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5501 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5505 case 0xbb: /* CDS - compare double and swap */
5506 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5507 if (record_full_arch_list_add_mem (oaddr
, 8))
5509 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5511 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5513 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5517 /* 0xbc undefined */
5519 case 0xbe: /* STCM - store characters under mask */
5520 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5521 if (record_full_arch_list_add_mem (oaddr
, s390_popcnt (inib
[3])))
5530 /* RIL-format instruction */
5531 switch (ibyte
[0] << 4 | inib
[3])
5533 case 0xc00: /* LARL - load address relative long */
5534 case 0xc05: /* BRASL - branch relative and save long */
5535 case 0xc09: /* IILF - insert immediate */
5536 case 0xc21: /* MSFI - multiply single immediate */
5537 case 0xc42: /* LLHRL - load logical halfword relative long */
5538 case 0xc45: /* LHRL - load halfword relative long */
5539 case 0xc4d: /* LRL - load relative long */
5540 /* 32-bit or native gpr destination */
5541 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5545 case 0xc01: /* LGFI - load immediate */
5546 case 0xc0e: /* LLIHF - load logical immediate */
5547 case 0xc0f: /* LLILF - load logical immediate */
5548 case 0xc20: /* MSGFI - multiply single immediate */
5549 case 0xc44: /* LGHRL - load halfword relative long */
5550 case 0xc46: /* LLGHRL - load logical halfword relative long */
5551 case 0xc48: /* LGRL - load relative long */
5552 case 0xc4c: /* LGFRL - load relative long */
5553 case 0xc4e: /* LLGFRL - load logical relative long */
5554 /* 64-bit gpr destination */
5555 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5559 /* 0xc02-0xc03 undefined */
5561 case 0xc04: /* BRCL - branch relative on condition long */
5562 case 0xc62: /* PFDRL - prefetch data relative long */
5565 case 0xc06: /* XIHF - xor immediate */
5566 case 0xc0a: /* NIHF - and immediate */
5567 case 0xc0c: /* OIHF - or immediate */
5568 case 0xcc8: /* AIH - add immediate high */
5569 case 0xcca: /* ALSIH - add logical with signed immediate high */
5570 /* 32-bit high gpr destination + flags */
5571 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5573 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5577 case 0xc07: /* XILF - xor immediate */
5578 case 0xc0b: /* NILF - and immediate */
5579 case 0xc0d: /* OILF - or immediate */
5580 case 0xc25: /* SLFI - subtract logical immediate */
5581 case 0xc29: /* AFI - add immediate */
5582 case 0xc2b: /* ALFI - add logical immediate */
5583 /* 32-bit gpr destination + flags */
5584 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5586 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5590 case 0xc08: /* IIHF - insert immediate */
5591 case 0xcc6: /* BRCTH - branch relative on count high */
5592 case 0xccb: /* ALSIHN - add logical with signed immediate high */
5593 /* 32-bit high gpr destination */
5594 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5598 /* 0xc22-0xc23 undefined */
5600 case 0xc24: /* SLGFI - subtract logical immediate */
5601 case 0xc28: /* AGFI - add immediate */
5602 case 0xc2a: /* ALGFI - add logical immediate */
5603 /* 64-bit gpr destination + flags */
5604 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5606 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5610 /* 0xc26-0xc27 undefined */
5612 case 0xc2c: /* CGFI - compare immediate */
5613 case 0xc2d: /* CFI - compare immediate */
5614 case 0xc2e: /* CLGFI - compare logical immediate */
5615 case 0xc2f: /* CLFI - compare logical immediate */
5616 case 0xc64: /* CGHRL - compare halfword relative long */
5617 case 0xc65: /* CHRL - compare halfword relative long */
5618 case 0xc66: /* CLGHRL - compare logical halfword relative long */
5619 case 0xc67: /* CLHRL - compare logical halfword relative long */
5620 case 0xc68: /* CGRL - compare relative long */
5621 case 0xc6a: /* CLGRL - compare logical relative long */
5622 case 0xc6c: /* CGFRL - compare relative long */
5623 case 0xc6d: /* CRL - compare relative long */
5624 case 0xc6e: /* CLGFRL - compare logical relative long */
5625 case 0xc6f: /* CLRL - compare logical relative long */
5626 case 0xccd: /* CIH - compare immediate high */
5627 case 0xccf: /* CLIH - compare logical immediate high */
5629 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5633 /* 0xc40-0xc41 undefined */
5634 /* 0xc43 undefined */
5636 case 0xc47: /* STHRL - store halfword relative long */
5637 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5638 if (record_full_arch_list_add_mem (oaddr
, 2))
5642 /* 0xc49-0xc4a undefined */
5644 case 0xc4b: /* STGRL - store relative long */
5645 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5646 if (record_full_arch_list_add_mem (oaddr
, 8))
5650 case 0xc4f: /* STRL - store relative long */
5651 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5652 if (record_full_arch_list_add_mem (oaddr
, 4))
5656 case 0xc60: /* EXRL - execute relative long */
5659 fprintf_unfiltered (gdb_stdlog
, "Warning: Double execute at %s.\n",
5660 paddress (gdbarch
, addr
));
5663 addr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
5666 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
5675 /* 0xc61 undefined */
5676 /* 0xc63 undefined */
5677 /* 0xc69 undefined */
5678 /* 0xc6b undefined */
5679 /* 0xcc0-0xcc5 undefined */
5680 /* 0xcc7 undefined */
5681 /* 0xcc9 undefined */
5682 /* 0xccc undefined */
5683 /* 0xcce undefined */
5690 /* 0xc1 undefined */
5691 /* 0xc3 undefined */
5693 case 0xc5: /* BPRP - branch prediction relative preload */
5694 case 0xc7: /* BPP - branch prediction preload */
5695 /* no visible effect */
5699 /* SSF-format instruction */
5700 switch (ibyte
[0] << 4 | inib
[3])
5702 /* 0xc80 unsupported */
5704 case 0xc81: /* ECTG - extract cpu time */
5705 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5707 if (s390_record_gpr_g (gdbarch
, regcache
, 0))
5709 if (s390_record_gpr_g (gdbarch
, regcache
, 1))
5713 case 0xc82: /* CSST - compare and swap and store */
5716 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
5718 sc
= tmp
>> 8 & 0xff;
5720 /* First and third operands. */
5721 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5724 case 0x00: /* 32-bit */
5725 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5727 if (record_full_arch_list_add_mem (oaddr
, 4))
5731 case 0x01: /* 64-bit */
5732 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5734 if (record_full_arch_list_add_mem (oaddr
, 8))
5738 case 0x02: /* 128-bit */
5739 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5741 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5743 if (record_full_arch_list_add_mem (oaddr
, 16))
5748 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown CSST FC %02x at %s.\n",
5749 fc
, paddress (gdbarch
, addr
));
5753 /* Second operand. */
5754 oaddr2
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[2], 0);
5757 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown CSST FC %02x at %s.\n",
5758 sc
, paddress (gdbarch
, addr
));
5762 if (record_full_arch_list_add_mem (oaddr2
, 1 << sc
))
5766 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5771 /* 0xc83 undefined */
5773 case 0xc84: /* LPD - load pair disjoint */
5774 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5776 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5778 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5782 case 0xc85: /* LPDG - load pair disjoint */
5783 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5785 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5787 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5791 /* 0xc86-0xc8f undefined */
5798 /* 0xc9-0xcb undefined */
5799 /* 0xcd-0xcf undefined */
5801 case 0xd0: /* TRTR - translate and test reversed */
5802 case 0xdd: /* TRT - translate and test */
5803 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
5805 if (record_full_arch_list_add_reg (regcache
, S390_R2_REGNUM
))
5807 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5811 case 0xd1: /* MVN - move numbers */
5812 case 0xd2: /* MVC - move */
5813 case 0xd3: /* MVZ - move zones */
5814 case 0xdc: /* TR - translate */
5815 case 0xe8: /* MVCIN - move inverse */
5816 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5817 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5821 case 0xd4: /* NC - and */
5822 case 0xd6: /* OC - or*/
5823 case 0xd7: /* XC - xor */
5824 case 0xe2: /* UNPKU - unpack unicode */
5825 case 0xea: /* UNPKA - unpack ASCII */
5826 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5827 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5829 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5833 case 0xde: /* ED - edit */
5834 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5835 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5837 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5839 /* DXC may be written */
5840 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5844 case 0xdf: /* EDMK - edit and mark */
5845 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5846 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5848 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
5850 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5852 /* DXC may be written */
5853 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5857 /* 0xd8 undefined */
5858 /* 0xd9 unsupported: MVCK - move with key */
5859 /* 0xda unsupported: MVCP - move to primary */
5860 /* 0xdb unsupported: MVCS - move to secondary */
5861 /* 0xe0 undefined */
5863 case 0xe1: /* PKU - pack unicode */
5864 case 0xe9: /* PKA - pack ASCII */
5865 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5866 if (record_full_arch_list_add_mem (oaddr
, 16))
5874 /* RXY/RXE/RXF/RSL/RSY/SIY/V*-format instruction */
5875 switch (ibyte
[0] << 8 | ibyte
[5])
5877 /* 0xe300-0xe301 undefined */
5879 case 0xe302: /* LTG - load and test */
5880 case 0xe308: /* AG - add */
5881 case 0xe309: /* SG - subtract */
5882 case 0xe30a: /* ALG - add logical */
5883 case 0xe30b: /* SLG - subtract logical */
5884 case 0xe318: /* AGF - add */
5885 case 0xe319: /* SGF - subtract */
5886 case 0xe31a: /* ALGF - add logical */
5887 case 0xe31b: /* SLGF - subtract logical */
5888 case 0xe332: /* LTGF - load and test */
5889 case 0xe380: /* NG - and */
5890 case 0xe381: /* OG - or */
5891 case 0xe382: /* XG - xor */
5892 case 0xe388: /* ALCG - add logical with carry */
5893 case 0xe389: /* SLBG - subtract logical with borrow */
5894 case 0xeb0a: /* SRAG - shift right single */
5895 case 0xeb0b: /* SLAG - shift left single */
5896 /* 64-bit gpr destination + flags */
5897 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5899 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5903 /* 0xe303 privileged */
5905 case 0xe304: /* LG - load */
5906 case 0xe30c: /* MSG - multiply single */
5907 case 0xe30f: /* LRVG - load reversed */
5908 case 0xe314: /* LGF - load */
5909 case 0xe315: /* LGH - load halfword */
5910 case 0xe316: /* LLGF - load logical */
5911 case 0xe317: /* LLGT - load logical thirty one bits */
5912 case 0xe31c: /* MSGF - multiply single */
5913 case 0xe32a: /* LZRG - load and zero rightmost byte */
5914 case 0xe33a: /* LLZRGF - load logical and zero rightmost byte */
5915 case 0xe346: /* BCTG - branch on count */
5916 case 0xe377: /* LGB - load byte */
5917 case 0xe390: /* LLGC - load logical character */
5918 case 0xe391: /* LLGH - load logical halfword */
5919 case 0xeb0c: /* SRLG - shift right single logical */
5920 case 0xeb0d: /* SLLG - shift left single logical */
5921 case 0xeb1c: /* RLLG - rotate left single logical */
5922 case 0xeb44: /* BXHG - branch on index high */
5923 case 0xeb45: /* BXLEG - branch on index low or equal */
5924 case 0xeb4c: /* ECAG - extract cpu attribute */
5925 case 0xebe2: /* LOCG - load on condition */
5926 /* 64-bit gpr destination */
5927 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5931 /* 0xe305 undefined */
5933 case 0xe306: /* CVBY - convert to binary */
5934 /* 32-bit or native gpr destination + FPC (DXC write) */
5935 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5937 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5941 /* 0xe307 undefined */
5943 case 0xe30d: /* DSG - divide single */
5944 case 0xe31d: /* DSGF - divide single */
5945 case 0xe386: /* MLG - multiply logical */
5946 case 0xe387: /* DLG - divide logical */
5947 case 0xe38f: /* LPQ - load pair from quadword */
5948 /* 64-bit gpr pair destination */
5949 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5951 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5955 case 0xe30e: /* CVBG - convert to binary */
5956 /* 64-bit gpr destination + FPC (DXC write) */
5957 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5959 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5963 /* 0xe310-0xe311 undefined */
5965 case 0xe312: /* LT - load and test */
5966 case 0xe354: /* NY - and */
5967 case 0xe356: /* OY - or */
5968 case 0xe357: /* XY - xor */
5969 case 0xe35a: /* AY - add */
5970 case 0xe35b: /* SY - subtract */
5971 case 0xe35e: /* ALY - add logical */
5972 case 0xe35f: /* SLY - subtract logical */
5973 case 0xe37a: /* AHY - add halfword */
5974 case 0xe37b: /* SHY - subtract halfword */
5975 case 0xe398: /* ALC - add logical with carry */
5976 case 0xe399: /* SLB - subtract logical with borrow */
5977 case 0xe727: /* LCBB - load count to block bounduary */
5978 case 0xeb81: /* ICMY - insert characters under mask */
5979 case 0xebdc: /* SRAK - shift left single */
5980 case 0xebdd: /* SLAK - shift left single */
5981 /* 32-bit gpr destination + flags */
5982 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5984 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5988 /* 0xe313 privileged */
5990 case 0xe31e: /* LRV - load reversed */
5991 case 0xe31f: /* LRVH - load reversed */
5992 case 0xe33b: /* LZRF - load and zero rightmost byte */
5993 case 0xe351: /* MSY - multiply single */
5994 case 0xe358: /* LY - load */
5995 case 0xe371: /* LAY - load address */
5996 case 0xe373: /* ICY - insert character */
5997 case 0xe376: /* LB - load byte */
5998 case 0xe378: /* LHY - load */
5999 case 0xe37c: /* MHY - multiply halfword */
6000 case 0xe394: /* LLC - load logical character */
6001 case 0xe395: /* LLH - load logical halfword */
6002 case 0xeb1d: /* RLL - rotate left single logical */
6003 case 0xebde: /* SRLK - shift left single logical */
6004 case 0xebdf: /* SLLK - shift left single logical */
6005 case 0xebf2: /* LOC - load on condition */
6006 /* 32-bit or native gpr destination */
6007 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6011 case 0xe320: /* CG - compare */
6012 case 0xe321: /* CLG - compare logical */
6013 case 0xe330: /* CGF - compare */
6014 case 0xe331: /* CLGF - compare logical */
6015 case 0xe334: /* CGH - compare halfword */
6016 case 0xe355: /* CLY - compare logical */
6017 case 0xe359: /* CY - compare */
6018 case 0xe379: /* CHY - compare halfword */
6019 case 0xe3cd: /* CHF - compare high */
6020 case 0xe3cf: /* CLHF - compare logical high */
6021 case 0xeb20: /* CLMH - compare logical under mask high */
6022 case 0xeb21: /* CLMY - compare logical under mask */
6023 case 0xeb51: /* TMY - test under mask */
6024 case 0xeb55: /* CLIY - compare logical */
6025 case 0xebc0: /* TP - test decimal */
6026 case 0xed10: /* TCEB - test data class */
6027 case 0xed11: /* TCDB - test data class */
6028 case 0xed12: /* TCXB - test data class */
6029 case 0xed50: /* TDCET - test data class */
6030 case 0xed51: /* TDGET - test data group */
6031 case 0xed54: /* TDCDT - test data class */
6032 case 0xed55: /* TDGDT - test data group */
6033 case 0xed58: /* TDCXT - test data class */
6034 case 0xed59: /* TDGXT - test data group */
6036 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6040 /* 0xe322-0xe323 undefined */
6042 case 0xe324: /* STG - store */
6043 case 0xe325: /* NTSTG - nontransactional store */
6044 case 0xe326: /* CVDY - convert to decimal */
6045 case 0xe32f: /* STRVG - store reversed */
6046 case 0xebe3: /* STOCG - store on condition */
6047 case 0xed67: /* STDY - store */
6048 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6049 if (record_full_arch_list_add_mem (oaddr
, 8))
6053 /* 0xe327-0xe329 undefined */
6054 /* 0xe32b-0xe32d undefined */
6056 case 0xe32e: /* CVDG - convert to decimal */
6057 case 0xe38e: /* STPQ - store pair to quadword */
6058 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6059 if (record_full_arch_list_add_mem (oaddr
, 16))
6063 /* 0xe333 undefined */
6064 /* 0xe335 undefined */
6066 case 0xe336: /* PFD - prefetch data */
6069 /* 0xe337-0xe339 undefined */
6070 /* 0xe33c-0xe33d undefined */
6072 case 0xe33e: /* STRV - store reversed */
6073 case 0xe350: /* STY - store */
6074 case 0xe3cb: /* STFH - store high */
6075 case 0xebe1: /* STOCFH - store high on condition */
6076 case 0xebf3: /* STOC - store on condition */
6077 case 0xed66: /* STEY - store */
6078 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6079 if (record_full_arch_list_add_mem (oaddr
, 4))
6083 case 0xe33f: /* STRVH - store reversed */
6084 case 0xe370: /* STHY - store halfword */
6085 case 0xe3c7: /* STHH - store halfword high */
6086 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6087 if (record_full_arch_list_add_mem (oaddr
, 2))
6091 /* 0xe340-0xe345 undefined */
6092 /* 0xe347-0xe34f undefined */
6093 /* 0xe352-0xe353 undefined */
6095 case 0xe35c: /* MFY - multiply */
6096 case 0xe396: /* ML - multiply logical */
6097 case 0xe397: /* DL - divide logical */
6098 /* 32-bit gpr pair destination */
6099 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6101 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6105 /* 0xe35d undefined */
6106 /* 0xe360-0xe36f undefined */
6108 case 0xe372: /* STCY - store character */
6109 case 0xe3c3: /* STCH - store character high */
6110 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
6111 if (record_full_arch_list_add_mem (oaddr
, 1))
6115 /* 0xe374 undefined */
6117 case 0xe375: /* LAEY - load address extended */
6118 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6120 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[2]))
6124 /* 0xe37d-0xe37f undefined */
6125 /* 0xe383-0xe384 undefined */
6127 case 0xe385: /* LGAT - load and trap */
6128 case 0xe39c: /* LLGTAT - load logical thirty one bits and trap */
6129 case 0xe39d: /* LLGFAT - load logical and trap */
6130 case 0xe721: /* VLGV - vector load gr from vr element */
6131 /* 64-bit gpr destination + fpc for possible DXC write */
6132 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6134 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6138 /* 0xe38a-0xe38d undefined */
6139 /* 0xe392-0xe393 undefined */
6140 /* 0xe39a-0xe39b undefined */
6141 /* 0xe39e undefined */
6143 case 0xe39f: /* LAT - load and trap */
6144 /* 32-bit gpr destination + fpc for possible DXC write */
6145 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6147 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6151 /* 0xe3a0-0xe3bf undefined */
6153 case 0xe3c0: /* LBH - load byte high */
6154 case 0xe3c2: /* LLCH - load logical character high */
6155 case 0xe3c4: /* LHH - load halfword high */
6156 case 0xe3c6: /* LLHH - load logical halfword high */
6157 case 0xe3ca: /* LFH - load high */
6158 case 0xebe0: /* LOCFH - load high on condition */
6159 /* 32-bit high gpr destination */
6160 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6164 /* 0xe3c1 undefined */
6165 /* 0xe3c5 undefined */
6167 case 0xe3c8: /* LFHAT - load high and trap */
6168 /* 32-bit high gpr destination + fpc for possible DXC write */
6169 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6171 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6175 /* 0xe3c9 undefined */
6176 /* 0xe3cc undefined */
6177 /* 0xe3ce undefined */
6178 /* 0xe3d0-0xe3ff undefined */
6180 case 0xe700: /* VLEB - vector load element */
6181 case 0xe701: /* VLEH - vector load element */
6182 case 0xe702: /* VLEG - vector load element */
6183 case 0xe703: /* VLEF - vector load element */
6184 case 0xe704: /* VLLEZ - vector load logical element and zero */
6185 case 0xe705: /* VLREP - vector load and replicate */
6186 case 0xe706: /* VL - vector load */
6187 case 0xe707: /* VLBB - vector load to block bounduary */
6188 case 0xe712: /* VGEG - vector gather element */
6189 case 0xe713: /* VGEF - vector gather element */
6190 case 0xe722: /* VLVG - vector load vr element from gr */
6191 case 0xe730: /* VESL - vector element shift left */
6192 case 0xe733: /* VERLL - vector element rotate left logical */
6193 case 0xe737: /* VLL - vector load with length */
6194 case 0xe738: /* VESRL - vector element shift right logical */
6195 case 0xe73a: /* VESRA - vector element shift right arithmetic */
6196 case 0xe740: /* VLEIB - vector load element immediate */
6197 case 0xe741: /* VLEIH - vector load element immediate */
6198 case 0xe742: /* VLEIG - vector load element immediate */
6199 case 0xe743: /* VLEIF - vector load element immediate */
6200 case 0xe744: /* VGBM - vector generate byte mask */
6201 case 0xe745: /* VREPI - vector replicate immediate */
6202 case 0xe746: /* VGM - vector generate mask */
6203 case 0xe74d: /* VREP - vector replicate */
6204 case 0xe750: /* VPOPCT - vector population count */
6205 case 0xe752: /* VCTZ - vector count trailing zeros */
6206 case 0xe753: /* VCLZ - vector count leading zeros */
6207 case 0xe756: /* VLR - vector load */
6208 case 0xe75f: /* VSEG -vector sign extend to doubleword */
6209 case 0xe760: /* VMRL - vector merge low */
6210 case 0xe761: /* VMRH - vector merge high */
6211 case 0xe762: /* VLVGP - vector load vr from grs disjoint */
6212 case 0xe764: /* VSUM - vector sum across word */
6213 case 0xe765: /* VSUMG - vector sum across doubleword */
6214 case 0xe766: /* VCKSM - vector checksum */
6215 case 0xe767: /* VSUMQ - vector sum across quadword */
6216 case 0xe768: /* VN - vector and */
6217 case 0xe769: /* VNC - vector and with complement */
6218 case 0xe76a: /* VO - vector or */
6219 case 0xe76b: /* VNO - vector nor */
6220 case 0xe76d: /* VX - vector xor */
6221 case 0xe770: /* VESLV - vector element shift left */
6222 case 0xe772: /* VERIM - vector element rotate and insert under mask */
6223 case 0xe773: /* VERLLV - vector element rotate left logical */
6224 case 0xe774: /* VSL - vector shift left */
6225 case 0xe775: /* VSLB - vector shift left by byte */
6226 case 0xe777: /* VSLDB - vector shift left double by byte */
6227 case 0xe778: /* VESRLV - vector element shift right logical */
6228 case 0xe77a: /* VESRAV - vector element shift right arithmetic */
6229 case 0xe77c: /* VSRL - vector shift right logical */
6230 case 0xe77d: /* VSRLB - vector shift right logical by byte */
6231 case 0xe77e: /* VSRA - vector shift right arithmetic */
6232 case 0xe77f: /* VSRAB - vector shift right arithmetic by byte */
6233 case 0xe784: /* VPDI - vector permute doubleword immediate */
6234 case 0xe78c: /* VPERM - vector permute */
6235 case 0xe78d: /* VSEL - vector select */
6236 case 0xe78e: /* VFMS - vector fp multiply and subtract */
6237 case 0xe78f: /* VFMA - vector fp multiply and add */
6238 case 0xe794: /* VPK - vector pack */
6239 case 0xe7a1: /* VMLH - vector multiply logical high */
6240 case 0xe7a2: /* VML - vector multiply low */
6241 case 0xe7a3: /* VMH - vector multiply high */
6242 case 0xe7a4: /* VMLE - vector multiply logical even */
6243 case 0xe7a5: /* VMLO - vector multiply logical odd */
6244 case 0xe7a6: /* VME - vector multiply even */
6245 case 0xe7a7: /* VMO - vector multiply odd */
6246 case 0xe7a9: /* VMALH - vector multiply and add logical high */
6247 case 0xe7aa: /* VMAL - vector multiply and add low */
6248 case 0xe7ab: /* VMAH - vector multiply and add high */
6249 case 0xe7ac: /* VMALE - vector multiply and add logical even */
6250 case 0xe7ad: /* VMALO - vector multiply and add logical odd */
6251 case 0xe7ae: /* VMAE - vector multiply and add even */
6252 case 0xe7af: /* VMAO - vector multiply and add odd */
6253 case 0xe7b4: /* VGFM - vector Galois field multiply sum */
6254 case 0xe7b9: /* VACCC - vector add with carry compute carry */
6255 case 0xe7bb: /* VAC - vector add with carry */
6256 case 0xe7bc: /* VGFMA - vector Galois field multiply sum and accumulate */
6257 case 0xe7bd: /* VSBCBI - vector subtract with borrow compute borrow indication */
6258 case 0xe7bf: /* VSBI - vector subtract with borrow indication */
6259 case 0xe7c0: /* VCLGD - vector convert to logical 64-bit */
6260 case 0xe7c1: /* VCDLG - vector convert from logical 64-bit */
6261 case 0xe7c2: /* VCGD - vector convert to fixed 64-bit */
6262 case 0xe7c3: /* VCDG - vector convert from fixed 64-bit */
6263 case 0xe7c4: /* VLDE - vector fp load lengthened */
6264 case 0xe7c5: /* VLED - vector fp load rounded */
6265 case 0xe7c7: /* VFI - vector load fp integer */
6266 case 0xe7cc: /* VFPSO - vector fp perform sign operation */
6267 case 0xe7ce: /* VFSQ - vector fp square root */
6268 case 0xe7d4: /* VUPLL - vector unpack logical low */
6269 case 0xe7d6: /* VUPL - vector unpack low */
6270 case 0xe7d5: /* VUPLH - vector unpack logical high */
6271 case 0xe7d7: /* VUPH - vector unpack high */
6272 case 0xe7de: /* VLC - vector load complement */
6273 case 0xe7df: /* VLP - vector load positive */
6274 case 0xe7e2: /* VFA - vector fp subtract */
6275 case 0xe7e3: /* VFA - vector fp add */
6276 case 0xe7e5: /* VFD - vector fp divide */
6277 case 0xe7e7: /* VFM - vector fp multiply */
6278 case 0xe7f0: /* VAVGL - vector average logical */
6279 case 0xe7f1: /* VACC - vector add and compute carry */
6280 case 0xe7f2: /* VAVG - vector average */
6281 case 0xe7f3: /* VA - vector add */
6282 case 0xe7f5: /* VSCBI - vector subtract compute borrow indication */
6283 case 0xe7f7: /* VS - vector subtract */
6284 case 0xe7fc: /* VMNL - vector minimum logical */
6285 case 0xe7fd: /* VMXL - vector maximum logical */
6286 case 0xe7fe: /* VMN - vector minimum */
6287 case 0xe7ff: /* VMX - vector maximum */
6288 /* vector destination + FPC */
6289 if (s390_record_vr (gdbarch
, regcache
, ivec
[0]))
6291 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6295 case 0xe708: /* VSTEB - vector store element */
6296 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6297 if (record_full_arch_list_add_mem (oaddr
, 1))
6299 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6303 case 0xe709: /* VSTEH - vector store element */
6304 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6305 if (record_full_arch_list_add_mem (oaddr
, 2))
6307 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6311 case 0xe70a: /* VSTEG - vector store element */
6312 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6313 if (record_full_arch_list_add_mem (oaddr
, 8))
6315 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6319 case 0xe70b: /* VSTEF - vector store element */
6320 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6321 if (record_full_arch_list_add_mem (oaddr
, 4))
6323 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6327 /* 0xe70c-0xe70d undefined */
6329 case 0xe70e: /* VST - vector store */
6330 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
6331 if (record_full_arch_list_add_mem (oaddr
, 16))
6333 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6337 /* 0xe70f-0xe711 undefined */
6338 /* 0xe714-0xe719 undefined */
6340 case 0xe71a: /* VSCEG - vector scatter element */
6341 if (s390_record_calc_disp_vsce (gdbarch
, regcache
, ivec
[1], inib
[8], 8, insn
[1], 0, &oaddr
))
6343 if (record_full_arch_list_add_mem (oaddr
, 8))
6345 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6349 case 0xe71b: /* VSCEF - vector scatter element */
6350 if (s390_record_calc_disp_vsce (gdbarch
, regcache
, ivec
[1], inib
[8], 4, insn
[1], 0, &oaddr
))
6352 if (record_full_arch_list_add_mem (oaddr
, 4))
6354 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6358 /* 0xe71c-0xe720 undefined */
6359 /* 0xe723-0xe726 undefined */
6360 /* 0xe728-0xe72f undefined */
6361 /* 0xe731-0xe732 undefined */
6362 /* 0xe734-0xe735 undefined */
6364 case 0xe736: /* VLM - vector load multiple */
6365 for (i
= ivec
[0]; i
!= ivec
[1]; i
++, i
&= 0x1f)
6366 if (s390_record_vr (gdbarch
, regcache
, i
))
6368 if (s390_record_vr (gdbarch
, regcache
, ivec
[1]))
6370 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6374 /* 0xe739 undefined */
6375 /* 0xe73b-0xe73d undefined */
6377 case 0xe73e: /* VSTM - vector store multiple */
6378 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6379 if (ivec
[0] <= ivec
[1])
6380 n
= ivec
[1] - ivec
[0] + 1;
6382 n
= ivec
[1] + 0x20 - ivec
[0] + 1;
6383 if (record_full_arch_list_add_mem (oaddr
, n
* 16))
6385 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6389 case 0xe73f: /* VSTL - vector store with length */
6390 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6391 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[3], &tmp
);
6395 if (record_full_arch_list_add_mem (oaddr
, tmp
))
6397 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6401 /* 0xe747-0xe749 undefined */
6403 case 0xe74a: /* VFTCI - vector fp test data class immediate */
6404 case 0xe75c: /* VISTR - vector isolate string */
6405 case 0xe780: /* VFEE - vector find element equal */
6406 case 0xe781: /* VFENE - vector find element not equal */
6407 case 0xe782: /* VFA - vector find any element equal */
6408 case 0xe78a: /* VSTRC - vector string range compare */
6409 case 0xe795: /* VPKLS - vector pack logical saturate */
6410 case 0xe797: /* VPKS - vector pack saturate */
6411 case 0xe7e8: /* VFCE - vector fp compare equal */
6412 case 0xe7ea: /* VFCHE - vector fp compare high or equal */
6413 case 0xe7eb: /* VFCE - vector fp compare high */
6414 case 0xe7f8: /* VCEQ - vector compare equal */
6415 case 0xe7f9: /* VCHL - vector compare high logical */
6416 case 0xe7fb: /* VCH - vector compare high */
6417 /* vector destination + flags + FPC */
6418 if (s390_record_vr (gdbarch
, regcache
, ivec
[0]))
6420 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6422 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6426 /* 0xe74b-0xe74c undefined */
6427 /* 0xe74e-0xe74f undefined */
6428 /* 0xe751 undefined */
6429 /* 0xe754-0xe755 undefined */
6430 /* 0xe757-0xe75b undefined */
6431 /* 0xe75d-0xe75e undefined */
6432 /* 0xe763 undefined */
6433 /* 0xe76c undefined */
6434 /* 0xe76e-0xe76f undefined */
6435 /* 0xe771 undefined */
6436 /* 0xe776 undefined */
6437 /* 0xe779 undefined */
6438 /* 0xe77b undefined */
6439 /* 0xe783 undefined */
6440 /* 0xe785-0xe789 undefined */
6441 /* 0xe78b undefined */
6442 /* 0xe790-0xe793 undefined */
6443 /* 0xe796 undefined */
6444 /* 0xe798-0xe7a0 undefined */
6445 /* 0xe7a8 undefined */
6446 /* 0xe7b0-0xe7b3 undefined */
6447 /* 0xe7b5-0xe7b8 undefined */
6448 /* 0xe7ba undefined */
6449 /* 0xe7be undefined */
6450 /* 0xe7c6 undefined */
6451 /* 0xe7c8-0xe7c9 undefined */
6453 case 0xe7ca: /* WFK - vector fp compare and signal scalar */
6454 case 0xe7cb: /* WFC - vector fp compare scalar */
6455 case 0xe7d8: /* VTM - vector test under mask */
6456 case 0xe7d9: /* VECL - vector element compare logical */
6457 case 0xe7db: /* VEC - vector element compare */
6458 case 0xed08: /* KEB - compare and signal */
6459 case 0xed09: /* CEB - compare */
6460 case 0xed18: /* KDB - compare and signal */
6461 case 0xed19: /* CDB - compare */
6462 /* flags + fpc only */
6463 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6465 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6469 /* 0xe7cd undefined */
6470 /* 0xe7cf-0xe7d3 undefined */
6471 /* 0xe7da undefined */
6472 /* 0xe7dc-0xe7dd undefined */
6473 /* 0xe7e0-0xe7e1 undefined */
6474 /* 0xe7e4 undefined */
6475 /* 0xe7e6 undefined */
6476 /* 0xe7e9 undefined */
6477 /* 0xe7ec-0xe7ef undefined */
6478 /* 0xe7f4 undefined */
6479 /* 0xe7f6 undefined */
6480 /* 0xe7fa undefined */
6482 /* 0xeb00-0xeb03 undefined */
6484 case 0xeb04: /* LMG - load multiple */
6485 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6486 if (s390_record_gpr_g (gdbarch
, regcache
, i
))
6488 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
6492 /* 0xeb05-0xeb09 undefined */
6493 /* 0xeb0e undefined */
6494 /* 0xeb0f privileged: TRACG */
6495 /* 0xeb10-0xeb13 undefined */
6497 case 0xeb14: /* CSY - compare and swap */
6498 case 0xebf4: /* LAN - load and and */
6499 case 0xebf6: /* LAO - load and or */
6500 case 0xebf7: /* LAX - load and xor */
6501 case 0xebf8: /* LAA - load and add */
6502 case 0xebfa: /* LAAL - load and add logical */
6503 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6504 if (record_full_arch_list_add_mem (oaddr
, 4))
6506 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6508 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6512 /* 0xeb15-0xeb1b undefined */
6513 /* 0xeb1e-0xeb1f undefined */
6514 /* 0xeb22 undefined */
6516 case 0xeb23: /* CLT - compare logical and trap */
6517 case 0xeb2b: /* CLGT - compare logical and trap */
6518 /* fpc only - including possible DXC write for trapping insns */
6519 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6523 case 0xeb24: /* STMG - store multiple */
6524 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6525 if (inib
[2] <= inib
[3])
6526 n
= inib
[3] - inib
[2] + 1;
6528 n
= inib
[3] + 0x10 - inib
[2] + 1;
6529 if (record_full_arch_list_add_mem (oaddr
, n
* 8))
6533 /* 0xeb25 privileged */
6535 case 0xeb26: /* STMH - store multiple high */
6536 case 0xeb90: /* STMY - store multiple */
6537 case 0xeb9b: /* STAMY - store access multiple */
6538 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6539 if (inib
[2] <= inib
[3])
6540 n
= inib
[3] - inib
[2] + 1;
6542 n
= inib
[3] + 0x10 - inib
[2] + 1;
6543 if (record_full_arch_list_add_mem (oaddr
, n
* 4))
6547 /* 0xeb27-0xeb2a undefined */
6549 case 0xeb2c: /* STCMH - store characters under mask */
6550 case 0xeb2d: /* STCMY - store characters under mask */
6551 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6552 if (record_full_arch_list_add_mem (oaddr
, s390_popcnt (inib
[3])))
6556 /* 0xeb2e undefined */
6557 /* 0xeb2f privileged */
6559 case 0xeb30: /* CSG - compare and swap */
6560 case 0xebe4: /* LANG - load and and */
6561 case 0xebe6: /* LAOG - load and or */
6562 case 0xebe7: /* LAXG - load and xor */
6563 case 0xebe8: /* LAAG - load and add */
6564 case 0xebea: /* LAALG - load and add logical */
6565 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6566 if (record_full_arch_list_add_mem (oaddr
, 8))
6568 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6570 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6574 case 0xeb31: /* CDSY - compare double and swap */
6575 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6576 if (record_full_arch_list_add_mem (oaddr
, 8))
6578 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6580 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6582 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6586 /* 0xeb32-0xeb3d undefined */
6588 case 0xeb3e: /* CDSG - compare double and swap */
6589 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6590 if (record_full_arch_list_add_mem (oaddr
, 16))
6592 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6594 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
6596 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6600 /* 0xeb3f-0xeb43 undefined */
6601 /* 0xeb46-0xeb4b undefined */
6602 /* 0xeb4d-0xeb50 undefined */
6604 case 0xeb52: /* MVIY - move */
6605 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6606 if (record_full_arch_list_add_mem (oaddr
, 1))
6610 case 0xeb54: /* NIY - and */
6611 case 0xeb56: /* OIY - or */
6612 case 0xeb57: /* XIY - xor */
6613 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6614 if (record_full_arch_list_add_mem (oaddr
, 1))
6616 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6620 /* 0xeb53 undefined */
6621 /* 0xeb58-0xeb69 undefined */
6623 case 0xeb6a: /* ASI - add immediate */
6624 case 0xeb6e: /* ALSI - add immediate */
6625 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6626 if (record_full_arch_list_add_mem (oaddr
, 4))
6628 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6632 /* 0xeb6b-0xeb6d undefined */
6633 /* 0xeb6f-0xeb79 undefined */
6635 case 0xeb7a: /* AGSI - add immediate */
6636 case 0xeb7e: /* ALGSI - add immediate */
6637 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
6638 if (record_full_arch_list_add_mem (oaddr
, 8))
6640 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6644 /* 0xeb7b-0xeb7d undefined */
6645 /* 0xeb7f undefined */
6647 case 0xeb80: /* ICMH - insert characters under mask */
6648 /* 32-bit high gpr destination + flags */
6649 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6651 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6655 /* 0xeb82-0xeb8d undefined */
6657 case 0xeb8e: /* MVCLU - move long unicode [partial] */
6658 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
6659 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
6660 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
6661 if (record_full_arch_list_add_mem (oaddr
, tmp
))
6663 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6665 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6667 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6669 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
6671 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6675 case 0xeb8f: /* CLCLU - compare logical long unicode [partial] */
6676 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6678 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6680 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6682 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
6684 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6688 /* 0xeb91-0xeb95 undefined */
6690 case 0xeb96: /* LMH - load multiple high */
6691 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6692 if (s390_record_gpr_h (gdbarch
, regcache
, i
))
6694 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[3]))
6698 /* 0xeb97 undefined */
6700 case 0xeb98: /* LMY - load multiple */
6701 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6702 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
6704 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6708 /* 0xeb99 undefined */
6710 case 0xeb9a: /* LAMY - load access multiple */
6711 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6712 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
6714 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[3]))
6718 /* 0xeb9c-0xebbf undefined */
6719 /* 0xebc1-0xebdb undefined */
6720 /* 0xebe5 undefined */
6721 /* 0xebe9 undefined */
6722 /* 0xebeb-0xebf1 undefined */
6723 /* 0xebf5 undefined */
6724 /* 0xebf9 undefined */
6725 /* 0xebfb-0xebff undefined */
6727 /* 0xed00-0xed03 undefined */
6729 case 0xed04: /* LDEB - load lengthened */
6730 case 0xed0c: /* MDEB - multiply */
6731 case 0xed0d: /* DEB - divide */
6732 case 0xed14: /* SQEB - square root */
6733 case 0xed15: /* SQDB - square root */
6734 case 0xed17: /* MEEB - multiply */
6735 case 0xed1c: /* MDB - multiply */
6736 case 0xed1d: /* DDB - divide */
6737 /* float destination + fpc */
6738 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6740 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6744 case 0xed05: /* LXDB - load lengthened */
6745 case 0xed06: /* LXEB - load lengthened */
6746 case 0xed07: /* MXDB - multiply */
6747 /* float pair destination + fpc */
6748 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6750 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
6752 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6756 case 0xed0a: /* AEB - add */
6757 case 0xed0b: /* SEB - subtract */
6758 case 0xed1a: /* ADB - add */
6759 case 0xed1b: /* SDB - subtract */
6760 /* float destination + flags + fpc */
6761 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6763 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6765 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6769 case 0xed0e: /* MAEB - multiply and add */
6770 case 0xed0f: /* MSEB - multiply and subtract */
6771 case 0xed1e: /* MADB - multiply and add */
6772 case 0xed1f: /* MSDB - multiply and subtract */
6773 case 0xed40: /* SLDT - shift significand left */
6774 case 0xed41: /* SRDT - shift significand right */
6775 case 0xedaa: /* CDZT - convert from zoned */
6776 case 0xedae: /* CDPT - convert from packed */
6777 /* float destination [RXF] + fpc */
6778 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6780 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6784 /* 0xed13 undefined */
6785 /* 0xed16 undefined */
6786 /* 0xed20-0xed23 undefined */
6788 case 0xed24: /* LDE - load lengthened */
6789 case 0xed34: /* SQE - square root */
6790 case 0xed35: /* SQD - square root */
6791 case 0xed37: /* MEE - multiply */
6792 case 0xed64: /* LEY - load */
6793 case 0xed65: /* LDY - load */
6794 /* float destination */
6795 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6799 case 0xed25: /* LXD - load lengthened */
6800 case 0xed26: /* LXE - load lengthened */
6801 /* float pair destination */
6802 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6804 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
6808 /* 0xed27-0xed2d undefined */
6810 case 0xed2e: /* MAE - multiply and add */
6811 case 0xed2f: /* MSE - multiply and subtract */
6812 case 0xed38: /* MAYL - multiply and add unnormalized */
6813 case 0xed39: /* MYL - multiply unnormalized */
6814 case 0xed3c: /* MAYH - multiply and add unnormalized */
6815 case 0xed3d: /* MYH - multiply unnormalized */
6816 case 0xed3e: /* MAD - multiply and add */
6817 case 0xed3f: /* MSD - multiply and subtract */
6818 /* float destination [RXF] */
6819 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6823 /* 0xed30-0xed33 undefined */
6824 /* 0xed36 undefined */
6826 case 0xed3a: /* MAY - multiply and add unnormalized */
6827 case 0xed3b: /* MY - multiply unnormalized */
6828 /* float pair destination [RXF] */
6829 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6831 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[8] | 2)))
6835 /* 0xed42-0xed47 undefind */
6837 case 0xed48: /* SLXT - shift significand left */
6838 case 0xed49: /* SRXT - shift significand right */
6839 case 0xedab: /* CXZT - convert from zoned */
6840 case 0xedaf: /* CXPT - convert from packed */
6841 /* float pair destination [RXF] + fpc */
6842 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6844 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[8] | 2)))
6846 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6850 /* 0xed4a-0xed4f undefind */
6851 /* 0xed52-0xed53 undefind */
6852 /* 0xed56-0xed57 undefind */
6853 /* 0xed5a-0xed63 undefind */
6854 /* 0xed68-0xeda7 undefined */
6856 case 0xeda8: /* CZDT - convert to zoned */
6857 case 0xeda9: /* CZXT - convert to zoned */
6858 case 0xedac: /* CPDT - convert to packed */
6859 case 0xedad: /* CPXT - convert to packed */
6860 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6861 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
6863 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6867 /* 0xedb0-0xedff undefined */
6874 /* 0xe4 undefined */
6877 /* SSE/SIL-format instruction */
6880 /* 0xe500-0xe543 undefined, privileged, or unsupported */
6882 case 0xe544: /* MVHHI - move */
6883 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6884 if (record_full_arch_list_add_mem (oaddr
, 2))
6888 /* 0xe545-0xe547 undefined */
6890 case 0xe548: /* MVGHI - move */
6891 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6892 if (record_full_arch_list_add_mem (oaddr
, 8))
6896 /* 0xe549-0xe54b undefined */
6898 case 0xe54c: /* MVHI - move */
6899 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6900 if (record_full_arch_list_add_mem (oaddr
, 4))
6904 /* 0xe54d-0xe553 undefined */
6906 case 0xe554: /* CHHSI - compare halfword immediate */
6907 case 0xe555: /* CLHHSI - compare logical immediate */
6908 case 0xe558: /* CGHSI - compare halfword immediate */
6909 case 0xe559: /* CLGHSI - compare logical immediate */
6910 case 0xe55c: /* CHSI - compare halfword immediate */
6911 case 0xe55d: /* CLFHSI - compare logical immediate */
6912 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6916 /* 0xe556-0xe557 undefined */
6917 /* 0xe55a-0xe55b undefined */
6918 /* 0xe55e-0xe55f undefined */
6920 case 0xe560: /* TBEGIN - transaction begin */
6921 /* The transaction will be immediately aborted after this
6922 instruction, due to single-stepping. This instruction is
6923 only supported so that the program can fail a few times
6924 and go to the non-transactional fallback. */
6927 /* Transaction diagnostic block - user. */
6928 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6929 if (record_full_arch_list_add_mem (oaddr
, 256))
6932 /* Transaction diagnostic block - supervisor. */
6933 if (record_full_arch_list_add_reg (regcache
, S390_TDB_DWORD0_REGNUM
))
6935 if (record_full_arch_list_add_reg (regcache
, S390_TDB_ABORT_CODE_REGNUM
))
6937 if (record_full_arch_list_add_reg (regcache
, S390_TDB_CONFLICT_TOKEN_REGNUM
))
6939 if (record_full_arch_list_add_reg (regcache
, S390_TDB_ATIA_REGNUM
))
6941 for (i
= 0; i
< 16; i
++)
6942 if (record_full_arch_list_add_reg (regcache
, S390_TDB_R0_REGNUM
+ i
))
6945 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6949 /* 0xe561 unsupported: TBEGINC */
6950 /* 0xe562-0xe5ff undefined */
6957 /* 0xe6 undefined */
6960 /* RIE/RIS/RRS-format instruction */
6961 switch (ibyte
[0] << 8 | ibyte
[5])
6963 /* 0xec00-0xec41 undefined */
6965 case 0xec42: /* LOCHI - load halfword immediate on condition */
6966 case 0xec51: /* RISBLG - rotate then insert selected bits low */
6967 /* 32-bit or native gpr destination */
6968 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6972 /* 0xec43 undefined */
6974 case 0xec44: /* BRXHG - branch relative on index high */
6975 case 0xec45: /* BRXLG - branch relative on index low or equal */
6976 case 0xec46: /* LOCGHI - load halfword immediate on condition */
6977 case 0xec59: /* RISBGN - rotate then insert selected bits */
6978 /* 64-bit gpr destination */
6979 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6983 /* 0xec47-0xec4d undefined */
6985 case 0xec4e: /* LOCHHI - load halfword immediate on condition */
6986 case 0xec5d: /* RISBHG - rotate then insert selected bits high */
6987 /* 32-bit high gpr destination */
6988 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6992 /* 0xec4f-0xec50 undefined */
6993 /* 0xec52-0xec53 undefined */
6995 case 0xec54: /* RNSBG - rotate then and selected bits */
6996 case 0xec55: /* RISBG - rotate then insert selected bits */
6997 case 0xec56: /* ROSBG - rotate then or selected bits */
6998 case 0xec57: /* RXSBG - rotate then xor selected bits */
6999 case 0xecd9: /* AGHIK - add immediate */
7000 case 0xecdb: /* ALGHSIK - add logical immediate */
7001 /* 64-bit gpr destination + flags */
7002 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
7004 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7008 /* 0xec58 undefined */
7009 /* 0xec5a-0xec5c undefined */
7010 /* 0xec5e-0xec63 undefined */
7012 case 0xec64: /* CGRJ - compare and branch relative */
7013 case 0xec65: /* CLGRJ - compare logical and branch relative */
7014 case 0xec76: /* CRJ - compare and branch relative */
7015 case 0xec77: /* CLRJ - compare logical and branch relative */
7016 case 0xec7c: /* CGIJ - compare immediate and branch relative */
7017 case 0xec7d: /* CLGIJ - compare logical immediate and branch relative */
7018 case 0xec7e: /* CIJ - compare immediate and branch relative */
7019 case 0xec7f: /* CLIJ - compare logical immediate and branch relative */
7020 case 0xece4: /* CGRB - compare and branch */
7021 case 0xece5: /* CLGRB - compare logical and branch */
7022 case 0xecf6: /* CRB - compare and branch */
7023 case 0xecf7: /* CLRB - compare logical and branch */
7024 case 0xecfc: /* CGIB - compare immediate and branch */
7025 case 0xecfd: /* CLGIB - compare logical immediate and branch */
7026 case 0xecfe: /* CIB - compare immediate and branch */
7027 case 0xecff: /* CLIB - compare logical immediate and branch */
7030 /* 0xec66-0xec6f undefined */
7032 case 0xec70: /* CGIT - compare immediate and trap */
7033 case 0xec71: /* CLGIT - compare logical immediate and trap */
7034 case 0xec72: /* CIT - compare immediate and trap */
7035 case 0xec73: /* CLFIT - compare logical immediate and trap */
7036 /* fpc only - including possible DXC write for trapping insns */
7037 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7041 /* 0xec74-0xec75 undefined */
7042 /* 0xec78-0xec7b undefined */
7044 /* 0xec80-0xecd7 undefined */
7046 case 0xecd8: /* AHIK - add immediate */
7047 case 0xecda: /* ALHSIK - add logical immediate */
7048 /* 32-bit gpr destination + flags */
7049 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
7051 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7055 /* 0xecdc-0xece3 undefined */
7056 /* 0xece6-0xecf5 undefined */
7057 /* 0xecf8-0xecfb undefined */
7064 case 0xee: /* PLO - perform locked operation */
7065 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
7066 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7067 oaddr2
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[2], 0);
7070 uint8_t fc
= tmp
& 0xff;
7076 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
7079 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
7083 case 0x01: /* CLG */
7085 if (record_full_arch_list_add_mem (oaddr2
+ 0x08, 8))
7088 if (record_full_arch_list_add_mem (oaddr2
+ 0x28, 8))
7092 case 0x02: /* CLGR */
7094 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
7097 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
7101 case 0x03: /* CLX */
7103 if (record_full_arch_list_add_mem (oaddr2
+ 0x00, 16))
7106 if (record_full_arch_list_add_mem (oaddr2
+ 0x20, 16))
7110 case 0x08: /* DCS */
7112 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
7115 case 0x0c: /* CSST */
7117 if (record_full_arch_list_add_mem (oaddr2
, 4))
7121 case 0x14: /* CSTST */
7123 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7125 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7126 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7127 if (record_full_arch_list_add_mem (oaddr3
, 4))
7130 case 0x10: /* CSDST */
7132 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7134 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7135 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7136 if (record_full_arch_list_add_mem (oaddr3
, 4))
7139 if (target_read_memory (oaddr2
+ 0x48, 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))
7149 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
7152 if (record_full_arch_list_add_mem (oaddr
, 4))
7156 case 0x09: /* DCSG */
7158 if (record_full_arch_list_add_mem (oaddr2
+ 0x28, 8))
7162 case 0x15: /* CSTSTG */
7164 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7166 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7167 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7168 if (record_full_arch_list_add_mem (oaddr3
, 8))
7171 case 0x11: /* CSDSTG */
7173 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7175 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7176 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7177 if (record_full_arch_list_add_mem (oaddr3
, 8))
7180 case 0x0d: /* CSSTG */
7183 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
7185 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7186 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7187 if (record_full_arch_list_add_mem (oaddr3
, 8))
7190 case 0x05: /* CSG */
7192 if (record_full_arch_list_add_mem (oaddr2
+ 0x08, 8))
7195 if (record_full_arch_list_add_mem (oaddr
, 8))
7199 case 0x0a: /* DCSGR */
7201 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
7204 case 0x0e: /* CSSTGR */
7206 if (record_full_arch_list_add_mem (oaddr2
, 8))
7210 case 0x16: /* CSTSTGR */
7212 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7214 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7215 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7216 if (record_full_arch_list_add_mem (oaddr3
, 8))
7219 case 0x12: /* CSDSTGR */
7221 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7223 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7224 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7225 if (record_full_arch_list_add_mem (oaddr3
, 8))
7228 if (target_read_memory (oaddr2
+ 0x48, 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 case 0x06: /* CSGR */
7238 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
7241 if (record_full_arch_list_add_mem (oaddr
, 8))
7245 case 0x0b: /* DCSX */
7247 if (record_full_arch_list_add_mem (oaddr2
+ 0x20, 16))
7251 case 0x17: /* CSTSTX */
7253 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
7255 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7256 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7257 if (record_full_arch_list_add_mem (oaddr3
, 16))
7260 case 0x13: /* CSDSTX */
7262 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
7264 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7265 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7266 if (record_full_arch_list_add_mem (oaddr3
, 16))
7269 case 0x0f: /* CSSTX */
7272 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
7274 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
7275 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
7276 if (record_full_arch_list_add_mem (oaddr3
, 16))
7279 case 0x07: /* CSX */
7281 if (record_full_arch_list_add_mem (oaddr2
+ 0x00, 16))
7284 if (record_full_arch_list_add_mem (oaddr
, 16))
7289 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PLO FC %02x at %s.\n",
7290 fc
, paddress (gdbarch
, addr
));
7294 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7298 case 0xef: /* LMD - load multiple disjoint */
7299 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
7300 if (s390_record_gpr_g (gdbarch
, regcache
, i
))
7302 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
7306 case 0xf0: /* SRP - shift and round decimal */
7307 case 0xf8: /* ZAP - zero and add */
7308 case 0xfa: /* AP - add decimal */
7309 case 0xfb: /* SP - subtract decimal */
7310 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7311 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
7313 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7315 /* DXC may be written */
7316 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7320 case 0xf1: /* MVO - move with offset */
7321 case 0xf2: /* PACK - pack */
7322 case 0xf3: /* UNPK - unpack */
7323 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7324 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
7328 /* 0xf4-0xf7 undefined */
7330 case 0xf9: /* CP - compare decimal */
7331 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
7333 /* DXC may be written */
7334 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7338 case 0xfc: /* MP - multiply decimal */
7339 case 0xfd: /* DP - divide decimal */
7340 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
7341 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
7343 /* DXC may be written */
7344 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
7348 /* 0xfe-0xff undefined */
7352 fprintf_unfiltered (gdb_stdlog
, "Warning: Don't know how to record %04x "
7353 "at %s.\n", insn
[0], paddress (gdbarch
, addr
));
7357 if (record_full_arch_list_add_reg (regcache
, S390_PSWA_REGNUM
))
7359 if (record_full_arch_list_add_end ())
7364 /* Initialize linux_record_tdep if not initialized yet. */
7367 s390_init_linux_record_tdep (struct linux_record_tdep
*record_tdep
,
7368 enum s390_abi_kind abi
)
7370 /* These values are the size of the type that will be used in a system
7371 call. They are obtained from Linux Kernel source. */
7373 if (abi
== ABI_LINUX_ZSERIES
)
7375 record_tdep
->size_pointer
= 8;
7376 /* no _old_kernel_stat */
7377 record_tdep
->size_tms
= 32;
7378 record_tdep
->size_loff_t
= 8;
7379 record_tdep
->size_flock
= 32;
7380 record_tdep
->size_ustat
= 32;
7381 record_tdep
->size_old_sigaction
= 32;
7382 record_tdep
->size_old_sigset_t
= 8;
7383 record_tdep
->size_rlimit
= 16;
7384 record_tdep
->size_rusage
= 144;
7385 record_tdep
->size_timeval
= 16;
7386 record_tdep
->size_timezone
= 8;
7387 /* old_[ug]id_t never used */
7388 record_tdep
->size_fd_set
= 128;
7389 record_tdep
->size_old_dirent
= 280;
7390 record_tdep
->size_statfs
= 88;
7391 record_tdep
->size_statfs64
= 88;
7392 record_tdep
->size_sockaddr
= 16;
7393 record_tdep
->size_int
= 4;
7394 record_tdep
->size_long
= 8;
7395 record_tdep
->size_ulong
= 8;
7396 record_tdep
->size_msghdr
= 56;
7397 record_tdep
->size_itimerval
= 32;
7398 record_tdep
->size_stat
= 144;
7399 /* old_utsname unused */
7400 record_tdep
->size_sysinfo
= 112;
7401 record_tdep
->size_msqid_ds
= 120;
7402 record_tdep
->size_shmid_ds
= 112;
7403 record_tdep
->size_new_utsname
= 390;
7404 record_tdep
->size_timex
= 208;
7405 record_tdep
->size_mem_dqinfo
= 24;
7406 record_tdep
->size_if_dqblk
= 72;
7407 record_tdep
->size_fs_quota_stat
= 80;
7408 record_tdep
->size_timespec
= 16;
7409 record_tdep
->size_pollfd
= 8;
7410 record_tdep
->size_NFS_FHSIZE
= 32;
7411 record_tdep
->size_knfsd_fh
= 132;
7412 record_tdep
->size_TASK_COMM_LEN
= 16;
7413 record_tdep
->size_sigaction
= 32;
7414 record_tdep
->size_sigset_t
= 8;
7415 record_tdep
->size_siginfo_t
= 128;
7416 record_tdep
->size_cap_user_data_t
= 12;
7417 record_tdep
->size_stack_t
= 24;
7418 record_tdep
->size_off_t
= 8;
7420 record_tdep
->size_gid_t
= 4;
7421 record_tdep
->size_uid_t
= 4;
7422 record_tdep
->size_PAGE_SIZE
= 0x1000; /* 4KB */
7423 record_tdep
->size_flock64
= 32;
7424 record_tdep
->size_io_event
= 32;
7425 record_tdep
->size_iocb
= 64;
7426 record_tdep
->size_epoll_event
= 16;
7427 record_tdep
->size_itimerspec
= 32;
7428 record_tdep
->size_mq_attr
= 64;
7429 record_tdep
->size_termios
= 36;
7430 record_tdep
->size_termios2
= 44;
7431 record_tdep
->size_pid_t
= 4;
7432 record_tdep
->size_winsize
= 8;
7433 record_tdep
->size_serial_struct
= 72;
7434 record_tdep
->size_serial_icounter_struct
= 80;
7435 record_tdep
->size_size_t
= 8;
7436 record_tdep
->size_iovec
= 16;
7437 record_tdep
->size_time_t
= 8;
7439 else if (abi
== ABI_LINUX_S390
)
7441 record_tdep
->size_pointer
= 4;
7442 record_tdep
->size__old_kernel_stat
= 32;
7443 record_tdep
->size_tms
= 16;
7444 record_tdep
->size_loff_t
= 8;
7445 record_tdep
->size_flock
= 16;
7446 record_tdep
->size_ustat
= 20;
7447 record_tdep
->size_old_sigaction
= 16;
7448 record_tdep
->size_old_sigset_t
= 4;
7449 record_tdep
->size_rlimit
= 8;
7450 record_tdep
->size_rusage
= 72;
7451 record_tdep
->size_timeval
= 8;
7452 record_tdep
->size_timezone
= 8;
7453 record_tdep
->size_old_gid_t
= 2;
7454 record_tdep
->size_old_uid_t
= 2;
7455 record_tdep
->size_fd_set
= 128;
7456 record_tdep
->size_old_dirent
= 268;
7457 record_tdep
->size_statfs
= 64;
7458 record_tdep
->size_statfs64
= 88;
7459 record_tdep
->size_sockaddr
= 16;
7460 record_tdep
->size_int
= 4;
7461 record_tdep
->size_long
= 4;
7462 record_tdep
->size_ulong
= 4;
7463 record_tdep
->size_msghdr
= 28;
7464 record_tdep
->size_itimerval
= 16;
7465 record_tdep
->size_stat
= 64;
7466 /* old_utsname unused */
7467 record_tdep
->size_sysinfo
= 64;
7468 record_tdep
->size_msqid_ds
= 88;
7469 record_tdep
->size_shmid_ds
= 84;
7470 record_tdep
->size_new_utsname
= 390;
7471 record_tdep
->size_timex
= 128;
7472 record_tdep
->size_mem_dqinfo
= 24;
7473 record_tdep
->size_if_dqblk
= 72;
7474 record_tdep
->size_fs_quota_stat
= 80;
7475 record_tdep
->size_timespec
= 8;
7476 record_tdep
->size_pollfd
= 8;
7477 record_tdep
->size_NFS_FHSIZE
= 32;
7478 record_tdep
->size_knfsd_fh
= 132;
7479 record_tdep
->size_TASK_COMM_LEN
= 16;
7480 record_tdep
->size_sigaction
= 20;
7481 record_tdep
->size_sigset_t
= 8;
7482 record_tdep
->size_siginfo_t
= 128;
7483 record_tdep
->size_cap_user_data_t
= 12;
7484 record_tdep
->size_stack_t
= 12;
7485 record_tdep
->size_off_t
= 4;
7486 record_tdep
->size_stat64
= 104;
7487 record_tdep
->size_gid_t
= 4;
7488 record_tdep
->size_uid_t
= 4;
7489 record_tdep
->size_PAGE_SIZE
= 0x1000; /* 4KB */
7490 record_tdep
->size_flock64
= 32;
7491 record_tdep
->size_io_event
= 32;
7492 record_tdep
->size_iocb
= 64;
7493 record_tdep
->size_epoll_event
= 16;
7494 record_tdep
->size_itimerspec
= 16;
7495 record_tdep
->size_mq_attr
= 32;
7496 record_tdep
->size_termios
= 36;
7497 record_tdep
->size_termios2
= 44;
7498 record_tdep
->size_pid_t
= 4;
7499 record_tdep
->size_winsize
= 8;
7500 record_tdep
->size_serial_struct
= 60;
7501 record_tdep
->size_serial_icounter_struct
= 80;
7502 record_tdep
->size_size_t
= 4;
7503 record_tdep
->size_iovec
= 8;
7504 record_tdep
->size_time_t
= 4;
7507 /* These values are the second argument of system call "sys_fcntl"
7508 and "sys_fcntl64". They are obtained from Linux Kernel source. */
7509 record_tdep
->fcntl_F_GETLK
= 5;
7510 record_tdep
->fcntl_F_GETLK64
= 12;
7511 record_tdep
->fcntl_F_SETLK64
= 13;
7512 record_tdep
->fcntl_F_SETLKW64
= 14;
7514 record_tdep
->arg1
= S390_R2_REGNUM
;
7515 record_tdep
->arg2
= S390_R3_REGNUM
;
7516 record_tdep
->arg3
= S390_R4_REGNUM
;
7517 record_tdep
->arg4
= S390_R5_REGNUM
;
7518 record_tdep
->arg5
= S390_R6_REGNUM
;
7520 /* These values are the second argument of system call "sys_ioctl".
7521 They are obtained from Linux Kernel source.
7522 See arch/s390/include/uapi/asm/ioctls.h. */
7524 record_tdep
->ioctl_TCGETS
= 0x5401;
7525 record_tdep
->ioctl_TCSETS
= 0x5402;
7526 record_tdep
->ioctl_TCSETSW
= 0x5403;
7527 record_tdep
->ioctl_TCSETSF
= 0x5404;
7528 record_tdep
->ioctl_TCGETA
= 0x5405;
7529 record_tdep
->ioctl_TCSETA
= 0x5406;
7530 record_tdep
->ioctl_TCSETAW
= 0x5407;
7531 record_tdep
->ioctl_TCSETAF
= 0x5408;
7532 record_tdep
->ioctl_TCSBRK
= 0x5409;
7533 record_tdep
->ioctl_TCXONC
= 0x540a;
7534 record_tdep
->ioctl_TCFLSH
= 0x540b;
7535 record_tdep
->ioctl_TIOCEXCL
= 0x540c;
7536 record_tdep
->ioctl_TIOCNXCL
= 0x540d;
7537 record_tdep
->ioctl_TIOCSCTTY
= 0x540e;
7538 record_tdep
->ioctl_TIOCGPGRP
= 0x540f;
7539 record_tdep
->ioctl_TIOCSPGRP
= 0x5410;
7540 record_tdep
->ioctl_TIOCOUTQ
= 0x5411;
7541 record_tdep
->ioctl_TIOCSTI
= 0x5412;
7542 record_tdep
->ioctl_TIOCGWINSZ
= 0x5413;
7543 record_tdep
->ioctl_TIOCSWINSZ
= 0x5414;
7544 record_tdep
->ioctl_TIOCMGET
= 0x5415;
7545 record_tdep
->ioctl_TIOCMBIS
= 0x5416;
7546 record_tdep
->ioctl_TIOCMBIC
= 0x5417;
7547 record_tdep
->ioctl_TIOCMSET
= 0x5418;
7548 record_tdep
->ioctl_TIOCGSOFTCAR
= 0x5419;
7549 record_tdep
->ioctl_TIOCSSOFTCAR
= 0x541a;
7550 record_tdep
->ioctl_FIONREAD
= 0x541b;
7551 record_tdep
->ioctl_TIOCINQ
= 0x541b; /* alias */
7552 record_tdep
->ioctl_TIOCLINUX
= 0x541c;
7553 record_tdep
->ioctl_TIOCCONS
= 0x541d;
7554 record_tdep
->ioctl_TIOCGSERIAL
= 0x541e;
7555 record_tdep
->ioctl_TIOCSSERIAL
= 0x541f;
7556 record_tdep
->ioctl_TIOCPKT
= 0x5420;
7557 record_tdep
->ioctl_FIONBIO
= 0x5421;
7558 record_tdep
->ioctl_TIOCNOTTY
= 0x5422;
7559 record_tdep
->ioctl_TIOCSETD
= 0x5423;
7560 record_tdep
->ioctl_TIOCGETD
= 0x5424;
7561 record_tdep
->ioctl_TCSBRKP
= 0x5425;
7562 record_tdep
->ioctl_TIOCSBRK
= 0x5427;
7563 record_tdep
->ioctl_TIOCCBRK
= 0x5428;
7564 record_tdep
->ioctl_TIOCGSID
= 0x5429;
7565 record_tdep
->ioctl_TCGETS2
= 0x802c542a;
7566 record_tdep
->ioctl_TCSETS2
= 0x402c542b;
7567 record_tdep
->ioctl_TCSETSW2
= 0x402c542c;
7568 record_tdep
->ioctl_TCSETSF2
= 0x402c542d;
7569 record_tdep
->ioctl_TIOCGPTN
= 0x80045430;
7570 record_tdep
->ioctl_TIOCSPTLCK
= 0x40045431;
7571 record_tdep
->ioctl_FIONCLEX
= 0x5450;
7572 record_tdep
->ioctl_FIOCLEX
= 0x5451;
7573 record_tdep
->ioctl_FIOASYNC
= 0x5452;
7574 record_tdep
->ioctl_TIOCSERCONFIG
= 0x5453;
7575 record_tdep
->ioctl_TIOCSERGWILD
= 0x5454;
7576 record_tdep
->ioctl_TIOCSERSWILD
= 0x5455;
7577 record_tdep
->ioctl_TIOCGLCKTRMIOS
= 0x5456;
7578 record_tdep
->ioctl_TIOCSLCKTRMIOS
= 0x5457;
7579 record_tdep
->ioctl_TIOCSERGSTRUCT
= 0x5458;
7580 record_tdep
->ioctl_TIOCSERGETLSR
= 0x5459;
7581 record_tdep
->ioctl_TIOCSERGETMULTI
= 0x545a;
7582 record_tdep
->ioctl_TIOCSERSETMULTI
= 0x545b;
7583 record_tdep
->ioctl_TIOCMIWAIT
= 0x545c;
7584 record_tdep
->ioctl_TIOCGICOUNT
= 0x545d;
7585 record_tdep
->ioctl_FIOQSIZE
= 0x545e;
7588 /* Set up gdbarch struct. */
7590 static struct gdbarch
*
7591 s390_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
7593 const struct target_desc
*tdesc
= info
.target_desc
;
7594 struct tdesc_arch_data
*tdesc_data
= NULL
;
7595 struct gdbarch
*gdbarch
;
7596 struct gdbarch_tdep
*tdep
;
7597 enum s390_abi_kind tdep_abi
;
7598 enum s390_vector_abi_kind vector_abi
;
7600 int have_linux_v1
= 0;
7601 int have_linux_v2
= 0;
7604 int first_pseudo_reg
, last_pseudo_reg
;
7605 static const char *const stap_register_prefixes
[] = { "%", NULL
};
7606 static const char *const stap_register_indirection_prefixes
[] = { "(",
7608 static const char *const stap_register_indirection_suffixes
[] = { ")",
7611 /* Default ABI and register size. */
7612 switch (info
.bfd_arch_info
->mach
)
7614 case bfd_mach_s390_31
:
7615 tdep_abi
= ABI_LINUX_S390
;
7618 case bfd_mach_s390_64
:
7619 tdep_abi
= ABI_LINUX_ZSERIES
;
7626 /* Use default target description if none provided by the target. */
7627 if (!tdesc_has_registers (tdesc
))
7629 if (tdep_abi
== ABI_LINUX_S390
)
7630 tdesc
= tdesc_s390_linux32
;
7632 tdesc
= tdesc_s390x_linux64
;
7635 /* Check any target description for validity. */
7636 if (tdesc_has_registers (tdesc
))
7638 static const char *const gprs
[] = {
7639 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
7640 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
7642 static const char *const fprs
[] = {
7643 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
7644 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
7646 static const char *const acrs
[] = {
7647 "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
7648 "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15"
7650 static const char *const gprs_lower
[] = {
7651 "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l",
7652 "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
7654 static const char *const gprs_upper
[] = {
7655 "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
7656 "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
7658 static const char *const tdb_regs
[] = {
7659 "tdb0", "tac", "tct", "atia",
7660 "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
7661 "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
7663 static const char *const vxrs_low
[] = {
7664 "v0l", "v1l", "v2l", "v3l", "v4l", "v5l", "v6l", "v7l", "v8l",
7665 "v9l", "v10l", "v11l", "v12l", "v13l", "v14l", "v15l",
7667 static const char *const vxrs_high
[] = {
7668 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24",
7669 "v25", "v26", "v27", "v28", "v29", "v30", "v31",
7671 const struct tdesc_feature
*feature
;
7674 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.core");
7675 if (feature
== NULL
)
7678 tdesc_data
= tdesc_data_alloc ();
7680 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7681 S390_PSWM_REGNUM
, "pswm");
7682 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7683 S390_PSWA_REGNUM
, "pswa");
7685 if (tdesc_unnumbered_register (feature
, "r0"))
7687 for (i
= 0; i
< 16; i
++)
7688 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7689 S390_R0_REGNUM
+ i
, gprs
[i
]);
7695 for (i
= 0; i
< 16; i
++)
7696 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7699 for (i
= 0; i
< 16; i
++)
7700 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7701 S390_R0_UPPER_REGNUM
+ i
,
7705 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.fpr");
7706 if (feature
== NULL
)
7708 tdesc_data_cleanup (tdesc_data
);
7712 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7713 S390_FPC_REGNUM
, "fpc");
7714 for (i
= 0; i
< 16; i
++)
7715 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7716 S390_F0_REGNUM
+ i
, fprs
[i
]);
7718 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.acr");
7719 if (feature
== NULL
)
7721 tdesc_data_cleanup (tdesc_data
);
7725 for (i
= 0; i
< 16; i
++)
7726 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7727 S390_A0_REGNUM
+ i
, acrs
[i
]);
7729 /* Optional GNU/Linux-specific "registers". */
7730 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.linux");
7733 tdesc_numbered_register (feature
, tdesc_data
,
7734 S390_ORIG_R2_REGNUM
, "orig_r2");
7736 if (tdesc_numbered_register (feature
, tdesc_data
,
7737 S390_LAST_BREAK_REGNUM
, "last_break"))
7740 if (tdesc_numbered_register (feature
, tdesc_data
,
7741 S390_SYSTEM_CALL_REGNUM
, "system_call"))
7744 if (have_linux_v2
> have_linux_v1
)
7748 /* Transaction diagnostic block. */
7749 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.tdb");
7752 for (i
= 0; i
< ARRAY_SIZE (tdb_regs
); i
++)
7753 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7754 S390_TDB_DWORD0_REGNUM
+ i
,
7759 /* Vector registers. */
7760 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.vx");
7763 for (i
= 0; i
< 16; i
++)
7764 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7765 S390_V0_LOWER_REGNUM
+ i
,
7767 for (i
= 0; i
< 16; i
++)
7768 valid_p
&= tdesc_numbered_register (feature
, tdesc_data
,
7769 S390_V16_REGNUM
+ i
,
7776 tdesc_data_cleanup (tdesc_data
);
7781 /* Determine vector ABI. */
7782 vector_abi
= S390_VECTOR_ABI_NONE
;
7785 && info
.abfd
!= NULL
7786 && info
.abfd
->format
== bfd_object
7787 && bfd_get_flavour (info
.abfd
) == bfd_target_elf_flavour
7788 && bfd_elf_get_obj_attr_int (info
.abfd
, OBJ_ATTR_GNU
,
7789 Tag_GNU_S390_ABI_Vector
) == 2)
7790 vector_abi
= S390_VECTOR_ABI_128
;
7793 /* Find a candidate among extant architectures. */
7794 for (arches
= gdbarch_list_lookup_by_info (arches
, &info
);
7796 arches
= gdbarch_list_lookup_by_info (arches
->next
, &info
))
7798 tdep
= gdbarch_tdep (arches
->gdbarch
);
7801 if (tdep
->abi
!= tdep_abi
)
7803 if (tdep
->vector_abi
!= vector_abi
)
7805 if ((tdep
->gpr_full_regnum
!= -1) != have_upper
)
7807 if (tdesc_data
!= NULL
)
7808 tdesc_data_cleanup (tdesc_data
);
7809 return arches
->gdbarch
;
7812 /* Otherwise create a new gdbarch for the specified machine type. */
7813 tdep
= XCNEW (struct gdbarch_tdep
);
7814 tdep
->abi
= tdep_abi
;
7815 tdep
->vector_abi
= vector_abi
;
7816 tdep
->have_linux_v1
= have_linux_v1
;
7817 tdep
->have_linux_v2
= have_linux_v2
;
7818 tdep
->have_tdb
= have_tdb
;
7819 gdbarch
= gdbarch_alloc (&info
, tdep
);
7821 set_gdbarch_believe_pcc_promotion (gdbarch
, 0);
7822 set_gdbarch_char_signed (gdbarch
, 0);
7824 /* S/390 GNU/Linux uses either 64-bit or 128-bit long doubles.
7825 We can safely let them default to 128-bit, since the debug info
7826 will give the size of type actually used in each case. */
7827 set_gdbarch_long_double_bit (gdbarch
, 128);
7828 set_gdbarch_long_double_format (gdbarch
, floatformats_ia64_quad
);
7830 /* Amount PC must be decremented by after a breakpoint. This is
7831 often the number of bytes returned by gdbarch_breakpoint_from_pc but not
7833 set_gdbarch_decr_pc_after_break (gdbarch
, 2);
7834 /* Stack grows downward. */
7835 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
7836 set_gdbarch_breakpoint_from_pc (gdbarch
, s390_breakpoint_from_pc
);
7837 set_gdbarch_software_single_step (gdbarch
, s390_software_single_step
);
7838 set_gdbarch_displaced_step_hw_singlestep (gdbarch
, s390_displaced_step_hw_singlestep
);
7839 set_gdbarch_skip_prologue (gdbarch
, s390_skip_prologue
);
7840 set_gdbarch_stack_frame_destroyed_p (gdbarch
, s390_stack_frame_destroyed_p
);
7842 set_gdbarch_num_regs (gdbarch
, S390_NUM_REGS
);
7843 set_gdbarch_sp_regnum (gdbarch
, S390_SP_REGNUM
);
7844 set_gdbarch_fp0_regnum (gdbarch
, S390_F0_REGNUM
);
7845 set_gdbarch_stab_reg_to_regnum (gdbarch
, s390_dwarf_reg_to_regnum
);
7846 set_gdbarch_dwarf2_reg_to_regnum (gdbarch
, s390_dwarf_reg_to_regnum
);
7847 set_gdbarch_value_from_register (gdbarch
, s390_value_from_register
);
7848 set_gdbarch_core_read_description (gdbarch
, s390_core_read_description
);
7849 set_gdbarch_iterate_over_regset_sections (gdbarch
,
7850 s390_iterate_over_regset_sections
);
7851 set_gdbarch_cannot_store_register (gdbarch
, s390_cannot_store_register
);
7852 set_gdbarch_write_pc (gdbarch
, s390_write_pc
);
7853 set_gdbarch_pseudo_register_read (gdbarch
, s390_pseudo_register_read
);
7854 set_gdbarch_pseudo_register_write (gdbarch
, s390_pseudo_register_write
);
7855 set_tdesc_pseudo_register_name (gdbarch
, s390_pseudo_register_name
);
7856 set_tdesc_pseudo_register_type (gdbarch
, s390_pseudo_register_type
);
7857 set_tdesc_pseudo_register_reggroup_p (gdbarch
,
7858 s390_pseudo_register_reggroup_p
);
7859 tdesc_use_registers (gdbarch
, tdesc
, tdesc_data
);
7860 set_gdbarch_register_name (gdbarch
, s390_register_name
);
7862 /* Assign pseudo register numbers. */
7863 first_pseudo_reg
= gdbarch_num_regs (gdbarch
);
7864 last_pseudo_reg
= first_pseudo_reg
;
7865 tdep
->gpr_full_regnum
= -1;
7868 tdep
->gpr_full_regnum
= last_pseudo_reg
;
7869 last_pseudo_reg
+= 16;
7871 tdep
->v0_full_regnum
= -1;
7874 tdep
->v0_full_regnum
= last_pseudo_reg
;
7875 last_pseudo_reg
+= 16;
7877 tdep
->pc_regnum
= last_pseudo_reg
++;
7878 tdep
->cc_regnum
= last_pseudo_reg
++;
7879 set_gdbarch_pc_regnum (gdbarch
, tdep
->pc_regnum
);
7880 set_gdbarch_num_pseudo_regs (gdbarch
, last_pseudo_reg
- first_pseudo_reg
);
7882 /* Inferior function calls. */
7883 set_gdbarch_push_dummy_call (gdbarch
, s390_push_dummy_call
);
7884 set_gdbarch_dummy_id (gdbarch
, s390_dummy_id
);
7885 set_gdbarch_frame_align (gdbarch
, s390_frame_align
);
7886 set_gdbarch_return_value (gdbarch
, s390_return_value
);
7888 /* Syscall handling. */
7889 set_gdbarch_get_syscall_number (gdbarch
, s390_linux_get_syscall_number
);
7891 /* Frame handling. */
7892 dwarf2_frame_set_init_reg (gdbarch
, s390_dwarf2_frame_init_reg
);
7893 dwarf2_frame_set_adjust_regnum (gdbarch
, s390_adjust_frame_regnum
);
7894 dwarf2_append_unwinders (gdbarch
);
7895 frame_base_append_sniffer (gdbarch
, dwarf2_frame_base_sniffer
);
7896 frame_unwind_append_unwinder (gdbarch
, &s390_stub_frame_unwind
);
7897 frame_unwind_append_unwinder (gdbarch
, &s390_sigtramp_frame_unwind
);
7898 frame_unwind_append_unwinder (gdbarch
, &s390_frame_unwind
);
7899 frame_base_set_default (gdbarch
, &s390_frame_base
);
7900 set_gdbarch_unwind_pc (gdbarch
, s390_unwind_pc
);
7901 set_gdbarch_unwind_sp (gdbarch
, s390_unwind_sp
);
7903 /* Displaced stepping. */
7904 set_gdbarch_displaced_step_copy_insn (gdbarch
,
7905 s390_displaced_step_copy_insn
);
7906 set_gdbarch_displaced_step_fixup (gdbarch
, s390_displaced_step_fixup
);
7907 set_gdbarch_displaced_step_free_closure (gdbarch
,
7908 simple_displaced_step_free_closure
);
7909 set_gdbarch_displaced_step_location (gdbarch
, linux_displaced_step_location
);
7910 set_gdbarch_max_insn_length (gdbarch
, S390_MAX_INSTR_SIZE
);
7912 /* Note that GNU/Linux is the only OS supported on this
7914 linux_init_abi (info
, gdbarch
);
7918 case ABI_LINUX_S390
:
7919 set_gdbarch_addr_bits_remove (gdbarch
, s390_addr_bits_remove
);
7920 set_solib_svr4_fetch_link_map_offsets
7921 (gdbarch
, svr4_ilp32_fetch_link_map_offsets
);
7923 set_xml_syscall_file_name (gdbarch
, XML_SYSCALL_FILENAME_S390
);
7926 case ABI_LINUX_ZSERIES
:
7927 set_gdbarch_long_bit (gdbarch
, 64);
7928 set_gdbarch_long_long_bit (gdbarch
, 64);
7929 set_gdbarch_ptr_bit (gdbarch
, 64);
7930 set_solib_svr4_fetch_link_map_offsets
7931 (gdbarch
, svr4_lp64_fetch_link_map_offsets
);
7932 set_gdbarch_address_class_type_flags (gdbarch
,
7933 s390_address_class_type_flags
);
7934 set_gdbarch_address_class_type_flags_to_name (gdbarch
,
7935 s390_address_class_type_flags_to_name
);
7936 set_gdbarch_address_class_name_to_type_flags (gdbarch
,
7937 s390_address_class_name_to_type_flags
);
7938 set_xml_syscall_file_name (gdbarch
, XML_SYSCALL_FILENAME_S390X
);
7942 set_gdbarch_print_insn (gdbarch
, print_insn_s390
);
7944 set_gdbarch_skip_trampoline_code (gdbarch
, find_solib_trampoline_target
);
7946 /* Enable TLS support. */
7947 set_gdbarch_fetch_tls_load_module_address (gdbarch
,
7948 svr4_fetch_objfile_link_map
);
7950 /* SystemTap functions. */
7951 set_gdbarch_stap_register_prefixes (gdbarch
, stap_register_prefixes
);
7952 set_gdbarch_stap_register_indirection_prefixes (gdbarch
,
7953 stap_register_indirection_prefixes
);
7954 set_gdbarch_stap_register_indirection_suffixes (gdbarch
,
7955 stap_register_indirection_suffixes
);
7956 set_gdbarch_stap_is_single_operand (gdbarch
, s390_stap_is_single_operand
);
7957 set_gdbarch_gcc_target_options (gdbarch
, s390_gcc_target_options
);
7958 set_gdbarch_gnu_triplet_regexp (gdbarch
, s390_gnu_triplet_regexp
);
7960 /* Support reverse debugging. */
7962 set_gdbarch_process_record (gdbarch
, s390_process_record
);
7963 set_gdbarch_process_record_signal (gdbarch
, s390_linux_record_signal
);
7965 s390_init_linux_record_tdep (&s390_linux_record_tdep
, ABI_LINUX_S390
);
7966 s390_init_linux_record_tdep (&s390x_linux_record_tdep
, ABI_LINUX_ZSERIES
);
7972 extern initialize_file_ftype _initialize_s390_tdep
; /* -Wmissing-prototypes */
7975 _initialize_s390_tdep (void)
7977 /* Hook us into the gdbarch mechanism. */
7978 register_gdbarch_init (bfd_arch_s390
, s390_gdbarch_init
);
7980 /* Initialize the GNU/Linux target descriptions. */
7981 initialize_tdesc_s390_linux32 ();
7982 initialize_tdesc_s390_linux32v1 ();
7983 initialize_tdesc_s390_linux32v2 ();
7984 initialize_tdesc_s390_linux64 ();
7985 initialize_tdesc_s390_linux64v1 ();
7986 initialize_tdesc_s390_linux64v2 ();
7987 initialize_tdesc_s390_te_linux64 ();
7988 initialize_tdesc_s390_vx_linux64 ();
7989 initialize_tdesc_s390_tevx_linux64 ();
7990 initialize_tdesc_s390x_linux64 ();
7991 initialize_tdesc_s390x_linux64v1 ();
7992 initialize_tdesc_s390x_linux64v2 ();
7993 initialize_tdesc_s390x_te_linux64 ();
7994 initialize_tdesc_s390x_vx_linux64 ();
7995 initialize_tdesc_s390x_tevx_linux64 ();