GDB (xrefs)
/tmp/gdb-8.1/gdb/s390-linux-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for GDB, the GNU debugger.
2 
3  Copyright (C) 2001-2018 Free Software Foundation, Inc.
4 
5  Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
6  for IBM Deutschland Entwicklung GmbH, IBM Corporation.
7 
8  This file is part of GDB.
9 
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.
14 
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.
19 
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/>. */
22 
23 #include "defs.h"
24 #include "arch-utils.h"
25 #include "frame.h"
26 #include "inferior.h"
27 #include "infrun.h"
28 #include "symtab.h"
29 #include "target.h"
30 #include "gdbcore.h"
31 #include "gdbcmd.h"
32 #include "objfiles.h"
33 #include "regcache.h"
34 #include "trad-frame.h"
35 #include "frame-base.h"
36 #include "frame-unwind.h"
37 #include "dwarf2-frame.h"
38 #include "reggroups.h"
39 #include "regset.h"
40 #include "value.h"
41 #include "dis-asm.h"
42 #include "solib-svr4.h"
43 #include "prologue-value.h"
44 #include "linux-tdep.h"
45 #include "s390-linux-tdep.h"
46 #include "linux-record.h"
47 #include "record-full.h"
48 #include "auxv.h"
49 #include "xml-syscall.h"
50 
51 #include "stap-probe.h"
52 #include "ax.h"
53 #include "ax-gdb.h"
54 #include "user-regs.h"
55 #include "cli/cli-utils.h"
56 #include <ctype.h>
57 #include "elf/common.h"
58 #include "elf/s390.h"
59 #include "elf-bfd.h"
60 #include <algorithm>
61 
62 #include "features/s390-linux32.c"
65 #include "features/s390-linux64.c"
72 #include "features/s390x-linux64.c"
79 
80 #define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml"
81 #define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml"
82 
83 /* Holds the current set of options to be passed to the disassembler. */
85 
87 {
90 };
91 
93 {
96 };
97 
98 /* The tdep structure. */
99 
100 struct gdbarch_tdep
101 {
102  /* ABI version. */
104 
105  /* Vector ABI. */
107 
108  /* Pseudo register numbers. */
113 
116  int have_tdb;
117  bool have_gs;
118 };
119 
120 
121 /* ABI call-saved register information. */
122 
123 static int
125 {
126  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
127 
128  switch (tdep->abi)
129  {
130  case ABI_LINUX_S390:
133  || regnum == S390_A0_REGNUM)
134  return 1;
135 
136  break;
137 
138  case ABI_LINUX_ZSERIES:
142  return 1;
143 
144  break;
145  }
146 
147  return 0;
148 }
149 
150 static int
152 {
153  /* The last-break address is read-only. */
154  return regnum == S390_LAST_BREAK_REGNUM;
155 }
156 
157 static void
159 {
160  struct gdbarch *gdbarch = regcache->arch ();
161  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
162 
164 
165  /* Set special SYSTEM_CALL register to 0 to prevent the kernel from
166  messing with the PC we just installed, if we happen to be within
167  an interrupted system call that the kernel wants to restart.
168 
169  Note that after we return from the dummy call, the SYSTEM_CALL and
170  ORIG_R2 registers will be automatically restored, and the kernel
171  continues to restart the system call at this point. */
174 }
175 
176 /* The "guess_tracepoint_registers" gdbarch method. */
177 
178 static void
180  struct regcache *regcache,
181  CORE_ADDR addr)
182 {
183  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
185  gdb_byte *reg = (gdb_byte *) alloca (sz);
186  ULONGEST pswm, pswa;
187 
188  /* Set PSWA from the location and a default PSWM (the only part we're
189  unlikely to get right is the CC). */
190  if (tdep->abi == ABI_LINUX_S390)
191  {
192  /* 31-bit PSWA needs high bit set (it's very unlikely the target
193  was in 24-bit mode). */
194  pswa = addr | 0x80000000UL;
195  pswm = 0x070d0000UL;
196  }
197  else
198  {
199  pswa = addr;
200  pswm = 0x0705000180000000ULL;
201  }
202 
205 
208 }
209 
210 
211 /* DWARF Register Mapping. */
212 
213 static const short s390_dwarf_regmap[] =
214 {
215  /* 0-15: General Purpose Registers. */
220 
221  /* 16-31: Floating Point Registers / Vector Registers 0-15. */
226 
227  /* 32-47: Control Registers (not mapped). */
228  -1, -1, -1, -1, -1, -1, -1, -1,
229  -1, -1, -1, -1, -1, -1, -1, -1,
230 
231  /* 48-63: Access Registers. */
236 
237  /* 64-65: Program Status Word. */
240 
241  /* 66-67: Reserved. */
242  -1, -1,
243 
244  /* 68-83: Vector Registers 16-31. */
249 
250  /* End of "official" DWARF registers. The remainder of the map is
251  for GDB internal use only. */
252 
253  /* GPR Lower Half Access. */
258 };
259 
260 enum { s390_dwarf_reg_r0l = ARRAY_SIZE (s390_dwarf_regmap) - 16 };
261 
262 /* Convert DWARF register number REG to the appropriate register
263  number used by GDB. */
264 static int
266 {
267  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
268  int gdb_reg = -1;
269 
270  /* In a 32-on-64 debug scenario, debug info refers to the full
271  64-bit GPRs. Note that call frame information still refers to
272  the 32-bit lower halves, because s390_adjust_frame_regnum uses
273  special register numbers to access GPRs. */
274  if (tdep->gpr_full_regnum != -1 && reg >= 0 && reg < 16)
275  return tdep->gpr_full_regnum + reg;
276 
277  if (reg >= 0 && reg < ARRAY_SIZE (s390_dwarf_regmap))
278  gdb_reg = s390_dwarf_regmap[reg];
279 
280  if (tdep->v0_full_regnum == -1)
281  {
282  if (gdb_reg >= S390_V16_REGNUM && gdb_reg <= S390_V31_REGNUM)
283  gdb_reg = -1;
284  }
285  else
286  {
287  if (gdb_reg >= S390_F0_REGNUM && gdb_reg <= S390_F15_REGNUM)
288  gdb_reg = gdb_reg - S390_F0_REGNUM + tdep->v0_full_regnum;
289  }
290 
291  return gdb_reg;
292 }
293 
294 /* Translate a .eh_frame register to DWARF register, or adjust a
295  .debug_frame register. */
296 static int
297 s390_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
298 {
299  /* See s390_dwarf_reg_to_regnum for comments. */
300  return (num >= 0 && num < 16) ? num + s390_dwarf_reg_r0l : num;
301 }
302 
303 
304 /* Pseudo registers. */
305 
306 static int
308 {
309  return (tdep->gpr_full_regnum != -1
310  && regnum >= tdep->gpr_full_regnum
311  && regnum <= tdep->gpr_full_regnum + 15);
312 }
313 
314 /* Check whether REGNUM indicates a full vector register (v0-v15).
315  These pseudo-registers are composed of f0-f15 and v0l-v15l. */
316 
317 static int
319 {
320  return (tdep->v0_full_regnum != -1
321  && regnum >= tdep->v0_full_regnum
322  && regnum <= tdep->v0_full_regnum + 15);
323 }
324 
325 /* Return the name of register REGNO. Return the empty string for
326  registers that shouldn't be visible. */
327 
328 static const char *
330 {
333  return "";
335 }
336 
337 static const char *
339 {
340  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
341 
342  if (regnum == tdep->pc_regnum)
343  return "pc";
344 
345  if (regnum == tdep->cc_regnum)
346  return "cc";
347 
348  if (regnum_is_gpr_full (tdep, regnum))
349  {
350  static const char *full_name[] = {
351  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
352  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
353  };
354  return full_name[regnum - tdep->gpr_full_regnum];
355  }
356 
357  if (regnum_is_vxr_full (tdep, regnum))
358  {
359  static const char *full_name[] = {
360  "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
361  "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15"
362  };
363  return full_name[regnum - tdep->v0_full_regnum];
364  }
365 
366  internal_error (__FILE__, __LINE__, _("invalid regnum"));
367 }
368 
369 static struct type *
371 {
372  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
373 
374  if (regnum == tdep->pc_regnum)
376 
377  if (regnum == tdep->cc_regnum)
378  return builtin_type (gdbarch)->builtin_int;
379 
380  if (regnum_is_gpr_full (tdep, regnum))
382 
383  if (regnum_is_vxr_full (tdep, regnum))
384  return tdesc_find_type (gdbarch, "vec128");
385 
386  internal_error (__FILE__, __LINE__, _("invalid regnum"));
387 }
388 
389 static enum register_status
391  int regnum, gdb_byte *buf)
392 {
393  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
394  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
395  int regsize = register_size (gdbarch, regnum);
396  ULONGEST val;
397 
398  if (regnum == tdep->pc_regnum)
399  {
400  enum register_status status;
401 
403  if (status == REG_VALID)
404  {
406  val &= 0x7fffffff;
407  store_unsigned_integer (buf, regsize, byte_order, val);
408  }
409  return status;
410  }
411 
412  if (regnum == tdep->cc_regnum)
413  {
414  enum register_status status;
415 
417  if (status == REG_VALID)
418  {
420  val = (val >> 12) & 3;
421  else
422  val = (val >> 44) & 3;
423  store_unsigned_integer (buf, regsize, byte_order, val);
424  }
425  return status;
426  }
427 
428  if (regnum_is_gpr_full (tdep, regnum))
429  {
430  enum register_status status;
431  ULONGEST val_upper;
432 
433  regnum -= tdep->gpr_full_regnum;
434 
436  if (status == REG_VALID)
438  &val_upper);
439  if (status == REG_VALID)
440  {
441  val |= val_upper << 32;
442  store_unsigned_integer (buf, regsize, byte_order, val);
443  }
444  return status;
445  }
446 
447  if (regnum_is_vxr_full (tdep, regnum))
448  {
449  enum register_status status;
450 
451  regnum -= tdep->v0_full_regnum;
452 
454  if (status == REG_VALID)
456  S390_V0_LOWER_REGNUM + regnum, buf + 8);
457  return status;
458  }
459 
460  internal_error (__FILE__, __LINE__, _("invalid regnum"));
461 }
462 
463 static void
465  int regnum, const gdb_byte *buf)
466 {
467  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
468  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
469  int regsize = register_size (gdbarch, regnum);
470  ULONGEST val, psw;
471 
472  if (regnum == tdep->pc_regnum)
473  {
474  val = extract_unsigned_integer (buf, regsize, byte_order);
476  {
478  val = (psw & 0x80000000) | (val & 0x7fffffff);
479  }
481  return;
482  }
483 
484  if (regnum == tdep->cc_regnum)
485  {
486  val = extract_unsigned_integer (buf, regsize, byte_order);
489  val = (psw & ~((ULONGEST)3 << 12)) | ((val & 3) << 12);
490  else
491  val = (psw & ~((ULONGEST)3 << 44)) | ((val & 3) << 44);
493  return;
494  }
495 
496  if (regnum_is_gpr_full (tdep, regnum))
497  {
498  regnum -= tdep->gpr_full_regnum;
499  val = extract_unsigned_integer (buf, regsize, byte_order);
501  val & 0xffffffff);
503  val >> 32);
504  return;
505  }
506 
507  if (regnum_is_vxr_full (tdep, regnum))
508  {
509  regnum -= tdep->v0_full_regnum;
512  return;
513  }
514 
515  internal_error (__FILE__, __LINE__, _("invalid regnum"));
516 }
517 
518 /* 'float' values are stored in the upper half of floating-point
519  registers, even though we are otherwise a big-endian platform. The
520  same applies to a 'float' value within a vector. */
521 
522 static struct value *
524  int regnum, struct frame_id frame_id)
525 {
526  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
528  regnum, frame_id);
530 
532  && TYPE_LENGTH (type) < 8)
533  || regnum_is_vxr_full (tdep, regnum)
535  set_value_offset (value, 0);
536 
537  return value;
538 }
539 
540 /* Register groups. */
541 
542 static int
544  struct reggroup *group)
545 {
546  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
547 
548  /* We usually save/restore the whole PSW, which includes PC and CC.
549  However, some older gdbservers may not support saving/restoring
550  the whole PSW yet, and will return an XML register description
551  excluding those from the save/restore register groups. In those
552  cases, we still need to explicitly save/restore PC and CC in order
553  to push or pop frames. Since this doesn't hurt anything if we
554  already save/restore the whole PSW (it's just redundant), we add
555  PC and CC at this point unconditionally. */
556  if (group == save_reggroup || group == restore_reggroup)
557  return regnum == tdep->pc_regnum || regnum == tdep->cc_regnum;
558 
559  if (group == vector_reggroup)
560  return regnum_is_vxr_full (tdep, regnum);
561 
562  if (group == general_reggroup && regnum_is_vxr_full (tdep, regnum))
563  return 0;
564 
565  return default_register_reggroup_p (gdbarch, regnum, group);
566 }
567 
568 /* The "ax_pseudo_register_collect" gdbarch method. */
569 
570 static int
572  struct agent_expr *ax, int regnum)
573 {
574  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
575  if (regnum == tdep->pc_regnum)
576  {
578  }
579  else if (regnum == tdep->cc_regnum)
580  {
582  }
583  else if (regnum_is_gpr_full (tdep, regnum))
584  {
585  regnum -= tdep->gpr_full_regnum;
588  }
589  else if (regnum_is_vxr_full (tdep, regnum))
590  {
591  regnum -= tdep->v0_full_regnum;
594  }
595  else
596  {
597  internal_error (__FILE__, __LINE__, _("invalid regnum"));
598  }
599  return 0;
600 }
601 
602 /* The "ax_pseudo_register_push_stack" gdbarch method. */
603 
604 static int
606  struct agent_expr *ax, int regnum)
607 {
608  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
609  if (regnum == tdep->pc_regnum)
610  {
611  ax_reg (ax, S390_PSWA_REGNUM);
613  {
614  ax_zero_ext (ax, 31);
615  }
616  }
617  else if (regnum == tdep->cc_regnum)
618  {
619  ax_reg (ax, S390_PSWM_REGNUM);
621  ax_const_l (ax, 12);
622  else
623  ax_const_l (ax, 44);
624  ax_simple (ax, aop_rsh_unsigned);
625  ax_zero_ext (ax, 2);
626  }
627  else if (regnum_is_gpr_full (tdep, regnum))
628  {
629  regnum -= tdep->gpr_full_regnum;
630  ax_reg (ax, S390_R0_REGNUM + regnum);
632  ax_const_l (ax, 32);
633  ax_simple (ax, aop_lsh);
634  ax_simple (ax, aop_bit_or);
635  }
636  else if (regnum_is_vxr_full (tdep, regnum))
637  {
638  /* Too large to stuff on the stack. */
639  return 1;
640  }
641  else
642  {
643  internal_error (__FILE__, __LINE__, _("invalid regnum"));
644  }
645  return 0;
646 }
647 
648 /* The "gen_return_address" gdbarch method. Since this is supposed to be
649  just a best-effort method, and we don't really have the means to run
650  the full unwinder here, just collect the link register. */
651 
652 static void
654  struct agent_expr *ax, struct axs_value *value,
655  CORE_ADDR scope)
656 {
658  value->kind = axs_lvalue_register;
660 }
661 
662 
663 /* A helper for s390_software_single_step, decides if an instruction
664  is a partial-execution instruction that needs to be executed until
665  completion when in record mode. If it is, returns 1 and writes
666  instruction length to a pointer. */
667 
668 static int
670 {
671  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
672  uint16_t insn;
673 
674  insn = read_memory_integer (loc, 2, byte_order);
675 
676  switch (insn >> 8)
677  {
678  case 0xa8: /* MVCLE */
679  *len = 4;
680  return 1;
681 
682  case 0xeb:
683  {
684  insn = read_memory_integer (loc + 4, 2, byte_order);
685  if ((insn & 0xff) == 0x8e)
686  {
687  /* MVCLU */
688  *len = 6;
689  return 1;
690  }
691  }
692  break;
693  }
694 
695  switch (insn)
696  {
697  case 0xb255: /* MVST */
698  case 0xb263: /* CMPSC */
699  case 0xb2a5: /* TRE */
700  case 0xb2a6: /* CU21 */
701  case 0xb2a7: /* CU12 */
702  case 0xb9b0: /* CU14 */
703  case 0xb9b1: /* CU24 */
704  case 0xb9b2: /* CU41 */
705  case 0xb9b3: /* CU42 */
706  case 0xb92a: /* KMF */
707  case 0xb92b: /* KMO */
708  case 0xb92f: /* KMC */
709  case 0xb92d: /* KMCTR */
710  case 0xb92e: /* KM */
711  case 0xb93c: /* PPNO */
712  case 0xb990: /* TRTT */
713  case 0xb991: /* TRTO */
714  case 0xb992: /* TROT */
715  case 0xb993: /* TROO */
716  *len = 4;
717  return 1;
718  }
719 
720  return 0;
721 }
722 
723 /* Implement the "software_single_step" gdbarch method, needed to single step
724  through instructions like MVCLE in record mode, to make sure they are
725  executed to completion. Without that, record will save the full length
726  of destination buffer on every iteration, even though the CPU will only
727  process about 4kiB of it each time, leading to O(n**2) memory and time
728  complexity. */
729 
730 static std::vector<CORE_ADDR>
732 {
733  struct gdbarch *gdbarch = regcache->arch ();
735  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
736  int len;
737  uint16_t insn;
738 
739  /* Special handling only if recording. */
740  if (!record_full_is_used ())
741  return {};
742 
743  /* First, match a partial instruction. */
745  return {};
746 
747  loc += len;
748 
749  /* Second, look for a branch back to it. */
750  insn = read_memory_integer (loc, 2, byte_order);
751  if (insn != 0xa714) /* BRC with mask 1 */
752  return {};
753 
754  insn = read_memory_integer (loc + 2, 2, byte_order);
755  if (insn != (uint16_t) -(len / 2))
756  return {};
757 
758  loc += 4;
759 
760  /* Found it, step past the whole thing. */
761  return {loc};
762 }
763 
764 static int
766  struct displaced_step_closure *closure)
767 {
768  return 1;
769 }
770 
771 
772 /* Maps for register sets. */
773 
774 static const struct regcache_map_entry s390_gregmap[] =
775  {
776  { 1, S390_PSWM_REGNUM },
777  { 1, S390_PSWA_REGNUM },
778  { 16, S390_R0_REGNUM },
779  { 16, S390_A0_REGNUM },
780  { 1, S390_ORIG_R2_REGNUM },
781  { 0 }
782  };
783 
784 static const struct regcache_map_entry s390_fpregmap[] =
785  {
786  { 1, S390_FPC_REGNUM, 8 },
787  { 16, S390_F0_REGNUM, 8 },
788  { 0 }
789  };
790 
791 static const struct regcache_map_entry s390_regmap_upper[] =
792  {
793  { 16, S390_R0_UPPER_REGNUM, 4 },
794  { 0 }
795  };
796 
798  {
799  { 1, REGCACHE_MAP_SKIP, 4 },
800  { 1, S390_LAST_BREAK_REGNUM, 4 },
801  { 0 }
802  };
803 
805  {
806  { 1, S390_LAST_BREAK_REGNUM, 8 },
807  { 0 }
808  };
809 
811  {
812  { 1, S390_SYSTEM_CALL_REGNUM, 4 },
813  { 0 }
814  };
815 
816 static const struct regcache_map_entry s390_regmap_tdb[] =
817  {
818  { 1, S390_TDB_DWORD0_REGNUM, 8 },
819  { 1, S390_TDB_ABORT_CODE_REGNUM, 8 },
821  { 1, S390_TDB_ATIA_REGNUM, 8 },
822  { 12, REGCACHE_MAP_SKIP, 8 },
823  { 16, S390_TDB_R0_REGNUM, 8 },
824  { 0 }
825  };
826 
828  {
829  { 16, S390_V0_LOWER_REGNUM, 8 },
830  { 0 }
831  };
832 
834  {
835  { 16, S390_V16_REGNUM, 16 },
836  { 0 }
837  };
838 
839 static const struct regcache_map_entry s390_regmap_gs[] =
840  {
841  { 1, REGCACHE_MAP_SKIP, 8 },
842  { 1, S390_GSD_REGNUM, 8 },
843  { 1, S390_GSSM_REGNUM, 8 },
844  { 1, S390_GSEPLA_REGNUM, 8 },
845  { 0 }
846  };
847 
848 static const struct regcache_map_entry s390_regmap_gsbc[] =
849  {
850  { 1, REGCACHE_MAP_SKIP, 8 },
851  { 1, S390_BC_GSD_REGNUM, 8 },
852  { 1, S390_BC_GSSM_REGNUM, 8 },
853  { 1, S390_BC_GSEPLA_REGNUM, 8 },
854  { 0 }
855  };
856 
857 
858 /* Supply the TDB regset. Like regcache_supply_regset, but invalidate
859  the TDB registers unless the TDB format field is valid. */
860 
861 static void
863  int regnum, const void *regs, size_t len)
864 {
865  ULONGEST tdw;
866  enum register_status ret;
867 
870  if (ret != REG_VALID || (tdw >> 56) != 1)
872 }
873 
874 const struct regset s390_gregset = {
875  s390_gregmap,
878 };
879 
880 const struct regset s390_fpregset = {
884 };
885 
886 static const struct regset s390_upper_regset = {
890 };
891 
896 };
897 
902 };
903 
908 };
909 
910 const struct regset s390_tdb_regset = {
914 };
915 
916 const struct regset s390_vxrs_low_regset = {
920 };
921 
926 };
927 
928 const struct regset s390_gs_regset = {
932 };
933 
934 const struct regset s390_gsbc_regset = {
938 };
939 
940 /* Iterate over supported core file register note sections. */
941 
942 static void
945  void *cb_data,
946  const struct regcache *regcache)
947 {
948  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
949  const int gregset_size = (tdep->abi == ABI_LINUX_S390 ?
951 
952  cb (".reg", gregset_size, &s390_gregset, NULL, cb_data);
953  cb (".reg2", s390_sizeof_fpregset, &s390_fpregset, NULL, cb_data);
954 
955  if (tdep->abi == ABI_LINUX_S390 && tdep->gpr_full_regnum != -1)
956  cb (".reg-s390-high-gprs", 16 * 4, &s390_upper_regset,
957  "s390 GPR upper halves", cb_data);
958 
959  if (tdep->have_linux_v1)
960  cb (".reg-s390-last-break", 8,
961  (gdbarch_ptr_bit (gdbarch) == 32
963  "s390 last-break address", cb_data);
964 
965  if (tdep->have_linux_v2)
966  cb (".reg-s390-system-call", 4, &s390_system_call_regset,
967  "s390 system-call", cb_data);
968 
969  /* If regcache is set, we are in "write" (gcore) mode. In this
970  case, don't iterate over the TDB unless its registers are
971  available. */
972  if (tdep->have_tdb
973  && (regcache == NULL
976  cb (".reg-s390-tdb", s390_sizeof_tdbregset, &s390_tdb_regset,
977  "s390 TDB", cb_data);
978 
979  if (tdep->v0_full_regnum != -1)
980  {
981  cb (".reg-s390-vxrs-low", 16 * 8, &s390_vxrs_low_regset,
982  "s390 vector registers 0-15 lower half", cb_data);
983  cb (".reg-s390-vxrs-high", 16 * 16, &s390_vxrs_high_regset,
984  "s390 vector registers 16-31", cb_data);
985  }
986 
987  /* Iterate over the guarded-storage regsets if in "read" mode, or if
988  their registers are available. */
989  if (tdep->have_gs)
990  {
991  if (regcache == NULL
994  cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset,
995  "s390 guarded-storage registers", cb_data);
996 
997  if (regcache == NULL
1000  cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset,
1001  "s390 guarded-storage broadcast control", cb_data);
1002  }
1003 }
1004 
1005 static const struct target_desc *
1007  struct target_ops *target, bfd *abfd)
1008 {
1009  asection *section = bfd_get_section_by_name (abfd, ".reg");
1010  CORE_ADDR hwcap = 0;
1011  bool high_gprs, v1, v2, te, vx, gs;
1012 
1013  target_auxv_search (target, AT_HWCAP, &hwcap);
1014  if (!section)
1015  return NULL;
1016 
1017  high_gprs = (bfd_get_section_by_name (abfd, ".reg-s390-high-gprs")
1018  != NULL);
1019  v1 = (bfd_get_section_by_name (abfd, ".reg-s390-last-break") != NULL);
1020  v2 = (bfd_get_section_by_name (abfd, ".reg-s390-system-call") != NULL);
1021  vx = (hwcap & HWCAP_S390_VX);
1022  te = (hwcap & HWCAP_S390_TE);
1023  gs = (hwcap & HWCAP_S390_GS);
1024 
1025  switch (bfd_section_size (abfd, section))
1026  {
1027  case s390_sizeof_gregset:
1028  if (high_gprs)
1029  return (gs ? tdesc_s390_gs_linux64 :
1030  te && vx ? tdesc_s390_tevx_linux64 :
1031  vx ? tdesc_s390_vx_linux64 :
1032  te ? tdesc_s390_te_linux64 :
1033  v2 ? tdesc_s390_linux64v2 :
1035  else
1036  return (v2 ? tdesc_s390_linux32v2 :
1038 
1039  case s390x_sizeof_gregset:
1040  return (gs ? tdesc_s390x_gs_linux64 :
1041  te && vx ? tdesc_s390x_tevx_linux64 :
1042  vx ? tdesc_s390x_vx_linux64 :
1043  te ? tdesc_s390x_te_linux64 :
1044  v2 ? tdesc_s390x_linux64v2 :
1046 
1047  default:
1048  return NULL;
1049  }
1050 }
1051 
1052 
1053 /* Decoding S/390 instructions. */
1054 
1055 /* Named opcode values for the S/390 instructions we recognize. Some
1056  instructions have their opcode split across two fields; those are the
1057  op1_* and op2_* enums. */
1058 enum
1059  {
1060  op1_lhi = 0xa7, op2_lhi = 0x08,
1061  op1_lghi = 0xa7, op2_lghi = 0x09,
1062  op1_lgfi = 0xc0, op2_lgfi = 0x01,
1063  op_lr = 0x18,
1064  op_lgr = 0xb904,
1065  op_l = 0x58,
1066  op1_ly = 0xe3, op2_ly = 0x58,
1067  op1_lg = 0xe3, op2_lg = 0x04,
1068  op_lm = 0x98,
1069  op1_lmy = 0xeb, op2_lmy = 0x98,
1070  op1_lmg = 0xeb, op2_lmg = 0x04,
1071  op_st = 0x50,
1072  op1_sty = 0xe3, op2_sty = 0x50,
1073  op1_stg = 0xe3, op2_stg = 0x24,
1074  op_std = 0x60,
1075  op_stm = 0x90,
1076  op1_stmy = 0xeb, op2_stmy = 0x90,
1077  op1_stmg = 0xeb, op2_stmg = 0x24,
1078  op1_aghi = 0xa7, op2_aghi = 0x0b,
1079  op1_ahi = 0xa7, op2_ahi = 0x0a,
1080  op1_agfi = 0xc2, op2_agfi = 0x08,
1081  op1_afi = 0xc2, op2_afi = 0x09,
1082  op1_algfi= 0xc2, op2_algfi= 0x0a,
1083  op1_alfi = 0xc2, op2_alfi = 0x0b,
1084  op_ar = 0x1a,
1085  op_agr = 0xb908,
1086  op_a = 0x5a,
1087  op1_ay = 0xe3, op2_ay = 0x5a,
1088  op1_ag = 0xe3, op2_ag = 0x08,
1089  op1_slgfi= 0xc2, op2_slgfi= 0x04,
1090  op1_slfi = 0xc2, op2_slfi = 0x05,
1091  op_sr = 0x1b,
1092  op_sgr = 0xb909,
1093  op_s = 0x5b,
1094  op1_sy = 0xe3, op2_sy = 0x5b,
1095  op1_sg = 0xe3, op2_sg = 0x09,
1096  op_nr = 0x14,
1097  op_ngr = 0xb980,
1098  op_la = 0x41,
1099  op1_lay = 0xe3, op2_lay = 0x71,
1100  op1_larl = 0xc0, op2_larl = 0x00,
1101  op_basr = 0x0d,
1102  op_bas = 0x4d,
1103  op_bcr = 0x07,
1104  op_bc = 0x0d,
1105  op_bctr = 0x06,
1106  op_bctgr = 0xb946,
1107  op_bct = 0x46,
1108  op1_bctg = 0xe3, op2_bctg = 0x46,
1109  op_bxh = 0x86,
1110  op1_bxhg = 0xeb, op2_bxhg = 0x44,
1111  op_bxle = 0x87,
1112  op1_bxleg= 0xeb, op2_bxleg= 0x45,
1113  op1_bras = 0xa7, op2_bras = 0x05,
1114  op1_brasl= 0xc0, op2_brasl= 0x05,
1115  op1_brc = 0xa7, op2_brc = 0x04,
1116  op1_brcl = 0xc0, op2_brcl = 0x04,
1117  op1_brct = 0xa7, op2_brct = 0x06,
1118  op1_brctg= 0xa7, op2_brctg= 0x07,
1119  op_brxh = 0x84,
1120  op1_brxhg= 0xec, op2_brxhg= 0x44,
1121  op_brxle = 0x85,
1122  op1_brxlg= 0xec, op2_brxlg= 0x45,
1123  op_svc = 0x0a,
1124  };
1125 
1126 
1127 /* Read a single instruction from address AT. */
1128 
1129 #define S390_MAX_INSTR_SIZE 6
1130 static int
1131 s390_readinstruction (bfd_byte instr[], CORE_ADDR at)
1132 {
1133  static int s390_instrlen[] = { 2, 4, 4, 6 };
1134  int instrlen;
1135 
1136  if (target_read_memory (at, &instr[0], 2))
1137  return -1;
1138  instrlen = s390_instrlen[instr[0] >> 6];
1139  if (instrlen > 2)
1140  {
1141  if (target_read_memory (at + 2, &instr[2], instrlen - 2))
1142  return -1;
1143  }
1144  return instrlen;
1145 }
1146 
1147 
1148 /* The functions below are for recognizing and decoding S/390
1149  instructions of various formats. Each of them checks whether INSN
1150  is an instruction of the given format, with the specified opcodes.
1151  If it is, it sets the remaining arguments to the values of the
1152  instruction's fields, and returns a non-zero value; otherwise, it
1153  returns zero.
1154 
1155  These functions' arguments appear in the order they appear in the
1156  instruction, not in the machine-language form. So, opcodes always
1157  come first, even though they're sometimes scattered around the
1158  instructions. And displacements appear before base and extension
1159  registers, as they do in the assembly syntax, not at the end, as
1160  they do in the machine language. */
1161 static int
1162 is_ri (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
1163 {
1164  if (insn[0] == op1 && (insn[1] & 0xf) == op2)
1165  {
1166  *r1 = (insn[1] >> 4) & 0xf;
1167  /* i2 is a 16-bit signed quantity. */
1168  *i2 = (((insn[2] << 8) | insn[3]) ^ 0x8000) - 0x8000;
1169  return 1;
1170  }
1171  else
1172  return 0;
1173 }
1174 
1175 
1176 static int
1177 is_ril (bfd_byte *insn, int op1, int op2,
1178  unsigned int *r1, int *i2)
1179 {
1180  if (insn[0] == op1 && (insn[1] & 0xf) == op2)
1181  {
1182  *r1 = (insn[1] >> 4) & 0xf;
1183  /* i2 is a signed quantity. If the host 'int' is 32 bits long,
1184  no sign extension is necessary, but we don't want to assume
1185  that. */
1186  *i2 = (((insn[2] << 24)
1187  | (insn[3] << 16)
1188  | (insn[4] << 8)
1189  | (insn[5])) ^ 0x80000000) - 0x80000000;
1190  return 1;
1191  }
1192  else
1193  return 0;
1194 }
1195 
1196 
1197 static int
1198 is_rr (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
1199 {
1200  if (insn[0] == op)
1201  {
1202  *r1 = (insn[1] >> 4) & 0xf;
1203  *r2 = insn[1] & 0xf;
1204  return 1;
1205  }
1206  else
1207  return 0;
1208 }
1209 
1210 
1211 static int
1212 is_rre (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
1213 {
1214  if (((insn[0] << 8) | insn[1]) == op)
1215  {
1216  /* Yes, insn[3]. insn[2] is unused in RRE format. */
1217  *r1 = (insn[3] >> 4) & 0xf;
1218  *r2 = insn[3] & 0xf;
1219  return 1;
1220  }
1221  else
1222  return 0;
1223 }
1224 
1225 
1226 static int
1227 is_rs (bfd_byte *insn, int op,
1228  unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
1229 {
1230  if (insn[0] == op)
1231  {
1232  *r1 = (insn[1] >> 4) & 0xf;
1233  *r3 = insn[1] & 0xf;
1234  *b2 = (insn[2] >> 4) & 0xf;
1235  *d2 = ((insn[2] & 0xf) << 8) | insn[3];
1236  return 1;
1237  }
1238  else
1239  return 0;
1240 }
1241 
1242 
1243 static int
1244 is_rsy (bfd_byte *insn, int op1, int op2,
1245  unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
1246 {
1247  if (insn[0] == op1
1248  && insn[5] == op2)
1249  {
1250  *r1 = (insn[1] >> 4) & 0xf;
1251  *r3 = insn[1] & 0xf;
1252  *b2 = (insn[2] >> 4) & 0xf;
1253  /* The 'long displacement' is a 20-bit signed integer. */
1254  *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
1255  ^ 0x80000) - 0x80000;
1256  return 1;
1257  }
1258  else
1259  return 0;
1260 }
1261 
1262 
1263 static int
1264 is_rx (bfd_byte *insn, int op,
1265  unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
1266 {
1267  if (insn[0] == op)
1268  {
1269  *r1 = (insn[1] >> 4) & 0xf;
1270  *x2 = insn[1] & 0xf;
1271  *b2 = (insn[2] >> 4) & 0xf;
1272  *d2 = ((insn[2] & 0xf) << 8) | insn[3];
1273  return 1;
1274  }
1275  else
1276  return 0;
1277 }
1278 
1279 
1280 static int
1281 is_rxy (bfd_byte *insn, int op1, int op2,
1282  unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
1283 {
1284  if (insn[0] == op1
1285  && insn[5] == op2)
1286  {
1287  *r1 = (insn[1] >> 4) & 0xf;
1288  *x2 = insn[1] & 0xf;
1289  *b2 = (insn[2] >> 4) & 0xf;
1290  /* The 'long displacement' is a 20-bit signed integer. */
1291  *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
1292  ^ 0x80000) - 0x80000;
1293  return 1;
1294  }
1295  else
1296  return 0;
1297 }
1298 
1299 
1300 /* Prologue analysis. */
1301 
1302 #define S390_NUM_GPRS 16
1303 #define S390_NUM_FPRS 16
1304 
1306 
1307  /* The stack. */
1308  struct pv_area *stack;
1309 
1310  /* The size and byte-order of a GPR or FPR. */
1313  enum bfd_endian byte_order;
1314 
1315  /* The general-purpose registers. */
1317 
1318  /* The floating-point registers. */
1320 
1321  /* The offset relative to the CFA where the incoming GPR N was saved
1322  by the function prologue. 0 if not saved or unknown. */
1324 
1325  /* Likewise for FPRs. */
1327 
1328  /* Nonzero if the backchain was saved. This is assumed to be the
1329  case when the incoming SP is saved at the current SP location. */
1331 };
1332 
1333 /* Return the effective address for an X-style instruction, like:
1334 
1335  L R1, D2(X2, B2)
1336 
1337  Here, X2 and B2 are registers, and D2 is a signed 20-bit
1338  constant; the effective address is the sum of all three. If either
1339  X2 or B2 are zero, then it doesn't contribute to the sum --- this
1340  means that r0 can't be used as either X2 or B2. */
1341 static pv_t
1343  int d2, unsigned int x2, unsigned int b2)
1344 {
1345  pv_t result;
1346 
1347  result = pv_constant (d2);
1348  if (x2)
1349  result = pv_add (result, data->gpr[x2]);
1350  if (b2)
1351  result = pv_add (result, data->gpr[b2]);
1352 
1353  return result;
1354 }
1355 
1356 /* Do a SIZE-byte store of VALUE to D2(X2,B2). */
1357 static void
1359  int d2, unsigned int x2, unsigned int b2, CORE_ADDR size,
1360  pv_t value)
1361 {
1362  pv_t addr = s390_addr (data, d2, x2, b2);
1363  pv_t offset;
1364 
1365  /* Check whether we are storing the backchain. */
1366  offset = pv_subtract (data->gpr[S390_SP_REGNUM - S390_R0_REGNUM], addr);
1367 
1368  if (pv_is_constant (offset) && offset.k == 0)
1369  if (size == data->gpr_size
1371  {
1372  data->back_chain_saved_p = 1;
1373  return;
1374  }
1375 
1376 
1377  /* Check whether we are storing a register into the stack. */
1378  if (!data->stack->store_would_trash (addr))
1379  data->stack->store (addr, size, value);
1380 
1381 
1382  /* Note: If this is some store we cannot identify, you might think we
1383  should forget our cached values, as any of those might have been hit.
1384 
1385  However, we make the assumption that the register save areas are only
1386  ever stored to once in any given function, and we do recognize these
1387  stores. Thus every store we cannot recognize does not hit our data. */
1388 }
1389 
1390 /* Do a SIZE-byte load from D2(X2,B2). */
1391 static pv_t
1393  int d2, unsigned int x2, unsigned int b2, CORE_ADDR size)
1394 
1395 {
1396  pv_t addr = s390_addr (data, d2, x2, b2);
1397 
1398  /* If it's a load from an in-line constant pool, then we can
1399  simulate that, under the assumption that the code isn't
1400  going to change between the time the processor actually
1401  executed it creating the current frame, and the time when
1402  we're analyzing the code to unwind past that frame. */
1403  if (pv_is_constant (addr))
1404  {
1405  struct target_section *secp;
1407  if (secp != NULL
1408  && (bfd_get_section_flags (secp->the_bfd_section->owner,
1409  secp->the_bfd_section)
1410  & SEC_READONLY))
1412  data->byte_order));
1413  }
1414 
1415  /* Check whether we are accessing one of our save slots. */
1416  return data->stack->fetch (addr, size);
1417 }
1418 
1419 /* Function for finding saved registers in a 'struct pv_area'; we pass
1420  this to pv_area::scan.
1421 
1422  If VALUE is a saved register, ADDR says it was saved at a constant
1423  offset from the frame base, and SIZE indicates that the whole
1424  register was saved, record its offset in the reg_offset table in
1425  PROLOGUE_UNTYPED. */
1426 static void
1427 s390_check_for_saved (void *data_untyped, pv_t addr,
1429 {
1430  struct s390_prologue_data *data = (struct s390_prologue_data *) data_untyped;
1431  int i, offset;
1432 
1433  if (!pv_is_register (addr, S390_SP_REGNUM))
1434  return;
1435 
1436  offset = 16 * data->gpr_size + 32 - addr.k;
1437 
1438  /* If we are storing the original value of a register, we want to
1439  record the CFA offset. If the same register is stored multiple
1440  times, the stack slot with the highest address counts. */
1441 
1442  for (i = 0; i < S390_NUM_GPRS; i++)
1443  if (size == data->gpr_size
1444  && pv_is_register_k (value, S390_R0_REGNUM + i, 0))
1445  if (data->gpr_slot[i] == 0
1446  || data->gpr_slot[i] > offset)
1447  {
1448  data->gpr_slot[i] = offset;
1449  return;
1450  }
1451 
1452  for (i = 0; i < S390_NUM_FPRS; i++)
1453  if (size == data->fpr_size
1454  && pv_is_register_k (value, S390_F0_REGNUM + i, 0))
1455  if (data->fpr_slot[i] == 0
1456  || data->fpr_slot[i] > offset)
1457  {
1458  data->fpr_slot[i] = offset;
1459  return;
1460  }
1461 }
1462 
1463 /* Analyze the prologue of the function starting at START_PC,
1464  continuing at most until CURRENT_PC. Initialize DATA to
1465  hold all information we find out about the state of the registers
1466  and stack slots. Return the address of the instruction after
1467  the last one that changed the SP, FP, or back chain; or zero
1468  on error. */
1469 static CORE_ADDR
1471  CORE_ADDR start_pc,
1472  CORE_ADDR current_pc,
1473  struct s390_prologue_data *data)
1474 {
1475  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
1476 
1477  /* Our return value:
1478  The address of the instruction after the last one that changed
1479  the SP, FP, or back chain; zero if we got an error trying to
1480  read memory. */
1481  CORE_ADDR result = start_pc;
1482 
1483  /* The current PC for our abstract interpretation. */
1484  CORE_ADDR pc;
1485 
1486  /* The address of the next instruction after that. */
1487  CORE_ADDR next_pc;
1488 
1490  scoped_restore restore_stack = make_scoped_restore (&data->stack, &stack);
1491 
1492  /* Set up everything's initial value. */
1493  {
1494  int i;
1495 
1496  /* For the purpose of prologue tracking, we consider the GPR size to
1497  be equal to the ABI word size, even if it is actually larger
1498  (i.e. when running a 32-bit binary under a 64-bit kernel). */
1499  data->gpr_size = word_size;
1500  data->fpr_size = 8;
1502 
1503  for (i = 0; i < S390_NUM_GPRS; i++)
1504  data->gpr[i] = pv_register (S390_R0_REGNUM + i, 0);
1505 
1506  for (i = 0; i < S390_NUM_FPRS; i++)
1507  data->fpr[i] = pv_register (S390_F0_REGNUM + i, 0);
1508 
1509  for (i = 0; i < S390_NUM_GPRS; i++)
1510  data->gpr_slot[i] = 0;
1511 
1512  for (i = 0; i < S390_NUM_FPRS; i++)
1513  data->fpr_slot[i] = 0;
1514 
1515  data->back_chain_saved_p = 0;
1516  }
1517 
1518  /* Start interpreting instructions, until we hit the frame's
1519  current PC or the first branch instruction. */
1520  for (pc = start_pc; pc > 0 && pc < current_pc; pc = next_pc)
1521  {
1522  bfd_byte insn[S390_MAX_INSTR_SIZE];
1523  int insn_len = s390_readinstruction (insn, pc);
1524 
1525  bfd_byte dummy[S390_MAX_INSTR_SIZE] = { 0 };
1526  bfd_byte *insn32 = word_size == 4 ? insn : dummy;
1527  bfd_byte *insn64 = word_size == 8 ? insn : dummy;
1528 
1529  /* Fields for various kinds of instructions. */
1530  unsigned int b2, r1, r2, x2, r3;
1531  int i2, d2;
1532 
1533  /* The values of SP and FP before this instruction,
1534  for detecting instructions that change them. */
1535  pv_t pre_insn_sp, pre_insn_fp;
1536  /* Likewise for the flag whether the back chain was saved. */
1537  int pre_insn_back_chain_saved_p;
1538 
1539  /* If we got an error trying to read the instruction, report it. */
1540  if (insn_len < 0)
1541  {
1542  result = 0;
1543  break;
1544  }
1545 
1546  next_pc = pc + insn_len;
1547 
1548  pre_insn_sp = data->gpr[S390_SP_REGNUM - S390_R0_REGNUM];
1549  pre_insn_fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM];
1550  pre_insn_back_chain_saved_p = data->back_chain_saved_p;
1551 
1552 
1553  /* LHI r1, i2 --- load halfword immediate. */
1554  /* LGHI r1, i2 --- load halfword immediate (64-bit version). */
1555  /* LGFI r1, i2 --- load fullword immediate. */
1556  if (is_ri (insn32, op1_lhi, op2_lhi, &r1, &i2)
1557  || is_ri (insn64, op1_lghi, op2_lghi, &r1, &i2)
1558  || is_ril (insn, op1_lgfi, op2_lgfi, &r1, &i2))
1559  data->gpr[r1] = pv_constant (i2);
1560 
1561  /* LR r1, r2 --- load from register. */
1562  /* LGR r1, r2 --- load from register (64-bit version). */
1563  else if (is_rr (insn32, op_lr, &r1, &r2)
1564  || is_rre (insn64, op_lgr, &r1, &r2))
1565  data->gpr[r1] = data->gpr[r2];
1566 
1567  /* L r1, d2(x2, b2) --- load. */
1568  /* LY r1, d2(x2, b2) --- load (long-displacement version). */
1569  /* LG r1, d2(x2, b2) --- load (64-bit version). */
1570  else if (is_rx (insn32, op_l, &r1, &d2, &x2, &b2)
1571  || is_rxy (insn32, op1_ly, op2_ly, &r1, &d2, &x2, &b2)
1572  || is_rxy (insn64, op1_lg, op2_lg, &r1, &d2, &x2, &b2))
1573  data->gpr[r1] = s390_load (data, d2, x2, b2, data->gpr_size);
1574 
1575  /* ST r1, d2(x2, b2) --- store. */
1576  /* STY r1, d2(x2, b2) --- store (long-displacement version). */
1577  /* STG r1, d2(x2, b2) --- store (64-bit version). */
1578  else if (is_rx (insn32, op_st, &r1, &d2, &x2, &b2)
1579  || is_rxy (insn32, op1_sty, op2_sty, &r1, &d2, &x2, &b2)
1580  || is_rxy (insn64, op1_stg, op2_stg, &r1, &d2, &x2, &b2))
1581  s390_store (data, d2, x2, b2, data->gpr_size, data->gpr[r1]);
1582 
1583  /* STD r1, d2(x2,b2) --- store floating-point register. */
1584  else if (is_rx (insn, op_std, &r1, &d2, &x2, &b2))
1585  s390_store (data, d2, x2, b2, data->fpr_size, data->fpr[r1]);
1586 
1587  /* STM r1, r3, d2(b2) --- store multiple. */
1588  /* STMY r1, r3, d2(b2) --- store multiple (long-displacement
1589  version). */
1590  /* STMG r1, r3, d2(b2) --- store multiple (64-bit version). */
1591  else if (is_rs (insn32, op_stm, &r1, &r3, &d2, &b2)
1592  || is_rsy (insn32, op1_stmy, op2_stmy, &r1, &r3, &d2, &b2)
1593  || is_rsy (insn64, op1_stmg, op2_stmg, &r1, &r3, &d2, &b2))
1594  {
1595  for (; r1 <= r3; r1++, d2 += data->gpr_size)
1596  s390_store (data, d2, 0, b2, data->gpr_size, data->gpr[r1]);
1597  }
1598 
1599  /* AHI r1, i2 --- add halfword immediate. */
1600  /* AGHI r1, i2 --- add halfword immediate (64-bit version). */
1601  /* AFI r1, i2 --- add fullword immediate. */
1602  /* AGFI r1, i2 --- add fullword immediate (64-bit version). */
1603  else if (is_ri (insn32, op1_ahi, op2_ahi, &r1, &i2)
1604  || is_ri (insn64, op1_aghi, op2_aghi, &r1, &i2)
1605  || is_ril (insn32, op1_afi, op2_afi, &r1, &i2)
1606  || is_ril (insn64, op1_agfi, op2_agfi, &r1, &i2))
1607  data->gpr[r1] = pv_add_constant (data->gpr[r1], i2);
1608 
1609  /* ALFI r1, i2 --- add logical immediate. */
1610  /* ALGFI r1, i2 --- add logical immediate (64-bit version). */
1611  else if (is_ril (insn32, op1_alfi, op2_alfi, &r1, &i2)
1612  || is_ril (insn64, op1_algfi, op2_algfi, &r1, &i2))
1613  data->gpr[r1] = pv_add_constant (data->gpr[r1],
1614  (CORE_ADDR)i2 & 0xffffffff);
1615 
1616  /* AR r1, r2 -- add register. */
1617  /* AGR r1, r2 -- add register (64-bit version). */
1618  else if (is_rr (insn32, op_ar, &r1, &r2)
1619  || is_rre (insn64, op_agr, &r1, &r2))
1620  data->gpr[r1] = pv_add (data->gpr[r1], data->gpr[r2]);
1621 
1622  /* A r1, d2(x2, b2) -- add. */
1623  /* AY r1, d2(x2, b2) -- add (long-displacement version). */
1624  /* AG r1, d2(x2, b2) -- add (64-bit version). */
1625  else if (is_rx (insn32, op_a, &r1, &d2, &x2, &b2)
1626  || is_rxy (insn32, op1_ay, op2_ay, &r1, &d2, &x2, &b2)
1627  || is_rxy (insn64, op1_ag, op2_ag, &r1, &d2, &x2, &b2))
1628  data->gpr[r1] = pv_add (data->gpr[r1],
1629  s390_load (data, d2, x2, b2, data->gpr_size));
1630 
1631  /* SLFI r1, i2 --- subtract logical immediate. */
1632  /* SLGFI r1, i2 --- subtract logical immediate (64-bit version). */
1633  else if (is_ril (insn32, op1_slfi, op2_slfi, &r1, &i2)
1634  || is_ril (insn64, op1_slgfi, op2_slgfi, &r1, &i2))
1635  data->gpr[r1] = pv_add_constant (data->gpr[r1],
1636  -((CORE_ADDR)i2 & 0xffffffff));
1637 
1638  /* SR r1, r2 -- subtract register. */
1639  /* SGR r1, r2 -- subtract register (64-bit version). */
1640  else if (is_rr (insn32, op_sr, &r1, &r2)
1641  || is_rre (insn64, op_sgr, &r1, &r2))
1642  data->gpr[r1] = pv_subtract (data->gpr[r1], data->gpr[r2]);
1643 
1644  /* S r1, d2(x2, b2) -- subtract. */
1645  /* SY r1, d2(x2, b2) -- subtract (long-displacement version). */
1646  /* SG r1, d2(x2, b2) -- subtract (64-bit version). */
1647  else if (is_rx (insn32, op_s, &r1, &d2, &x2, &b2)
1648  || is_rxy (insn32, op1_sy, op2_sy, &r1, &d2, &x2, &b2)
1649  || is_rxy (insn64, op1_sg, op2_sg, &r1, &d2, &x2, &b2))
1650  data->gpr[r1] = pv_subtract (data->gpr[r1],
1651  s390_load (data, d2, x2, b2, data->gpr_size));
1652 
1653  /* LA r1, d2(x2, b2) --- load address. */
1654  /* LAY r1, d2(x2, b2) --- load address (long-displacement version). */
1655  else if (is_rx (insn, op_la, &r1, &d2, &x2, &b2)
1656  || is_rxy (insn, op1_lay, op2_lay, &r1, &d2, &x2, &b2))
1657  data->gpr[r1] = s390_addr (data, d2, x2, b2);
1658 
1659  /* LARL r1, i2 --- load address relative long. */
1660  else if (is_ril (insn, op1_larl, op2_larl, &r1, &i2))
1661  data->gpr[r1] = pv_constant (pc + i2 * 2);
1662 
1663  /* BASR r1, 0 --- branch and save.
1664  Since r2 is zero, this saves the PC in r1, but doesn't branch. */
1665  else if (is_rr (insn, op_basr, &r1, &r2)
1666  && r2 == 0)
1667  data->gpr[r1] = pv_constant (next_pc);
1668 
1669  /* BRAS r1, i2 --- branch relative and save. */
1670  else if (is_ri (insn, op1_bras, op2_bras, &r1, &i2))
1671  {
1672  data->gpr[r1] = pv_constant (next_pc);
1673  next_pc = pc + i2 * 2;
1674 
1675  /* We'd better not interpret any backward branches. We'll
1676  never terminate. */
1677  if (next_pc <= pc)
1678  break;
1679  }
1680 
1681  /* BRC/BRCL -- branch relative on condition. Ignore "branch
1682  never", branch to following instruction, and "conditional
1683  trap" (BRC +2). Otherwise terminate search. */
1684  else if (is_ri (insn, op1_brc, op2_brc, &r1, &i2))
1685  {
1686  if (r1 != 0 && i2 != 1 && i2 != 2)
1687  break;
1688  }
1689  else if (is_ril (insn, op1_brcl, op2_brcl, &r1, &i2))
1690  {
1691  if (r1 != 0 && i2 != 3)
1692  break;
1693  }
1694 
1695  /* Terminate search when hitting any other branch instruction. */
1696  else if (is_rr (insn, op_basr, &r1, &r2)
1697  || is_rx (insn, op_bas, &r1, &d2, &x2, &b2)
1698  || is_rr (insn, op_bcr, &r1, &r2)
1699  || is_rx (insn, op_bc, &r1, &d2, &x2, &b2)
1700  || is_ril (insn, op1_brasl, op2_brasl, &r2, &i2))
1701  break;
1702 
1703  else
1704  {
1705  /* An instruction we don't know how to simulate. The only
1706  safe thing to do would be to set every value we're tracking
1707  to 'unknown'. Instead, we'll be optimistic: we assume that
1708  we *can* interpret every instruction that the compiler uses
1709  to manipulate any of the data we're interested in here --
1710  then we can just ignore anything else. */
1711  }
1712 
1713  /* Record the address after the last instruction that changed
1714  the FP, SP, or backlink. Ignore instructions that changed
1715  them back to their original values --- those are probably
1716  restore instructions. (The back chain is never restored,
1717  just popped.) */
1718  {
1719  pv_t sp = data->gpr[S390_SP_REGNUM - S390_R0_REGNUM];
1720  pv_t fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM];
1721 
1722  if ((! pv_is_identical (pre_insn_sp, sp)
1723  && ! pv_is_register_k (sp, S390_SP_REGNUM, 0)
1724  && sp.kind != pvk_unknown)
1725  || (! pv_is_identical (pre_insn_fp, fp)
1726  && ! pv_is_register_k (fp, S390_FRAME_REGNUM, 0)
1727  && fp.kind != pvk_unknown)
1728  || pre_insn_back_chain_saved_p != data->back_chain_saved_p)
1729  result = next_pc;
1730  }
1731  }
1732 
1733  /* Record where all the registers were saved. */
1734  data->stack->scan (s390_check_for_saved, data);
1735 
1736  return result;
1737 }
1738 
1739 /* Advance PC across any function entry prologue instructions to reach
1740  some "real" code. */
1741 static CORE_ADDR
1743 {
1744  struct s390_prologue_data data;
1745  CORE_ADDR skip_pc, func_addr;
1746 
1747  if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
1748  {
1749  CORE_ADDR post_prologue_pc
1750  = skip_prologue_using_sal (gdbarch, func_addr);
1751  if (post_prologue_pc != 0)
1752  return std::max (pc, post_prologue_pc);
1753  }
1754 
1755  skip_pc = s390_analyze_prologue (gdbarch, pc, (CORE_ADDR)-1, &data);
1756  return skip_pc ? skip_pc : pc;
1757 }
1758 
1759 /* Implmement the stack_frame_destroyed_p gdbarch method. */
1760 static int
1762 {
1763  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
1764 
1765  /* In frameless functions, there's not frame to destroy and thus
1766  we don't care about the epilogue.
1767 
1768  In functions with frame, the epilogue sequence is a pair of
1769  a LM-type instruction that restores (amongst others) the
1770  return register %r14 and the stack pointer %r15, followed
1771  by a branch 'br %r14' --or equivalent-- that effects the
1772  actual return.
1773 
1774  In that situation, this function needs to return 'true' in
1775  exactly one case: when pc points to that branch instruction.
1776 
1777  Thus we try to disassemble the one instructions immediately
1778  preceding pc and check whether it is an LM-type instruction
1779  modifying the stack pointer.
1780 
1781  Note that disassembling backwards is not reliable, so there
1782  is a slight chance of false positives here ... */
1783 
1784  bfd_byte insn[6];
1785  unsigned int r1, r3, b2;
1786  int d2;
1787 
1788  if (word_size == 4
1789  && !target_read_memory (pc - 4, insn, 4)
1790  && is_rs (insn, op_lm, &r1, &r3, &d2, &b2)
1791  && r3 == S390_SP_REGNUM - S390_R0_REGNUM)
1792  return 1;
1793 
1794  if (word_size == 4
1795  && !target_read_memory (pc - 6, insn, 6)
1796  && is_rsy (insn, op1_lmy, op2_lmy, &r1, &r3, &d2, &b2)
1797  && r3 == S390_SP_REGNUM - S390_R0_REGNUM)
1798  return 1;
1799 
1800  if (word_size == 8
1801  && !target_read_memory (pc - 6, insn, 6)
1802  && is_rsy (insn, op1_lmg, op2_lmg, &r1, &r3, &d2, &b2)
1803  && r3 == S390_SP_REGNUM - S390_R0_REGNUM)
1804  return 1;
1805 
1806  return 0;
1807 }
1808 
1809 /* Displaced stepping. */
1810 
1811 /* Return true if INSN is a non-branch RIL-b or RIL-c format
1812  instruction. */
1813 
1814 static int
1816 {
1817  gdb_byte op1 = insn[0];
1818 
1819  if (op1 == 0xc4)
1820  {
1821  gdb_byte op2 = insn[1] & 0x0f;
1822 
1823  switch (op2)
1824  {
1825  case 0x02: /* llhrl */
1826  case 0x04: /* lghrl */
1827  case 0x05: /* lhrl */
1828  case 0x06: /* llghrl */
1829  case 0x07: /* sthrl */
1830  case 0x08: /* lgrl */
1831  case 0x0b: /* stgrl */
1832  case 0x0c: /* lgfrl */
1833  case 0x0d: /* lrl */
1834  case 0x0e: /* llgfrl */
1835  case 0x0f: /* strl */
1836  return 1;
1837  }
1838  }
1839  else if (op1 == 0xc6)
1840  {
1841  gdb_byte op2 = insn[1] & 0x0f;
1842 
1843  switch (op2)
1844  {
1845  case 0x00: /* exrl */
1846  case 0x02: /* pfdrl */
1847  case 0x04: /* cghrl */
1848  case 0x05: /* chrl */
1849  case 0x06: /* clghrl */
1850  case 0x07: /* clhrl */
1851  case 0x08: /* cgrl */
1852  case 0x0a: /* clgrl */
1853  case 0x0c: /* cgfrl */
1854  case 0x0d: /* crl */
1855  case 0x0e: /* clgfrl */
1856  case 0x0f: /* clrl */
1857  return 1;
1858  }
1859  }
1860 
1861  return 0;
1862 }
1863 
1865 
1866 /* Implementation of gdbarch_displaced_step_copy_insn. */
1867 
1868 static struct displaced_step_closure *
1870  CORE_ADDR from, CORE_ADDR to,
1871  struct regcache *regs)
1872 {
1873  size_t len = gdbarch_max_insn_length (gdbarch);
1874  std::unique_ptr<s390_displaced_step_closure> closure
1875  (new s390_displaced_step_closure (len));
1876  gdb_byte *buf = closure->buf.data ();
1877 
1878  read_memory (from, buf, len);
1879 
1880  /* Adjust the displacement field of PC-relative RIL instructions,
1881  except branches. The latter are handled in the fixup hook. */
1882  if (is_non_branch_ril (buf))
1883  {
1884  LONGEST offset;
1885 
1886  offset = extract_signed_integer (buf + 2, 4, BFD_ENDIAN_BIG);
1887  offset = (from - to + offset * 2) / 2;
1888 
1889  /* If the instruction is too far from the jump pad, punt. This
1890  will usually happen with instructions in shared libraries.
1891  We could probably support these by rewriting them to be
1892  absolute or fully emulating them. */
1893  if (offset < INT32_MIN || offset > INT32_MAX)
1894  {
1895  /* Let the core fall back to stepping over the breakpoint
1896  in-line. */
1897  if (debug_displaced)
1898  {
1900  "displaced: can't displaced step "
1901  "RIL instruction: offset %s out of range\n",
1902  plongest (offset));
1903  }
1904 
1905  return NULL;
1906  }
1907 
1908  store_signed_integer (buf + 2, 4, BFD_ENDIAN_BIG, offset);
1909  }
1910 
1911  write_memory (to, buf, len);
1912 
1913  if (debug_displaced)
1914  {
1915  fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ",
1916  paddress (gdbarch, from), paddress (gdbarch, to));
1918  }
1919 
1920  return closure.release ();
1921 }
1922 
1923 /* Fix up the state of registers and memory after having single-stepped
1924  a displaced instruction. */
1925 static void
1927  struct displaced_step_closure *closure_,
1928  CORE_ADDR from, CORE_ADDR to,
1929  struct regcache *regs)
1930 {
1931  /* Our closure is a copy of the instruction. */
1933  = (s390_displaced_step_closure *) closure_;
1934  gdb_byte *insn = closure->buf.data ();
1935  static int s390_instrlen[] = { 2, 4, 4, 6 };
1936  int insnlen = s390_instrlen[insn[0] >> 6];
1937 
1938  /* Fields for various kinds of instructions. */
1939  unsigned int b2, r1, r2, x2, r3;
1940  int i2, d2;
1941 
1942  /* Get current PC and addressing mode bit. */
1943  CORE_ADDR pc = regcache_read_pc (regs);
1944  ULONGEST amode = 0;
1945 
1947  {
1949  amode &= 0x80000000;
1950  }
1951 
1952  if (debug_displaced)
1954  "displaced: (s390) fixup (%s, %s) pc %s len %d amode 0x%x\n",
1955  paddress (gdbarch, from), paddress (gdbarch, to),
1956  paddress (gdbarch, pc), insnlen, (int) amode);
1957 
1958  /* Handle absolute branch and save instructions. */
1959  if (is_rr (insn, op_basr, &r1, &r2)
1960  || is_rx (insn, op_bas, &r1, &d2, &x2, &b2))
1961  {
1962  /* Recompute saved return address in R1. */
1964  amode | (from + insnlen));
1965  }
1966 
1967  /* Handle absolute branch instructions. */
1968  else if (is_rr (insn, op_bcr, &r1, &r2)
1969  || is_rx (insn, op_bc, &r1, &d2, &x2, &b2)
1970  || is_rr (insn, op_bctr, &r1, &r2)
1971  || is_rre (insn, op_bctgr, &r1, &r2)
1972  || is_rx (insn, op_bct, &r1, &d2, &x2, &b2)
1973  || is_rxy (insn, op1_bctg, op2_brctg, &r1, &d2, &x2, &b2)
1974  || is_rs (insn, op_bxh, &r1, &r3, &d2, &b2)
1975  || is_rsy (insn, op1_bxhg, op2_bxhg, &r1, &r3, &d2, &b2)
1976  || is_rs (insn, op_bxle, &r1, &r3, &d2, &b2)
1977  || is_rsy (insn, op1_bxleg, op2_bxleg, &r1, &r3, &d2, &b2))
1978  {
1979  /* Update PC iff branch was *not* taken. */
1980  if (pc == to + insnlen)
1981  regcache_write_pc (regs, from + insnlen);
1982  }
1983 
1984  /* Handle PC-relative branch and save instructions. */
1985  else if (is_ri (insn, op1_bras, op2_bras, &r1, &i2)
1986  || is_ril (insn, op1_brasl, op2_brasl, &r1, &i2))
1987  {
1988  /* Update PC. */
1989  regcache_write_pc (regs, pc - to + from);
1990  /* Recompute saved return address in R1. */
1992  amode | (from + insnlen));
1993  }
1994 
1995  /* Handle LOAD ADDRESS RELATIVE LONG. */
1996  else if (is_ril (insn, op1_larl, op2_larl, &r1, &i2))
1997  {
1998  /* Update PC. */
1999  regcache_write_pc (regs, from + insnlen);
2000  /* Recompute output address in R1. */
2002  amode | (from + i2 * 2));
2003  }
2004 
2005  /* If we executed a breakpoint instruction, point PC right back at it. */
2006  else if (insn[0] == 0x0 && insn[1] == 0x1)
2007  regcache_write_pc (regs, from);
2008 
2009  /* For any other insn, adjust PC by negated displacement. PC then
2010  points right after the original instruction, except for PC-relative
2011  branches, where it points to the adjusted branch target. */
2012  else
2013  regcache_write_pc (regs, pc - to + from);
2014 
2015  if (debug_displaced)
2017  "displaced: (s390) pc is now %s\n",
2018  paddress (gdbarch, regcache_read_pc (regs)));
2019 }
2020 
2021 
2022 /* Helper routine to unwind pseudo registers. */
2023 
2024 static struct value *
2026 {
2027  struct gdbarch *gdbarch = get_frame_arch (this_frame);
2028  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2029  struct type *type = register_type (gdbarch, regnum);
2030 
2031  /* Unwind PC via PSW address. */
2032  if (regnum == tdep->pc_regnum)
2033  {
2034  struct value *val;
2035 
2036  val = frame_unwind_register_value (this_frame, S390_PSWA_REGNUM);
2037  if (!value_optimized_out (val))
2038  {
2039  LONGEST pswa = value_as_long (val);
2040 
2041  if (TYPE_LENGTH (type) == 4)
2042  return value_from_pointer (type, pswa & 0x7fffffff);
2043  else
2044  return value_from_pointer (type, pswa);
2045  }
2046  }
2047 
2048  /* Unwind CC via PSW mask. */
2049  if (regnum == tdep->cc_regnum)
2050  {
2051  struct value *val;
2052 
2053  val = frame_unwind_register_value (this_frame, S390_PSWM_REGNUM);
2054  if (!value_optimized_out (val))
2055  {
2056  LONGEST pswm = value_as_long (val);
2057 
2058  if (TYPE_LENGTH (type) == 4)
2059  return value_from_longest (type, (pswm >> 12) & 3);
2060  else
2061  return value_from_longest (type, (pswm >> 44) & 3);
2062  }
2063  }
2064 
2065  /* Unwind full GPRs to show at least the lower halves (as the
2066  upper halves are undefined). */
2067  if (regnum_is_gpr_full (tdep, regnum))
2068  {
2069  int reg = regnum - tdep->gpr_full_regnum;
2070  struct value *val;
2071 
2072  val = frame_unwind_register_value (this_frame, S390_R0_REGNUM + reg);
2073  if (!value_optimized_out (val))
2074  return value_cast (type, val);
2075  }
2076 
2078 }
2079 
2080 static struct value *
2082  struct trad_frame_saved_reg saved_regs[],
2083  int regnum)
2084 {
2085  if (regnum < S390_NUM_REGS)
2086  return trad_frame_get_prev_register (this_frame, saved_regs, regnum);
2087  else
2088  return s390_unwind_pseudo_register (this_frame, regnum);
2089 }
2090 
2091 
2092 /* Normal stack frames. */
2093 
2095 
2099 
2101 };
2102 
2103 static int
2105  struct s390_unwind_cache *info)
2106 {
2107  struct gdbarch *gdbarch = get_frame_arch (this_frame);
2108  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
2109  struct s390_prologue_data data;
2110  pv_t *fp = &data.gpr[S390_FRAME_REGNUM - S390_R0_REGNUM];
2111  pv_t *sp = &data.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
2112  int i;
2113  CORE_ADDR cfa;
2114  CORE_ADDR func;
2115  CORE_ADDR result;
2116  ULONGEST reg;
2117  CORE_ADDR prev_sp;
2118  int frame_pointer;
2119  int size;
2120  struct frame_info *next_frame;
2121 
2122  /* Try to find the function start address. If we can't find it, we don't
2123  bother searching for it -- with modern compilers this would be mostly
2124  pointless anyway. Trust that we'll either have valid DWARF-2 CFI data
2125  or else a valid backchain ... */
2126  if (!get_frame_func_if_available (this_frame, &info->func))
2127  {
2128  info->func = -1;
2129  return 0;
2130  }
2131  func = info->func;
2132 
2133  /* Try to analyze the prologue. */
2134  result = s390_analyze_prologue (gdbarch, func,
2135  get_frame_pc (this_frame), &data);
2136  if (!result)
2137  return 0;
2138 
2139  /* If this was successful, we should have found the instruction that
2140  sets the stack pointer register to the previous value of the stack
2141  pointer minus the frame size. */
2142  if (!pv_is_register (*sp, S390_SP_REGNUM))
2143  return 0;
2144 
2145  /* A frame size of zero at this point can mean either a real
2146  frameless function, or else a failure to find the prologue.
2147  Perform some sanity checks to verify we really have a
2148  frameless function. */
2149  if (sp->k == 0)
2150  {
2151  /* If the next frame is a NORMAL_FRAME, this frame *cannot* have frame
2152  size zero. This is only possible if the next frame is a sentinel
2153  frame, a dummy frame, or a signal trampoline frame. */
2154  /* FIXME: cagney/2004-05-01: This sanity check shouldn't be
2155  needed, instead the code should simpliy rely on its
2156  analysis. */
2157  next_frame = get_next_frame (this_frame);
2158  while (next_frame && get_frame_type (next_frame) == INLINE_FRAME)
2159  next_frame = get_next_frame (next_frame);
2160  if (next_frame
2161  && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME)
2162  return 0;
2163 
2164  /* If we really have a frameless function, %r14 must be valid
2165  -- in particular, it must point to a different function. */
2168  if (get_pc_function_start (reg) == func)
2169  {
2170  /* However, there is one case where it *is* valid for %r14
2171  to point to the same function -- if this is a recursive
2172  call, and we have stopped in the prologue *before* the
2173  stack frame was allocated.
2174 
2175  Recognize this case by looking ahead a bit ... */
2176 
2177  struct s390_prologue_data data2;
2178  pv_t *sp = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
2179 
2180  if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR)-1, &data2)
2181  && pv_is_register (*sp, S390_SP_REGNUM)
2182  && sp->k != 0))
2183  return 0;
2184  }
2185  }
2186 
2187 
2188  /* OK, we've found valid prologue data. */
2189  size = -sp->k;
2190 
2191  /* If the frame pointer originally also holds the same value
2192  as the stack pointer, we're probably using it. If it holds
2193  some other value -- even a constant offset -- it is most
2194  likely used as temp register. */
2195  if (pv_is_identical (*sp, *fp))
2196  frame_pointer = S390_FRAME_REGNUM;
2197  else
2198  frame_pointer = S390_SP_REGNUM;
2199 
2200  /* If we've detected a function with stack frame, we'll still have to
2201  treat it as frameless if we're currently within the function epilog
2202  code at a point where the frame pointer has already been restored.
2203  This can only happen in an innermost frame. */
2204  /* FIXME: cagney/2004-05-01: This sanity check shouldn't be needed,
2205  instead the code should simpliy rely on its analysis. */
2206  next_frame = get_next_frame (this_frame);
2207  while (next_frame && get_frame_type (next_frame) == INLINE_FRAME)
2208  next_frame = get_next_frame (next_frame);
2209  if (size > 0
2210  && (next_frame == NULL
2211  || get_frame_type (get_next_frame (this_frame)) != NORMAL_FRAME))
2212  {
2213  /* See the comment in s390_stack_frame_destroyed_p on why this is
2214  not completely reliable ... */
2216  {
2217  memset (&data, 0, sizeof (data));
2218  size = 0;
2219  frame_pointer = S390_SP_REGNUM;
2220  }
2221  }
2222 
2223  /* Once we know the frame register and the frame size, we can unwind
2224  the current value of the frame register from the next frame, and
2225  add back the frame size to arrive that the previous frame's
2226  stack pointer value. */
2227  prev_sp = get_frame_register_unsigned (this_frame, frame_pointer) + size;
2228  cfa = prev_sp + 16*word_size + 32;
2229 
2230  /* Set up ABI call-saved/call-clobbered registers. */
2231  for (i = 0; i < S390_NUM_REGS; i++)
2234 
2235  /* CC is always call-clobbered. */
2237 
2238  /* Record the addresses of all register spill slots the prologue parser
2239  has recognized. Consider only registers defined as call-saved by the
2240  ABI; for call-clobbered registers the parser may have recognized
2241  spurious stores. */
2242 
2243  for (i = 0; i < 16; i++)
2245  && data.gpr_slot[i] != 0)
2246  info->saved_regs[S390_R0_REGNUM + i].addr = cfa - data.gpr_slot[i];
2247 
2248  for (i = 0; i < 16; i++)
2250  && data.fpr_slot[i] != 0)
2251  info->saved_regs[S390_F0_REGNUM + i].addr = cfa - data.fpr_slot[i];
2252 
2253  /* Function return will set PC to %r14. */
2255 
2256  /* In frameless functions, we unwind simply by moving the return
2257  address to the PC. However, if we actually stored to the
2258  save area, use that -- we might only think the function frameless
2259  because we're in the middle of the prologue ... */
2260  if (size == 0
2262  {
2264  }
2265 
2266  /* Another sanity check: unless this is a frameless function,
2267  we should have found spill slots for SP and PC.
2268  If not, we cannot unwind further -- this happens e.g. in
2269  libc's thread_start routine. */
2270  if (size > 0)
2271  {
2274  prev_sp = -1;
2275  }
2276 
2277  /* We use the current value of the frame register as local_base,
2278  and the top of the register save area as frame_base. */
2279  if (prev_sp != -1)
2280  {
2281  info->frame_base = prev_sp + 16*word_size + 32;
2282  info->local_base = prev_sp - size;
2283  }
2284 
2285  return 1;
2286 }
2287 
2288 static void
2290  struct s390_unwind_cache *info)
2291 {
2292  struct gdbarch *gdbarch = get_frame_arch (this_frame);
2293  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
2294  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
2295  CORE_ADDR backchain;
2296  ULONGEST reg;
2297  LONGEST sp, tmp;
2298  int i;
2299 
2300  /* Set up ABI call-saved/call-clobbered registers. */
2301  for (i = 0; i < S390_NUM_REGS; i++)
2304 
2305  /* CC is always call-clobbered. */
2307 
2308  /* Get the backchain. */
2310  if (!safe_read_memory_integer (reg, word_size, byte_order, &tmp))
2311  tmp = 0;
2312  backchain = (CORE_ADDR) tmp;
2313 
2314  /* A zero backchain terminates the frame chain. As additional
2315  sanity check, let's verify that the spill slot for SP in the
2316  save area pointed to by the backchain in fact links back to
2317  the save area. */
2318  if (backchain != 0
2319  && safe_read_memory_integer (backchain + 15*word_size,
2320  word_size, byte_order, &sp)
2321  && (CORE_ADDR)sp == backchain)
2322  {
2323  /* We don't know which registers were saved, but it will have
2324  to be at least %r14 and %r15. This will allow us to continue
2325  unwinding, but other prev-frame registers may be incorrect ... */
2326  info->saved_regs[S390_SP_REGNUM].addr = backchain + 15*word_size;
2327  info->saved_regs[S390_RETADDR_REGNUM].addr = backchain + 14*word_size;
2328 
2329  /* Function return will set PC to %r14. */
2332 
2333  /* We use the current value of the frame register as local_base,
2334  and the top of the register save area as frame_base. */
2335  info->frame_base = backchain + 16*word_size + 32;
2336  info->local_base = reg;
2337  }
2338 
2339  info->func = get_frame_pc (this_frame);
2340 }
2341 
2342 static struct s390_unwind_cache *
2344  void **this_prologue_cache)
2345 {
2346  struct s390_unwind_cache *info;
2347 
2348  if (*this_prologue_cache)
2349  return (struct s390_unwind_cache *) *this_prologue_cache;
2350 
2351  info = FRAME_OBSTACK_ZALLOC (struct s390_unwind_cache);
2352  *this_prologue_cache = info;
2353  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
2354  info->func = -1;
2355  info->frame_base = -1;
2356  info->local_base = -1;
2357 
2358  TRY
2359  {
2360  /* Try to use prologue analysis to fill the unwind cache.
2361  If this fails, fall back to reading the stack backchain. */
2362  if (!s390_prologue_frame_unwind_cache (this_frame, info))
2363  s390_backchain_frame_unwind_cache (this_frame, info);
2364  }
2365  CATCH (ex, RETURN_MASK_ERROR)
2366  {
2367  if (ex.error != NOT_AVAILABLE_ERROR)
2368  throw_exception (ex);
2369  }
2370  END_CATCH
2371 
2372  return info;
2373 }
2374 
2375 static void
2376 s390_frame_this_id (struct frame_info *this_frame,
2377  void **this_prologue_cache,
2378  struct frame_id *this_id)
2379 {
2380  struct s390_unwind_cache *info
2381  = s390_frame_unwind_cache (this_frame, this_prologue_cache);
2382 
2383  if (info->frame_base == -1)
2384  {
2385  if (info->func != -1)
2386  *this_id = frame_id_build_unavailable_stack (info->func);
2387  return;
2388  }
2389 
2390  *this_id = frame_id_build (info->frame_base, info->func);
2391 }
2392 
2393 static struct value *
2395  void **this_prologue_cache, int regnum)
2396 {
2397  struct s390_unwind_cache *info
2398  = s390_frame_unwind_cache (this_frame, this_prologue_cache);
2399 
2400  return s390_trad_frame_prev_register (this_frame, info->saved_regs, regnum);
2401 }
2402 
2403 static const struct frame_unwind s390_frame_unwind = {
2404  NORMAL_FRAME,
2408  NULL,
2410 };
2411 
2412 
2413 /* Code stubs and their stack frames. For things like PLTs and NULL
2414  function calls (where there is no true frame and the return address
2415  is in the RETADDR register). */
2416 
2418 {
2421 };
2422 
2423 static struct s390_stub_unwind_cache *
2425  void **this_prologue_cache)
2426 {
2427  struct gdbarch *gdbarch = get_frame_arch (this_frame);
2428  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
2429  struct s390_stub_unwind_cache *info;
2430  ULONGEST reg;
2431 
2432  if (*this_prologue_cache)
2433  return (struct s390_stub_unwind_cache *) *this_prologue_cache;
2434 
2436  *this_prologue_cache = info;
2437  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
2438 
2439  /* The return address is in register %r14. */
2441 
2442  /* Retrieve stack pointer and determine our frame base. */
2444  info->frame_base = reg + 16*word_size + 32;
2445 
2446  return info;
2447 }
2448 
2449 static void
2451  void **this_prologue_cache,
2452  struct frame_id *this_id)
2453 {
2454  struct s390_stub_unwind_cache *info
2455  = s390_stub_frame_unwind_cache (this_frame, this_prologue_cache);
2456  *this_id = frame_id_build (info->frame_base, get_frame_pc (this_frame));
2457 }
2458 
2459 static struct value *
2461  void **this_prologue_cache, int regnum)
2462 {
2463  struct s390_stub_unwind_cache *info
2464  = s390_stub_frame_unwind_cache (this_frame, this_prologue_cache);
2465  return s390_trad_frame_prev_register (this_frame, info->saved_regs, regnum);
2466 }
2467 
2468 static int
2470  struct frame_info *this_frame,
2471  void **this_prologue_cache)
2472 {
2473  CORE_ADDR addr_in_block;
2474  bfd_byte insn[S390_MAX_INSTR_SIZE];
2475 
2476  /* If the current PC points to non-readable memory, we assume we
2477  have trapped due to an invalid function pointer call. We handle
2478  the non-existing current function like a PLT stub. */
2479  addr_in_block = get_frame_address_in_block (this_frame);
2480  if (in_plt_section (addr_in_block)
2481  || s390_readinstruction (insn, get_frame_pc (this_frame)) < 0)
2482  return 1;
2483  return 0;
2484 }
2485 
2486 static const struct frame_unwind s390_stub_frame_unwind = {
2487  NORMAL_FRAME,
2491  NULL,
2493 };
2494 
2495 
2496 /* Signal trampoline stack frames. */
2497 
2501 };
2502 
2503 static struct s390_sigtramp_unwind_cache *
2505  void **this_prologue_cache)
2506 {
2507  struct gdbarch *gdbarch = get_frame_arch (this_frame);
2508  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2509  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
2510  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
2511  struct s390_sigtramp_unwind_cache *info;
2512  ULONGEST this_sp, prev_sp;
2513  CORE_ADDR next_ra, next_cfa, sigreg_ptr, sigreg_high_off;
2514  int i;
2515 
2516  if (*this_prologue_cache)
2517  return (struct s390_sigtramp_unwind_cache *) *this_prologue_cache;
2518 
2520  *this_prologue_cache = info;
2521  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
2522 
2523  this_sp = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
2524  next_ra = get_frame_pc (this_frame);
2525  next_cfa = this_sp + 16*word_size + 32;
2526 
2527  /* New-style RT frame:
2528  retcode + alignment (8 bytes)
2529  siginfo (128 bytes)
2530  ucontext (contains sigregs at offset 5 words). */
2531  if (next_ra == next_cfa)
2532  {
2533  sigreg_ptr = next_cfa + 8 + 128 + align_up (5*word_size, 8);
2534  /* sigregs are followed by uc_sigmask (8 bytes), then by the
2535  upper GPR halves if present. */
2536  sigreg_high_off = 8;
2537  }
2538 
2539  /* Old-style RT frame and all non-RT frames:
2540  old signal mask (8 bytes)
2541  pointer to sigregs. */
2542  else
2543  {
2544  sigreg_ptr = read_memory_unsigned_integer (next_cfa + 8,
2545  word_size, byte_order);
2546  /* sigregs are followed by signo (4 bytes), then by the
2547  upper GPR halves if present. */
2548  sigreg_high_off = 4;
2549  }
2550 
2551  /* The sigregs structure looks like this:
2552  long psw_mask;
2553  long psw_addr;
2554  long gprs[16];
2555  int acrs[16];
2556  int fpc;
2557  int __pad;
2558  double fprs[16]; */
2559 
2560  /* PSW mask and address. */
2561  info->saved_regs[S390_PSWM_REGNUM].addr = sigreg_ptr;
2562  sigreg_ptr += word_size;
2563  info->saved_regs[S390_PSWA_REGNUM].addr = sigreg_ptr;
2564  sigreg_ptr += word_size;
2565 
2566  /* Then the GPRs. */
2567  for (i = 0; i < 16; i++)
2568  {
2569  info->saved_regs[S390_R0_REGNUM + i].addr = sigreg_ptr;
2570  sigreg_ptr += word_size;
2571  }
2572 
2573  /* Then the ACRs. */
2574  for (i = 0; i < 16; i++)
2575  {
2576  info->saved_regs[S390_A0_REGNUM + i].addr = sigreg_ptr;
2577  sigreg_ptr += 4;
2578  }
2579 
2580  /* The floating-point control word. */
2581  info->saved_regs[S390_FPC_REGNUM].addr = sigreg_ptr;
2582  sigreg_ptr += 8;
2583 
2584  /* And finally the FPRs. */
2585  for (i = 0; i < 16; i++)
2586  {
2587  info->saved_regs[S390_F0_REGNUM + i].addr = sigreg_ptr;
2588  sigreg_ptr += 8;
2589  }
2590 
2591  /* If we have them, the GPR upper halves are appended at the end. */
2592  sigreg_ptr += sigreg_high_off;
2593  if (tdep->gpr_full_regnum != -1)
2594  for (i = 0; i < 16; i++)
2595  {
2596  info->saved_regs[S390_R0_UPPER_REGNUM + i].addr = sigreg_ptr;
2597  sigreg_ptr += 4;
2598  }
2599 
2600  /* Restore the previous frame's SP. */
2601  prev_sp = read_memory_unsigned_integer (
2603  word_size, byte_order);
2604 
2605  /* Determine our frame base. */
2606  info->frame_base = prev_sp + 16*word_size + 32;
2607 
2608  return info;
2609 }
2610 
2611 static void
2613  void **this_prologue_cache,
2614  struct frame_id *this_id)
2615 {
2616  struct s390_sigtramp_unwind_cache *info
2617  = s390_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
2618  *this_id = frame_id_build (info->frame_base, get_frame_pc (this_frame));
2619 }
2620 
2621 static struct value *
2623  void **this_prologue_cache, int regnum)
2624 {
2625  struct s390_sigtramp_unwind_cache *info
2626  = s390_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
2627  return s390_trad_frame_prev_register (this_frame, info->saved_regs, regnum);
2628 }
2629 
2630 static int
2632  struct frame_info *this_frame,
2633  void **this_prologue_cache)
2634 {
2635  CORE_ADDR pc = get_frame_pc (this_frame);
2636  bfd_byte sigreturn[2];
2637 
2638  if (target_read_memory (pc, sigreturn, 2))
2639  return 0;
2640 
2641  if (sigreturn[0] != op_svc)
2642  return 0;
2643 
2644  if (sigreturn[1] != 119 /* sigreturn */
2645  && sigreturn[1] != 173 /* rt_sigreturn */)
2646  return 0;
2647 
2648  return 1;
2649 }
2650 
2656  NULL,
2658 };
2659 
2660 /* Retrieve the syscall number at a ptrace syscall-stop. Return -1
2661  upon error. */
2662 
2663 static LONGEST
2665  ptid_t ptid)
2666 {
2667  struct regcache *regs = get_thread_regcache (ptid);
2668  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2669  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
2670  ULONGEST pc;
2671  ULONGEST svc_number = -1;
2672  unsigned opcode;
2673 
2674  /* Assume that the PC points after the 2-byte SVC instruction. We
2675  don't currently support SVC via EXECUTE. */
2677  pc -= 2;
2678  opcode = read_memory_unsigned_integer ((CORE_ADDR) pc, 1, byte_order);
2679  if (opcode != op_svc)
2680  return -1;
2681 
2682  svc_number = read_memory_unsigned_integer ((CORE_ADDR) pc + 1, 1,
2683  byte_order);
2684  if (svc_number == 0)
2686 
2687  return svc_number;
2688 }
2689 
2690 /* Process record-replay */
2691 
2694 
2695 /* Record all registers but PC register for process-record. */
2696 
2697 static int
2699 {
2700  struct gdbarch *gdbarch = regcache->arch ();
2701  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2702  int i;
2703 
2704  for (i = 0; i < 16; i++)
2705  {
2707  return -1;
2709  return -1;
2711  return -1;
2712  if (tdep->gpr_full_regnum != -1)
2714  return -1;
2715  if (tdep->v0_full_regnum != -1)
2716  {
2718  return -1;
2720  return -1;
2721  }
2722  }
2724  return -1;
2726  return -1;
2727 
2728  return 0;
2729 }
2730 
2731 static enum gdb_syscall
2733 {
2734  switch (syscall)
2735  {
2736  /* s390 syscall numbers < 222 are mostly the same as x86, so just list
2737  the exceptions. */
2738  case 0:
2739  return gdb_sys_no_syscall;
2740  case 7:
2741  return gdb_sys_restart_syscall;
2742  /* These syscalls work only on 31-bit. */
2743  case 13: /* time */
2744  case 16: /* lchown[16] */
2745  case 23: /* setuid[16] */
2746  case 24: /* getuid[16] */
2747  case 25: /* stime */
2748  case 46: /* setgid[16] */
2749  case 47: /* getgid[16] */
2750  case 49: /* seteuid[16] */
2751  case 50: /* getegid[16] */
2752  case 70: /* setreuid[16] */
2753  case 71: /* setregid[16] */
2754  case 76: /* [old_]getrlimit */
2755  case 80: /* getgroups[16] */
2756  case 81: /* setgroups[16] */
2757  case 95: /* fchown[16] */
2758  case 101: /* ioperm */
2759  case 138: /* setfsuid[16] */
2760  case 139: /* setfsgid[16] */
2761  case 140: /* _llseek */
2762  case 164: /* setresuid[16] */
2763  case 165: /* getresuid[16] */
2764  case 170: /* setresgid[16] */
2765  case 171: /* getresgid[16] */
2766  case 182: /* chown[16] */
2767  case 192: /* mmap2 */
2768  case 193: /* truncate64 */
2769  case 194: /* ftruncate64 */
2770  case 195: /* stat64 */
2771  case 196: /* lstat64 */
2772  case 197: /* fstat64 */
2773  case 221: /* fcntl64 */
2774  if (abi == ABI_LINUX_S390)
2775  return (enum gdb_syscall) syscall;
2776  return gdb_sys_no_syscall;
2777  /* These syscalls don't exist on s390. */
2778  case 17: /* break */
2779  case 18: /* oldstat */
2780  case 28: /* oldfstat */
2781  case 31: /* stty */
2782  case 32: /* gtty */
2783  case 35: /* ftime */
2784  case 44: /* prof */
2785  case 53: /* lock */
2786  case 56: /* mpx */
2787  case 58: /* ulimit */
2788  case 59: /* oldolduname */
2789  case 68: /* sgetmask */
2790  case 69: /* ssetmask */
2791  case 82: /* [old_]select */
2792  case 84: /* oldlstat */
2793  case 98: /* profil */
2794  case 109: /* olduname */
2795  case 113: /* vm86old */
2796  case 123: /* modify_ldt */
2797  case 166: /* vm86 */
2798  return gdb_sys_no_syscall;
2799  case 110:
2800  return gdb_sys_lookup_dcookie;
2801  /* Here come the differences. */
2802  case 222:
2803  return gdb_sys_readahead;
2804  case 223:
2805  if (abi == ABI_LINUX_S390)
2806  return gdb_sys_sendfile64;
2807  return gdb_sys_no_syscall;
2808  /* 224-235 handled below */
2809  case 236:
2810  return gdb_sys_gettid;
2811  case 237:
2812  return gdb_sys_tkill;
2813  case 238:
2814  return gdb_sys_futex;
2815  case 239:
2817  case 240:
2819  case 241:
2820  return gdb_sys_tgkill;
2821  /* 242 reserved */
2822  case 243:
2823  return gdb_sys_io_setup;
2824  case 244:
2825  return gdb_sys_io_destroy;
2826  case 245:
2827  return gdb_sys_io_getevents;
2828  case 246:
2829  return gdb_sys_io_submit;
2830  case 247:
2831  return gdb_sys_io_cancel;
2832  case 248:
2833  return gdb_sys_exit_group;
2834  case 249:
2835  return gdb_sys_epoll_create;
2836  case 250:
2837  return gdb_sys_epoll_ctl;
2838  case 251:
2839  return gdb_sys_epoll_wait;
2840  case 252:
2841  return gdb_sys_set_tid_address;
2842  case 253:
2843  return gdb_sys_fadvise64;
2844  /* 254-262 handled below */
2845  /* 263 reserved */
2846  case 264:
2847  if (abi == ABI_LINUX_S390)
2848  return gdb_sys_fadvise64_64;
2849  return gdb_sys_no_syscall;
2850  case 265:
2851  return gdb_sys_statfs64;
2852  case 266:
2853  return gdb_sys_fstatfs64;
2854  case 267:
2855  return gdb_sys_remap_file_pages;
2856  /* 268-270 reserved */
2857  /* 271-277 handled below */
2858  case 278:
2859  return gdb_sys_add_key;
2860  case 279:
2861  return gdb_sys_request_key;
2862  case 280:
2863  return gdb_sys_keyctl;
2864  case 281:
2865  return gdb_sys_waitid;
2866  /* 282-312 handled below */
2867  case 293:
2868  if (abi == ABI_LINUX_S390)
2869  return gdb_sys_fstatat64;
2870  return gdb_sys_newfstatat;
2871  /* 313+ not yet supported */
2872  default:
2873  {
2874  int ret;
2875 
2876  /* Most "old" syscalls copied from i386. */
2877  if (syscall <= 221)
2878  ret = syscall;
2879  /* xattr syscalls. */
2880  else if (syscall >= 224 && syscall <= 235)
2881  ret = syscall + 2;
2882  /* timer syscalls. */
2883  else if (syscall >= 254 && syscall <= 262)
2884  ret = syscall + 5;
2885  /* mq_* and kexec_load */
2886  else if (syscall >= 271 && syscall <= 277)
2887  ret = syscall + 6;
2888  /* ioprio_set .. epoll_pwait */
2889  else if (syscall >= 282 && syscall <= 312)
2890  ret = syscall + 7;
2891  else
2892  ret = gdb_sys_no_syscall;
2893 
2894  return (enum gdb_syscall) ret;
2895  }
2896  }
2897 }
2898 
2899 static int
2901 {
2902  struct gdbarch *gdbarch = regcache->arch ();
2903  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2904  int ret;
2905  enum gdb_syscall syscall_gdb;
2906 
2907  /* On s390, syscall number can be passed either as immediate field of svc
2908  instruction, or in %r1 (with svc 0). */
2909  if (syscall_native == 0)
2910  regcache_raw_read_signed (regcache, S390_R1_REGNUM, &syscall_native);
2911 
2912  syscall_gdb = s390_canonicalize_syscall (syscall_native, tdep->abi);
2913 
2914  if (syscall_gdb < 0)
2915  {
2916  printf_unfiltered (_("Process record and replay target doesn't "
2917  "support syscall number %s\n"),
2918  plongest (syscall_native));
2919  return -1;
2920  }
2921 
2922  if (syscall_gdb == gdb_sys_sigreturn
2923  || syscall_gdb == gdb_sys_rt_sigreturn)
2924  {
2926  return -1;
2927  return 0;
2928  }
2929 
2930  if (tdep->abi == ABI_LINUX_ZSERIES)
2931  ret = record_linux_system_call (syscall_gdb, regcache,
2933  else
2934  ret = record_linux_system_call (syscall_gdb, regcache,
2936 
2937  if (ret)
2938  return ret;
2939 
2940  /* Record the return value of the system call. */
2942  return -1;
2943 
2944  return 0;
2945 }
2946 
2947 static int
2949  enum gdb_signal signal)
2950 {
2951  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2952  /* There are two kinds of signal frames on s390. rt_sigframe is always
2953  the larger one, so don't even bother with sigframe. */
2954  const int sizeof_rt_sigframe = (tdep->abi == ABI_LINUX_ZSERIES ?
2955  160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
2956  ULONGEST sp;
2957  int i;
2958 
2959  for (i = 0; i < 16; i++)
2960  {
2962  return -1;
2963  if (tdep->gpr_full_regnum != -1)
2965  return -1;
2966  }
2968  return -1;
2970  return -1;
2971 
2972  /* Record the change in the stack.
2973  frame-size = sizeof (struct rt_sigframe) + SIGNAL_FRAMESIZE */
2975  sp -= sizeof_rt_sigframe;
2976 
2977  if (record_full_arch_list_add_mem (sp, sizeof_rt_sigframe))
2978  return -1;
2979 
2981  return -1;
2982 
2983  return 0;
2984 }
2985 
2986 /* Frame base handling. */
2987 
2988 static CORE_ADDR
2989 s390_frame_base_address (struct frame_info *this_frame, void **this_cache)
2990 {
2991  struct s390_unwind_cache *info
2992  = s390_frame_unwind_cache (this_frame, this_cache);
2993  return info->frame_base;
2994 }
2995 
2996 static CORE_ADDR
2997 s390_local_base_address (struct frame_info *this_frame, void **this_cache)
2998 {
2999  struct s390_unwind_cache *info
3000  = s390_frame_unwind_cache (this_frame, this_cache);
3001  return info->local_base;
3002 }
3003 
3004 static const struct frame_base s390_frame_base = {
3009 };
3010 
3011 static CORE_ADDR
3012 s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
3013 {
3014  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
3015  ULONGEST pc;
3016  pc = frame_unwind_register_unsigned (next_frame, tdep->pc_regnum);
3018 }
3019 
3020 static CORE_ADDR
3021 s390_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
3022 {
3023  ULONGEST sp;
3026 }
3027 
3028 
3029 /* DWARF-2 frame support. */
3030 
3031 static struct value *
3032 s390_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
3033  int regnum)
3034 {
3035  return s390_unwind_pseudo_register (this_frame, regnum);
3036 }
3037 
3038 static void
3040  struct dwarf2_frame_state_reg *reg,
3041  struct frame_info *this_frame)
3042 {
3043  /* The condition code (and thus PSW mask) is call-clobbered. */
3044  if (regnum == S390_PSWM_REGNUM)
3046 
3047  /* The PSW address unwinds to the return address. */
3048  else if (regnum == S390_PSWA_REGNUM)
3049  reg->how = DWARF2_FRAME_REG_RA;
3050 
3051  /* Fixed registers are call-saved or call-clobbered
3052  depending on the ABI in use. */
3053  else if (regnum < S390_NUM_REGS)
3054  {
3057  else
3059  }
3060 
3061  /* We install a special function to unwind pseudos. */
3062  else
3063  {
3064  reg->how = DWARF2_FRAME_REG_FN;
3065  reg->loc.fn = s390_dwarf2_prev_register;
3066  }
3067 }
3068 
3069 
3070 /* Dummy function calls. */
3071 
3072 /* Unwrap any single-field structs in TYPE and return the effective
3073  "inner" type. E.g., yield "float" for all these cases:
3074 
3075  float x;
3076  struct { float x };
3077  struct { struct { float x; } x; };
3078  struct { struct { struct { float x; } x; } x; };
3079 
3080  However, if an inner type is smaller than MIN_SIZE, abort the
3081  unwrapping. */
3082 
3083 static struct type *
3084 s390_effective_inner_type (struct type *type, unsigned int min_size)
3085 {
3086  while (TYPE_CODE (type) == TYPE_CODE_STRUCT
3087  && TYPE_NFIELDS (type) == 1)
3088  {
3089  struct type *inner = check_typedef (TYPE_FIELD_TYPE (type, 0));
3090 
3091  if (TYPE_LENGTH (inner) < min_size)
3092  break;
3093  type = inner;
3094  }
3095 
3096  return type;
3097 }
3098 
3099 /* Return non-zero if TYPE should be passed like "float" or
3100  "double". */
3101 
3102 static int
3104 {
3105  /* Note that long double as well as complex types are intentionally
3106  excluded. */
3107  if (TYPE_LENGTH (type) > 8)
3108  return 0;
3109 
3110  /* A struct containing just a float or double is passed like a float
3111  or double. */
3113 
3114  return (TYPE_CODE (type) == TYPE_CODE_FLT
3116 }
3117 
3118 /* Return non-zero if TYPE should be passed like a vector. */
3119 
3120 static int
3122 {
3123  if (TYPE_LENGTH (type) > 16)
3124  return 0;
3125 
3126  /* Structs containing just a vector are passed like a vector. */
3128 
3129  return TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type);
3130 }
3131 
3132 /* Determine whether N is a power of two. */
3133 
3134 static int
3135 is_power_of_two (unsigned int n)
3136 {
3137  return n && ((n & (n - 1)) == 0);
3138 }
3139 
3140 /* For an argument whose type is TYPE and which is not passed like a
3141  float or vector, return non-zero if it should be passed like "int"
3142  or "long long". */
3143 
3144 static int
3146 {
3147  enum type_code code = TYPE_CODE (type);
3148 
3149  if (TYPE_LENGTH (type) > 8)
3150  return 0;
3151 
3152  if (code == TYPE_CODE_INT
3153  || code == TYPE_CODE_ENUM
3154  || code == TYPE_CODE_RANGE
3155  || code == TYPE_CODE_CHAR
3156  || code == TYPE_CODE_BOOL
3157  || code == TYPE_CODE_PTR
3158  || TYPE_IS_REFERENCE (type))
3159  return 1;
3160 
3161  return ((code == TYPE_CODE_UNION || code == TYPE_CODE_STRUCT)
3163 }
3164 
3165 /* Argument passing state: Internal data structure passed to helper
3166  routines of s390_push_dummy_call. */
3167 
3169  {
3170  /* Register cache, or NULL, if we are in "preparation mode". */
3172  /* Next available general/floating-point/vector register for
3173  argument passing. */
3174  int gr, fr, vr;
3175  /* Current pointer to copy area (grows downwards). */
3177  /* Current pointer to parameter area (grows upwards). */
3179  };
3180 
3181 /* Prepare one argument ARG for a dummy call and update the argument
3182  passing state AS accordingly. If the regcache field in AS is set,
3183  operate in "write mode" and write ARG into the inferior. Otherwise
3184  run "preparation mode" and skip all updates to the inferior. */
3185 
3186 static void
3187 s390_handle_arg (struct s390_arg_state *as, struct value *arg,
3188  struct gdbarch_tdep *tdep, int word_size,
3189  enum bfd_endian byte_order, int is_unnamed)
3190 {
3191  struct type *type = check_typedef (value_type (arg));
3192  unsigned int length = TYPE_LENGTH (type);
3193  int write_mode = as->regcache != NULL;
3194 
3196  {
3197  /* The GNU/Linux for S/390 ABI uses FPRs 0 and 2 to pass
3198  arguments. The GNU/Linux for zSeries ABI uses 0, 2, 4, and
3199  6. */
3200  if (as->fr <= (tdep->abi == ABI_LINUX_S390 ? 2 : 6))
3201  {
3202  /* When we store a single-precision value in an FP register,
3203  it occupies the leftmost bits. */
3204  if (write_mode)
3206  S390_F0_REGNUM + as->fr,
3207  0, length,
3208  value_contents (arg));
3209  as->fr += 2;
3210  }
3211  else
3212  {
3213  /* When we store a single-precision value in a stack slot,
3214  it occupies the rightmost bits. */
3215  as->argp = align_up (as->argp + length, word_size);
3216  if (write_mode)
3217  write_memory (as->argp - length, value_contents (arg),
3218  length);
3219  }
3220  }
3221  else if (tdep->vector_abi == S390_VECTOR_ABI_128
3223  {
3224  static const char use_vr[] = {24, 26, 28, 30, 25, 27, 29, 31};
3225 
3226  if (!is_unnamed && as->vr < ARRAY_SIZE (use_vr))
3227  {
3228  int regnum = S390_V24_REGNUM + use_vr[as->vr] - 24;
3229 
3230  if (write_mode)
3232  0, length,
3233  value_contents (arg));
3234  as->vr++;
3235  }
3236  else
3237  {
3238  if (write_mode)
3239  write_memory (as->argp, value_contents (arg), length);
3240  as->argp = align_up (as->argp + length, word_size);
3241  }
3242  }
3243  else if (s390_function_arg_integer (type) && length <= word_size)
3244  {
3245  /* Initialize it just to avoid a GCC false warning. */
3246  ULONGEST val = 0;
3247 
3248  if (write_mode)
3249  {
3250  /* Place value in least significant bits of the register or
3251  memory word and sign- or zero-extend to full word size.
3252  This also applies to a struct or union. */
3253  val = TYPE_UNSIGNED (type)
3255  length, byte_order)
3257  length, byte_order);
3258  }
3259 
3260  if (as->gr <= 6)
3261  {
3262  if (write_mode)
3264  S390_R0_REGNUM + as->gr,
3265  val);
3266  as->gr++;
3267  }
3268  else
3269  {
3270  if (write_mode)
3271  write_memory_unsigned_integer (as->argp, word_size,
3272  byte_order, val);
3273  as->argp += word_size;
3274  }
3275  }
3276  else if (s390_function_arg_integer (type) && length == 8)
3277  {
3278  if (as->gr <= 5)
3279  {
3280  if (write_mode)
3281  {
3283  S390_R0_REGNUM + as->gr,
3284  value_contents (arg));
3286  S390_R0_REGNUM + as->gr + 1,
3287  value_contents (arg) + word_size);
3288  }
3289  as->gr += 2;
3290  }
3291  else
3292  {
3293  /* If we skipped r6 because we couldn't fit a DOUBLE_ARG
3294  in it, then don't go back and use it again later. */
3295  as->gr = 7;
3296 
3297  if (write_mode)
3298  write_memory (as->argp, value_contents (arg), length);
3299  as->argp += length;
3300  }
3301  }
3302  else
3303  {
3304  /* This argument type is never passed in registers. Place the
3305  value in the copy area and pass a pointer to it. Use 8-byte
3306  alignment as a conservative assumption. */
3307  as->copy = align_down (as->copy - length, 8);
3308  if (write_mode)
3309  write_memory (as->copy, value_contents (arg), length);
3310 
3311  if (as->gr <= 6)
3312  {
3313  if (write_mode)
3315  S390_R0_REGNUM + as->gr,
3316  as->copy);
3317  as->gr++;
3318  }
3319  else
3320  {
3321  if (write_mode)
3322  write_memory_unsigned_integer (as->argp, word_size,
3323  byte_order, as->copy);
3324  as->argp += word_size;
3325  }
3326  }
3327 }
3328 
3329 /* Put the actual parameter values pointed to by ARGS[0..NARGS-1] in
3330  place to be passed to a function, as specified by the "GNU/Linux
3331  for S/390 ELF Application Binary Interface Supplement".
3332 
3333  SP is the current stack pointer. We must put arguments, links,
3334  padding, etc. whereever they belong, and return the new stack
3335  pointer value.
3336 
3337  If STRUCT_RETURN is non-zero, then the function we're calling is
3338  going to return a structure by value; STRUCT_ADDR is the address of
3339  a block we've allocated for it on the stack.
3340 
3341  Our caller has taken care of any type promotions needed to satisfy
3342  prototypes or the old K&R argument-passing rules. */
3343 
3344 static CORE_ADDR
3345 s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
3346  struct regcache *regcache, CORE_ADDR bp_addr,
3347  int nargs, struct value **args, CORE_ADDR sp,
3348  int struct_return, CORE_ADDR struct_addr)
3349 {
3350  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
3351  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
3352  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
3353  int i;
3354  struct s390_arg_state arg_state, arg_prep;
3355  CORE_ADDR param_area_start, new_sp;
3356  struct type *ftype = check_typedef (value_type (function));
3357 
3358  if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
3359  ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
3360 
3361  arg_prep.copy = sp;
3362  arg_prep.gr = struct_return ? 3 : 2;
3363  arg_prep.fr = 0;
3364  arg_prep.vr = 0;
3365  arg_prep.argp = 0;
3366  arg_prep.regcache = NULL;
3367 
3368  /* Initialize arg_state for "preparation mode". */
3369  arg_state = arg_prep;
3370 
3371  /* Update arg_state.copy with the start of the reference-to-copy area
3372  and arg_state.argp with the size of the parameter area. */
3373  for (i = 0; i < nargs; i++)
3374  s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
3375  TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
3376 
3377  param_area_start = align_down (arg_state.copy - arg_state.argp, 8);
3378 
3379  /* Allocate the standard frame areas: the register save area, the
3380  word reserved for the compiler, and the back chain pointer. */
3381  new_sp = param_area_start - (16 * word_size + 32);
3382 
3383  /* Now we have the final stack pointer. Make sure we didn't
3384  underflow; on 31-bit, this would result in addresses with the
3385  high bit set, which causes confusion elsewhere. Note that if we
3386  error out here, stack and registers remain untouched. */
3387  if (gdbarch_addr_bits_remove (gdbarch, new_sp) != new_sp)
3388  error (_("Stack overflow"));
3389 
3390  /* Pass the structure return address in general register 2. */
3391  if (struct_return)
3393 
3394  /* Initialize arg_state for "write mode". */
3395  arg_state = arg_prep;
3396  arg_state.argp = param_area_start;
3397  arg_state.regcache = regcache;
3398 
3399  /* Write all parameters. */
3400  for (i = 0; i < nargs; i++)
3401  s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
3402  TYPE_VARARGS (ftype) && i >= TYPE_NFIELDS (ftype));
3403 
3404  /* Store return PSWA. In 31-bit mode, keep addressing mode bit. */
3405  if (word_size == 4)
3406  {
3407  ULONGEST pswa;
3409  bp_addr = (bp_addr & 0x7fffffff) | (pswa & 0x80000000);
3410  }
3412 
3413  /* Store updated stack pointer. */
3415 
3416  /* We need to return the 'stack part' of the frame ID,
3417  which is actually the top of the register save area. */
3418  return param_area_start;
3419 }
3420 
3421 /* Assuming THIS_FRAME is a dummy, return the frame ID of that
3422  dummy frame. The frame ID's base needs to match the TOS value
3423  returned by push_dummy_call, and the PC match the dummy frame's
3424  breakpoint. */
3425 static struct frame_id
3426 s390_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
3427 {
3428  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
3430  sp = gdbarch_addr_bits_remove (gdbarch, sp);
3431 
3432  return frame_id_build (sp + 16*word_size + 32,
3433  get_frame_pc (this_frame));
3434 }
3435 
3436 static CORE_ADDR
3438 {
3439  /* Both the 32- and 64-bit ABI's say that the stack pointer should
3440  always be aligned on an eight-byte boundary. */
3441  return (addr & -8);
3442 }
3443 
3444 
3445 /* Helper for s390_return_value: Set or retrieve a function return
3446  value if it resides in a register. */
3447 
3448 static void
3450  struct regcache *regcache,
3451  gdb_byte *out, const gdb_byte *in)
3452 {
3453  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
3454  int word_size = gdbarch_ptr_bit (gdbarch) / 8;
3455  int length = TYPE_LENGTH (type);
3456  int code = TYPE_CODE (type);
3457 
3459  {
3460  /* Float-like value: left-aligned in f0. */
3461  if (in != NULL)
3463  0, length, in);
3464  else
3466  0, length, out);
3467  }
3468  else if (code == TYPE_CODE_ARRAY)
3469  {
3470  /* Vector: left-aligned in v24. */
3471  if (in != NULL)
3473  0, length, in);
3474  else
3476  0, length, out);
3477  }
3478  else if (length <= word_size)
3479  {
3480  /* Integer: zero- or sign-extended in r2. */
3481  if (out != NULL)
3483  word_size - length, length, out);
3484  else if (TYPE_UNSIGNED (type))
3487  extract_unsigned_integer (in, length, byte_order));
3488  else
3491  extract_signed_integer (in, length, byte_order));
3492  }
3493  else if (length == 2 * word_size)
3494  {
3495  /* Double word: in r2 and r3. */
3496  if (in != NULL)
3497  {
3500  in + word_size);
3501  }
3502  else
3503  {
3506  out + word_size);
3507  }
3508  }
3509  else
3510  internal_error (__FILE__, __LINE__, _("invalid return type"));
3511 }
3512 
3513 
3514 /* Implement the 'return_value' gdbarch method. */
3515 
3516 static enum return_value_convention
3517 s390_return_value (struct gdbarch *gdbarch, struct value *function,
3518  struct type *type, struct regcache *regcache,
3519  gdb_byte *out, const gdb_byte *in)
3520 {
3521  enum return_value_convention rvc;
3522 
3523  type = check_typedef (type);
3524 
3525  switch (TYPE_CODE (type))
3526  {
3527  case TYPE_CODE_STRUCT:
3528  case TYPE_CODE_UNION:
3529  case TYPE_CODE_COMPLEX:
3531  break;
3532  case TYPE_CODE_ARRAY:
3534  && TYPE_LENGTH (type) <= 16 && TYPE_VECTOR (type))
3537  break;
3538  default:
3539  rvc = TYPE_LENGTH (type) <= 8
3542  }
3543 
3544  if (in != NULL || out != NULL)
3545  {
3548  else if (in != NULL)
3549  error (_("Cannot set function return value."));
3550  else
3551  error (_("Function return value unknown."));
3552  }
3553 
3554  return rvc;
3555 }
3556 
3557 
3558 /* Breakpoints. */
3559 constexpr gdb_byte s390_break_insn[] = { 0x0, 0x1 };
3560 
3561 typedef BP_MANIPULATION (s390_break_insn) s390_breakpoint;
3562 
3563 /* Address handling. */
3564 
3565 static CORE_ADDR
3566 s390_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
3567 {
3568  return addr & 0x7fffffff;
3569 }
3570 
3571 static int
3572 s390_address_class_type_flags (int byte_size, int dwarf2_addr_class)
3573 {
3574  if (byte_size == 4)
3576  else
3577  return 0;
3578 }
3579 
3580 static const char *
3582 {
3583  if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
3584  return "mode32";
3585  else
3586  return NULL;
3587 }
3588 
3589 static int
3591  const char *name,
3592  int *type_flags_ptr)
3593 {
3594  if (strcmp (name, "mode32") == 0)
3595  {
3596  *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
3597  return 1;
3598  }
3599  else
3600  return 0;
3601 }
3602 
3603 /* Implement gdbarch_gcc_target_options. GCC does not know "-m32" or
3604  "-mcmodel=large". */
3605 
3606 static char *
3608 {
3609  return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31");
3610 }
3611 
3612 /* Implement gdbarch_gnu_triplet_regexp. Target triplets are "s390-*"
3613  for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
3614  always "s390". Note that an s390x compiler supports "-m31" as
3615  well. */
3616 
3617 static const char *
3619 {
3620  return "s390x?";
3621 }
3622 
3623 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
3624  gdbarch.h. */
3625 
3626 static int
3628 {
3629  return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
3630  or indirection. */
3631  || *s == '%' /* Register access. */
3632  || isdigit (*s)); /* Literal number. */
3633 }
3634 
3635 /* Process record and replay helpers. */
3636 
3637 /* Takes the intermediate sum of address calculations and masks off upper
3638  bits according to current addressing mode. */
3639 
3640 static CORE_ADDR
3642  CORE_ADDR val) {
3643  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
3644  ULONGEST pswm, pswa;
3645  int am;
3646  if (tdep->abi == ABI_LINUX_S390)
3647  {
3649  am = pswa >> 31 & 1;
3650  }
3651  else
3652  {
3654  am = pswm >> 31 & 3;
3655  }
3656  switch (am)
3657  {
3658  case 0:
3659  return val & 0xffffff;
3660  case 1:
3661  return val & 0x7fffffff;
3662  case 3:
3663  return val;
3664  default:
3665  fprintf_unfiltered (gdb_stdlog, "Warning: Addressing mode %d used.", am);
3666  return 0;
3667  }
3668 }
3669 
3670 /* Calculates memory address using pre-calculated index, raw instruction word
3671  with b and d/dl fields, and raw instruction byte with dh field. Index and
3672  dh should be set to 0 if unused. */
3673 
3674 static CORE_ADDR
3676  ULONGEST x, uint16_t bd, int8_t dh)
3677 {
3678  uint8_t rb = bd >> 12 & 0xf;
3679  int32_t d = (bd & 0xfff) | ((int32_t)dh << 12);
3680  ULONGEST b;
3681  CORE_ADDR res = d + x;
3682  if (rb)
3683  {
3685  res += b;
3686  }
3687  return s390_record_address_mask (gdbarch, regcache, res);
3688 }
3689 
3690 /* Calculates memory address using raw x, b + d/dl, dh fields from
3691  instruction. rx and dh should be set to 0 if unused. */
3692 
3693 static CORE_ADDR
3695  uint8_t rx, uint16_t bd, int8_t dh)
3696 {
3697  ULONGEST x = 0;
3698  if (rx)
3700  return s390_record_calc_disp_common (gdbarch, regcache, x, bd, dh);
3701 }
3702 
3703 /* Calculates memory address for VSCE[GF] instructions. */
3704 
3705 static int
3707  uint8_t vx, uint8_t el, uint8_t es, uint16_t bd,
3708  int8_t dh, CORE_ADDR *res)
3709 {
3710  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
3711  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
3712  ULONGEST x;
3713  gdb_byte buf[16];
3714  if (tdep->v0_full_regnum == -1 || el * es >= 16)
3715  return -1;
3716  if (vx < 16)
3717  regcache_cooked_read (regcache, tdep->v0_full_regnum + vx, buf);
3718  else
3719  regcache_raw_read (regcache, S390_V16_REGNUM + vx - 16, buf);
3720  x = extract_unsigned_integer (buf + el * es, es, byte_order);
3721  *res = s390_record_calc_disp_common (gdbarch, regcache, x, bd, dh);
3722  return 0;
3723 }
3724 
3725 /* Calculates memory address for instructions with relative long addressing. */
3726 
3727 static CORE_ADDR
3729  CORE_ADDR addr, uint16_t i1, uint16_t i2)
3730 {
3731  int32_t ri = i1 << 16 | i2;
3732  return s390_record_address_mask (gdbarch, regcache, addr + (LONGEST)ri * 2);
3733 }
3734 
3735 /* Population count helper. */
3736 
3737 static int s390_popcnt (unsigned int x) {
3738  int res = 0;
3739  while (x)
3740  {
3741  if (x & 1)
3742  res++;
3743  x >>= 1;
3744  }
3745  return res;
3746 }
3747 
3748 /* Record 64-bit register. */
3749 
3750 static int
3752 {
3753  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
3755  return -1;
3756  if (tdep->abi == ABI_LINUX_S390)
3758  return -1;
3759  return 0;
3760 }
3761 
3762 /* Record high 32 bits of a register. */
3763 
3764 static int
3766 {
3767  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
3768  if (tdep->abi == ABI_LINUX_S390)
3769  {
3771  return -1;
3772  }
3773  else
3774  {
3776  return -1;
3777  }
3778  return 0;
3779 }
3780 
3781 /* Record vector register. */
3782 
3783 static int
3785 {
3786  if (i < 16)
3787  {
3789  return -1;
3791  return -1;
3792  }
3793  else
3794  {
3796  return -1;
3797  }
3798  return 0;
3799 }
3800 
3801 static int
3803  CORE_ADDR addr)
3804 {
3805  uint16_t insn[3] = {0};
3806  /* Instruction as bytes. */
3807  uint8_t ibyte[6];
3808  /* Instruction as nibbles. */
3809  uint8_t inib[12];
3810  /* Instruction vector registers. */
3811  uint8_t ivec[4];
3812  CORE_ADDR oaddr, oaddr2, oaddr3;
3813  ULONGEST tmp;
3814  int i, n;
3815  /* if EX/EXRL instruction used, here's the reg parameter */
3816  int ex = -1;
3817  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
3818 
3819  /* Attempting to use EX or EXRL jumps back here */
3820 ex:
3821 
3822  /* Read instruction. */
3823  insn[0] = read_memory_unsigned_integer (addr, 2, byte_order);
3824  /* If execute was involved, do the adjustment. */
3825  if (ex != -1)
3826  insn[0] |= ex & 0xff;
3827  /* Two highest bits determine instruction size. */
3828  if (insn[0] >= 0x4000)
3829  insn[1] = read_memory_unsigned_integer (addr+2, 2, byte_order);
3830  else
3831  /* Not necessary, but avoids uninitialized variable warnings. */
3832  insn[1] = 0;
3833  if (insn[0] >= 0xc000)
3834  insn[2] = read_memory_unsigned_integer (addr+4, 2, byte_order);
3835  else
3836  insn[2] = 0;
3837  /* Split instruction into bytes and nibbles. */
3838  for (i = 0; i < 3; i++)
3839  {
3840  ibyte[i*2] = insn[i] >> 8 & 0xff;
3841  ibyte[i*2+1] = insn[i] & 0xff;
3842  }
3843  for (i = 0; i < 6; i++)
3844  {
3845  inib[i*2] = ibyte[i] >> 4 & 0xf;
3846  inib[i*2+1] = ibyte[i] & 0xf;
3847  }
3848  /* Compute vector registers, if applicable. */
3849  ivec[0] = (inib[9] >> 3 & 1) << 4 | inib[2];
3850  ivec[1] = (inib[9] >> 2 & 1) << 4 | inib[3];
3851  ivec[2] = (inib[9] >> 1 & 1) << 4 | inib[4];
3852  ivec[3] = (inib[9] >> 0 & 1) << 4 | inib[8];
3853 
3854  switch (ibyte[0])
3855  {
3856  /* 0x00 undefined */
3857 
3858  case 0x01:
3859  /* E-format instruction */
3860  switch (ibyte[1])
3861  {
3862  /* 0x00 undefined */
3863  /* 0x01 unsupported: PR - program return */
3864  /* 0x02 unsupported: UPT */
3865  /* 0x03 undefined */
3866  /* 0x04 privileged: PTFF - perform timing facility function */
3867  /* 0x05-0x06 undefined */
3868  /* 0x07 privileged: SCKPF - set clock programmable field */
3869  /* 0x08-0x09 undefined */
3870 
3871  case 0x0a: /* PFPO - perform floating point operation */
3873  if (!(tmp & 0x80000000u))
3874  {
3875  uint8_t ofc = tmp >> 16 & 0xff;
3876  switch (ofc)
3877  {
3878  case 0x00: /* HFP32 */
3879  case 0x01: /* HFP64 */
3880  case 0x05: /* BFP32 */
3881  case 0x06: /* BFP64 */
3882  case 0x08: /* DFP32 */
3883  case 0x09: /* DFP64 */
3885  return -1;
3886  break;
3887  case 0x02: /* HFP128 */
3888  case 0x07: /* BFP128 */
3889  case 0x0a: /* DFP128 */
3891  return -1;
3893  return -1;
3894  break;
3895  default:
3896  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown PFPO OFC %02x at %s.\n",
3897  ofc, paddress (gdbarch, addr));
3898  return -1;
3899  }
3900 
3902  return -1;
3903  }
3905  return -1;
3907  return -1;
3908  break;
3909 
3910  case 0x0b: /* TAM - test address mode */
3911  case 0x0c: /* SAM24 - set address mode 24 */
3912  case 0x0d: /* SAM31 - set address mode 31 */
3913  case 0x0e: /* SAM64 - set address mode 64 */
3915  return -1;
3916  break;
3917 
3918  /* 0x0f-0xfe undefined */
3919 
3920  /* 0xff unsupported: TRAP */
3921 
3922  default:
3923  goto UNKNOWN_OP;
3924  }
3925  break;
3926 
3927  /* 0x02 undefined */
3928  /* 0x03 undefined */
3929 
3930  case 0x04: /* SPM - set program mask */
3932  return -1;
3933  break;
3934 
3935  case 0x05: /* BALR - branch and link */
3936  case 0x45: /* BAL - branch and link */
3937  case 0x06: /* BCTR - branch on count */
3938  case 0x46: /* BCT - branch on count */
3939  case 0x0d: /* BASR - branch and save */
3940  case 0x4d: /* BAS - branch and save */
3941  case 0x84: /* BRXH - branch relative on index high */
3942  case 0x85: /* BRXLE - branch relative on index low or equal */
3943  case 0x86: /* BXH - branch on index high */
3944  case 0x87: /* BXLE - branch on index low or equal */
3945  /* BA[SL]* use native-size destination for linkage info, BCT*, BRX*, BX*
3946  use 32-bit destination as counter. */
3948  return -1;
3949  break;
3950 
3951  case 0x07: /* BCR - branch on condition */
3952  case 0x47: /* BC - branch on condition */
3953  /* No effect other than PC transfer. */
3954  break;
3955 
3956  /* 0x08 undefined */
3957  /* 0x09 undefined */
3958 
3959  case 0x0a:
3960  /* SVC - supervisor call */
3961  if (s390_linux_syscall_record (regcache, ibyte[1]))
3962  return -1;
3963  break;
3964 
3965  case 0x0b: /* BSM - branch and set mode */
3966  if (inib[2])
3968  return -1;
3970  return -1;
3971  break;
3972 
3973  case 0x0c: /* BASSM - branch and save and set mode */
3975  return -1;
3977  return -1;
3978  break;
3979 
3980  case 0x0e: /* MVCL - move long [interruptible] */
3982  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
3983  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1), &tmp);
3984  tmp &= 0xffffff;
3985  if (record_full_arch_list_add_mem (oaddr, tmp))
3986  return -1;
3988  return -1;
3989  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
3990  return -1;
3992  return -1;
3993  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
3994  return -1;
3996  return -1;
3997  break;
3998 
3999  case 0x0f: /* CLCL - compare logical long [interruptible] */
4000  case 0xa9: /* CLCLE - compare logical long extended [partial] */
4002  return -1;
4003  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
4004  return -1;
4006  return -1;
4007  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
4008  return -1;
4010  return -1;
4011  break;
4012 
4013  case 0x10: /* LPR - load positive */
4014  case 0x11: /* LNR - load negative */
4015  case 0x12: /* LTR - load and test */
4016  case 0x13: /* LCR - load complement */
4017  case 0x14: /* NR - and */
4018  case 0x16: /* OR - or */
4019  case 0x17: /* XR - xor */
4020  case 0x1a: /* AR - add */
4021  case 0x1b: /* SR - subtract */
4022  case 0x1e: /* ALR - add logical */
4023  case 0x1f: /* SLR - subtract logical */
4024  case 0x54: /* N - and */
4025  case 0x56: /* O - or */
4026  case 0x57: /* X - xor */
4027  case 0x5a: /* A - add */
4028  case 0x5b: /* S - subtract */
4029  case 0x5e: /* AL - add logical */
4030  case 0x5f: /* SL - subtract logical */
4031  case 0x4a: /* AH - add halfword */
4032  case 0x4b: /* SH - subtract halfword */
4033  case 0x8a: /* SRA - shift right single */
4034  case 0x8b: /* SLA - shift left single */
4035  case 0xbf: /* ICM - insert characters under mask */
4036  /* 32-bit destination + flags */
4038  return -1;
4040  return -1;
4041  break;
4042 
4043  case 0x15: /* CLR - compare logical */
4044  case 0x55: /* CL - compare logical */
4045  case 0x19: /* CR - compare */
4046  case 0x29: /* CDR - compare */
4047  case 0x39: /* CER - compare */
4048  case 0x49: /* CH - compare halfword */
4049  case 0x59: /* C - compare */
4050  case 0x69: /* CD - compare */
4051  case 0x79: /* CE - compare */
4052  case 0x91: /* TM - test under mask */
4053  case 0x95: /* CLI - compare logical */
4054  case 0xbd: /* CLM - compare logical under mask */
4055  case 0xd5: /* CLC - compare logical */
4057  return -1;
4058  break;
4059 
4060  case 0x18: /* LR - load */
4061  case 0x48: /* LH - load halfword */
4062  case 0x58: /* L - load */
4063  case 0x41: /* LA - load address */
4064  case 0x43: /* IC - insert character */
4065  case 0x4c: /* MH - multiply halfword */
4066  case 0x71: /* MS - multiply single */
4067  case 0x88: /* SRL - shift right single logical */
4068  case 0x89: /* SLL - shift left single logical */
4069  /* 32-bit, 8-bit (IC), or native width (LA) destination, no flags */
4071  return -1;
4072  break;
4073 
4074  case 0x1c: /* MR - multiply */
4075  case 0x5c: /* M - multiply */
4076  case 0x1d: /* DR - divide */
4077  case 0x5d: /* D - divide */
4078  case 0x8c: /* SRDL - shift right double logical */
4079  case 0x8d: /* SLDL - shift left double logical */
4080  /* 32-bit pair destination, no flags */
4082  return -1;
4083  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
4084  return -1;
4085  break;
4086 
4087  case 0x20: /* LPDR - load positive */
4088  case 0x30: /* LPER - load positive */
4089  case 0x21: /* LNDR - load negative */
4090  case 0x31: /* LNER - load negative */
4091  case 0x22: /* LTDR - load and test */
4092  case 0x32: /* LTER - load and test */
4093  case 0x23: /* LCDR - load complement */
4094  case 0x33: /* LCER - load complement */
4095  case 0x2a: /* ADR - add */
4096  case 0x3a: /* AER - add */
4097  case 0x6a: /* AD - add */
4098  case 0x7a: /* AE - add */
4099  case 0x2b: /* SDR - subtract */
4100  case 0x3b: /* SER - subtract */
4101  case 0x6b: /* SD - subtract */
4102  case 0x7b: /* SE - subtract */
4103  case 0x2e: /* AWR - add unnormalized */
4104  case 0x3e: /* AUR - add unnormalized */
4105  case 0x6e: /* AW - add unnormalized */
4106  case 0x7e: /* AU - add unnormalized */
4107  case 0x2f: /* SWR - subtract unnormalized */
4108  case 0x3f: /* SUR - subtract unnormalized */
4109  case 0x6f: /* SW - subtract unnormalized */
4110  case 0x7f: /* SU - subtract unnormalized */
4111  /* float destination + flags */
4113  return -1;
4115  return -1;
4116  break;
4117 
4118  case 0x24: /* HDR - halve */
4119  case 0x34: /* HER - halve */
4120  case 0x25: /* LDXR - load rounded */
4121  case 0x35: /* LEDR - load rounded */
4122  case 0x28: /* LDR - load */
4123  case 0x38: /* LER - load */
4124  case 0x68: /* LD - load */
4125  case 0x78: /* LE - load */
4126  case 0x2c: /* MDR - multiply */
4127  case 0x3c: /* MDER - multiply */
4128  case 0x6c: /* MD - multiply */
4129  case 0x7c: /* MDE - multiply */
4130  case 0x2d: /* DDR - divide */
4131  case 0x3d: /* DER - divide */
4132  case 0x6d: /* DD - divide */
4133  case 0x7d: /* DE - divide */
4134  /* float destination, no flags */
4136  return -1;
4137  break;
4138 
4139  case 0x26: /* MXR - multiply */
4140  case 0x27: /* MXDR - multiply */
4141  case 0x67: /* MXD - multiply */
4142  /* float pair destination, no flags */
4144  return -1;
4145  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
4146  return -1;
4147  break;
4148 
4149  case 0x36: /* AXR - add */
4150  case 0x37: /* SXR - subtract */
4151  /* float pair destination + flags */
4153  return -1;
4154  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
4155  return -1;
4157  return -1;
4158  break;
4159 
4160  case 0x40: /* STH - store halfword */
4161  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
4162  if (record_full_arch_list_add_mem (oaddr, 2))
4163  return -1;
4164  break;
4165 
4166  case 0x42: /* STC - store character */
4167  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
4168  if (record_full_arch_list_add_mem (oaddr, 1))
4169  return -1;
4170  break;
4171 
4172  case 0x44: /* EX - execute */
4173  if (ex != -1)
4174  {
4175  fprintf_unfiltered (gdb_stdlog, "Warning: Double execute at %s.\n",
4176  paddress (gdbarch, addr));
4177  return -1;
4178  }
4179  addr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
4180  if (inib[2])
4181  {
4183  ex = tmp & 0xff;
4184  }
4185  else
4186  {
4187  ex = 0;
4188  }
4189  goto ex;
4190 
4191  case 0x4e: /* CVD - convert to decimal */
4192  case 0x60: /* STD - store */
4193  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
4194  if (record_full_arch_list_add_mem (oaddr, 8))
4195  return -1;
4196  break;
4197 
4198  case 0x4f: /* CVB - convert to binary */
4199  /* 32-bit gpr destination + FPC (DXC write) */
4201  return -1;
4203  return -1;
4204  break;
4205 
4206  case 0x50: /* ST - store */
4207  case 0x70: /* STE - store */
4208  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
4209  if (record_full_arch_list_add_mem (oaddr, 4))
4210  return -1;
4211  break;
4212 
4213  case 0x51: /* LAE - load address extended */
4215  return -1;
4217  return -1;
4218  break;
4219 
4220  /* 0x52 undefined */
4221  /* 0x53 undefined */
4222 
4223  /* 0x61-0x66 undefined */
4224 
4225  /* 0x72-0x77 undefined */
4226 
4227  /* 0x80 privileged: SSM - set system mask */
4228  /* 0x81 undefined */
4229  /* 0x82 privileged: LPSW - load PSW */
4230  /* 0x83 privileged: diagnose */
4231 
4232  case 0x8e: /* SRDA - shift right double */
4233  case 0x8f: /* SLDA - shift left double */
4234  /* 32-bit pair destination + flags */
4236  return -1;
4237  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
4238  return -1;
4240  return -1;
4241  break;
4242 
4243  case 0x90: /* STM - store multiple */
4244  case 0x9b: /* STAM - store access multiple */
4245  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4246  if (inib[2] <= inib[3])
4247  n = inib[3] - inib[2] + 1;
4248  else
4249  n = inib[3] + 0x10 - inib[2] + 1;
4250  if (record_full_arch_list_add_mem (oaddr, n * 4))
4251  return -1;
4252  break;
4253 
4254  case 0x92: /* MVI - move */
4255  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4256  if (record_full_arch_list_add_mem (oaddr, 1))
4257  return -1;
4258  break;
4259 
4260  case 0x93: /* TS - test and set */
4261  case 0x94: /* NI - and */
4262  case 0x96: /* OI - or */
4263  case 0x97: /* XI - xor */
4264  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4265  if (record_full_arch_list_add_mem (oaddr, 1))
4266  return -1;
4268  return -1;
4269  break;
4270 
4271  case 0x98: /* LM - load multiple */
4272  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
4274  return -1;
4276  return -1;
4277  break;
4278 
4279  /* 0x99 privileged: TRACE */
4280 
4281  case 0x9a: /* LAM - load access multiple */
4282  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
4284  return -1;
4286  return -1;
4287  break;
4288 
4289  /* 0x9c-0x9f privileged and obsolete (old I/O) */
4290  /* 0xa0-0xa4 undefined */
4291 
4292  case 0xa5:
4293  case 0xa7:
4294  /* RI-format instruction */
4295  switch (ibyte[0] << 4 | inib[3])
4296  {
4297  case 0xa50: /* IIHH - insert immediate */
4298  case 0xa51: /* IIHL - insert immediate */
4299  /* high 32-bit destination */
4300  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
4301  return -1;
4302  break;
4303 
4304  case 0xa52: /* IILH - insert immediate */
4305  case 0xa53: /* IILL - insert immediate */
4306  case 0xa75: /* BRAS - branch relative and save */
4307  case 0xa76: /* BRCT - branch relative on count */
4308  case 0xa78: /* LHI - load halfword immediate */
4309  case 0xa7c: /* MHI - multiply halfword immediate */
4310  /* 32-bit or native destination */
4312  return -1;
4313  break;
4314 
4315  case 0xa54: /* NIHH - and immediate */
4316  case 0xa55: /* NIHL - and immediate */
4317  case 0xa58: /* OIHH - or immediate */
4318  case 0xa59: /* OIHL - or immediate */
4319  /* high 32-bit destination + flags */
4320  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
4321  return -1;
4323  return -1;
4324  break;
4325 
4326  case 0xa56: /* NILH - and immediate */
4327  case 0xa57: /* NILL - and immediate */
4328  case 0xa5a: /* OILH - or immediate */
4329  case 0xa5b: /* OILL - or immediate */
4330  case 0xa7a: /* AHI - add halfword immediate */
4331  /* 32-bit destination + flags */
4333  return -1;
4335  return -1;
4336  break;
4337 
4338  case 0xa5c: /* LLIHH - load logical immediate */
4339  case 0xa5d: /* LLIHL - load logical immediate */
4340  case 0xa5e: /* LLILH - load logical immediate */
4341  case 0xa5f: /* LLILL - load logical immediate */
4342  case 0xa77: /* BRCTG - branch relative on count */
4343  case 0xa79: /* LGHI - load halfword immediate */
4344  case 0xa7d: /* MGHI - multiply halfword immediate */
4345  /* 64-bit destination */
4346  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
4347  return -1;
4348  break;
4349 
4350  case 0xa70: /* TMLH - test under mask */
4351  case 0xa71: /* TMLL - test under mask */
4352  case 0xa72: /* TMHH - test under mask */
4353  case 0xa73: /* TMHL - test under mask */
4354  case 0xa7e: /* CHI - compare halfword immediate */
4355  case 0xa7f: /* CGHI - compare halfword immediate */
4356  /* flags only */
4358  return -1;
4359  break;
4360 
4361  case 0xa74: /* BRC - branch relative on condition */
4362  /* no register change */
4363  break;
4364 
4365  case 0xa7b: /* AGHI - add halfword immediate */
4366  /* 64-bit destination + flags */
4367  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
4368  return -1;
4370  return -1;
4371  break;
4372 
4373  default:
4374  goto UNKNOWN_OP;
4375  }
4376  break;
4377 
4378  /* 0xa6 undefined */
4379 
4380  case 0xa8: /* MVCLE - move long extended [partial] */
4382  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
4383  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1), &tmp);
4384  if (record_full_arch_list_add_mem (oaddr, tmp))
4385  return -1;
4387  return -1;
4388  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
4389  return -1;
4391  return -1;
4392  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
4393  return -1;
4395  return -1;
4396  break;
4397 
4398  /* 0xaa-0xab undefined */
4399  /* 0xac privileged: STNSM - store then and system mask */
4400  /* 0xad privileged: STOSM - store then or system mask */
4401  /* 0xae privileged: SIGP - signal processor */
4402  /* 0xaf unsupported: MC - monitor call */
4403  /* 0xb0 undefined */
4404  /* 0xb1 privileged: LRA - load real address */
4405 
4406  case 0xb2:
4407  case 0xb3:
4408  case 0xb9:
4409  /* S/RRD/RRE/RRF/IE-format instruction */
4410  switch (insn[0])
4411  {
4412  /* 0xb200-0xb204 undefined or privileged */
4413 
4414  case 0xb205: /* STCK - store clock */
4415  case 0xb27c: /* STCKF - store clock fast */
4416  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4417  if (record_full_arch_list_add_mem (oaddr, 8))
4418  return -1;
4420  return -1;
4421  break;
4422 
4423  /* 0xb206-0xb219 undefined, privileged, or unsupported */
4424  /* 0xb21a unsupported: CFC */
4425  /* 0xb21b-0xb221 undefined or privileged */
4426 
4427  case 0xb222: /* IPM - insert program mask */
4428  case 0xb24f: /* EAR - extract access */
4429  case 0xb252: /* MSR - multiply single */
4430  case 0xb2ec: /* ETND - extract transaction nesting depth */
4431  case 0xb38c: /* EFPC - extract fpc */
4432  case 0xb91f: /* LRVR - load reversed */
4433  case 0xb926: /* LBR - load byte */
4434  case 0xb927: /* LHR - load halfword */
4435  case 0xb994: /* LLCR - load logical character */
4436  case 0xb995: /* LLHR - load logical halfword */
4437  case 0xb9f2: /* LOCR - load on condition */
4438  /* 32-bit gpr destination */
4440  return -1;
4441  break;
4442 
4443  /* 0xb223-0xb22c privileged or unsupported */
4444 
4445  case 0xb22d: /* DXR - divide */
4446  case 0xb325: /* LXDR - load lengthened */
4447  case 0xb326: /* LXER - load lengthened */
4448  case 0xb336: /* SQXR - square root */
4449  case 0xb365: /* LXR - load */
4450  case 0xb367: /* FIXR - load fp integer */
4451  case 0xb376: /* LZXR - load zero */
4452  case 0xb3b6: /* CXFR - convert from fixed */
4453  case 0xb3c6: /* CXGR - convert from fixed */
4454  case 0xb3fe: /* IEXTR - insert biased exponent */
4455  /* float pair destination */
4457  return -1;
4458  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
4459  return -1;
4460  break;
4461 
4462  /* 0xb22e-0xb240 undefined, privileged, or unsupported */
4463 
4464  case 0xb241: /* CKSM - checksum [partial] */
4466  return -1;
4468  return -1;
4469  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
4470  return -1;
4472  return -1;
4473  break;
4474 
4475  /* 0xb242-0xb243 undefined */
4476 
4477  case 0xb244: /* SQDR - square root */
4478  case 0xb245: /* SQER - square root */
4479  case 0xb324: /* LDER - load lengthened */
4480  case 0xb337: /* MEER - multiply */
4481  case 0xb366: /* LEXR - load rounded */
4482  case 0xb370: /* LPDFR - load positive */
4483  case 0xb371: /* LNDFR - load negative */
4484  case 0xb372: /* CSDFR - copy sign */
4485  case 0xb373: /* LCDFR - load complement */
4486  case 0xb374: /* LZER - load zero */
4487  case 0xb375: /* LZDR - load zero */
4488  case 0xb377: /* FIER - load fp integer */
4489  case 0xb37f: /* FIDR - load fp integer */
4490  case 0xb3b4: /* CEFR - convert from fixed */
4491  case 0xb3b5: /* CDFR - convert from fixed */
4492  case 0xb3c1: /* LDGR - load fpr from gr */
4493  case 0xb3c4: /* CEGR - convert from fixed */
4494  case 0xb3c5: /* CDGR - convert from fixed */
4495  case 0xb3f6: /* IEDTR - insert biased exponent */
4496  /* float destination */
4498  return -1;
4499  break;
4500 
4501  /* 0xb246-0xb24c: privileged or unsupported */
4502 
4503  case 0xb24d: /* CPYA - copy access */
4504  case 0xb24e: /* SAR - set access */
4506  return -1;
4507  break;
4508 
4509  /* 0xb250-0xb251 undefined or privileged */
4510  /* 0xb253-0xb254 undefined or privileged */
4511 
4512  case 0xb255: /* MVST - move string [partial] */
4513  {
4514  uint8_t end;
4515  gdb_byte cur;
4516  ULONGEST num = 0;
4517  /* Read ending byte. */
4519  end = tmp & 0xff;
4520  /* Get address of second operand. */
4522  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
4523  /* Search for ending byte and compute length. */
4524  do {
4525  num++;
4526  if (target_read_memory (oaddr, &cur, 1))
4527  return -1;
4528  oaddr++;
4529  } while (cur != end);
4530  /* Get address of first operand and record it. */
4532  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
4533  if (record_full_arch_list_add_mem (oaddr, num))
4534  return -1;
4535  /* Record the registers. */
4537  return -1;
4539  return -1;
4541  return -1;
4542  }
4543  break;
4544 
4545  /* 0xb256 undefined */
4546 
4547  case 0xb257: /* CUSE - compare until substring equal [interruptible] */
4549  return -1;
4550  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
4551  return -1;
4553  return -1;
4554  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
4555  return -1;
4557  return -1;
4558  break;
4559 
4560  /* 0xb258-0xb25c undefined, privileged, or unsupported */
4561 
4562  case 0xb25d: /* CLST - compare logical string [partial] */
4563  case 0xb25e: /* SRST - search string [partial] */
4564  case 0xb9be: /* SRSTU - search string unicode [partial] */
4566  return -1;
4568  return -1;
4570  return -1;
4571  break;
4572 
4573  /* 0xb25f-0xb262 undefined */
4574 
4575  case 0xb263: /* CMPSC - compression call [interruptible] */
4577  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
4578  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
4579  if (record_full_arch_list_add_mem (oaddr, tmp))
4580  return -1;
4582  return -1;
4583  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
4584  return -1;
4586  return -1;
4587  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
4588  return -1;
4590  return -1;
4591  /* DXC may be written */
4593  return -1;
4595  return -1;
4596  break;
4597 
4598  /* 0xb264-0xb277 undefined, privileged, or unsupported */
4599 
4600  case 0xb278: /* STCKE - store clock extended */
4601  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4602  if (record_full_arch_list_add_mem (oaddr, 16))
4603  return -1;
4605  return -1;
4606  break;
4607 
4608  /* 0xb279-0xb27b undefined or unsupported */
4609  /* 0xb27d-0xb298 undefined or privileged */
4610 
4611  case 0xb299: /* SRNM - set rounding mode */
4612  case 0xb2b8: /* SRNMB - set bfp rounding mode */
4613  case 0xb2b9: /* SRNMT - set dfp rounding mode */
4614  case 0xb29d: /* LFPC - load fpc */
4615  case 0xb2bd: /* LFAS - load fpc and signal */
4616  case 0xb384: /* SFPC - set fpc */
4617  case 0xb385: /* SFASR - set fpc and signal */
4618  case 0xb960: /* CGRT - compare and trap */
4619  case 0xb961: /* CLGRT - compare logical and trap */
4620  case 0xb972: /* CRT - compare and trap */
4621  case 0xb973: /* CLRT - compare logical and trap */
4622  /* fpc only - including possible DXC write for trapping insns */
4624  return -1;
4625  break;
4626 
4627  /* 0xb29a-0xb29b undefined */
4628 
4629  case 0xb29c: /* STFPC - store fpc */
4630  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4631  if (record_full_arch_list_add_mem (oaddr, 4))
4632  return -1;
4633  break;
4634 
4635  /* 0xb29e-0xb2a4 undefined */
4636 
4637  case 0xb2a5: /* TRE - translate extended [partial] */
4639  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
4640  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
4641  if (record_full_arch_list_add_mem (oaddr, tmp))
4642  return -1;
4644  return -1;
4645  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
4646  return -1;
4648  return -1;
4649  break;
4650 
4651  case 0xb2a6: /* CU21 - convert UTF-16 to UTF-8 [partial] */
4652  case 0xb2a7: /* CU12 - convert UTF-8 to UTF-16 [partial] */
4653  case 0xb9b0: /* CU14 - convert UTF-8 to UTF-32 [partial] */
4654  case 0xb9b1: /* CU24 - convert UTF-16 to UTF-32 [partial] */
4655  case 0xb9b2: /* CU41 - convert UTF-32 to UTF-8 [partial] */
4656  case 0xb9b3: /* CU42 - convert UTF-32 to UTF-16 [partial] */
4658  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
4659  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
4660  if (record_full_arch_list_add_mem (oaddr, tmp))
4661  return -1;
4663  return -1;
4664  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
4665  return -1;
4667  return -1;
4668  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
4669  return -1;
4671  return -1;
4672  break;
4673 
4674  /* 0xb2a8-0xb2af undefined */
4675 
4676  case 0xb2b0: /* STFLE - store facility list extended */
4677  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
4679  tmp &= 0xff;
4680  if (record_full_arch_list_add_mem (oaddr, 8 * (tmp + 1)))
4681  return -1;
4683  return -1;
4685  return -1;
4686  break;
4687 
4688  /* 0xb2b1-0xb2b7 undefined or privileged */
4689  /* 0xb2ba-0xb2bc undefined */
4690  /* 0xb2be-0xb2e7 undefined */
4691  /* 0xb2e9-0xb2eb undefined */
4692  /* 0xb2ed-0xb2f7 undefined */
4693  /* 0xb2f8 unsupported: TEND */
4694  /* 0xb2f9 undefined */
4695 
4696  case 0xb2e8: /* PPA - perform processor assist */
4697  case 0xb2fa: /* NIAI - next instruction access intent */
4698  /* no visible effects */
4699  break;
4700 
4701  /* 0xb2fb undefined */
4702  /* 0xb2fc unsupported: TABORT */
4703  /* 0xb2fd-0xb2fe undefined */
4704  /* 0xb2ff unsupported: TRAP */
4705 
4706  case 0xb300: /* LPEBR - load positive */
4707  case 0xb301: /* LNEBR - load negative */
4708  case 0xb303: /* LCEBR - load complement */
4709  case 0xb310: /* LPDBR - load positive */
4710  case 0xb311: /* LNDBR - load negative */
4711  case 0xb313: /* LCDBR - load complement */
4712  case 0xb350: /* TBEDR - convert hfp to bfp */
4713  case 0xb351: /* TBDR - convert hfp to bfp */
4714  case 0xb358: /* THDER - convert bfp to hfp */
4715  case 0xb359: /* THDR - convert bfp to hfp */
4716  /* float destination + flags */
4718  return -1;
4720  return -1;
4721  break;
4722 
4723  case 0xb304: /* LDEBR - load lengthened */
4724  case 0xb30c: /* MDEBR - multiply */
4725  case 0xb30d: /* DEBR - divide */
4726  case 0xb314: /* SQEBR - square root */
4727  case 0xb315: /* SQDBR - square root */
4728  case 0xb317: /* MEEBR - multiply */
4729  case 0xb31c: /* MDBR - multiply */
4730  case 0xb31d: /* DDBR - divide */
4731  case 0xb344: /* LEDBRA - load rounded */
4732  case 0xb345: /* LDXBRA - load rounded */
4733  case 0xb346: /* LEXBRA - load rounded */
4734  case 0xb357: /* FIEBRA - load fp integer */
4735  case 0xb35f: /* FIDBRA - load fp integer */
4736  case 0xb390: /* CELFBR - convert from logical */
4737  case 0xb391: /* CDLFBR - convert from logical */
4738  case 0xb394: /* CEFBR - convert from fixed */
4739  case 0xb395: /* CDFBR - convert from fixed */
4740  case 0xb3a0: /* CELGBR - convert from logical */
4741  case 0xb3a1: /* CDLGBR - convert from logical */
4742  case 0xb3a4: /* CEGBR - convert from fixed */
4743  case 0xb3a5: /* CDGBR - convert from fixed */
4744  case 0xb3d0: /* MDTR - multiply */
4745  case 0xb3d1: /* DDTR - divide */
4746  case 0xb3d4: /* LDETR - load lengthened */
4747  case 0xb3d5: /* LEDTR - load lengthened */
4748  case 0xb3d7: /* FIDTR - load fp integer */
4749  case 0xb3dd: /* LDXTR - load lengthened */
4750  case 0xb3f1: /* CDGTR - convert from fixed */
4751  case 0xb3f2: /* CDUTR - convert from unsigned packed */
4752  case 0xb3f3: /* CDSTR - convert from signed packed */
4753  case 0xb3f5: /* QADTR - quantize */
4754  case 0xb3f7: /* RRDTR - reround */
4755  case 0xb951: /* CDFTR - convert from fixed */
4756  case 0xb952: /* CDLGTR - convert from logical */
4757  case 0xb953: /* CDLFTR - convert from logical */
4758  /* float destination + fpc */
4760  return -1;
4762  return -1;
4763  break;
4764 
4765  case 0xb305: /* LXDBR - load lengthened */
4766  case 0xb306: /* LXEBR - load lengthened */
4767  case 0xb307: /* MXDBR - multiply */
4768  case 0xb316: /* SQXBR - square root */
4769  case 0xb34c: /* MXBR - multiply */
4770  case 0xb34d: /* DXBR - divide */
4771  case 0xb347: /* FIXBRA - load fp integer */
4772  case 0xb392: /* CXLFBR - convert from logical */
4773  case 0xb396: /* CXFBR - convert from fixed */
4774  case 0xb3a2: /* CXLGBR - convert from logical */
4775  case 0xb3a6: /* CXGBR - convert from fixed */
4776  case 0xb3d8: /* MXTR - multiply */
4777  case 0xb3d9: /* DXTR - divide */
4778  case 0xb3dc: /* LXDTR - load lengthened */
4779  case 0xb3df: /* FIXTR - load fp integer */
4780  case 0xb3f9: /* CXGTR - convert from fixed */
4781  case 0xb3fa: /* CXUTR - convert from unsigned packed */
4782  case 0xb3fb: /* CXSTR - convert from signed packed */
4783  case 0xb3fd: /* QAXTR - quantize */
4784  case 0xb3ff: /* RRXTR - reround */
4785  case 0xb959: /* CXFTR - convert from fixed */
4786  case 0xb95a: /* CXLGTR - convert from logical */
4787  case 0xb95b: /* CXLFTR - convert from logical */
4788  /* float pair destination + fpc */
4790  return -1;
4791  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
4792  return -1;
4794  return -1;
4795  break;
4796 
4797  case 0xb308: /* KEBR - compare and signal */
4798  case 0xb309: /* CEBR - compare */
4799  case 0xb318: /* KDBR - compare and signal */
4800  case 0xb319: /* CDBR - compare */
4801  case 0xb348: /* KXBR - compare and signal */
4802  case 0xb349: /* CXBR - compare */
4803  case 0xb3e0: /* KDTR - compare and signal */
4804  case 0xb3e4: /* CDTR - compare */
4805  case 0xb3e8: /* KXTR - compare and signal */
4806  case 0xb3ec: /* CXTR - compare */
4807  /* flags + fpc only */
4809  return -1;
4811  return -1;
4812  break;
4813 
4814  case 0xb302: /* LTEBR - load and test */
4815  case 0xb312: /* LTDBR - load and test */
4816  case 0xb30a: /* AEBR - add */
4817  case 0xb30b: /* SEBR - subtract */
4818  case 0xb31a: /* ADBR - add */
4819  case 0xb31b: /* SDBR - subtract */
4820  case 0xb3d2: /* ADTR - add */
4821  case 0xb3d3: /* SDTR - subtract */
4822  case 0xb3d6: /* LTDTR - load and test */
4823  /* float destination + flags + fpc */
4825  return -1;
4827  return -1;
4829  return -1;
4830  break;
4831 
4832  case 0xb30e: /* MAEBR - multiply and add */
4833  case 0xb30f: /* MSEBR - multiply and subtract */
4834  case 0xb31e: /* MADBR - multiply and add */
4835  case 0xb31f: /* MSDBR - multiply and subtract */
4836  /* float destination [RRD] + fpc */
4838  return -1;
4840  return -1;
4841  break;
4842 
4843  /* 0xb320-0xb323 undefined */
4844  /* 0xb327-0xb32d undefined */
4845 
4846  case 0xb32e: /* MAER - multiply and add */
4847  case 0xb32f: /* MSER - multiply and subtract */
4848  case 0xb338: /* MAYLR - multiply and add unnormalized */
4849  case 0xb339: /* MYLR - multiply unnormalized */
4850  case 0xb33c: /* MAYHR - multiply and add unnormalized */
4851  case 0xb33d: /* MYHR - multiply unnormalized */
4852  case 0xb33e: /* MADR - multiply and add */
4853  case 0xb33f: /* MSDR - multiply and subtract */
4854  /* float destination [RRD] */
4856  return -1;
4857  break;
4858 
4859  /* 0xb330-0xb335 undefined */
4860 
4861  case 0xb33a: /* MAYR - multiply and add unnormalized */
4862  case 0xb33b: /* MYR - multiply unnormalized */
4863  /* float pair destination [RRD] */
4865  return -1;
4866  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[4] | 2)))
4867  return -1;
4868  break;
4869 
4870  case 0xb340: /* LPXBR - load positive */
4871  case 0xb341: /* LNXBR - load negative */
4872  case 0xb343: /* LCXBR - load complement */
4873  case 0xb360: /* LPXR - load positive */
4874  case 0xb361: /* LNXR - load negative */
4875  case 0xb362: /* LTXR - load and test */
4876  case 0xb363: /* LCXR - load complement */
4877  /* float pair destination + flags */
4879  return -1;
4880  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
4881  return -1;
4883  return -1;
4884  break;
4885 
4886  case 0xb342: /* LTXBR - load and test */
4887  case 0xb34a: /* AXBR - add */
4888  case 0xb34b: /* SXBR - subtract */
4889  case 0xb3da: /* AXTR - add */
4890  case 0xb3db: /* SXTR - subtract */
4891  case 0xb3de: /* LTXTR - load and test */
4892  /* float pair destination + flags + fpc */
4894  return -1;
4895  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
4896  return -1;
4898  return -1;
4900  return -1;
4901  break;
4902 
4903  /* 0xb34e-0xb34f undefined */
4904  /* 0xb352 undefined */
4905 
4906  case 0xb353: /* DIEBR - divide to integer */
4907  case 0xb35b: /* DIDBR - divide to integer */
4908  /* two float destinations + flags + fpc */
4910  return -1;
4912  return -1;
4914  return -1;
4916  return -1;
4917  break;
4918 
4919  /* 0xb354-0xb356 undefined */
4920  /* 0xb35a undefined */
4921 
4922  /* 0xb35c-0xb35e undefined */
4923  /* 0xb364 undefined */
4924  /* 0xb368 undefined */
4925 
4926  case 0xb369: /* CXR - compare */
4927  case 0xb3f4: /* CEDTR - compare biased exponent */
4928  case 0xb3fc: /* CEXTR - compare biased exponent */
4929  case 0xb920: /* CGR - compare */
4930  case 0xb921: /* CLGR - compare logical */
4931  case 0xb930: /* CGFR - compare */
4932  case 0xb931: /* CLGFR - compare logical */
4933  case 0xb9cd: /* CHHR - compare high */
4934  case 0xb9cf: /* CLHHR - compare logical high */
4935  case 0xb9dd: /* CHLR - compare high */
4936  case 0xb9df: /* CLHLR - compare logical high */
4937  /* flags only */
4939  return -1;
4940  break;
4941 
4942  /* 0xb36a-0xb36f undefined */
4943  /* 0xb377-0xb37e undefined */
4944  /* 0xb380-0xb383 undefined */
4945  /* 0xb386-0xb38b undefined */
4946  /* 0xb38d-0xb38f undefined */
4947  /* 0xb393 undefined */
4948  /* 0xb397 undefined */
4949 
4950  case 0xb398: /* CFEBR - convert to fixed */
4951  case 0xb399: /* CFDBR - convert to fixed */
4952  case 0xb39a: /* CFXBR - convert to fixed */
4953  case 0xb39c: /* CLFEBR - convert to logical */
4954  case 0xb39d: /* CLFDBR - convert to logical */
4955  case 0xb39e: /* CLFXBR - convert to logical */
4956  case 0xb941: /* CFDTR - convert to fixed */
4957  case 0xb949: /* CFXTR - convert to fixed */
4958  case 0xb943: /* CLFDTR - convert to logical */
4959  case 0xb94b: /* CLFXTR - convert to logical */
4960  /* 32-bit gpr destination + flags + fpc */
4962  return -1;
4964  return -1;
4966  return -1;
4967  break;
4968 
4969  /* 0xb39b undefined */
4970  /* 0xb39f undefined */
4971 
4972  /* 0xb3a3 undefined */
4973  /* 0xb3a7 undefined */
4974 
4975  case 0xb3a8: /* CGEBR - convert to fixed */
4976  case 0xb3a9: /* CGDBR - convert to fixed */
4977  case 0xb3aa: /* CGXBR - convert to fixed */
4978  case 0xb3ac: /* CLGEBR - convert to logical */
4979  case 0xb3ad: /* CLGDBR - convert to logical */
4980  case 0xb3ae: /* CLGXBR - convert to logical */
4981  case 0xb3e1: /* CGDTR - convert to fixed */
4982  case 0xb3e9: /* CGXTR - convert to fixed */
4983  case 0xb942: /* CLGDTR - convert to logical */
4984  case 0xb94a: /* CLGXTR - convert to logical */
4985  /* 64-bit gpr destination + flags + fpc */
4986  if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
4987  return -1;
4989  return -1;
4991  return -1;
4992  break;
4993 
4994  /* 0xb3ab undefined */
4995  /* 0xb3af-0xb3b3 undefined */
4996  /* 0xb3b7 undefined */
4997 
4998  case 0xb3b8: /* CFER - convert to fixed */
4999  case 0xb3b9: /* CFDR - convert to fixed */
5000  case 0xb3ba: /* CFXR - convert to fixed */
5001  case 0xb998: /* ALCR - add logical with carry */
5002  case 0xb999: /* SLBR - subtract logical with borrow */
5003  case 0xb9f4: /* NRK - and */
5004  case 0xb9f6: /* ORK - or */
5005  case 0xb9f7: /* XRK - xor */
5006  case 0xb9f8: /* ARK - add */
5007  case 0xb9f9: /* SRK - subtract */
5008  case 0xb9fa: /* ALRK - add logical */
5009  case 0xb9fb: /* SLRK - subtract logical */
5010  /* 32-bit gpr destination + flags */
5012  return -1;
5014  return -1;
5015  break;
5016 
5017  case 0xb3c8: /* CGER - convert to fixed */
5018  case 0xb3c9: /* CGDR - convert to fixed */
5019  case 0xb3ca: /* CGXR - convert to fixed */
5020  case 0xb900: /* LPGR - load positive */
5021  case 0xb901: /* LNGR - load negative */
5022  case 0xb902: /* LTGR - load and test */
5023  case 0xb903: /* LCGR - load complement */
5024  case 0xb908: /* AGR - add */
5025  case 0xb909: /* SGR - subtract */
5026  case 0xb90a: /* ALGR - add logical */
5027  case 0xb90b: /* SLGR - subtract logical */
5028  case 0xb910: /* LPGFR - load positive */
5029  case 0xb911: /* LNGFR - load negative */
5030  case 0xb912: /* LTGFR - load and test */
5031  case 0xb913: /* LCGFR - load complement */
5032  case 0xb918: /* AGFR - add */
5033  case 0xb919: /* SGFR - subtract */
5034  case 0xb91a: /* ALGFR - add logical */
5035  case 0xb91b: /* SLGFR - subtract logical */
5036  case 0xb980: /* NGR - and */
5037  case 0xb981: /* OGR - or */
5038  case 0xb982: /* XGR - xor */
5039  case 0xb988: /* ALCGR - add logical with carry */
5040  case 0xb989: /* SLBGR - subtract logical with borrow */
5041  case 0xb9e1: /* POPCNT - population count */
5042  case 0xb9e4: /* NGRK - and */
5043  case 0xb9e6: /* OGRK - or */
5044  case 0xb9e7: /* XGRK - xor */
5045  case 0xb9e8: /* AGRK - add */
5046  case 0xb9e9: /* SGRK - subtract */
5047  case 0xb9ea: /* ALGRK - add logical */
5048  case 0xb9eb: /* SLGRK - subtract logical */
5049  case 0xb9ed: /* MSGRKC - multiply single 64x64 -> 64 */
5050  case 0xb9fd: /* MSRKC - multiply single 32x32 -> 32 */
5051  /* 64-bit gpr destination + flags */
5052  if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
5053  return -1;
5055  return -1;
5056  break;
5057 
5058  /* 0xb3bb-0xb3c0 undefined */
5059  /* 0xb3c2-0xb3c3 undefined */
5060  /* 0xb3c7 undefined */
5061  /* 0xb3cb-0xb3cc undefined */
5062 
5063  case 0xb3cd: /* LGDR - load gr from fpr */
5064  case 0xb3e2: /* CUDTR - convert to unsigned packed */
5065  case 0xb3e3: /* CSDTR - convert to signed packed */
5066  case 0xb3e5: /* EEDTR - extract biased exponent */
5067  case 0xb3e7: /* ESDTR - extract significance */
5068  case 0xb3ed: /* EEXTR - extract biased exponent */
5069  case 0xb3ef: /* ESXTR - extract significance */
5070  case 0xb904: /* LGR - load */
5071  case 0xb906: /* LGBR - load byte */
5072  case 0xb907: /* LGHR - load halfword */
5073  case 0xb90c: /* MSGR - multiply single */
5074  case 0xb90f: /* LRVGR - load reversed */
5075  case 0xb914: /* LGFR - load */
5076  case 0xb916: /* LLGFR - load logical */
5077  case 0xb917: /* LLGTR - load logical thirty one bits */
5078  case 0xb91c: /* MSGFR - multiply single 64<32 */
5079  case 0xb946: /* BCTGR - branch on count */
5080  case 0xb984: /* LLGCR - load logical character */
5081  case 0xb985: /* LLGHR - load logical halfword */
5082  case 0xb9e2: /* LOCGR - load on condition */
5083  /* 64-bit gpr destination */
5084  if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
5085  return -1;
5086  break;
5087 
5088  /* 0xb3ce-0xb3cf undefined */
5089  /* 0xb3e6 undefined */
5090 
5091  case 0xb3ea: /* CUXTR - convert to unsigned packed */
5092  case 0xb3eb: /* CSXTR - convert to signed packed */
5093  case 0xb90d: /* DSGR - divide single */
5094  case 0xb91d: /* DSGFR - divide single */
5095  case 0xb986: /* MLGR - multiply logical */
5096  case 0xb987: /* DLGR - divide logical */
5097  case 0xb9ec: /* MGRK - multiply 64x64 -> 128 */
5098  /* 64-bit gpr pair destination */
5099  if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
5100  return -1;
5101  if (s390_record_gpr_g (gdbarch, regcache, inib[6] | 1))
5102  return -1;
5103  break;
5104 
5105  /* 0xb3ee undefined */
5106  /* 0xb3f0 undefined */
5107  /* 0xb3f8 undefined */
5108 
5109  /* 0xb905 privileged */
5110 
5111  /* 0xb90e unsupported: EREGG */
5112 
5113  /* 0xb915 undefined */
5114 
5115  case 0xb91e: /* KMAC - compute message authentication code [partial] */
5117  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5119  tmp &= 0xff;
5120  switch (tmp)
5121  {
5122  case 0x00: /* KMAC-Query */
5123  if (record_full_arch_list_add_mem (oaddr, 16))
5124  return -1;
5125  break;
5126 
5127  case 0x01: /* KMAC-DEA */
5128  case 0x02: /* KMAC-TDEA-128 */
5129  case 0x03: /* KMAC-TDEA-192 */
5130  case 0x09: /* KMAC-Encrypted-DEA */
5131  case 0x0a: /* KMAC-Encrypted-TDEA-128 */
5132  case 0x0b: /* KMAC-Encrypted-TDEA-192 */
5133  if (record_full_arch_list_add_mem (oaddr, 8))
5134  return -1;
5135  break;
5136 
5137  case 0x12: /* KMAC-AES-128 */
5138  case 0x13: /* KMAC-AES-192 */
5139  case 0x14: /* KMAC-AES-256 */
5140  case 0x1a: /* KMAC-Encrypted-AES-128 */
5141  case 0x1b: /* KMAC-Encrypted-AES-192 */
5142  case 0x1c: /* KMAC-Encrypted-AES-256 */
5143  if (record_full_arch_list_add_mem (oaddr, 16))
5144  return -1;
5145  break;
5146 
5147  default:
5148  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KMAC function %02x at %s.\n",
5149  (int)tmp, paddress (gdbarch, addr));
5150  return -1;
5151  }
5152  if (tmp != 0)
5153  {
5155  return -1;
5156  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
5157  return -1;
5158  }
5160  return -1;
5161  break;
5162 
5163  /* 0xb922-0xb924 undefined */
5164  /* 0xb925 privileged */
5165  /* 0xb928 privileged */
5166 
5167  case 0xb929: /* KMA - cipher message with authentication */
5168  case 0xb92a: /* KMF - cipher message with cipher feedback [partial] */
5169  case 0xb92b: /* KMO - cipher message with output feedback [partial] */
5170  case 0xb92f: /* KMC - cipher message with chaining [partial] */
5172  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5174  tmp &= 0x7f;
5175  switch (tmp)
5176  {
5177  case 0x00: /* KM*-Query */
5178  if (record_full_arch_list_add_mem (oaddr, 16))
5179  return -1;
5180  break;
5181 
5182  case 0x01: /* KM*-DEA */
5183  case 0x02: /* KM*-TDEA-128 */
5184  case 0x03: /* KM*-TDEA-192 */
5185  case 0x09: /* KM*-Encrypted-DEA */
5186  case 0x0a: /* KM*-Encrypted-TDEA-128 */
5187  case 0x0b: /* KM*-Encrypted-TDEA-192 */
5188  if (record_full_arch_list_add_mem (oaddr, 8))
5189  return -1;
5190  break;
5191 
5192  case 0x12: /* KM*-AES-128 */
5193  case 0x13: /* KM*-AES-192 */
5194  case 0x14: /* KM*-AES-256 */
5195  case 0x1a: /* KM*-Encrypted-AES-128 */
5196  case 0x1b: /* KM*-Encrypted-AES-192 */
5197  case 0x1c: /* KM*-Encrypted-AES-256 */
5198  if (record_full_arch_list_add_mem (oaddr, 16))
5199  return -1;
5200  break;
5201 
5202  case 0x43: /* KMC-PRNG */
5203  /* Only valid for KMC. */
5204  if (insn[0] == 0xb92f)
5205  {
5206  if (record_full_arch_list_add_mem (oaddr, 8))
5207  return -1;
5208  break;
5209  }
5210  /* For other instructions, fallthru. */
5211  default:
5212  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KM* function %02x at %s.\n",
5213  (int)tmp, paddress (gdbarch, addr));
5214  return -1;
5215  }
5216  if (tmp != 0)
5217  {
5219  oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
5220  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[7] | 1), &tmp);
5221  if (record_full_arch_list_add_mem (oaddr2, tmp))
5222  return -1;
5224  return -1;
5226  return -1;
5227  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
5228  return -1;
5229  }
5230  if (tmp != 0 && insn[0] == 0xb929)
5231  {
5233  S390_R0_REGNUM + inib[4]))
5234  return -1;
5236  S390_R0_REGNUM + (inib[4] | 1)))
5237  return -1;
5238  }
5240  return -1;
5241  break;
5242 
5243  case 0xb92c: /* PCC - perform cryptographic computation [partial] */
5245  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5247  tmp &= 0x7f;
5248  switch (tmp)
5249  {
5250  case 0x00: /* PCC-Query */
5251  if (record_full_arch_list_add_mem (oaddr, 16))
5252  return -1;
5253  break;
5254 
5255  case 0x01: /* PCC-Compute-Last-Block-CMAC-Using-DEA */
5256  case 0x02: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-128 */
5257  case 0x03: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-192 */
5258  case 0x09: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-DEA */
5259  case 0x0a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-128 */
5260  case 0x0b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-192 */
5261  if (record_full_arch_list_add_mem (oaddr + 0x10, 8))
5262  return -1;
5263  break;
5264 
5265  case 0x12: /* PCC-Compute-Last-Block-CMAC-Using-AES-128 */
5266  case 0x13: /* PCC-Compute-Last-Block-CMAC-Using-AES-192 */
5267  case 0x14: /* PCC-Compute-Last-Block-CMAC-Using-AES-256 */
5268  case 0x1a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-128 */
5269  case 0x1b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-192 */
5270  case 0x1c: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-256 */
5271  if (record_full_arch_list_add_mem (oaddr + 0x18, 16))
5272  return -1;
5273  break;
5274 
5275  case 0x32: /* PCC-Compute-XTS-Parameter-Using-AES-128 */
5276  if (record_full_arch_list_add_mem (oaddr + 0x30, 32))
5277  return -1;
5278  break;
5279 
5280  case 0x34: /* PCC-Compute-XTS-Parameter-Using-AES-256 */
5281  if (record_full_arch_list_add_mem (oaddr + 0x40, 32))
5282  return -1;
5283  break;
5284 
5285  case 0x3a: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-128 */
5286  if (record_full_arch_list_add_mem (oaddr + 0x50, 32))
5287  return -1;
5288  break;
5289 
5290  case 0x3c: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-256 */
5291  if (record_full_arch_list_add_mem (oaddr + 0x60, 32))
5292  return -1;
5293  break;
5294 
5295  default:
5296  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown PCC function %02x at %s.\n",
5297  (int)tmp, paddress (gdbarch, addr));
5298  return -1;
5299  }
5301  return -1;
5302  break;
5303 
5304  case 0xb92d: /* KMCTR - cipher message with counter [partial] */
5306  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5308  tmp &= 0x7f;
5309  switch (tmp)
5310  {
5311  case 0x00: /* KMCTR-Query */
5312  if (record_full_arch_list_add_mem (oaddr, 16))
5313  return -1;
5314  break;
5315 
5316  case 0x01: /* KMCTR-DEA */
5317  case 0x02: /* KMCTR-TDEA-128 */
5318  case 0x03: /* KMCTR-TDEA-192 */
5319  case 0x09: /* KMCTR-Encrypted-DEA */
5320  case 0x0a: /* KMCTR-Encrypted-TDEA-128 */
5321  case 0x0b: /* KMCTR-Encrypted-TDEA-192 */
5322  case 0x12: /* KMCTR-AES-128 */
5323  case 0x13: /* KMCTR-AES-192 */
5324  case 0x14: /* KMCTR-AES-256 */
5325  case 0x1a: /* KMCTR-Encrypted-AES-128 */
5326  case 0x1b: /* KMCTR-Encrypted-AES-192 */
5327  case 0x1c: /* KMCTR-Encrypted-AES-256 */
5328  break;
5329 
5330  default:
5331  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KMCTR function %02x at %s.\n",
5332  (int)tmp, paddress (gdbarch, addr));
5333  return -1;
5334  }
5335  if (tmp != 0)
5336  {
5338  oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
5339  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[7] | 1), &tmp);
5340  if (record_full_arch_list_add_mem (oaddr2, tmp))
5341  return -1;
5343  return -1;
5345  return -1;
5346  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
5347  return -1;
5349  return -1;
5350  }
5352  return -1;
5353  break;
5354 
5355  case 0xb92e: /* KM - cipher message [partial] */
5357  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5359  tmp &= 0x7f;
5360  switch (tmp)
5361  {
5362  case 0x00: /* KM-Query */
5363  if (record_full_arch_list_add_mem (oaddr, 16))
5364  return -1;
5365  break;
5366 
5367  case 0x01: /* KM-DEA */
5368  case 0x02: /* KM-TDEA-128 */
5369  case 0x03: /* KM-TDEA-192 */
5370  case 0x09: /* KM-Encrypted-DEA */
5371  case 0x0a: /* KM-Encrypted-TDEA-128 */
5372  case 0x0b: /* KM-Encrypted-TDEA-192 */
5373  case 0x12: /* KM-AES-128 */
5374  case 0x13: /* KM-AES-192 */
5375  case 0x14: /* KM-AES-256 */
5376  case 0x1a: /* KM-Encrypted-AES-128 */
5377  case 0x1b: /* KM-Encrypted-AES-192 */
5378  case 0x1c: /* KM-Encrypted-AES-256 */
5379  break;
5380 
5381  case 0x32: /* KM-XTS-AES-128 */
5382  if (record_full_arch_list_add_mem (oaddr + 0x10, 16))
5383  return -1;
5384  break;
5385 
5386  case 0x34: /* KM-XTS-AES-256 */
5387  if (record_full_arch_list_add_mem (oaddr + 0x20, 16))
5388  return -1;
5389  break;
5390 
5391  case 0x3a: /* KM-XTS-Encrypted-AES-128 */
5392  if (record_full_arch_list_add_mem (oaddr + 0x30, 16))
5393  return -1;
5394  break;
5395 
5396  case 0x3c: /* KM-XTS-Encrypted-AES-256 */
5397  if (record_full_arch_list_add_mem (oaddr + 0x40, 16))
5398  return -1;
5399  break;
5400 
5401  default:
5402  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KM function %02x at %s.\n",
5403  (int)tmp, paddress (gdbarch, addr));
5404  return -1;
5405  }
5406  if (tmp != 0)
5407  {
5409  oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
5410  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[7] | 1), &tmp);
5411  if (record_full_arch_list_add_mem (oaddr2, tmp))
5412  return -1;
5414  return -1;
5416  return -1;
5417  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
5418  return -1;
5419  }
5421  return -1;
5422  break;
5423 
5424  /* 0xb932-0xb93b undefined */
5425 
5426  case 0xb93c: /* PPNO - perform pseudorandom number operation [partial] */
5428  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5430  tmp &= 0xff;
5431  switch (tmp)
5432  {
5433  case 0x00: /* PPNO-Query */
5434  case 0x80: /* PPNO-Query */
5435  if (record_full_arch_list_add_mem (oaddr, 16))
5436  return -1;
5437  break;
5438 
5439  case 0x03: /* PPNO-SHA-512-DRNG - generate */
5440  if (record_full_arch_list_add_mem (oaddr, 240))
5441  return -1;
5443  oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
5444  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
5445  if (record_full_arch_list_add_mem (oaddr2, tmp))
5446  return -1;
5448  return -1;
5449  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
5450  return -1;
5451  break;
5452 
5453  case 0x83: /* PPNO-SHA-512-DRNG - seed */
5454  if (record_full_arch_list_add_mem (oaddr, 240))
5455  return -1;
5457  return -1;
5458  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
5459  return -1;
5460  break;
5461 
5462  default:
5463  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown PPNO function %02x at %s.\n",
5464  (int)tmp, paddress (gdbarch, addr));
5465  return -1;
5466  }
5467  /* DXC may be written */
5469  return -1;
5471  return -1;
5472  break;
5473 
5474  /* 0xb93d undefined */
5475 
5476  case 0xb93e: /* KIMD - compute intermediate message digest [partial] */
5477  case 0xb93f: /* KLMD - compute last message digest [partial] */
5479  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5481  tmp &= 0xff;
5482  switch (tmp)
5483  {
5484  case 0x00: /* K*MD-Query */
5485  if (record_full_arch_list_add_mem (oaddr, 16))
5486  return -1;
5487  break;
5488 
5489  case 0x01: /* K*MD-SHA-1 */
5490  if (record_full_arch_list_add_mem (oaddr, 20))
5491  return -1;
5492  break;
5493 
5494  case 0x02: /* K*MD-SHA-256 */
5495  if (record_full_arch_list_add_mem (oaddr, 32))
5496  return -1;
5497  break;
5498 
5499  case 0x03: /* K*MD-SHA-512 */
5500  if (record_full_arch_list_add_mem (oaddr, 64))
5501  return -1;
5502  break;
5503 
5504  case 0x41: /* KIMD-GHASH */
5505  /* Only valid for KIMD. */
5506  if (insn[0] == 0xb93e)
5507  {
5508  if (record_full_arch_list_add_mem (oaddr, 16))
5509  return -1;
5510  break;
5511  }
5512  /* For KLMD, fallthru. */
5513  default:
5514  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown KMAC function %02x at %s.\n",
5515  (int)tmp, paddress (gdbarch, addr));
5516  return -1;
5517  }
5518  if (tmp != 0)
5519  {
5521  return -1;
5522  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
5523  return -1;
5524  }
5526  return -1;
5527  break;
5528 
5529  /* 0xb940 undefined */
5530  /* 0xb944-0xb945 undefined */
5531  /* 0xb947-0xb948 undefined */
5532  /* 0xb94c-0xb950 undefined */
5533  /* 0xb954-0xb958 undefined */
5534  /* 0xb95c-0xb95f undefined */
5535  /* 0xb962-0xb971 undefined */
5536  /* 0xb974-0xb97f undefined */
5537 
5538  case 0xb983: /* FLOGR - find leftmost one */
5539  /* 64-bit gpr pair destination + flags */
5540  if (s390_record_gpr_g (gdbarch, regcache, inib[6]))
5541  return -1;
5542  if (s390_record_gpr_g (gdbarch, regcache, inib[6] | 1))
5543  return -1;
5545  return -1;
5546  break;
5547 
5548  /* 0xb98a privileged */
5549  /* 0xb98b-0xb98c undefined */
5550 
5551  case 0xb98d: /* EPSW - extract psw */
5553  return -1;
5554  if (inib[7])
5556  return -1;
5557  break;
5558 
5559  /* 0xb98e-0xb98f privileged */
5560 
5561  case 0xb990: /* TRTT - translate two to two [partial] */
5562  case 0xb991: /* TRTO - translate two to one [partial] */
5563  case 0xb992: /* TROT - translate one to two [partial] */
5564  case 0xb993: /* TROO - translate one to one [partial] */
5566  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
5567  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
5568  /* tmp is source length, we want destination length. Adjust. */
5569  if (insn[0] == 0xb991)
5570  tmp >>= 1;
5571  if (insn[0] == 0xb992)
5572  tmp <<= 1;
5573  if (record_full_arch_list_add_mem (oaddr, tmp))
5574  return -1;
5576  return -1;
5577  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
5578  return -1;
5580  return -1;
5582  return -1;
5583  break;
5584 
5585  case 0xb996: /* MLR - multiply logical */
5586  case 0xb997: /* DLR - divide logical */
5587  /* 32-bit gpr pair destination */
5589  return -1;
5590  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
5591  return -1;
5592  break;
5593 
5594  /* 0xb99a-0xb9af unsupported, privileged, or undefined */
5595  /* 0xb9b4-0xb9bc undefined */
5596 
5597  case 0xb9bd: /* TRTRE - translate and test reverse extended [partial] */
5598  case 0xb9bf: /* TRTE - translate and test extended [partial] */
5600  return -1;
5601  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
5602  return -1;
5604  return -1;
5606  return -1;
5607  break;
5608 
5609  /* 0xb9c0-0xb9c7 undefined */
5610 
5611  case 0xb9c8: /* AHHHR - add high */
5612  case 0xb9c9: /* SHHHR - subtract high */
5613  case 0xb9ca: /* ALHHHR - add logical high */
5614  case 0xb9cb: /* SLHHHR - subtract logical high */
5615  case 0xb9d8: /* AHHLR - add high */
5616  case 0xb9d9: /* SHHLR - subtract high */
5617  case 0xb9da: /* ALHHLR - add logical high */
5618  case 0xb9db: /* SLHHLR - subtract logical high */
5619  /* 32-bit high gpr destination + flags */
5620  if (s390_record_gpr_h (gdbarch, regcache, inib[6]))
5621  return -1;
5623  return -1;
5624  break;
5625 
5626  /* 0xb9cc undefined */
5627  /* 0xb9ce undefined */
5628  /* 0xb9d0-0xb9d7 undefined */
5629  /* 0xb9dc undefined */
5630  /* 0xb9de undefined */
5631 
5632  case 0xb9e0: /* LOCFHR - load high on condition */
5633  /* 32-bit high gpr destination */
5634  if (s390_record_gpr_h (gdbarch, regcache, inib[6]))
5635  return -1;
5636  break;
5637 
5638  /* 0xb9e3 undefined */
5639  /* 0xb9e5 undefined */
5640  /* 0xb9ee-0xb9f1 undefined */
5641  /* 0xb9f3 undefined */
5642  /* 0xb9f5 undefined */
5643  /* 0xb9fc undefined */
5644  /* 0xb9fe -0xb9ff undefined */
5645 
5646  default:
5647  goto UNKNOWN_OP;
5648  }
5649  break;
5650 
5651  /* 0xb4-0xb5 undefined */
5652  /* 0xb6 privileged: STCTL - store control */
5653  /* 0xb7 privileged: LCTL - load control */
5654  /* 0xb8 undefined */
5655 
5656  case 0xba: /* CS - compare and swap */
5657  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5658  if (record_full_arch_list_add_mem (oaddr, 4))
5659  return -1;
5661  return -1;
5663  return -1;
5664  break;
5665 
5666  case 0xbb: /* CDS - compare double and swap */
5667  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5668  if (record_full_arch_list_add_mem (oaddr, 8))
5669  return -1;
5671  return -1;
5672  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
5673  return -1;
5675  return -1;
5676  break;
5677 
5678  /* 0xbc undefined */
5679 
5680  case 0xbe: /* STCM - store characters under mask */
5681  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5682  if (record_full_arch_list_add_mem (oaddr, s390_popcnt (inib[3])))
5683  return -1;
5684  break;
5685 
5686  case 0xc0:
5687  case 0xc2:
5688  case 0xc4:
5689  case 0xc6:
5690  case 0xcc:
5691  /* RIL-format instruction */
5692  switch (ibyte[0] << 4 | inib[3])
5693  {
5694  case 0xc00: /* LARL - load address relative long */
5695  case 0xc05: /* BRASL - branch relative and save long */
5696  case 0xc09: /* IILF - insert immediate */
5697  case 0xc21: /* MSFI - multiply single immediate */
5698  case 0xc42: /* LLHRL - load logical halfword relative long */
5699  case 0xc45: /* LHRL - load halfword relative long */
5700  case 0xc4d: /* LRL - load relative long */
5701  /* 32-bit or native gpr destination */
5703  return -1;
5704  break;
5705 
5706  case 0xc01: /* LGFI - load immediate */
5707  case 0xc0e: /* LLIHF - load logical immediate */
5708  case 0xc0f: /* LLILF - load logical immediate */
5709  case 0xc20: /* MSGFI - multiply single immediate */
5710  case 0xc44: /* LGHRL - load halfword relative long */
5711  case 0xc46: /* LLGHRL - load logical halfword relative long */
5712  case 0xc48: /* LGRL - load relative long */
5713  case 0xc4c: /* LGFRL - load relative long */
5714  case 0xc4e: /* LLGFRL - load logical relative long */
5715  /* 64-bit gpr destination */
5716  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
5717  return -1;
5718  break;
5719 
5720  /* 0xc02-0xc03 undefined */
5721 
5722  case 0xc04: /* BRCL - branch relative on condition long */
5723  case 0xc62: /* PFDRL - prefetch data relative long */
5724  break;
5725 
5726  case 0xc06: /* XIHF - xor immediate */
5727  case 0xc0a: /* NIHF - and immediate */
5728  case 0xc0c: /* OIHF - or immediate */
5729  case 0xcc8: /* AIH - add immediate high */
5730  case 0xcca: /* ALSIH - add logical with signed immediate high */
5731  /* 32-bit high gpr destination + flags */
5732  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
5733  return -1;
5735  return -1;
5736  break;
5737 
5738  case 0xc07: /* XILF - xor immediate */
5739  case 0xc0b: /* NILF - and immediate */
5740  case 0xc0d: /* OILF - or immediate */
5741  case 0xc25: /* SLFI - subtract logical immediate */
5742  case 0xc29: /* AFI - add immediate */
5743  case 0xc2b: /* ALFI - add logical immediate */
5744  /* 32-bit gpr destination + flags */
5746  return -1;
5748  return -1;
5749  break;
5750 
5751  case 0xc08: /* IIHF - insert immediate */
5752  case 0xcc6: /* BRCTH - branch relative on count high */
5753  case 0xccb: /* ALSIHN - add logical with signed immediate high */
5754  /* 32-bit high gpr destination */
5755  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
5756  return -1;
5757  break;
5758 
5759  /* 0xc22-0xc23 undefined */
5760 
5761  case 0xc24: /* SLGFI - subtract logical immediate */
5762  case 0xc28: /* AGFI - add immediate */
5763  case 0xc2a: /* ALGFI - add logical immediate */
5764  /* 64-bit gpr destination + flags */
5765  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
5766  return -1;
5768  return -1;
5769  break;
5770 
5771  /* 0xc26-0xc27 undefined */
5772 
5773  case 0xc2c: /* CGFI - compare immediate */
5774  case 0xc2d: /* CFI - compare immediate */
5775  case 0xc2e: /* CLGFI - compare logical immediate */
5776  case 0xc2f: /* CLFI - compare logical immediate */
5777  case 0xc64: /* CGHRL - compare halfword relative long */
5778  case 0xc65: /* CHRL - compare halfword relative long */
5779  case 0xc66: /* CLGHRL - compare logical halfword relative long */
5780  case 0xc67: /* CLHRL - compare logical halfword relative long */
5781  case 0xc68: /* CGRL - compare relative long */
5782  case 0xc6a: /* CLGRL - compare logical relative long */
5783  case 0xc6c: /* CGFRL - compare relative long */
5784  case 0xc6d: /* CRL - compare relative long */
5785  case 0xc6e: /* CLGFRL - compare logical relative long */
5786  case 0xc6f: /* CLRL - compare logical relative long */
5787  case 0xccd: /* CIH - compare immediate high */
5788  case 0xccf: /* CLIH - compare logical immediate high */
5789  /* flags only */
5791  return -1;
5792  break;
5793 
5794  /* 0xc40-0xc41 undefined */
5795  /* 0xc43 undefined */
5796 
5797  case 0xc47: /* STHRL - store halfword relative long */
5798  oaddr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
5799  if (record_full_arch_list_add_mem (oaddr, 2))
5800  return -1;
5801  break;
5802 
5803  /* 0xc49-0xc4a undefined */
5804 
5805  case 0xc4b: /* STGRL - store relative long */
5806  oaddr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
5807  if (record_full_arch_list_add_mem (oaddr, 8))
5808  return -1;
5809  break;
5810 
5811  case 0xc4f: /* STRL - store relative long */
5812  oaddr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
5813  if (record_full_arch_list_add_mem (oaddr, 4))
5814  return -1;
5815  break;
5816 
5817  case 0xc60: /* EXRL - execute relative long */
5818  if (ex != -1)
5819  {
5820  fprintf_unfiltered (gdb_stdlog, "Warning: Double execute at %s.\n",
5821  paddress (gdbarch, addr));
5822  return -1;
5823  }
5824  addr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
5825  if (inib[2])
5826  {
5828  ex = tmp & 0xff;
5829  }
5830  else
5831  {
5832  ex = 0;
5833  }
5834  goto ex;
5835 
5836  /* 0xc61 undefined */
5837  /* 0xc63 undefined */
5838  /* 0xc69 undefined */
5839  /* 0xc6b undefined */
5840  /* 0xcc0-0xcc5 undefined */
5841  /* 0xcc7 undefined */
5842  /* 0xcc9 undefined */
5843  /* 0xccc undefined */
5844  /* 0xcce undefined */
5845 
5846  default:
5847  goto UNKNOWN_OP;
5848  }
5849  break;
5850 
5851  /* 0xc1 undefined */
5852  /* 0xc3 undefined */
5853 
5854  case 0xc5: /* BPRP - branch prediction relative preload */
5855  case 0xc7: /* BPP - branch prediction preload */
5856  /* no visible effect */
5857  break;
5858 
5859  case 0xc8:
5860  /* SSF-format instruction */
5861  switch (ibyte[0] << 4 | inib[3])
5862  {
5863  /* 0xc80 unsupported */
5864 
5865  case 0xc81: /* ECTG - extract cpu time */
5866  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
5867  return -1;
5869  return -1;
5871  return -1;
5872  break;
5873 
5874  case 0xc82: /* CSST - compare and swap and store */
5875  {
5876  uint8_t fc, sc;
5878  fc = tmp & 0xff;
5879  sc = tmp >> 8 & 0xff;
5880 
5881  /* First and third operands. */
5882  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5883  switch (fc)
5884  {
5885  case 0x00: /* 32-bit */
5887  return -1;
5888  if (record_full_arch_list_add_mem (oaddr, 4))
5889  return -1;
5890  break;
5891 
5892  case 0x01: /* 64-bit */
5893  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
5894  return -1;
5895  if (record_full_arch_list_add_mem (oaddr, 8))
5896  return -1;
5897  break;
5898 
5899  case 0x02: /* 128-bit */
5900  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
5901  return -1;
5902  if (s390_record_gpr_g (gdbarch, regcache, inib[2] | 1))
5903  return -1;
5904  if (record_full_arch_list_add_mem (oaddr, 16))
5905  return -1;
5906  break;
5907 
5908  default:
5909  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown CSST FC %02x at %s.\n",
5910  fc, paddress (gdbarch, addr));
5911  return -1;
5912  }
5913 
5914  /* Second operand. */
5915  oaddr2 = s390_record_calc_disp (gdbarch, regcache, 0, insn[2], 0);
5916  if (sc > 4)
5917  {
5918  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown CSST FC %02x at %s.\n",
5919  sc, paddress (gdbarch, addr));
5920  return -1;
5921  }
5922 
5923  if (record_full_arch_list_add_mem (oaddr2, 1 << sc))
5924  return -1;
5925 
5926  /* Flags. */
5928  return -1;
5929  }
5930  break;
5931 
5932  /* 0xc83 undefined */
5933 
5934  case 0xc84: /* LPD - load pair disjoint */
5936  return -1;
5937  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
5938  return -1;
5940  return -1;
5941  break;
5942 
5943  case 0xc85: /* LPDG - load pair disjoint */
5944  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
5945  return -1;
5946  if (s390_record_gpr_g (gdbarch, regcache, inib[2] | 1))
5947  return -1;
5949  return -1;
5950  break;
5951 
5952  /* 0xc86-0xc8f undefined */
5953 
5954  default:
5955  goto UNKNOWN_OP;
5956  }
5957  break;
5958 
5959  /* 0xc9-0xcb undefined */
5960  /* 0xcd-0xcf undefined */
5961 
5962  case 0xd0: /* TRTR - translate and test reversed */
5963  case 0xdd: /* TRT - translate and test */
5965  return -1;
5967  return -1;
5969  return -1;
5970  break;
5971 
5972  case 0xd1: /* MVN - move numbers */
5973  case 0xd2: /* MVC - move */
5974  case 0xd3: /* MVZ - move zones */
5975  case 0xdc: /* TR - translate */
5976  case 0xe8: /* MVCIN - move inverse */
5977  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5978  if (record_full_arch_list_add_mem (oaddr, ibyte[1] + 1))
5979  return -1;
5980  break;
5981 
5982  case 0xd4: /* NC - and */
5983  case 0xd6: /* OC - or*/
5984  case 0xd7: /* XC - xor */
5985  case 0xe2: /* UNPKU - unpack unicode */
5986  case 0xea: /* UNPKA - unpack ASCII */
5987  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5988  if (record_full_arch_list_add_mem (oaddr, ibyte[1] + 1))
5989  return -1;
5991  return -1;
5992  break;
5993 
5994  case 0xde: /* ED - edit */
5995  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
5996  if (record_full_arch_list_add_mem (oaddr, ibyte[1] + 1))
5997  return -1;
5999  return -1;
6000  /* DXC may be written */
6002  return -1;
6003  break;
6004 
6005  case 0xdf: /* EDMK - edit and mark */
6006  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
6007  if (record_full_arch_list_add_mem (oaddr, ibyte[1] + 1))
6008  return -1;
6010  return -1;
6012  return -1;
6013  /* DXC may be written */
6015  return -1;
6016  break;
6017 
6018  /* 0xd8 undefined */
6019  /* 0xd9 unsupported: MVCK - move with key */
6020  /* 0xda unsupported: MVCP - move to primary */
6021  /* 0xdb unsupported: MVCS - move to secondary */
6022  /* 0xe0 undefined */
6023 
6024  case 0xe1: /* PKU - pack unicode */
6025  case 0xe9: /* PKA - pack ASCII */
6026  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
6027  if (record_full_arch_list_add_mem (oaddr, 16))
6028  return -1;
6029  break;
6030 
6031  case 0xe3:
6032  case 0xe6:
6033  case 0xe7:
6034  case 0xeb:
6035  case 0xed:
6036  /* RXY/RXE/RXF/RSL/RSY/SIY/V*-format instruction */
6037  switch (ibyte[0] << 8 | ibyte[5])
6038  {
6039  /* 0xe300-0xe301 undefined */
6040 
6041  case 0xe302: /* LTG - load and test */
6042  case 0xe308: /* AG - add */
6043  case 0xe309: /* SG - subtract */
6044  case 0xe30a: /* ALG - add logical */
6045  case 0xe30b: /* SLG - subtract logical */
6046  case 0xe318: /* AGF - add */
6047  case 0xe319: /* SGF - subtract */
6048  case 0xe31a: /* ALGF - add logical */
6049  case 0xe31b: /* SLGF - subtract logical */
6050  case 0xe332: /* LTGF - load and test */
6051  case 0xe380: /* NG - and */
6052  case 0xe381: /* OG - or */
6053  case 0xe382: /* XG - xor */
6054  case 0xe388: /* ALCG - add logical with carry */
6055  case 0xe389: /* SLBG - subtract logical with borrow */
6056  case 0xeb0a: /* SRAG - shift right single */
6057  case 0xeb0b: /* SLAG - shift left single */
6058  /* 64-bit gpr destination + flags */
6059  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6060  return -1;
6062  return -1;
6063  break;
6064 
6065  /* 0xe303 privileged */
6066 
6067  case 0xe304: /* LG - load */
6068  case 0xe30c: /* MSG - multiply single */
6069  case 0xe30f: /* LRVG - load reversed */
6070  case 0xe314: /* LGF - load */
6071  case 0xe315: /* LGH - load halfword */
6072  case 0xe316: /* LLGF - load logical */
6073  case 0xe317: /* LLGT - load logical thirty one bits */
6074  case 0xe31c: /* MSGF - multiply single */
6075  case 0xe32a: /* LZRG - load and zero rightmost byte */
6076  case 0xe33a: /* LLZRGF - load logical and zero rightmost byte */
6077  case 0xe33c: /* MGH - multiply halfword 64x16mem -> 64 */
6078  case 0xe346: /* BCTG - branch on count */
6079  case 0xe377: /* LGB - load byte */
6080  case 0xe390: /* LLGC - load logical character */
6081  case 0xe391: /* LLGH - load logical halfword */
6082  case 0xeb0c: /* SRLG - shift right single logical */
6083  case 0xeb0d: /* SLLG - shift left single logical */
6084  case 0xeb1c: /* RLLG - rotate left single logical */
6085  case 0xeb44: /* BXHG - branch on index high */
6086  case 0xeb45: /* BXLEG - branch on index low or equal */
6087  case 0xeb4c: /* ECAG - extract cpu attribute */
6088  case 0xebe2: /* LOCG - load on condition */
6089  /* 64-bit gpr destination */
6090  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6091  return -1;
6092  break;
6093 
6094  /* 0xe305 undefined */
6095 
6096  case 0xe306: /* CVBY - convert to binary */
6097  /* 32-bit or native gpr destination + FPC (DXC write) */
6099  return -1;
6101  return -1;
6102  break;
6103 
6104  /* 0xe307 undefined */
6105 
6106  case 0xe30d: /* DSG - divide single */
6107  case 0xe31d: /* DSGF - divide single */
6108  case 0xe384: /* MG - multiply 64x64mem -> 128 */
6109  case 0xe386: /* MLG - multiply logical */
6110  case 0xe387: /* DLG - divide logical */
6111  case 0xe38f: /* LPQ - load pair from quadword */
6112  /* 64-bit gpr pair destination */
6113  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6114  return -1;
6115  if (s390_record_gpr_g (gdbarch, regcache, inib[2] | 1))
6116  return -1;
6117  break;
6118 
6119  case 0xe30e: /* CVBG - convert to binary */
6120  /* 64-bit gpr destination + FPC (DXC write) */
6121  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6122  return -1;
6124  return -1;
6125  break;
6126 
6127  /* 0xe310-0xe311 undefined */
6128 
6129  case 0xe312: /* LT - load and test */
6130  case 0xe338: /* AGH - add halfword to 64 bit value */
6131  case 0xe339: /* SGH - subtract halfword from 64 bit value */
6132  case 0xe353: /* MSC - multiply single 32x32mem -> 32 */
6133  case 0xe354: /* NY - and */
6134  case 0xe356: /* OY - or */
6135  case 0xe357: /* XY - xor */
6136  case 0xe35a: /* AY - add */
6137  case 0xe35b: /* SY - subtract */
6138  case 0xe35e: /* ALY - add logical */
6139  case 0xe35f: /* SLY - subtract logical */
6140  case 0xe37a: /* AHY - add halfword */
6141  case 0xe37b: /* SHY - subtract halfword */
6142  case 0xe383: /* MSGC - multiply single 64x64mem -> 64 */
6143  case 0xe398: /* ALC - add logical with carry */
6144  case 0xe399: /* SLB - subtract logical with borrow */
6145  case 0xe727: /* LCBB - load count to block bounduary */
6146  case 0xeb81: /* ICMY - insert characters under mask */
6147  case 0xebdc: /* SRAK - shift left single */
6148  case 0xebdd: /* SLAK - shift left single */
6149  /* 32/64-bit gpr destination + flags */
6151  return -1;
6153  return -1;
6154  break;
6155 
6156  /* 0xe313 privileged */
6157 
6158  case 0xe31e: /* LRV - load reversed */
6159  case 0xe31f: /* LRVH - load reversed */
6160  case 0xe33b: /* LZRF - load and zero rightmost byte */
6161  case 0xe351: /* MSY - multiply single */
6162  case 0xe358: /* LY - load */
6163  case 0xe371: /* LAY - load address */
6164  case 0xe373: /* ICY - insert character */
6165  case 0xe376: /* LB - load byte */
6166  case 0xe378: /* LHY - load */
6167  case 0xe37c: /* MHY - multiply halfword */
6168  case 0xe394: /* LLC - load logical character */
6169  case 0xe395: /* LLH - load logical halfword */
6170  case 0xeb1d: /* RLL - rotate left single logical */
6171  case 0xebde: /* SRLK - shift left single logical */
6172  case 0xebdf: /* SLLK - shift left single logical */
6173  case 0xebf2: /* LOC - load on condition */
6174  /* 32-bit or native gpr destination */
6176  return -1;
6177  break;
6178 
6179  case 0xe320: /* CG - compare */
6180  case 0xe321: /* CLG - compare logical */
6181  case 0xe330: /* CGF - compare */
6182  case 0xe331: /* CLGF - compare logical */
6183  case 0xe334: /* CGH - compare halfword */
6184  case 0xe355: /* CLY - compare logical */
6185  case 0xe359: /* CY - compare */
6186  case 0xe379: /* CHY - compare halfword */
6187  case 0xe3cd: /* CHF - compare high */
6188  case 0xe3cf: /* CLHF - compare logical high */
6189  case 0xeb20: /* CLMH - compare logical under mask high */
6190  case 0xeb21: /* CLMY - compare logical under mask */
6191  case 0xeb51: /* TMY - test under mask */
6192  case 0xeb55: /* CLIY - compare logical */
6193  case 0xebc0: /* TP - test decimal */
6194  case 0xed10: /* TCEB - test data class */
6195  case 0xed11: /* TCDB - test data class */
6196  case 0xed12: /* TCXB - test data class */
6197  case 0xed50: /* TDCET - test data class */
6198  case 0xed51: /* TDGET - test data group */
6199  case 0xed54: /* TDCDT - test data class */
6200  case 0xed55: /* TDGDT - test data group */
6201  case 0xed58: /* TDCXT - test data class */
6202  case 0xed59: /* TDGXT - test data group */
6203  /* flags only */
6205  return -1;
6206  break;
6207 
6208  /* 0xe322-0xe323 undefined */
6209 
6210  case 0xe324: /* STG - store */
6211  case 0xe325: /* NTSTG - nontransactional store */
6212  case 0xe326: /* CVDY - convert to decimal */
6213  case 0xe32f: /* STRVG - store reversed */
6214  case 0xebe3: /* STOCG - store on condition */
6215  case 0xed67: /* STDY - store */
6216  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
6217  if (record_full_arch_list_add_mem (oaddr, 8))
6218  return -1;
6219  break;
6220 
6221  /* 0xe327-0xe329 undefined */
6222  /* 0xe32b-0xe32d undefined */
6223 
6224  case 0xe32e: /* CVDG - convert to decimal */
6225  case 0xe38e: /* STPQ - store pair to quadword */
6226  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
6227  if (record_full_arch_list_add_mem (oaddr, 16))
6228  return -1;
6229  break;
6230 
6231  /* 0xe333 undefined */
6232  /* 0xe335 undefined */
6233 
6234  case 0xe336: /* PFD - prefetch data */
6235  break;
6236 
6237  /* 0xe337 undefined */
6238  /* 0xe33c-0xe33d undefined */
6239 
6240  case 0xe33e: /* STRV - store reversed */
6241  case 0xe350: /* STY - store */
6242  case 0xe3cb: /* STFH - store high */
6243  case 0xebe1: /* STOCFH - store high on condition */
6244  case 0xebf3: /* STOC - store on condition */
6245  case 0xed66: /* STEY - store */
6246  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
6247  if (record_full_arch_list_add_mem (oaddr, 4))
6248  return -1;
6249  break;
6250 
6251  case 0xe33f: /* STRVH - store reversed */
6252  case 0xe370: /* STHY - store halfword */
6253  case 0xe3c7: /* STHH - store halfword high */
6254  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
6255  if (record_full_arch_list_add_mem (oaddr, 2))
6256  return -1;
6257  break;
6258 
6259  /* 0xe340-0xe345 undefined */
6260 
6261  case 0xe347: /* BIC - branch indirect on condition */
6262  break;
6263 
6264  /* 0xe348-0xe34f undefined */
6265  /* 0xe352 undefined */
6266 
6267  case 0xe35c: /* MFY - multiply */
6268  case 0xe396: /* ML - multiply logical */
6269  case 0xe397: /* DL - divide logical */
6270  /* 32-bit gpr pair destination */
6272  return -1;
6273  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
6274  return -1;
6275  break;
6276 
6277  /* 0xe35d undefined */
6278  /* 0xe360-0xe36f undefined */
6279 
6280  case 0xe372: /* STCY - store character */
6281  case 0xe3c3: /* STCH - store character high */
6282  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
6283  if (record_full_arch_list_add_mem (oaddr, 1))
6284  return -1;
6285  break;
6286 
6287  /* 0xe374 undefined */
6288 
6289  case 0xe375: /* LAEY - load address extended */
6291  return -1;
6293  return -1;
6294  break;
6295 
6296  /* 0xe37d-0xe37f undefined */
6297 
6298  case 0xe385: /* LGAT - load and trap */
6299  case 0xe39c: /* LLGTAT - load logical thirty one bits and trap */
6300  case 0xe39d: /* LLGFAT - load logical and trap */
6301  case 0xe650: /* VCVB - vector convert to binary 32 bit*/
6302  case 0xe652: /* VCVBG - vector convert to binary 64 bit*/
6303  case 0xe721: /* VLGV - vector load gr from vr element */
6304  /* 64-bit gpr destination + fpc for possible DXC write */
6305  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6306  return -1;
6308  return -1;
6309  break;
6310 
6311  /* 0xe38a-0xe38d undefined */
6312  /* 0xe392-0xe393 undefined */
6313  /* 0xe39a-0xe39b undefined */
6314  /* 0xe39e undefined */
6315 
6316  case 0xe39f: /* LAT - load and trap */
6317  /* 32-bit gpr destination + fpc for possible DXC write */
6319  return -1;
6321  return -1;
6322  break;
6323 
6324  /* 0xe3a0-0xe3bf undefined */
6325 
6326  case 0xe3c0: /* LBH - load byte high */
6327  case 0xe3c2: /* LLCH - load logical character high */
6328  case 0xe3c4: /* LHH - load halfword high */
6329  case 0xe3c6: /* LLHH - load logical halfword high */
6330  case 0xe3ca: /* LFH - load high */
6331  case 0xebe0: /* LOCFH - load high on condition */
6332  /* 32-bit high gpr destination */
6333  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
6334  return -1;
6335  break;
6336 
6337  /* 0xe3c1 undefined */
6338  /* 0xe3c5 undefined */
6339 
6340  case 0xe3c8: /* LFHAT - load high and trap */
6341  /* 32-bit high gpr destination + fpc for possible DXC write */
6342  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
6343  return -1;
6345  return -1;
6346  break;
6347 
6348  /* 0xe3c9 undefined */
6349  /* 0xe3cc undefined */
6350  /* 0xe3ce undefined */
6351  /* 0xe3d0-0xe3ff undefined */
6352 
6353  case 0xe634: /* VPKZ - vector pack zoned */
6354  case 0xe635: /* VLRL - vector load rightmost with immed. length */
6355  case 0xe637: /* VLRLR - vector load rightmost with length */
6356  case 0xe649: /* VLIP - vector load immediate decimal */
6357  case 0xe700: /* VLEB - vector load element */
6358  case 0xe701: /* VLEH - vector load element */
6359  case 0xe702: /* VLEG - vector load element */
6360  case 0xe703: /* VLEF - vector load element */
6361  case 0xe704: /* VLLEZ - vector load logical element and zero */
6362  case 0xe705: /* VLREP - vector load and replicate */
6363  case 0xe706: /* VL - vector load */
6364  case 0xe707: /* VLBB - vector load to block bounduary */
6365  case 0xe712: /* VGEG - vector gather element */
6366  case 0xe713: /* VGEF - vector gather element */
6367  case 0xe722: /* VLVG - vector load vr element from gr */
6368  case 0xe730: /* VESL - vector element shift left */
6369  case 0xe733: /* VERLL - vector element rotate left logical */
6370  case 0xe737: /* VLL - vector load with length */
6371  case 0xe738: /* VESRL - vector element shift right logical */
6372  case 0xe73a: /* VESRA - vector element shift right arithmetic */
6373  case 0xe740: /* VLEIB - vector load element immediate */
6374  case 0xe741: /* VLEIH - vector load element immediate */
6375  case 0xe742: /* VLEIG - vector load element immediate */
6376  case 0xe743: /* VLEIF - vector load element immediate */
6377  case 0xe744: /* VGBM - vector generate byte mask */
6378  case 0xe745: /* VREPI - vector replicate immediate */
6379  case 0xe746: /* VGM - vector generate mask */
6380  case 0xe74d: /* VREP - vector replicate */
6381  case 0xe750: /* VPOPCT - vector population count */
6382  case 0xe752: /* VCTZ - vector count trailing zeros */
6383  case 0xe753: /* VCLZ - vector count leading zeros */
6384  case 0xe756: /* VLR - vector load */
6385  case 0xe75f: /* VSEG -vector sign extend to doubleword */
6386  case 0xe760: /* VMRL - vector merge low */
6387  case 0xe761: /* VMRH - vector merge high */
6388  case 0xe762: /* VLVGP - vector load vr from grs disjoint */
6389  case 0xe764: /* VSUM - vector sum across word */
6390  case 0xe765: /* VSUMG - vector sum across doubleword */
6391  case 0xe766: /* VCKSM - vector checksum */
6392  case 0xe767: /* VSUMQ - vector sum across quadword */
6393  case 0xe768: /* VN - vector and */
6394  case 0xe769: /* VNC - vector and with complement */
6395  case 0xe76a: /* VO - vector or */
6396  case 0xe76b: /* VNO - vector nor */
6397  case 0xe76c: /* VNX - vector not exclusive or */
6398  case 0xe76d: /* VX - vector xor */
6399  case 0xe76e: /* VNN - vector nand */
6400  case 0xe76f: /* VOC - vector or with complement */
6401  case 0xe770: /* VESLV - vector element shift left */
6402  case 0xe772: /* VERIM - vector element rotate and insert under mask */
6403  case 0xe773: /* VERLLV - vector element rotate left logical */
6404  case 0xe774: /* VSL - vector shift left */
6405  case 0xe775: /* VSLB - vector shift left by byte */
6406  case 0xe777: /* VSLDB - vector shift left double by byte */
6407  case 0xe778: /* VESRLV - vector element shift right logical */
6408  case 0xe77a: /* VESRAV - vector element shift right arithmetic */
6409  case 0xe77c: /* VSRL - vector shift right logical */
6410  case 0xe77d: /* VSRLB - vector shift right logical by byte */
6411  case 0xe77e: /* VSRA - vector shift right arithmetic */
6412  case 0xe77f: /* VSRAB - vector shift right arithmetic by byte */
6413  case 0xe784: /* VPDI - vector permute doubleword immediate */
6414  case 0xe785: /* VBPERM - vector bit permute */
6415  case 0xe78c: /* VPERM - vector permute */
6416  case 0xe78d: /* VSEL - vector select */
6417  case 0xe78e: /* VFMS - vector fp multiply and subtract */
6418  case 0xe78f: /* VFMA - vector fp multiply and add */
6419  case 0xe794: /* VPK - vector pack */
6420  case 0xe79e: /* VFNMS - vector fp negative multiply and subtract */
6421  case 0xe79f: /* VFNMA - vector fp negative multiply and add */
6422  case 0xe7a1: /* VMLH - vector multiply logical high */
6423  case 0xe7a2: /* VML - vector multiply low */
6424  case 0xe7a3: /* VMH - vector multiply high */
6425  case 0xe7a4: /* VMLE - vector multiply logical even */
6426  case 0xe7a5: /* VMLO - vector multiply logical odd */
6427  case 0xe7a6: /* VME - vector multiply even */
6428  case 0xe7a7: /* VMO - vector multiply odd */
6429  case 0xe7a9: /* VMALH - vector multiply and add logical high */
6430  case 0xe7aa: /* VMAL - vector multiply and add low */
6431  case 0xe7ab: /* VMAH - vector multiply and add high */
6432  case 0xe7ac: /* VMALE - vector multiply and add logical even */
6433  case 0xe7ad: /* VMALO - vector multiply and add logical odd */
6434  case 0xe7ae: /* VMAE - vector multiply and add even */
6435  case 0xe7af: /* VMAO - vector multiply and add odd */
6436  case 0xe7b4: /* VGFM - vector Galois field multiply sum */
6437  case 0xe7b8: /* VMSL - vector multiply sum logical */
6438  case 0xe7b9: /* VACCC - vector add with carry compute carry */
6439  case 0xe7bb: /* VAC - vector add with carry */
6440  case 0xe7bc: /* VGFMA - vector Galois field multiply sum and accumulate */
6441  case 0xe7bd: /* VSBCBI - vector subtract with borrow compute borrow indication */
6442  case 0xe7bf: /* VSBI - vector subtract with borrow indication */
6443  case 0xe7c0: /* VCLGD - vector convert to logical 64-bit */
6444  case 0xe7c1: /* VCDLG - vector convert from logical 64-bit */
6445  case 0xe7c2: /* VCGD - vector convert to fixed 64-bit */
6446  case 0xe7c3: /* VCDG - vector convert from fixed 64-bit */
6447  case 0xe7c4: /* VLDE/VFLL - vector fp load lengthened */
6448  case 0xe7c5: /* VLED/VFLR - vector fp load rounded */
6449  case 0xe7c7: /* VFI - vector load fp integer */
6450  case 0xe7cc: /* VFPSO - vector fp perform sign operation */
6451  case 0xe7ce: /* VFSQ - vector fp square root */
6452  case 0xe7d4: /* VUPLL - vector unpack logical low */
6453  case 0xe7d6: /* VUPL - vector unpack low */
6454  case 0xe7d5: /* VUPLH - vector unpack logical high */
6455  case 0xe7d7: /* VUPH - vector unpack high */
6456  case 0xe7de: /* VLC - vector load complement */
6457  case 0xe7df: /* VLP - vector load positive */
6458  case 0xe7e2: /* VFA - vector fp subtract */
6459  case 0xe7e3: /* VFA - vector fp add */
6460  case 0xe7e5: /* VFD - vector fp divide */
6461  case 0xe7e7: /* VFM - vector fp multiply */
6462  case 0xe7ee: /* VFMIN - vector fp minimum */
6463  case 0xe7ef: /* VFMAX - vector fp maximum */
6464  case 0xe7f0: /* VAVGL - vector average logical */
6465  case 0xe7f1: /* VACC - vector add and compute carry */
6466  case 0xe7f2: /* VAVG - vector average */
6467  case 0xe7f3: /* VA - vector add */
6468  case 0xe7f5: /* VSCBI - vector subtract compute borrow indication */
6469  case 0xe7f7: /* VS - vector subtract */
6470  case 0xe7fc: /* VMNL - vector minimum logical */
6471  case 0xe7fd: /* VMXL - vector maximum logical */
6472  case 0xe7fe: /* VMN - vector minimum */
6473  case 0xe7ff: /* VMX - vector maximum */
6474  /* vector destination + FPC */
6475  if (s390_record_vr (gdbarch, regcache, ivec[0]))
6476  return -1;
6478  return -1;
6479  break;
6480 
6481  case 0xe63d: /* VSTRL - vector store rightmost with immed. length */
6482  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
6483  if (record_full_arch_list_add_mem (oaddr, inib[3] + 1))
6484  return -1;
6486  return -1;
6487  break;
6488 
6489  case 0xe708: /* VSTEB - vector store element */
6490  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
6491  if (record_full_arch_list_add_mem (oaddr, 1))
6492  return -1;
6494  return -1;
6495  break;
6496 
6497  case 0xe709: /* VSTEH - vector store element */
6498  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
6499  if (record_full_arch_list_add_mem (oaddr, 2))
6500  return -1;
6502  return -1;
6503  break;
6504 
6505  case 0xe70a: /* VSTEG - vector store element */
6506  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
6507  if (record_full_arch_list_add_mem (oaddr, 8))
6508  return -1;
6510  return -1;
6511  break;
6512 
6513  case 0xe70b: /* VSTEF - vector store element */
6514  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
6515  if (record_full_arch_list_add_mem (oaddr, 4))
6516  return -1;
6518  return -1;
6519  break;
6520 
6521  /* 0xe70c-0xe70d undefined */
6522 
6523  case 0xe70e: /* VST - vector store */
6524  oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
6525  if (record_full_arch_list_add_mem (oaddr, 16))
6526  return -1;
6528  return -1;
6529  break;
6530 
6531  /* 0xe70f-0xe711 undefined */
6532  /* 0xe714-0xe719 undefined */
6533 
6534  case 0xe71a: /* VSCEG - vector scatter element */
6535  if (s390_record_calc_disp_vsce (gdbarch, regcache, ivec[1], inib[8], 8, insn[1], 0, &oaddr))
6536  return -1;
6537  if (record_full_arch_list_add_mem (oaddr, 8))
6538  return -1;
6540  return -1;
6541  break;
6542 
6543  case 0xe71b: /* VSCEF - vector scatter element */
6544  if (s390_record_calc_disp_vsce (gdbarch, regcache, ivec[1], inib[8], 4, insn[1], 0, &oaddr))
6545  return -1;
6546  if (record_full_arch_list_add_mem (oaddr, 4))
6547  return -1;
6549  return -1;
6550  break;
6551 
6552  /* 0xe71c-0xe720 undefined */
6553  /* 0xe723-0xe726 undefined */
6554  /* 0xe728-0xe72f undefined */
6555  /* 0xe731-0xe732 undefined */
6556  /* 0xe734-0xe735 undefined */
6557 
6558  case 0xe736: /* VLM - vector load multiple */
6559  for (i = ivec[0]; i != ivec[1]; i++, i &= 0x1f)
6560  if (s390_record_vr (gdbarch, regcache, i))
6561  return -1;
6562  if (s390_record_vr (gdbarch, regcache, ivec[1]))
6563  return -1;
6565  return -1;
6566  break;
6567 
6568  /* 0xe739 undefined */
6569  /* 0xe73b-0xe73d undefined */
6570 
6571  case 0xe73e: /* VSTM - vector store multiple */
6572  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
6573  if (ivec[0] <= ivec[1])
6574  n = ivec[1] - ivec[0] + 1;
6575  else
6576  n = ivec[1] + 0x20 - ivec[0] + 1;
6577  if (record_full_arch_list_add_mem (oaddr, n * 16))
6578  return -1;
6580  return -1;
6581  break;
6582 
6583  case 0xe63c: /* VUPKZ - vector unpack zoned */
6584  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
6585  if (record_full_arch_list_add_mem (oaddr, (ibyte[1] + 1) & 31))
6586  return -1;
6588  return -1;
6589  break;
6590 
6591  case 0xe63f: /* VSTRLR - vector store rightmost with length */
6592  case 0xe73f: /* VSTL - vector store with length */
6593  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
6595  tmp &= 0xffffffffu;
6596  if (tmp > 15)
6597  tmp = 15;
6598  if (record_full_arch_list_add_mem (oaddr, tmp + 1))
6599  return -1;
6601  return -1;
6602  break;
6603 
6604  /* 0xe747-0xe749 undefined */
6605 
6606  case 0xe658: /* VCVD - vector convert to decimal 32 bit */
6607  case 0xe659: /* VSRP - vector shift and round decimal */
6608  case 0xe65a: /* VCVDG - vector convert to decimal 64 bit*/
6609  case 0xe65b: /* VPSOP - vector perform sign operation decimal */
6610  case 0xe671: /* VAP - vector add decimal */
6611  case 0xe673: /* VSP - vector subtract decimal */
6612  case 0xe678: /* VMP - vector multiply decimal */
6613  case 0xe679: /* VMSP - vector multiply decimal */
6614  case 0xe67a: /* VDP - vector divide decimal */
6615  case 0xe67b: /* VRP - vector remainder decimal */
6616  case 0xe67e: /* VSDP - vector shift and divide decimal */
6617  case 0xe74a: /* VFTCI - vector fp test data class immediate */
6618  case 0xe75c: /* VISTR - vector isolate string */
6619  case 0xe780: /* VFEE - vector find element equal */
6620  case 0xe781: /* VFENE - vector find element not equal */
6621  case 0xe782: /* VFA - vector find any element equal */
6622  case 0xe78a: /* VSTRC - vector string range compare */
6623  case 0xe795: /* VPKLS - vector pack logical saturate */
6624  case 0xe797: /* VPKS - vector pack saturate */
6625  case 0xe7e8: /* VFCE - vector fp compare equal */
6626  case 0xe7ea: /* VFCHE - vector fp compare high or equal */
6627  case 0xe7eb: /* VFCH - vector fp compare high */
6628  case 0xe7f8: /* VCEQ - vector compare equal */
6629  case 0xe7f9: /* VCHL - vector compare high logical */
6630  case 0xe7fb: /* VCH - vector compare high */
6631  /* vector destination + flags + FPC */
6632  if (s390_record_vr (gdbarch, regcache, ivec[0]))
6633  return -1;
6635  return -1;
6637  return -1;
6638  break;
6639 
6640  case 0xe65f: /* VTP - vector test decimal */
6641  /* flags + FPC */
6643  return -1;
6645  return -1;
6646  break;
6647 
6648  /* 0xe74b-0xe74c undefined */
6649  /* 0xe74e-0xe74f undefined */
6650  /* 0xe751 undefined */
6651  /* 0xe754-0xe755 undefined */
6652  /* 0xe757-0xe75b undefined */
6653  /* 0xe75d-0xe75e undefined */
6654  /* 0xe763 undefined */
6655  /* 0xe771 undefined */
6656  /* 0xe776 undefined */
6657  /* 0xe779 undefined */
6658  /* 0xe77b undefined */
6659  /* 0xe783 undefined */
6660  /* 0xe786-0xe789 undefined */
6661  /* 0xe78b undefined */
6662  /* 0xe790-0xe793 undefined */
6663  /* 0xe796 undefined */
6664  /* 0xe798-0xe79d undefined */
6665  /* 0xe7a0 undefined */
6666  /* 0xe7a8 undefined */
6667  /* 0xe7b0-0xe7b3 undefined */
6668  /* 0xe7b5-0xe7b7 undefined */
6669  /* 0xe7ba undefined */
6670  /* 0xe7be undefined */
6671  /* 0xe7c6 undefined */
6672  /* 0xe7c8-0xe7c9 undefined */
6673 
6674  case 0xe677: /* VCP - vector compare decimal */
6675  case 0xe7ca: /* WFK - vector fp compare and signal scalar */
6676  case 0xe7cb: /* WFC - vector fp compare scalar */
6677  case 0xe7d8: /* VTM - vector test under mask */
6678  case 0xe7d9: /* VECL - vector element compare logical */
6679  case 0xe7db: /* VEC - vector element compare */
6680  case 0xed08: /* KEB - compare and signal */
6681  case 0xed09: /* CEB - compare */
6682  case 0xed18: /* KDB - compare and signal */
6683  case 0xed19: /* CDB - compare */
6684  /* flags + fpc only */
6686  return -1;
6688  return -1;
6689  break;
6690 
6691  /* 0xe7cd undefined */
6692  /* 0xe7cf-0xe7d3 undefined */
6693  /* 0xe7da undefined */
6694  /* 0xe7dc-0xe7dd undefined */
6695  /* 0xe7e0-0xe7e1 undefined */
6696  /* 0xe7e4 undefined */
6697  /* 0xe7e6 undefined */
6698  /* 0xe7e9 undefined */
6699  /* 0xe7ec-0xe7ed undefined */
6700  /* 0xe7f4 undefined */
6701  /* 0xe7f6 undefined */
6702  /* 0xe7fa undefined */
6703 
6704  /* 0xeb00-0xeb03 undefined */
6705 
6706  case 0xeb04: /* LMG - load multiple */
6707  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
6709  return -1;
6710  if (s390_record_gpr_g (gdbarch, regcache, inib[3]))
6711  return -1;
6712  break;
6713 
6714  /* 0xeb05-0xeb09 undefined */
6715  /* 0xeb0e undefined */
6716  /* 0xeb0f privileged: TRACG */
6717  /* 0xeb10-0xeb13 undefined */
6718 
6719  case 0xeb14: /* CSY - compare and swap */
6720  case 0xebf4: /* LAN - load and and */
6721  case 0xebf6: /* LAO - load and or */
6722  case 0xebf7: /* LAX - load and xor */
6723  case 0xebf8: /* LAA - load and add */
6724  case 0xebfa: /* LAAL - load and add logical */
6725  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6726  if (record_full_arch_list_add_mem (oaddr, 4))
6727  return -1;
6729  return -1;
6731  return -1;
6732  break;
6733 
6734  /* 0xeb15-0xeb1b undefined */
6735  /* 0xeb1e-0xeb1f undefined */
6736  /* 0xeb22 undefined */
6737 
6738  case 0xeb23: /* CLT - compare logical and trap */
6739  case 0xeb2b: /* CLGT - compare logical and trap */
6740  /* fpc only - including possible DXC write for trapping insns */
6742  return -1;
6743  break;
6744 
6745  case 0xeb24: /* STMG - store multiple */
6746  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6747  if (inib[2] <= inib[3])
6748  n = inib[3] - inib[2] + 1;
6749  else
6750  n = inib[3] + 0x10 - inib[2] + 1;
6751  if (record_full_arch_list_add_mem (oaddr, n * 8))
6752  return -1;
6753  break;
6754 
6755  /* 0xeb25 privileged */
6756 
6757  case 0xeb26: /* STMH - store multiple high */
6758  case 0xeb90: /* STMY - store multiple */
6759  case 0xeb9b: /* STAMY - store access multiple */
6760  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6761  if (inib[2] <= inib[3])
6762  n = inib[3] - inib[2] + 1;
6763  else
6764  n = inib[3] + 0x10 - inib[2] + 1;
6765  if (record_full_arch_list_add_mem (oaddr, n * 4))
6766  return -1;
6767  break;
6768 
6769  /* 0xeb27-0xeb2a undefined */
6770 
6771  case 0xeb2c: /* STCMH - store characters under mask */
6772  case 0xeb2d: /* STCMY - store characters under mask */
6773  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6774  if (record_full_arch_list_add_mem (oaddr, s390_popcnt (inib[3])))
6775  return -1;
6776  break;
6777 
6778  /* 0xeb2e undefined */
6779  /* 0xeb2f privileged */
6780 
6781  case 0xeb30: /* CSG - compare and swap */
6782  case 0xebe4: /* LANG - load and and */
6783  case 0xebe6: /* LAOG - load and or */
6784  case 0xebe7: /* LAXG - load and xor */
6785  case 0xebe8: /* LAAG - load and add */
6786  case 0xebea: /* LAALG - load and add logical */
6787  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6788  if (record_full_arch_list_add_mem (oaddr, 8))
6789  return -1;
6790  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6791  return -1;
6793  return -1;
6794  break;
6795 
6796  case 0xeb31: /* CDSY - compare double and swap */
6797  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6798  if (record_full_arch_list_add_mem (oaddr, 8))
6799  return -1;
6801  return -1;
6802  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
6803  return -1;
6805  return -1;
6806  break;
6807 
6808  /* 0xeb32-0xeb3d undefined */
6809 
6810  case 0xeb3e: /* CDSG - compare double and swap */
6811  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6812  if (record_full_arch_list_add_mem (oaddr, 16))
6813  return -1;
6814  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
6815  return -1;
6816  if (s390_record_gpr_g (gdbarch, regcache, inib[2] | 1))
6817  return -1;
6819  return -1;
6820  break;
6821 
6822  /* 0xeb3f-0xeb43 undefined */
6823  /* 0xeb46-0xeb4b undefined */
6824  /* 0xeb4d-0xeb50 undefined */
6825 
6826  case 0xeb52: /* MVIY - move */
6827  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6828  if (record_full_arch_list_add_mem (oaddr, 1))
6829  return -1;
6830  break;
6831 
6832  case 0xeb54: /* NIY - and */
6833  case 0xeb56: /* OIY - or */
6834  case 0xeb57: /* XIY - xor */
6835  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6836  if (record_full_arch_list_add_mem (oaddr, 1))
6837  return -1;
6839  return -1;
6840  break;
6841 
6842  /* 0xeb53 undefined */
6843  /* 0xeb58-0xeb69 undefined */
6844 
6845  case 0xeb6a: /* ASI - add immediate */
6846  case 0xeb6e: /* ALSI - add immediate */
6847  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6848  if (record_full_arch_list_add_mem (oaddr, 4))
6849  return -1;
6851  return -1;
6852  break;
6853 
6854  /* 0xeb6b-0xeb6d undefined */
6855  /* 0xeb6f-0xeb79 undefined */
6856 
6857  case 0xeb7a: /* AGSI - add immediate */
6858  case 0xeb7e: /* ALGSI - add immediate */
6859  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
6860  if (record_full_arch_list_add_mem (oaddr, 8))
6861  return -1;
6863  return -1;
6864  break;
6865 
6866  /* 0xeb7b-0xeb7d undefined */
6867  /* 0xeb7f undefined */
6868 
6869  case 0xeb80: /* ICMH - insert characters under mask */
6870  /* 32-bit high gpr destination + flags */
6871  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
6872  return -1;
6874  return -1;
6875  break;
6876 
6877  /* 0xeb82-0xeb8d undefined */
6878 
6879  case 0xeb8e: /* MVCLU - move long unicode [partial] */
6881  oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
6882  regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1), &tmp);
6883  if (record_full_arch_list_add_mem (oaddr, tmp))
6884  return -1;
6886  return -1;
6887  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
6888  return -1;
6890  return -1;
6891  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
6892  return -1;
6894  return -1;
6895  break;
6896 
6897  case 0xeb8f: /* CLCLU - compare logical long unicode [partial] */
6899  return -1;
6900  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
6901  return -1;
6903  return -1;
6904  if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
6905  return -1;
6907  return -1;
6908  break;
6909 
6910  /* 0xeb91-0xeb95 undefined */
6911 
6912  case 0xeb96: /* LMH - load multiple high */
6913  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
6915  return -1;
6916  if (s390_record_gpr_h (gdbarch, regcache, inib[3]))
6917  return -1;
6918  break;
6919 
6920  /* 0xeb97 undefined */
6921 
6922  case 0xeb98: /* LMY - load multiple */
6923  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
6925  return -1;
6927  return -1;
6928  break;
6929 
6930  /* 0xeb99 undefined */
6931 
6932  case 0xeb9a: /* LAMY - load access multiple */
6933  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
6935  return -1;
6937  return -1;
6938  break;
6939 
6940  /* 0xeb9c-0xebbf undefined */
6941  /* 0xebc1-0xebdb undefined */
6942  /* 0xebe5 undefined */
6943  /* 0xebe9 undefined */
6944  /* 0xebeb-0xebf1 undefined */
6945  /* 0xebf5 undefined */
6946  /* 0xebf9 undefined */
6947  /* 0xebfb-0xebff undefined */
6948 
6949  /* 0xed00-0xed03 undefined */
6950 
6951  case 0xed04: /* LDEB - load lengthened */
6952  case 0xed0c: /* MDEB - multiply */
6953  case 0xed0d: /* DEB - divide */
6954  case 0xed14: /* SQEB - square root */
6955  case 0xed15: /* SQDB - square root */
6956  case 0xed17: /* MEEB - multiply */
6957  case 0xed1c: /* MDB - multiply */
6958  case 0xed1d: /* DDB - divide */
6959  /* float destination + fpc */
6961  return -1;
6963  return -1;
6964  break;
6965 
6966  case 0xed05: /* LXDB - load lengthened */
6967  case 0xed06: /* LXEB - load lengthened */
6968  case 0xed07: /* MXDB - multiply */
6969  /* float pair destination + fpc */
6971  return -1;
6972  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
6973  return -1;
6975  return -1;
6976  break;
6977 
6978  case 0xed0a: /* AEB - add */
6979  case 0xed0b: /* SEB - subtract */
6980  case 0xed1a: /* ADB - add */
6981  case 0xed1b: /* SDB - subtract */
6982  /* float destination + flags + fpc */
6984  return -1;
6986  return -1;
6988  return -1;
6989  break;
6990 
6991  case 0xed0e: /* MAEB - multiply and add */
6992  case 0xed0f: /* MSEB - multiply and subtract */
6993  case 0xed1e: /* MADB - multiply and add */
6994  case 0xed1f: /* MSDB - multiply and subtract */
6995  case 0xed40: /* SLDT - shift significand left */
6996  case 0xed41: /* SRDT - shift significand right */
6997  case 0xedaa: /* CDZT - convert from zoned */
6998  case 0xedae: /* CDPT - convert from packed */
6999  /* float destination [RXF] + fpc */
7001  return -1;
7003  return -1;
7004  break;
7005 
7006  /* 0xed13 undefined */
7007  /* 0xed16 undefined */
7008  /* 0xed20-0xed23 undefined */
7009 
7010  case 0xed24: /* LDE - load lengthened */
7011  case 0xed34: /* SQE - square root */
7012  case 0xed35: /* SQD - square root */
7013  case 0xed37: /* MEE - multiply */
7014  case 0xed64: /* LEY - load */
7015  case 0xed65: /* LDY - load */
7016  /* float destination */
7018  return -1;
7019  break;
7020 
7021  case 0xed25: /* LXD - load lengthened */
7022  case 0xed26: /* LXE - load lengthened */
7023  /* float pair destination */
7025  return -1;
7026  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
7027  return -1;
7028  break;
7029 
7030  /* 0xed27-0xed2d undefined */
7031 
7032  case 0xed2e: /* MAE - multiply and add */
7033  case 0xed2f: /* MSE - multiply and subtract */
7034  case 0xed38: /* MAYL - multiply and add unnormalized */
7035  case 0xed39: /* MYL - multiply unnormalized */
7036  case 0xed3c: /* MAYH - multiply and add unnormalized */
7037  case 0xed3d: /* MYH - multiply unnormalized */
7038  case 0xed3e: /* MAD - multiply and add */
7039  case 0xed3f: /* MSD - multiply and subtract */
7040  /* float destination [RXF] */
7042  return -1;
7043  break;
7044 
7045  /* 0xed30-0xed33 undefined */
7046  /* 0xed36 undefined */
7047 
7048  case 0xed3a: /* MAY - multiply and add unnormalized */
7049  case 0xed3b: /* MY - multiply unnormalized */
7050  /* float pair destination [RXF] */
7052  return -1;
7053  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[8] | 2)))
7054  return -1;
7055  break;
7056 
7057  /* 0xed42-0xed47 undefind */
7058 
7059  case 0xed48: /* SLXT - shift significand left */
7060  case 0xed49: /* SRXT - shift significand right */
7061  case 0xedab: /* CXZT - convert from zoned */
7062  case 0xedaf: /* CXPT - convert from packed */
7063  /* float pair destination [RXF] + fpc */
7065  return -1;
7066  if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[8] | 2)))
7067  return -1;
7069  return -1;
7070  break;
7071 
7072  /* 0xed4a-0xed4f undefind */
7073  /* 0xed52-0xed53 undefind */
7074  /* 0xed56-0xed57 undefind */
7075  /* 0xed5a-0xed63 undefind */
7076  /* 0xed68-0xeda7 undefined */
7077 
7078  case 0xeda8: /* CZDT - convert to zoned */
7079  case 0xeda9: /* CZXT - convert to zoned */
7080  case 0xedac: /* CPDT - convert to packed */
7081  case 0xedad: /* CPXT - convert to packed */
7082  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7083  if (record_full_arch_list_add_mem (oaddr, ibyte[1] + 1))
7084  return -1;
7086  return -1;
7087  break;
7088 
7089  /* 0xedb0-0xedff undefined */
7090 
7091  default:
7092  goto UNKNOWN_OP;
7093  }
7094  break;
7095 
7096  /* 0xe4 undefined */
7097 
7098  case 0xe5:
7099  /* SSE/SIL-format instruction */
7100  switch (insn[0])
7101  {
7102  /* 0xe500-0xe543 undefined, privileged, or unsupported */
7103 
7104  case 0xe544: /* MVHHI - move */
7105  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7106  if (record_full_arch_list_add_mem (oaddr, 2))
7107  return -1;
7108  break;
7109 
7110  /* 0xe545-0xe547 undefined */
7111 
7112  case 0xe548: /* MVGHI - move */
7113  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7114  if (record_full_arch_list_add_mem (oaddr, 8))
7115  return -1;
7116  break;
7117 
7118  /* 0xe549-0xe54b undefined */
7119 
7120  case 0xe54c: /* MVHI - move */
7121  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7122  if (record_full_arch_list_add_mem (oaddr, 4))
7123  return -1;
7124  break;
7125 
7126  /* 0xe54d-0xe553 undefined */
7127 
7128  case 0xe554: /* CHHSI - compare halfword immediate */
7129  case 0xe555: /* CLHHSI - compare logical immediate */
7130  case 0xe558: /* CGHSI - compare halfword immediate */
7131  case 0xe559: /* CLGHSI - compare logical immediate */
7132  case 0xe55c: /* CHSI - compare halfword immediate */
7133  case 0xe55d: /* CLFHSI - compare logical immediate */
7135  return -1;
7136  break;
7137 
7138  /* 0xe556-0xe557 undefined */
7139  /* 0xe55a-0xe55b undefined */
7140  /* 0xe55e-0xe55f undefined */
7141 
7142  case 0xe560: /* TBEGIN - transaction begin */
7143  /* The transaction will be immediately aborted after this
7144  instruction, due to single-stepping. This instruction is
7145  only supported so that the program can fail a few times
7146  and go to the non-transactional fallback. */
7147  if (inib[4])
7148  {
7149  /* Transaction diagnostic block - user. */
7150  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7151  if (record_full_arch_list_add_mem (oaddr, 256))
7152  return -1;
7153  }
7154  /* Transaction diagnostic block - supervisor. */
7156  return -1;
7158  return -1;
7160  return -1;
7162  return -1;
7163  for (i = 0; i < 16; i++)
7165  return -1;
7166  /* And flags. */
7168  return -1;
7169  break;
7170 
7171  /* 0xe561 unsupported: TBEGINC */
7172  /* 0xe562-0xe5ff undefined */
7173 
7174  default:
7175  goto UNKNOWN_OP;
7176  }
7177  break;
7178 
7179  case 0xec:
7180  /* RIE/RIS/RRS-format instruction */
7181  switch (ibyte[0] << 8 | ibyte[5])
7182  {
7183  /* 0xec00-0xec41 undefined */
7184 
7185  case 0xec42: /* LOCHI - load halfword immediate on condition */
7186  case 0xec51: /* RISBLG - rotate then insert selected bits low */
7187  /* 32-bit or native gpr destination */
7189  return -1;
7190  break;
7191 
7192  /* 0xec43 undefined */
7193 
7194  case 0xec44: /* BRXHG - branch relative on index high */
7195  case 0xec45: /* BRXLG - branch relative on index low or equal */
7196  case 0xec46: /* LOCGHI - load halfword immediate on condition */
7197  case 0xec59: /* RISBGN - rotate then insert selected bits */
7198  /* 64-bit gpr destination */
7199  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
7200  return -1;
7201  break;
7202 
7203  /* 0xec47-0xec4d undefined */
7204 
7205  case 0xec4e: /* LOCHHI - load halfword immediate on condition */
7206  case 0xec5d: /* RISBHG - rotate then insert selected bits high */
7207  /* 32-bit high gpr destination */
7208  if (s390_record_gpr_h (gdbarch, regcache, inib[2]))
7209  return -1;
7210  break;
7211 
7212  /* 0xec4f-0xec50 undefined */
7213  /* 0xec52-0xec53 undefined */
7214 
7215  case 0xec54: /* RNSBG - rotate then and selected bits */
7216  case 0xec55: /* RISBG - rotate then insert selected bits */
7217  case 0xec56: /* ROSBG - rotate then or selected bits */
7218  case 0xec57: /* RXSBG - rotate then xor selected bits */
7219  case 0xecd9: /* AGHIK - add immediate */
7220  case 0xecdb: /* ALGHSIK - add logical immediate */
7221  /* 64-bit gpr destination + flags */
7222  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
7223  return -1;
7225  return -1;
7226  break;
7227 
7228  /* 0xec58 undefined */
7229  /* 0xec5a-0xec5c undefined */
7230  /* 0xec5e-0xec63 undefined */
7231 
7232  case 0xec64: /* CGRJ - compare and branch relative */
7233  case 0xec65: /* CLGRJ - compare logical and branch relative */
7234  case 0xec76: /* CRJ - compare and branch relative */
7235  case 0xec77: /* CLRJ - compare logical and branch relative */
7236  case 0xec7c: /* CGIJ - compare immediate and branch relative */
7237  case 0xec7d: /* CLGIJ - compare logical immediate and branch relative */
7238  case 0xec7e: /* CIJ - compare immediate and branch relative */
7239  case 0xec7f: /* CLIJ - compare logical immediate and branch relative */
7240  case 0xece4: /* CGRB - compare and branch */
7241  case 0xece5: /* CLGRB - compare logical and branch */
7242  case 0xecf6: /* CRB - compare and branch */
7243  case 0xecf7: /* CLRB - compare logical and branch */
7244  case 0xecfc: /* CGIB - compare immediate and branch */
7245  case 0xecfd: /* CLGIB - compare logical immediate and branch */
7246  case 0xecfe: /* CIB - compare immediate and branch */
7247  case 0xecff: /* CLIB - compare logical immediate and branch */
7248  break;
7249 
7250  /* 0xec66-0xec6f undefined */
7251 
7252  case 0xec70: /* CGIT - compare immediate and trap */
7253  case 0xec71: /* CLGIT - compare logical immediate and trap */
7254  case 0xec72: /* CIT - compare immediate and trap */
7255  case 0xec73: /* CLFIT - compare logical immediate and trap */
7256  /* fpc only - including possible DXC write for trapping insns */
7258  return -1;
7259  break;
7260 
7261  /* 0xec74-0xec75 undefined */
7262  /* 0xec78-0xec7b undefined */
7263 
7264  /* 0xec80-0xecd7 undefined */
7265 
7266  case 0xecd8: /* AHIK - add immediate */
7267  case 0xecda: /* ALHSIK - add logical immediate */
7268  /* 32-bit gpr destination + flags */
7270  return -1;
7272  return -1;
7273  break;
7274 
7275  /* 0xecdc-0xece3 undefined */
7276  /* 0xece6-0xecf5 undefined */
7277  /* 0xecf8-0xecfb undefined */
7278 
7279  default:
7280  goto UNKNOWN_OP;
7281  }
7282  break;
7283 
7284  case 0xee: /* PLO - perform locked operation */
7286  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7287  oaddr2 = s390_record_calc_disp (gdbarch, regcache, 0, insn[2], 0);
7288  if (!(tmp & 0x100))
7289  {
7290  uint8_t fc = tmp & 0xff;
7291  gdb_byte buf[8];
7292  switch (fc)
7293  {
7294  case 0x00: /* CL */
7295  /* op1c */
7297  return -1;
7298  /* op3 */
7300  return -1;
7301  break;
7302 
7303  case 0x01: /* CLG */
7304  /* op1c */
7305  if (record_full_arch_list_add_mem (oaddr2 + 0x08, 8))
7306  return -1;
7307  /* op3 */
7308  if (record_full_arch_list_add_mem (oaddr2 + 0x28, 8))
7309  return -1;
7310  break;
7311 
7312  case 0x02: /* CLGR */
7313  /* op1c */
7314  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
7315  return -1;
7316  /* op3 */
7317  if (s390_record_gpr_g (gdbarch, regcache, inib[3]))
7318  return -1;
7319  break;
7320 
7321  case 0x03: /* CLX */
7322  /* op1c */
7323  if (record_full_arch_list_add_mem (oaddr2 + 0x00, 16))
7324  return -1;
7325  /* op3 */
7326  if (record_full_arch_list_add_mem (oaddr2 + 0x20, 16))
7327  return -1;
7328  break;
7329 
7330  case 0x08: /* DCS */
7331  /* op3c */
7333  return -1;
7334  /* fallthru */
7335  case 0x0c: /* CSST */
7336  /* op4 */
7337  if (record_full_arch_list_add_mem (oaddr2, 4))
7338  return -1;
7339  goto CS;
7340 
7341  case 0x14: /* CSTST */
7342  /* op8 */
7343  if (target_read_memory (oaddr2 + 0x88, buf, 8))
7344  return -1;
7345  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7346  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7347  if (record_full_arch_list_add_mem (oaddr3, 4))
7348  return -1;
7349  /* fallthru */
7350  case 0x10: /* CSDST */
7351  /* op6 */
7352  if (target_read_memory (oaddr2 + 0x68, buf, 8))
7353  return -1;
7354  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7355  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7356  if (record_full_arch_list_add_mem (oaddr3, 4))
7357  return -1;
7358  /* op4 */
7359  if (target_read_memory (oaddr2 + 0x48, buf, 8))
7360  return -1;
7361  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7362  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7363  if (record_full_arch_list_add_mem (oaddr3, 4))
7364  return -1;
7365  /* fallthru */
7366  case 0x04: /* CS */
7367 CS:
7368  /* op1c */
7370  return -1;
7371  /* op2 */
7372  if (record_full_arch_list_add_mem (oaddr, 4))
7373  return -1;
7374  break;
7375 
7376  case 0x09: /* DCSG */
7377  /* op3c */
7378  if (record_full_arch_list_add_mem (oaddr2 + 0x28, 8))
7379  return -1;
7380  goto CSSTG;
7381 
7382  case 0x15: /* CSTSTG */
7383  /* op8 */
7384  if (target_read_memory (oaddr2 + 0x88, buf, 8))
7385  return -1;
7386  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7387  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7388  if (record_full_arch_list_add_mem (oaddr3, 8))
7389  return -1;
7390  /* fallthru */
7391  case 0x11: /* CSDSTG */
7392  /* op6 */
7393  if (target_read_memory (oaddr2 + 0x68, buf, 8))
7394  return -1;
7395  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7396  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7397  if (record_full_arch_list_add_mem (oaddr3, 8))
7398  return -1;
7399  /* fallthru */
7400  case 0x0d: /* CSSTG */
7401 CSSTG:
7402  /* op4 */
7403  if (target_read_memory (oaddr2 + 0x48, buf, 8))
7404  return -1;
7405  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7406  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7407  if (record_full_arch_list_add_mem (oaddr3, 8))
7408  return -1;
7409  /* fallthru */
7410  case 0x05: /* CSG */
7411  /* op1c */
7412  if (record_full_arch_list_add_mem (oaddr2 + 0x08, 8))
7413  return -1;
7414  /* op2 */
7415  if (record_full_arch_list_add_mem (oaddr, 8))
7416  return -1;
7417  break;
7418 
7419  case 0x0a: /* DCSGR */
7420  /* op3c */
7421  if (s390_record_gpr_g (gdbarch, regcache, inib[3]))
7422  return -1;
7423  /* fallthru */
7424  case 0x0e: /* CSSTGR */
7425  /* op4 */
7426  if (record_full_arch_list_add_mem (oaddr2, 8))
7427  return -1;
7428  goto CSGR;
7429 
7430  case 0x16: /* CSTSTGR */
7431  /* op8 */
7432  if (target_read_memory (oaddr2 + 0x88, buf, 8))
7433  return -1;
7434  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7435  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7436  if (record_full_arch_list_add_mem (oaddr3, 8))
7437  return -1;
7438  /* fallthru */
7439  case 0x12: /* CSDSTGR */
7440  /* op6 */
7441  if (target_read_memory (oaddr2 + 0x68, buf, 8))
7442  return -1;
7443  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7444  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7445  if (record_full_arch_list_add_mem (oaddr3, 8))
7446  return -1;
7447  /* op4 */
7448  if (target_read_memory (oaddr2 + 0x48, buf, 8))
7449  return -1;
7450  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7451  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7452  if (record_full_arch_list_add_mem (oaddr3, 8))
7453  return -1;
7454  /* fallthru */
7455  case 0x06: /* CSGR */
7456 CSGR:
7457  /* op1c */
7458  if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
7459  return -1;
7460  /* op2 */
7461  if (record_full_arch_list_add_mem (oaddr, 8))
7462  return -1;
7463  break;
7464 
7465  case 0x0b: /* DCSX */
7466  /* op3c */
7467  if (record_full_arch_list_add_mem (oaddr2 + 0x20, 16))
7468  return -1;
7469  goto CSSTX;
7470 
7471  case 0x17: /* CSTSTX */
7472  /* op8 */
7473  if (target_read_memory (oaddr2 + 0x88, buf, 8))
7474  return -1;
7475  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7476  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7477  if (record_full_arch_list_add_mem (oaddr3, 16))
7478  return -1;
7479  /* fallthru */
7480  case 0x13: /* CSDSTX */
7481  /* op6 */
7482  if (target_read_memory (oaddr2 + 0x68, buf, 8))
7483  return -1;
7484  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7485  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7486  if (record_full_arch_list_add_mem (oaddr3, 16))
7487  return -1;
7488  /* fallthru */
7489  case 0x0f: /* CSSTX */
7490 CSSTX:
7491  /* op4 */
7492  if (target_read_memory (oaddr2 + 0x48, buf, 8))
7493  return -1;
7494  oaddr3 = extract_unsigned_integer (buf, 8, byte_order);
7495  oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
7496  if (record_full_arch_list_add_mem (oaddr3, 16))
7497  return -1;
7498  /* fallthru */
7499  case 0x07: /* CSX */
7500  /* op1c */
7501  if (record_full_arch_list_add_mem (oaddr2 + 0x00, 16))
7502  return -1;
7503  /* op2 */
7504  if (record_full_arch_list_add_mem (oaddr, 16))
7505  return -1;
7506  break;
7507 
7508  default:
7509  fprintf_unfiltered (gdb_stdlog, "Warning: Unknown PLO FC %02x at %s.\n",
7510  fc, paddress (gdbarch, addr));
7511  return -1;
7512  }
7513  }
7515  return -1;
7516  break;
7517 
7518  case 0xef: /* LMD - load multiple disjoint */
7519  for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
7521  return -1;
7522  if (s390_record_gpr_g (gdbarch, regcache, inib[3]))
7523  return -1;
7524  break;
7525 
7526  case 0xf0: /* SRP - shift and round decimal */
7527  case 0xf8: /* ZAP - zero and add */
7528  case 0xfa: /* AP - add decimal */
7529  case 0xfb: /* SP - subtract decimal */
7530  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7531  if (record_full_arch_list_add_mem (oaddr, inib[2] + 1))
7532  return -1;
7534  return -1;
7535  /* DXC may be written */
7537  return -1;
7538  break;
7539 
7540  case 0xf1: /* MVO - move with offset */
7541  case 0xf2: /* PACK - pack */
7542  case 0xf3: /* UNPK - unpack */
7543  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7544  if (record_full_arch_list_add_mem (oaddr, inib[2] + 1))
7545  return -1;
7546  break;
7547 
7548  /* 0xf4-0xf7 undefined */
7549 
7550  case 0xf9: /* CP - compare decimal */
7552  return -1;
7553  /* DXC may be written */
7555  return -1;
7556  break;
7557 
7558  case 0xfc: /* MP - multiply decimal */
7559  case 0xfd: /* DP - divide decimal */
7560  oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
7561  if (record_full_arch_list_add_mem (oaddr, inib[2] + 1))
7562  return -1;
7563  /* DXC may be written */
7565  return -1;
7566  break;
7567 
7568  /* 0xfe-0xff undefined */
7569 
7570  default:
7571 UNKNOWN_OP:
7572  fprintf_unfiltered (gdb_stdlog, "Warning: Don't know how to record %04x "
7573  "at %s.\n", insn[0], paddress (gdbarch, addr));
7574  return -1;
7575  }
7576 
7578  return -1;
7580  return -1;
7581  return 0;
7582 }
7583 
7584 /* Initialize linux_record_tdep if not initialized yet. */
7585 
7586 static void
7588  enum s390_abi_kind abi)
7589 {
7590  /* These values are the size of the type that will be used in a system
7591  call. They are obtained from Linux Kernel source. */
7592 
7593  if (abi == ABI_LINUX_ZSERIES)
7594  {
7595  record_tdep->size_pointer = 8;
7596  /* no _old_kernel_stat */
7597  record_tdep->size_tms = 32;
7598  record_tdep->size_loff_t = 8;
7599  record_tdep->size_flock = 32;
7600  record_tdep->size_ustat = 32;
7601  record_tdep->size_old_sigaction = 32;
7602  record_tdep->size_old_sigset_t = 8;
7603  record_tdep->size_rlimit = 16;
7604  record_tdep->size_rusage = 144;
7605  record_tdep->size_timeval = 16;
7606  record_tdep->size_timezone = 8;
7607  /* old_[ug]id_t never used */
7608  record_tdep->size_fd_set = 128;
7609  record_tdep->size_old_dirent = 280;
7610  record_tdep->size_statfs = 88;
7611  record_tdep->size_statfs64 = 88;
7612  record_tdep->size_sockaddr = 16;
7613  record_tdep->size_int = 4;
7614  record_tdep->size_long = 8;
7615  record_tdep->size_ulong = 8;
7616  record_tdep->size_msghdr = 56;
7617  record_tdep->size_itimerval = 32;
7618  record_tdep->size_stat = 144;
7619  /* old_utsname unused */
7620  record_tdep->size_sysinfo = 112;
7621  record_tdep->size_msqid_ds = 120;
7622  record_tdep->size_shmid_ds = 112;
7623  record_tdep->size_new_utsname = 390;
7624  record_tdep->size_timex = 208;
7625  record_tdep->size_mem_dqinfo = 24;
7626  record_tdep->size_if_dqblk = 72;
7627  record_tdep->size_fs_quota_stat = 80;
7628  record_tdep->size_timespec = 16;
7629  record_tdep->size_pollfd = 8;
7630  record_tdep->size_NFS_FHSIZE = 32;
7631  record_tdep->size_knfsd_fh = 132;
7632  record_tdep->size_TASK_COMM_LEN = 16;
7633  record_tdep->size_sigaction = 32;
7634  record_tdep->size_sigset_t = 8;
7635  record_tdep->size_siginfo_t = 128;
7636  record_tdep->size_cap_user_data_t = 12;
7637  record_tdep->size_stack_t = 24;
7638  record_tdep->size_off_t = 8;
7639  /* stat64 unused */
7640  record_tdep->size_gid_t = 4;
7641  record_tdep->size_uid_t = 4;
7642  record_tdep->size_PAGE_SIZE = 0x1000; /* 4KB */
7643  record_tdep->size_flock64 = 32;
7644  record_tdep->size_io_event = 32;
7645  record_tdep->size_iocb = 64;
7646  record_tdep->size_epoll_event = 16;
7647  record_tdep->size_itimerspec = 32;
7648  record_tdep->size_mq_attr = 64;
7649  record_tdep->size_termios = 36;
7650  record_tdep->size_termios2 = 44;
7651  record_tdep->size_pid_t = 4;
7652  record_tdep->size_winsize = 8;
7653  record_tdep->size_serial_struct = 72;
7654  record_tdep->size_serial_icounter_struct = 80;
7655  record_tdep->size_size_t = 8;
7656  record_tdep->size_iovec = 16;
7657  record_tdep->size_time_t = 8;
7658  }
7659  else if (abi == ABI_LINUX_S390)
7660  {
7661  record_tdep->size_pointer = 4;
7662  record_tdep->size__old_kernel_stat = 32;
7663  record_tdep->size_tms = 16;
7664  record_tdep->size_loff_t = 8;
7665  record_tdep->size_flock = 16;
7666  record_tdep->size_ustat = 20;
7667  record_tdep->size_old_sigaction = 16;
7668  record_tdep->size_old_sigset_t = 4;
7669  record_tdep->size_rlimit = 8;
7670  record_tdep->size_rusage = 72;
7671  record_tdep->size_timeval = 8;
7672  record_tdep->size_timezone = 8;
7673  record_tdep->size_old_gid_t = 2;
7674  record_tdep->size_old_uid_t = 2;
7675  record_tdep->size_fd_set = 128;
7676  record_tdep->size_old_dirent = 268;
7677  record_tdep->size_statfs = 64;
7678  record_tdep->size_statfs64 = 88;
7679  record_tdep->size_sockaddr = 16;
7680  record_tdep->size_int = 4;
7681  record_tdep->size_long = 4;
7682  record_tdep->size_ulong = 4;
7683  record_tdep->size_msghdr = 28;
7684  record_tdep->size_itimerval = 16;
7685  record_tdep->size_stat = 64;
7686  /* old_utsname unused */
7687  record_tdep->size_sysinfo = 64;
7688  record_tdep->size_msqid_ds = 88;
7689  record_tdep->size_shmid_ds = 84;
7690  record_tdep->size_new_utsname = 390;
7691  record_tdep->size_timex = 128;
7692  record_tdep->size_mem_dqinfo = 24;
7693  record_tdep->size_if_dqblk = 72;
7694  record_tdep->size_fs_quota_stat = 80;
7695  record_tdep->size_timespec = 8;
7696  record_tdep->size_pollfd = 8;
7697  record_tdep->size_NFS_FHSIZE = 32;
7698  record_tdep->size_knfsd_fh = 132;
7699  record_tdep->size_TASK_COMM_LEN = 16;
7700  record_tdep->size_sigaction = 20;
7701  record_tdep->size_sigset_t = 8;
7702  record_tdep->size_siginfo_t = 128;
7703  record_tdep->size_cap_user_data_t = 12;
7704  record_tdep->size_stack_t = 12;
7705  record_tdep->size_off_t = 4;
7706  record_tdep->size_stat64 = 104;
7707  record_tdep->size_gid_t = 4;
7708  record_tdep->size_uid_t = 4;
7709  record_tdep->size_PAGE_SIZE = 0x1000; /* 4KB */
7710  record_tdep->size_flock64 = 32;
7711  record_tdep->size_io_event = 32;
7712  record_tdep->size_iocb = 64;
7713  record_tdep->size_epoll_event = 16;
7714  record_tdep->size_itimerspec = 16;
7715  record_tdep->size_mq_attr = 32;
7716  record_tdep->size_termios = 36;
7717  record_tdep->size_termios2 = 44;
7718  record_tdep->size_pid_t = 4;
7719  record_tdep->size_winsize = 8;
7720  record_tdep->size_serial_struct = 60;
7721  record_tdep->size_serial_icounter_struct = 80;
7722  record_tdep->size_size_t = 4;
7723  record_tdep->size_iovec = 8;
7724  record_tdep->size_time_t = 4;
7725  }
7726 
7727  /* These values are the second argument of system call "sys_fcntl"
7728  and "sys_fcntl64". They are obtained from Linux Kernel source. */
7729  record_tdep->fcntl_F_GETLK = 5;
7730  record_tdep->fcntl_F_GETLK64 = 12;
7731  record_tdep->fcntl_F_SETLK64 = 13;
7732  record_tdep->fcntl_F_SETLKW64 = 14;
7733 
7734  record_tdep->arg1 = S390_R2_REGNUM;
7735  record_tdep->arg2 = S390_R3_REGNUM;
7736  record_tdep->arg3 = S390_R4_REGNUM;
7737  record_tdep->arg4 = S390_R5_REGNUM;
7738  record_tdep->arg5 = S390_R6_REGNUM;
7739 
7740  /* These values are the second argument of system call "sys_ioctl".
7741  They are obtained from Linux Kernel source.
7742  See arch/s390/include/uapi/asm/ioctls.h. */
7743 
7744  record_tdep->ioctl_TCGETS = 0x5401;
7745  record_tdep->ioctl_TCSETS = 0x5402;
7746  record_tdep->ioctl_TCSETSW = 0x5403;
7747  record_tdep->ioctl_TCSETSF = 0x5404;
7748  record_tdep->ioctl_TCGETA = 0x5405;
7749  record_tdep->ioctl_TCSETA = 0x5406;
7750  record_tdep->ioctl_TCSETAW = 0x5407;
7751  record_tdep->ioctl_TCSETAF = 0x5408;
7752  record_tdep->ioctl_TCSBRK = 0x5409;
7753  record_tdep->ioctl_TCXONC = 0x540a;
7754  record_tdep->ioctl_TCFLSH = 0x540b;
7755  record_tdep->ioctl_TIOCEXCL = 0x540c;
7756  record_tdep->ioctl_TIOCNXCL = 0x540d;
7757  record_tdep->ioctl_TIOCSCTTY = 0x540e;
7758  record_tdep->ioctl_TIOCGPGRP = 0x540f;
7759  record_tdep->ioctl_TIOCSPGRP = 0x5410;
7760  record_tdep->ioctl_TIOCOUTQ = 0x5411;
7761  record_tdep->ioctl_TIOCSTI = 0x5412;
7762  record_tdep->ioctl_TIOCGWINSZ = 0x5413;
7763  record_tdep->ioctl_TIOCSWINSZ = 0x5414;
7764  record_tdep->ioctl_TIOCMGET = 0x5415;
7765  record_tdep->ioctl_TIOCMBIS = 0x5416;
7766  record_tdep->ioctl_TIOCMBIC = 0x5417;
7767  record_tdep->ioctl_TIOCMSET = 0x5418;
7768  record_tdep->ioctl_TIOCGSOFTCAR = 0x5419;
7769  record_tdep->ioctl_TIOCSSOFTCAR = 0x541a;
7770  record_tdep->ioctl_FIONREAD = 0x541b;
7771  record_tdep->ioctl_TIOCINQ = 0x541b; /* alias */
7772  record_tdep->ioctl_TIOCLINUX = 0x541c;
7773  record_tdep->ioctl_TIOCCONS = 0x541d;
7774  record_tdep->ioctl_TIOCGSERIAL = 0x541e;
7775  record_tdep->ioctl_TIOCSSERIAL = 0x541f;
7776  record_tdep->ioctl_TIOCPKT = 0x5420;
7777  record_tdep->ioctl_FIONBIO = 0x5421;
7778  record_tdep->ioctl_TIOCNOTTY = 0x5422;
7779  record_tdep->ioctl_TIOCSETD = 0x5423;
7780  record_tdep->ioctl_TIOCGETD = 0x5424;
7781  record_tdep->ioctl_TCSBRKP = 0x5425;
7782  record_tdep->ioctl_TIOCSBRK = 0x5427;
7783  record_tdep->ioctl_TIOCCBRK = 0x5428;
7784  record_tdep->ioctl_TIOCGSID = 0x5429;
7785  record_tdep->ioctl_TCGETS2 = 0x802c542a;
7786  record_tdep->ioctl_TCSETS2 = 0x402c542b;
7787  record_tdep->ioctl_TCSETSW2 = 0x402c542c;
7788  record_tdep->ioctl_TCSETSF2 = 0x402c542d;
7789  record_tdep->ioctl_TIOCGPTN = 0x80045430;
7790  record_tdep->ioctl_TIOCSPTLCK = 0x40045431;
7791  record_tdep->ioctl_FIONCLEX = 0x5450;
7792  record_tdep->ioctl_FIOCLEX = 0x5451;
7793  record_tdep->ioctl_FIOASYNC = 0x5452;
7794  record_tdep->ioctl_TIOCSERCONFIG = 0x5453;
7795  record_tdep->ioctl_TIOCSERGWILD = 0x5454;
7796  record_tdep->ioctl_TIOCSERSWILD = 0x5455;
7797  record_tdep->ioctl_TIOCGLCKTRMIOS = 0x5456;
7798  record_tdep->ioctl_TIOCSLCKTRMIOS = 0x5457;
7799  record_tdep->ioctl_TIOCSERGSTRUCT = 0x5458;
7800  record_tdep->ioctl_TIOCSERGETLSR = 0x5459;
7801  record_tdep->ioctl_TIOCSERGETMULTI = 0x545a;
7802  record_tdep->ioctl_TIOCSERSETMULTI = 0x545b;
7803  record_tdep->ioctl_TIOCMIWAIT = 0x545c;
7804  record_tdep->ioctl_TIOCGICOUNT = 0x545d;
7805  record_tdep->ioctl_FIOQSIZE = 0x545e;
7806 }
7807 
7808 /* Set up gdbarch struct. */
7809 
7810 static struct gdbarch *
7811 s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
7812 {
7813  const struct target_desc *tdesc = info.target_desc;
7814  struct tdesc_arch_data *tdesc_data = NULL;
7815  struct gdbarch *gdbarch;
7816  struct gdbarch_tdep *tdep;
7817  enum s390_abi_kind tdep_abi;
7819  int have_upper = 0;
7820  int have_linux_v1 = 0;
7821  int have_linux_v2 = 0;
7822  int have_tdb = 0;
7823  int have_vx = 0;
7824  int have_gs = 0;
7825  int first_pseudo_reg, last_pseudo_reg;
7826  static const char *const stap_register_prefixes[] = { "%", NULL };
7827  static const char *const stap_register_indirection_prefixes[] = { "(",
7828  NULL };
7829  static const char *const stap_register_indirection_suffixes[] = { ")",
7830  NULL };
7831 
7832  /* Default ABI and register size. */
7833  switch (info.bfd_arch_info->mach)
7834  {
7835  case bfd_mach_s390_31:
7836  tdep_abi = ABI_LINUX_S390;
7837  break;
7838 
7839  case bfd_mach_s390_64:
7840  tdep_abi = ABI_LINUX_ZSERIES;
7841  break;
7842 
7843  default:
7844  return NULL;
7845  }
7846 
7847  /* Use default target description if none provided by the target. */
7848  if (!tdesc_has_registers (tdesc))
7849  {
7850  if (tdep_abi == ABI_LINUX_S390)
7852  else
7854  }
7855 
7856  /* Check any target description for validity. */
7857  if (tdesc_has_registers (tdesc))
7858  {
7859  static const char *const gprs[] = {
7860  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
7861  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
7862  };
7863  static const char *const fprs[] = {
7864  "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
7865  "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
7866  };
7867  static const char *const acrs[] = {
7868  "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
7869  "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15"
7870  };
7871  static const char *const gprs_lower[] = {
7872  "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l",
7873  "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
7874  };
7875  static const char *const gprs_upper[] = {
7876  "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
7877  "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
7878  };
7879  static const char *const tdb_regs[] = {
7880  "tdb0", "tac", "tct", "atia",
7881  "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
7882  "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
7883  };
7884  static const char *const vxrs_low[] = {
7885  "v0l", "v1l", "v2l", "v3l", "v4l", "v5l", "v6l", "v7l", "v8l",
7886  "v9l", "v10l", "v11l", "v12l", "v13l", "v14l", "v15l",
7887  };
7888  static const char *const vxrs_high[] = {
7889  "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24",
7890  "v25", "v26", "v27", "v28", "v29", "v30", "v31",
7891  };
7892  static const char *const gs_cb[] = {
7893  "gsd", "gssm", "gsepla",
7894  };
7895  static const char *const gs_bc[] = {
7896  "bc_gsd", "bc_gssm", "bc_gsepla",
7897  };
7898  const struct tdesc_feature *feature;
7899  int i, valid_p = 1;
7900 
7901  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.core");
7902  if (feature == NULL)
7903  return NULL;
7904 
7906 
7907  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7908  S390_PSWM_REGNUM, "pswm");
7909  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7910  S390_PSWA_REGNUM, "pswa");
7911 
7912  if (tdesc_unnumbered_register (feature, "r0"))
7913  {
7914  for (i = 0; i < 16; i++)
7915  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7916  S390_R0_REGNUM + i, gprs[i]);
7917  }
7918  else
7919  {
7920  have_upper = 1;
7921 
7922  for (i = 0; i < 16; i++)
7923  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7924  S390_R0_REGNUM + i,
7925  gprs_lower[i]);
7926  for (i = 0; i < 16; i++)
7927  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7929  gprs_upper[i]);
7930  }
7931 
7932  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.fpr");
7933  if (feature == NULL)
7934  {
7936  return NULL;
7937  }
7938 
7939  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7940  S390_FPC_REGNUM, "fpc");
7941  for (i = 0; i < 16; i++)
7942  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7943  S390_F0_REGNUM + i, fprs[i]);
7944 
7945  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.acr");
7946  if (feature == NULL)
7947  {
7949  return NULL;
7950  }
7951 
7952  for (i = 0; i < 16; i++)
7953  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7954  S390_A0_REGNUM + i, acrs[i]);
7955 
7956  /* Optional GNU/Linux-specific "registers". */
7957  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.linux");
7958  if (feature)
7959  {
7961  S390_ORIG_R2_REGNUM, "orig_r2");
7962 
7963  if (tdesc_numbered_register (feature, tdesc_data,
7964  S390_LAST_BREAK_REGNUM, "last_break"))
7965  have_linux_v1 = 1;
7966 
7967  if (tdesc_numbered_register (feature, tdesc_data,
7968  S390_SYSTEM_CALL_REGNUM, "system_call"))
7969  have_linux_v2 = 1;
7970 
7971  if (have_linux_v2 > have_linux_v1)
7972  valid_p = 0;
7973  }
7974 
7975  /* Transaction diagnostic block. */
7976  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.tdb");
7977  if (feature)
7978  {
7979  for (i = 0; i < ARRAY_SIZE (tdb_regs); i++)
7980  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7982  tdb_regs[i]);
7983  have_tdb = 1;
7984  }
7985 
7986  /* Vector registers. */
7987  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.vx");
7988  if (feature)
7989  {
7990  for (i = 0; i < 16; i++)
7991  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7993  vxrs_low[i]);
7994  for (i = 0; i < 16; i++)
7995  valid_p &= tdesc_numbered_register (feature, tdesc_data,
7996  S390_V16_REGNUM + i,
7997  vxrs_high[i]);
7998  have_vx = 1;
7999  }
8000 
8001  /* Guarded-storage registers. */
8002  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.gs");
8003  if (feature)
8004  {
8005  for (i = 0; i < 3; i++)
8006  valid_p &= tdesc_numbered_register (feature, tdesc_data,
8007  S390_GSD_REGNUM + i,
8008  gs_cb[i]);
8009  have_gs = 1;
8010  }
8011 
8012  /* Guarded-storage broadcast control. */
8013  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.gsbc");
8014  if (feature)
8015  {
8016  valid_p &= have_gs;
8017 
8018  for (i = 0; i < 3; i++)
8019  valid_p &= tdesc_numbered_register (feature, tdesc_data,
8020  S390_BC_GSD_REGNUM + i,
8021  gs_bc[i]);
8022  }
8023 
8024  if (!valid_p)
8025  {
8027  return NULL;
8028  }
8029  }
8030 
8031  /* Determine vector ABI. */
8032  vector_abi = S390_VECTOR_ABI_NONE;
8033 #ifdef HAVE_ELF
8034  if (have_vx
8035  && info.abfd != NULL
8036  && info.abfd->format == bfd_object
8037  && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
8038  && bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
8039  Tag_GNU_S390_ABI_Vector) == 2)
8040  vector_abi = S390_VECTOR_ABI_128;
8041 #endif
8042 
8043  /* Find a candidate among extant architectures. */
8044  for (arches = gdbarch_list_lookup_by_info (arches, &info);
8045  arches != NULL;
8046  arches = gdbarch_list_lookup_by_info (arches->next, &info))
8047  {
8048  tdep = gdbarch_tdep (arches->gdbarch);
8049  if (!tdep)
8050  continue;
8051  if (tdep->abi != tdep_abi)
8052  continue;
8053  if (tdep->vector_abi != vector_abi)
8054  continue;
8055  if ((tdep->gpr_full_regnum != -1) != have_upper)
8056  continue;
8057  if (tdep->have_gs != have_gs)
8058  continue;
8059  if (tdesc_data != NULL)
8061  return arches->gdbarch;
8062  }
8063 
8064  /* Otherwise create a new gdbarch for the specified machine type. */
8065  tdep = XCNEW (struct gdbarch_tdep);
8066  tdep->abi = tdep_abi;
8067  tdep->vector_abi = vector_abi;
8068  tdep->have_linux_v1 = have_linux_v1;
8069  tdep->have_linux_v2 = have_linux_v2;
8070  tdep->have_tdb = have_tdb;
8071  tdep->have_gs = have_gs;
8072  gdbarch = gdbarch_alloc (&info, tdep);
8073 
8076 
8077  /* S/390 GNU/Linux uses either 64-bit or 128-bit long doubles.
8078  We can safely let them default to 128-bit, since the debug info
8079  will give the size of type actually used in each case. */
8082 
8083  /* Amount PC must be decremented by after a breakpoint. This is
8084  often the number of bytes returned by gdbarch_breakpoint_from_pc but not
8085  always. */
8087  /* Stack grows downward. */
8089  set_gdbarch_breakpoint_kind_from_pc (gdbarch, s390_breakpoint::kind_from_pc);
8090  set_gdbarch_sw_breakpoint_from_kind (gdbarch, s390_breakpoint::bp_from_kind);
8095 
8121 
8122  /* Assign pseudo register numbers. */
8123  first_pseudo_reg = gdbarch_num_regs (gdbarch);
8124  last_pseudo_reg = first_pseudo_reg;
8125  tdep->gpr_full_regnum = -1;
8126  if (have_upper)
8127  {
8128  tdep->gpr_full_regnum = last_pseudo_reg;
8129  last_pseudo_reg += 16;
8130  }
8131  tdep->v0_full_regnum = -1;
8132  if (have_vx)
8133  {
8134  tdep->v0_full_regnum = last_pseudo_reg;
8135  last_pseudo_reg += 16;
8136  }
8137  tdep->pc_regnum = last_pseudo_reg++;
8138  tdep->cc_regnum = last_pseudo_reg++;
8140  set_gdbarch_num_pseudo_regs (gdbarch, last_pseudo_reg - first_pseudo_reg);
8141 
8142  /* Inferior function calls. */
8147 
8148  /* Syscall handling. */
8150 
8151  /* Frame handling. */
8162 
8163  /* Displaced stepping. */
8169 
8170  /* Note that GNU/Linux is the only OS supported on this
8171  platform. */
8172  linux_init_abi (info, gdbarch);
8173 
8174  switch (tdep->abi)
8175  {
8176  case ABI_LINUX_S390:
8177  set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove);
8180 
8182  break;
8183 
8184  case ABI_LINUX_ZSERIES:
8197  break;
8198  }
8199 
8201 
8202  /* Enable TLS support. */
8205 
8206  /* SystemTap functions. */
8207  set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
8209  stap_register_indirection_prefixes);
8211  stap_register_indirection_suffixes);
8215 
8216  /* Support reverse debugging. */
8217 
8220 
8223 
8226  disassembler_options_s390 ());
8227 
8228  return gdbarch;
8229 }
8230 
8231 void
8233 {
8234  /* Hook us into the gdbarch mechanism. */
8235  register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
8236 
8237  /* Initialize the GNU/Linux target descriptions. */
8255 }
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
Definition: gdbarch.c:2050
#define S390_V15_LOWER_REGNUM
unsigned int length
Definition: gdbtypes.h:803
static int s390_process_record(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
void set_gdbarch_frame_align(struct gdbarch *gdbarch, gdbarch_frame_align_ftype frame_align)
Definition: gdbarch.c:3151
bool store_would_trash(pv_t addr)
static void s390_dwarf2_frame_init_reg(struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, struct frame_info *this_frame)
static void s390_supply_tdb_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *regs, size_t len)
void set_gdbarch_address_class_type_flags_to_name(struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
Definition: gdbarch.c:3541
static int is_power_of_two(unsigned int n)
static const struct regcache_map_entry s390_regmap_vxrs_high[]
void set_gdbarch_gcc_target_options(struct gdbarch *gdbarch, gdbarch_gcc_target_options_ftype gcc_target_options)
Definition: gdbarch.c:5006
static int s390_record_gpr_g(struct gdbarch *gdbarch, struct regcache *regcache, int i)
type_code
Definition: gdbtypes.h:80
int size_serial_icounter_struct
Definition: linux-record.h:88
static CORE_ADDR s390_record_calc_rl(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr, uint16_t i1, uint16_t i2)
struct target_desc * tdesc_s390_vx_linux64
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition: frame.c:624
CORE_ADDR get_frame_address_in_block(struct frame_info *this_frame)
Definition: frame.c:2407
struct type * builtin_func_ptr
Definition: gdbtypes.h:1565
void set_tdesc_pseudo_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype *pseudo_name)
static int s390_function_arg_float(struct type *type)
void set_gdbarch_displaced_step_fixup(struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype displaced_step_fixup)
Definition: gdbarch.c:3982
struct target_desc * tdesc_s390x_gs_linux64
#define S390_SYSTEM_CALL_REGNUM
CORE_ADDR get_frame_pc(struct frame_info *frame)
Definition: frame.c:2376
struct target_desc * tdesc_s390_te_linux64
void set_gdbarch_fp0_regnum(struct gdbarch *gdbarch, int fp0_regnum)
Definition: gdbarch.c:2207
#define S390_V26_REGNUM
#define S390_A13_REGNUM
bfd_vma CORE_ADDR
Definition: common-types.h:41
struct target_desc * tdesc_s390_linux32v1
Definition: s390-linux32v1.c:8
struct type * type
Definition: value.c:266
#define HWCAP_S390_TE
#define S390_FPC_REGNUM
void set_gdbarch_fetch_tls_load_module_address(struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
Definition: gdbarch.c:3038
void displaced_step_dump_bytes(struct ui_file *file, const gdb_byte *buf, size_t len)
Definition: infrun.c:1721
#define S390_A7_REGNUM
struct link_map_offsets * svr4_lp64_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3214
static void initialize_tdesc_s390_linux64v2(void)
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
struct regcache * get_thread_regcache(ptid_t ptid)
Definition: regcache.c:434
void ax_reg_mask(struct agent_expr *ax, int reg)
Definition: ax-general.c:425
struct value * trad_frame_get_prev_register(struct frame_info *this_frame, struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:142
static int s390_address_class_type_flags(int byte_size, int dwarf2_addr_class)
int trad_frame_addr_p(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:84
static int s390_stub_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
static const struct regcache_map_entry s390_regmap_upper[]
int record_full_arch_list_add_reg(struct regcache *regcache, int regnum)
Definition: record-full.c:468
LONGEST value_as_long(struct value *val)
Definition: value.c:2749
void dwarf2_frame_set_adjust_regnum(struct gdbarch *gdbarch, int(*adjust_regnum)(struct gdbarch *, int, int))
Definition: dwarf2-frame.c:800
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
Definition: corefile.c:417
void(* func)(char *)
gdb::byte_vector buf
Definition: infrun.h:262
static int is_rsy(bfd_byte *insn, int op1, int op2, unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
void set_tdesc_pseudo_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype *pseudo_type)
void() iterate_over_regset_sections_cb(const char *sect_name, int size, const struct regset *regset, const char *human_name, void *cb_data)
Definition: gdbarch.h:99
void set_gdbarch_skip_trampoline_code(struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
Definition: gdbarch.c:3316
struct target_desc * tdesc_s390x_tevx_linux64
void set_gdbarch_gen_return_address(struct gdbarch *gdbarch, gdbarch_gen_return_address_ftype gen_return_address)
Definition: gdbarch.c:4764
void set_gdbarch_stab_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
Definition: gdbarch.c:2224
#define S390_F10_REGNUM
void set_gdbarch_write_pc(struct gdbarch *gdbarch, gdbarch_write_pc_ftype write_pc)
Definition: gdbarch.c:1943
static int s390_pseudo_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
void set_gdbarch_addr_bits_remove(struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype addr_bits_remove)
Definition: gdbarch.c:3218
void set_gdbarch_displaced_step_location(struct gdbarch *gdbarch, gdbarch_displaced_step_location_ftype displaced_step_location)
Definition: gdbarch.c:3999
#define S390_A6_REGNUM
static void initialize_tdesc_s390x_linux64(void)
Definition: s390x-linux64.c:10
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1831
static void s390_store(struct s390_prologue_data *data, int d2, unsigned int x2, unsigned int b2, CORE_ADDR size, pv_t value)
constexpr gdb_byte s390_break_insn[]
ULONGEST align_down(ULONGEST v, int n)
Definition: utils.c:3005
void set_gdbarch_stap_register_prefixes(struct gdbarch *gdbarch, const char *const *stap_register_prefixes)
Definition: gdbarch.c:4366
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1279
void regcache_cooked_write_signed(struct regcache *regcache, int regnum, LONGEST val)
Definition: regcache.c:785
#define S390_R6_REGNUM
#define INT32_MAX
Definition: ada-lex.c:75
#define S390_F9_REGNUM
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
Definition: gdbtypes.c:5217
static CORE_ADDR s390_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc, CORE_ADDR current_pc, struct s390_prologue_data *data)
void set_gdbarch_process_record_signal(struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype process_record_signal)
Definition: gdbarch.c:4161
struct frame_id frame_id_build_unavailable_stack(CORE_ADDR code_addr)
Definition: frame.c:597
static int s390_register_call_saved(struct gdbarch *gdbarch, int regnum)
#define S390_A4_REGNUM
#define S390_R9_REGNUM
int pv_is_register(pv_t a, int r)
void * memset(T *s, int c, size_t n)=delete
#define S390_GSSM_REGNUM
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
#define S390_A8_REGNUM
void set_gdbarch_ax_pseudo_register_collect(struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_collect_ftype ax_pseudo_register_collect)
Definition: gdbarch.c:2091
static const struct regcache_map_entry s390x_regmap_last_break[]
#define S390_F2_REGNUM
const char * tdesc_register_name(struct gdbarch *gdbarch, int regno)
struct m32c_reg * pc
Definition: m32c-tdep.c:116
static int s390_function_arg_vector(struct type *type)
static enum gdb_syscall s390_canonicalize_syscall(int syscall, enum s390_abi_kind abi)
return_value_convention
Definition: defs.h:247
#define S390_V31_REGNUM
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
Definition: regcache.c:1192
static struct displaced_step_closure * s390_displaced_step_copy_insn(struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
static void s390_write_pc(struct regcache *regcache, CORE_ADDR pc)
static char * s390_disassembler_options
static void initialize_tdesc_s390_linux32v2(void)
void linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: linux-tdep.c:2492
static int s390_dwarf_reg_to_regnum(struct gdbarch *gdbarch, int reg)
typedef BP_MANIPULATION(s390_break_insn)
int safe_read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order, LONGEST *return_value)
Definition: corefile.c:284
#define S390_V25_REGNUM
#define S390_BC_GSSM_REGNUM
static CORE_ADDR s390_frame_base_address(struct frame_info *this_frame, void **this_cache)
static const char * s390_register_name(struct gdbarch *gdbarch, int regnum)
enum prologue_value_kind kind
Definition: ax.h:83
void regcache_cooked_write_part(struct regcache *regcache, int regnum, int offset, int len, const gdb_byte *buf)
Definition: regcache.c:987
static void initialize_tdesc_s390x_tevx_linux64(void)
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3183
const struct regset s390_gregset
const struct floatformat * floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN]
Definition: gdbtypes.c:100
#define S390_V16_REGNUM
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
Definition: gdbarch.c:5309
register_status
CORE_ADDR skip_prologue_using_sal(struct gdbarch *gdbarch, CORE_ADDR func_addr)
Definition: symtab.c:3854
struct target_desc * tdesc_s390_linux64v2
Definition: s390-linux64v2.c:8
struct target_desc * tdesc_s390_linux32v2
Definition: s390-linux32v2.c:8
struct gdbarch_list * next
Definition: gdbarch.h:1623
struct reggroup *const restore_reggroup
Definition: reggroups.c:320
static const struct regcache_map_entry s390_regmap_system_call[]
static LONGEST s390_linux_get_syscall_number(struct gdbarch *gdbarch, ptid_t ptid)
void ax_reg(struct agent_expr *x, int reg)
Definition: ax-general.c:274
#define S390_FRAME_REGNUM
static void s390_guess_tracepoint_registers(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
int gdbarch_num_regs(struct gdbarch *gdbarch)
Definition: gdbarch.c:2039
static const short s390_dwarf_regmap[]
static void s390_stub_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
const struct regset s390_fpregset
#define _(String)
Definition: gdb_locale.h:35
#define S390_TDB_ATIA_REGNUM
static const struct regcache_map_entry s390_regmap_last_break[]
const struct bfd_arch_info * bfd_arch_info
Definition: gdbarch.h:1629
static void s390_check_for_saved(void *data_untyped, pv_t addr, CORE_ADDR size, pv_t value)
static void initialize_tdesc_s390_gs_linux64(void)
#define XML_SYSCALL_FILENAME_S390X
static int s390_ax_pseudo_register_push_stack(struct gdbarch *gdbarch, struct agent_expr *ax, int regnum)
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
Definition: gdbarch.c:2275
struct target_desc * tdesc_s390_tevx_linux64
static int s390_function_arg_integer(struct type *type)
static struct linux_record_tdep s390_linux_record_tdep
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1491
void regcache_write_pc(struct regcache *regcache, CORE_ADDR pc)
Definition: regcache.c:1256
void set_gdbarch_gnu_triplet_regexp(struct gdbarch *gdbarch, gdbarch_gnu_triplet_regexp_ftype gnu_triplet_regexp)
Definition: gdbarch.c:5023
int record_full_is_used(void)
Definition: record-full.c:216
void tdesc_data_cleanup(void *data_untyped)
void _initialize_s390_tdep(void)
#define TYPE_FIELD_TYPE(thistype, n)
Definition: gdbtypes.h:1371
#define END_CATCH
void set_gdbarch_displaced_step_hw_singlestep(struct gdbarch *gdbarch, gdbarch_displaced_step_hw_singlestep_ftype displaced_step_hw_singlestep)
Definition: gdbarch.c:3957
#define S390_A14_REGNUM
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
Definition: frame-unwind.c:79
void set_gdbarch_process_record(struct gdbarch *gdbarch, gdbarch_process_record_ftype process_record)
Definition: gdbarch.c:4137
pv_t pv_constant(CORE_ADDR k)
static void initialize_tdesc_s390x_gs_linux64(void)
static CORE_ADDR s390_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
#define FRAME_OBSTACK_ZALLOC(TYPE)
Definition: frame.h:678
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
Definition: utils.c:2745
pv_t fpr[S390_NUM_FPRS]
static void initialize_tdesc_s390_linux32v1(void)
void set_gdbarch_stap_register_indirection_suffixes(struct gdbarch *gdbarch, const char *const *stap_register_indirection_suffixes)
Definition: gdbarch.c:4417
#define S390_TDB_DWORD0_REGNUM
enum powerpc_vector_abi vector_abi
Definition: ppc-tdep.h:225
#define S390_V28_REGNUM
static const char * s390_address_class_type_flags_to_name(struct gdbarch *gdbarch, int type_flags)
#define TYPE_IS_REFERENCE(t)
Definition: gdbtypes.h:332
#define S390_GSD_REGNUM
int fpr_slot[S390_NUM_FPRS]
struct regcache * regcache
static CORE_ADDR s390_local_base_address(struct frame_info *this_frame, void **this_cache)
#define S390_RETADDR_REGNUM
static CORE_ADDR s390_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
CORE_ADDR svr4_fetch_objfile_link_map(struct objfile *objfile)
Definition: solib-svr4.c:1579
static void s390_backchain_frame_unwind_cache(struct frame_info *this_frame, struct s390_unwind_cache *info)
int pv_is_identical(pv_t a, pv_t b)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
Definition: regset.h:34
static struct type * s390_effective_inner_type(struct type *type, unsigned int min_size)
static struct s390_sigtramp_unwind_cache * s390_sigtramp_frame_unwind_cache(struct frame_info *this_frame, void **this_prologue_cache)
#define HWCAP_S390_GS
#define S390_R11_REGNUM
#define TRY
static int s390_ax_pseudo_register_collect(struct gdbarch *gdbarch, struct agent_expr *ax, int regnum)
int tdesc_numbered_register(const struct tdesc_feature *feature, struct tdesc_arch_data *data, int regno, const char *name)
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
Definition: frame-base.c:95
const char *const name
Definition: aarch64-tdep.c:76
s390_abi_kind
static CORE_ADDR s390_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
#define S390_TDB_R0_REGNUM
#define S390_F0_REGNUM
static const struct frame_unwind s390_sigtramp_frame_unwind
enum frame_type get_frame_type(struct frame_info *frame)
Definition: frame.c:2619
void set_gdbarch_pseudo_register_write(struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype pseudo_register_write)
Definition: gdbarch.c:2032
static struct value * s390_dwarf2_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
#define s390x_sizeof_gregset
static int is_rre(bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
#define S390_R2_REGNUM
#define s390_sizeof_gregset
const struct regset s390_vxrs_low_regset
struct type * check_typedef(struct type *type)
Definition: gdbtypes.c:2421
const struct frame_base * dwarf2_frame_base_sniffer(struct frame_info *this_frame)
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
Definition: corefile.c:316
static int s390_stack_frame_destroyed_p(struct gdbarch *gdbarch, CORE_ADDR pc)
static struct value * s390_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
ULONGEST gdbarch_max_insn_length(struct gdbarch *gdbarch)
Definition: gdbarch.c:3905
const gdb_byte * value_contents(struct value *value)
Definition: value.c:1407
#define CATCH(EXCEPTION, MASK)
struct reggroup *const general_reggroup
Definition: reggroups.c:314
#define S390_F13_REGNUM
static int s390_is_partial_instruction(struct gdbarch *gdbarch, CORE_ADDR loc, int *len)
#define S390_F5_REGNUM
#define XML_SYSCALL_FILENAME_S390
static struct linux_record_tdep s390x_linux_record_tdep
static pv_t s390_addr(struct s390_prologue_data *data, int d2, unsigned int x2, unsigned int b2)
#define S390_R4_REGNUM
static int s390_popcnt(unsigned int x)
struct target_ops current_target
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
Definition: gdbarch.c:3208
static const struct regcache_map_entry s390_regmap_gs[]
static const struct frame_unwind s390_stub_frame_unwind
#define S390_V24_REGNUM
struct value::@186::@187 reg
int record_linux_system_call(enum gdb_syscall syscall, struct regcache *regcache, struct linux_record_tdep *tdep)
Definition: linux-record.c:241
CORE_ADDR find_solib_trampoline_target(struct frame_info *frame, CORE_ADDR pc)
Definition: minsyms.c:1492
void set_gdbarch_stack_frame_destroyed_p(struct gdbarch *gdbarch, gdbarch_stack_frame_destroyed_p_ftype stack_frame_destroyed_p)
Definition: gdbarch.c:3367
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
Definition: defs.h:577
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
Definition: regcache.c:777
static const char * s390_pseudo_register_name(struct gdbarch *gdbarch, int regnum)
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
Definition: gdbarch.c:2156
int debug_displaced
Definition: infrun.c:156
bfd * abfd
Definition: gdbarch.h:1637
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
Definition: gdbarch.c:2980
const struct regset s390_last_break_regset
Definition: ptid.h:35
struct type * register_type(struct gdbarch *gdbarch, int regnum)
Definition: regcache.c:152
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
Definition: gdbarch.c:2340
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2018
static int s390_record_calc_disp_vsce(struct gdbarch *gdbarch, struct regcache *regcache, uint8_t vx, uint8_t el, uint8_t es, uint16_t bd, int8_t dh, CORE_ADDR *res)
int target_auxv_search(struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
Definition: auxv.c:375
struct_return
Definition: arm-tdep.h:88
void set_gdbarch_believe_pcc_promotion(struct gdbarch *gdbarch, int believe_pcc_promotion)
Definition: gdbarch.c:2588
#define TYPE_VECTOR(t)
Definition: gdbtypes.h:252
#define S390_TDB_ABORT_CODE_REGNUM
#define S390_A3_REGNUM
#define S390_F8_REGNUM
static char * s390_gcc_target_options(struct gdbarch *gdbarch)
static struct type * s390_pseudo_register_type(struct gdbarch *gdbarch, int regnum)
int gpr_slot[S390_NUM_GPRS]
struct trad_frame_saved_reg * saved_regs
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1509
int pv_is_register_k(pv_t a, int r, CORE_ADDR k)
static CORE_ADDR s390_record_calc_disp_common(struct gdbarch *gdbarch, struct regcache *regcache, ULONGEST x, uint16_t bd, int8_t dh)
#define S390_R1_REGNUM
#define S390_R0_UPPER_REGNUM
void set_gdbarch_cannot_store_register(struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype cannot_store_register)
Definition: gdbarch.c:2548
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
Definition: solib-svr4.c:3137
void set_gdbarch_stap_register_indirection_prefixes(struct gdbarch *gdbarch, const char *const *stap_register_indirection_prefixes)
Definition: gdbarch.c:4400
#define S390_LAST_BREAK_REGNUM
Definition: gdbtypes.h:749
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
Definition: blockframe.c:320
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
Definition: regcache.c:1211
pv_t gpr[S390_NUM_GPRS]
static void initialize_tdesc_s390_linux32(void)
Definition: s390-linux32.c:10
#define S390_A10_REGNUM
static const struct target_desc * s390_core_read_description(struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
struct trad_frame_saved_reg * saved_regs
void set_gdbarch_value_from_register(struct gdbarch *gdbarch, gdbarch_value_from_register_ftype value_from_register)
Definition: gdbarch.c:2656
#define S390_R0_REGNUM
#define S390_R7_REGNUM
static int s390_linux_record_signal(struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
Definition: gdbarch.c:3079
#define S390_R14_REGNUM
static void initialize_tdesc_s390_linux64v1(void)
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
Definition: frame-unwind.c:174
struct type * tdesc_find_type(struct gdbarch *gdbarch, const char *id)
static const char * type
Definition: language.c:113
static CORE_ADDR s390_frame_align(struct gdbarch *gdbarch, CORE_ADDR addr)
static int s390_stap_is_single_operand(struct gdbarch *gdbarch, const char *s)
void store(pv_t addr, CORE_ADDR size, pv_t value)
struct target_desc * tdesc_s390_linux64v1
Definition: s390-linux64v1.c:8
struct value * value_from_longest(struct type *type, LONGEST num)
Definition: value.c:3534
unsigned dummy
Definition: go32-nat.c:1073
static int s390_cannot_store_register(struct gdbarch *gdbarch, int regnum)
static struct s390_stub_unwind_cache * s390_stub_frame_unwind_cache(struct frame_info *this_frame, void **this_prologue_cache)
#define S390_TDB_CONFLICT_TOKEN_REGNUM
void scan(void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
Definition: gnu-nat.c:1822
void ax_simple(struct agent_expr *x, enum agent_op op)
Definition: ax-general.c:125
static CORE_ADDR s390_unwind_sp(struct gdbarch *gdbarch, struct frame_info *next_frame)
static const struct frame_unwind s390_frame_unwind
struct value * value_cast(struct type *type, struct value *arg2)
Definition: valops.c:351
static void s390_init_linux_record_tdep(struct linux_record_tdep *record_tdep, enum s390_abi_kind abi)
static int is_rr(bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1848
#define S390_NUM_GPRS
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
Definition: gdbarch.c:3103
struct target_desc * tdesc_s390x_vx_linux64
static void initialize_tdesc_s390x_linux64v2(void)
#define S390_V27_REGNUM
#define S390_R3_REGNUM
#define S390_A1_REGNUM
#define S390_A15_REGNUM
void set_value_offset(struct value *value, LONGEST offset)
Definition: value.c:1111
const struct regset s390x_last_break_regset
static struct frame_id s390_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
#define S390_NUM_REGS
struct gdbarch * gdbarch
Definition: gdbarch.h:1622
void set_gdbarch_ax_pseudo_register_push_stack(struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_push_stack_ftype ax_pseudo_register_push_stack)
Definition: gdbarch.c:2115
int regnum
Definition: aarch64-tdep.c:77
#define S390_R10_REGNUM
void set_xml_syscall_file_name(struct gdbarch *gdbarch, const char *name)
Definition: xml-syscall.c:513
void printf_unfiltered(const char *format,...)
Definition: utils.c:2056
#define S390_V21_REGNUM
static void s390_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
#define S390_NUM_FPRS
const struct regset s390_system_call_regset
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: corefile.c:258
#define S390_SP_REGNUM
static void s390_register_return_value(struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *out, const gdb_byte *in)
struct value * frame_unwind_register_value(struct frame_info *frame, int regnum)
Definition: frame.c:1172
static const struct regcache_map_entry s390_gregmap[]
struct bfd_section * the_bfd_section
Definition: target.h:2320
struct reggroup *const vector_reggroup
Definition: reggroups.c:317
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1308
CORE_ADDR linux_displaced_step_location(struct gdbarch *gdbarch)
Definition: linux-tdep.c:2437
struct target_desc * tdesc_s390_gs_linux64
static int is_rxy(bfd_byte *insn, int op1, int op2, unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
static struct gdbarch * s390_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
#define S390_PSWM_REGNUM
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
Definition: gdbarch.c:2871
struct trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct gdbarch *gdbarch)
Definition: trad-frame.c:47
#define S390_A2_REGNUM
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
Definition: gdbarch.c:1623
static const struct regcache_map_entry s390_regmap_gsbc[]
#define TYPE_UNSIGNED(t)
Definition: gdbtypes.h:205
static void s390_handle_arg(struct s390_arg_state *as, struct value *arg, struct gdbarch_tdep *tdep, int word_size, enum bfd_endian byte_order, int is_unnamed)
const struct regset s390_vxrs_high_regset
CORE_ADDR addr
Definition: target.h:2317
#define S390_V17_REGNUM
gdb_syscall
Definition: linux-record.h:183
Definition: regdef.h:22
#define S390_A0_REGNUM
static void initialize_tdesc_s390_linux64(void)
Definition: s390-linux64.c:10
static int s390_sigtramp_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
int record_full_arch_list_add_mem(CORE_ADDR addr, int len)
Definition: record-full.c:491
static std::vector< CORE_ADDR > s390_software_single_step(struct regcache *regcache)
const struct target_desc * target_desc
Definition: gdbarch.h:1660
Definition: value.c:169
static int s390_displaced_step_hw_singlestep(struct gdbarch *gdbarch, struct displaced_step_closure *closure)
static int s390_record_gpr_h(struct gdbarch *gdbarch, struct regcache *regcache, int i)
#define S390_V29_REGNUM
static struct value * s390_sigtramp_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
struct trad_frame_saved_reg * saved_regs
void set_gdbarch_software_single_step(struct gdbarch *gdbarch, gdbarch_software_single_step_ftype software_single_step)
Definition: gdbarch.c:3258
#define S390_ORIG_R2_REGNUM
#define s390_sizeof_fpregset
static int s390_linux_syscall_record(struct regcache *regcache, LONGEST syscall_native)
void set_gdbarch_disassembler_options(struct gdbarch *gdbarch, char **disassembler_options)
Definition: gdbarch.c:5057
static CORE_ADDR s390_record_calc_disp(struct gdbarch *gdbarch, struct regcache *regcache, uint8_t rx, uint16_t bd, int8_t dh)
#define S390_F14_REGNUM
static struct s390_unwind_cache * s390_frame_unwind_cache(struct frame_info *this_frame, void **this_prologue_cache)
static const char * s390_gnu_triplet_regexp(struct gdbarch *gdbarch)
#define S390_A5_REGNUM
void throw_exception(struct gdb_exception exception)
static void initialize_tdesc_s390_tevx_linux64(void)
static CORE_ADDR s390_record_address_mask(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val)
#define S390_F11_REGNUM
void tdesc_use_registers(struct gdbarch *gdbarch, const struct target_desc *target_desc, struct tdesc_arch_data *early_data)
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
Definition: arch-utils.c:117
bfd_byte gdb_byte
Definition: common-types.h:38
struct frame_info * get_next_frame(struct frame_info *this_frame)
Definition: frame.c:1771
int get_frame_func_if_available(struct frame_info *this_frame, CORE_ADDR *pc)
Definition: frame.c:957
static void initialize_tdesc_s390_vx_linux64(void)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
Definition: value.c:3560
static struct value * s390_unwind_pseudo_register(struct frame_info *this_frame, int regnum)
void set_gdbarch_displaced_step_copy_insn(struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype displaced_step_copy_insn)
Definition: gdbarch.c:3940
void set_gdbarch_pseudo_register_read(struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype pseudo_register_read)
Definition: gdbarch.c:1984
ULONGEST align_up(ULONGEST v, int n)
Definition: utils.c:2997
#define TYPE_VARARGS(t)
Definition: gdbtypes.h:247
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
Definition: gdbarch.c:1895
int value_optimized_out(struct value *value)
Definition: value.c:1424
#define TYPE_TARGET_TYPE(thistype)
Definition: gdbtypes.h:1226
static int is_ril(bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
static void initialize_tdesc_s390_te_linux64(void)
s390_vector_abi_kind
void set_gdbarch_address_class_type_flags(struct gdbarch *gdbarch, gdbarch_address_class_type_flags_ftype address_class_type_flags)
Definition: gdbarch.c:3517
struct target_desc * tdesc_s390x_linux64v2
enum register_status regcache_register_status(const struct regcache *regcache, int regnum)
Definition: regcache.c:359
#define XCNEW(T)
Definition: poison.h:121
#define S390_V23_REGNUM
static int is_non_branch_ril(gdb_byte *insn)
void set_gdbarch_address_class_name_to_type_flags(struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
Definition: gdbarch.c:3582
#define S390_GSEPLA_REGNUM
static int regnum_is_gpr_full(struct gdbarch_tdep *tdep, int regnum)
static int s390_address_class_name_to_type_flags(struct gdbarch *gdbarch, const char *name, int *type_flags_ptr)
#define TYPE_CODE(thistype)
Definition: gdbtypes.h:1238
enum register_status regcache_raw_read(struct regcache *regcache, int regnum, gdb_byte *buf)
Definition: regcache.c:565
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
Definition: regcache.c:806
#define S390_PSWA_REGNUM
struct pv_area * stack
static int s390_readinstruction(bfd_byte instr[], CORE_ADDR at)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: target.c:1370
static void initialize_tdesc_s390x_vx_linux64(void)
static int regnum_is_vxr_full(struct gdbarch_tdep *tdep, int regnum)
struct target_desc * tdesc_s390x_linux64v1
CORE_ADDR regcache_read_pc(struct regcache *regcache)
Definition: regcache.c:1229
static int in_plt_section(CORE_ADDR pc)
Definition: objfiles.h:542
const struct regset s390_tdb_regset
void set_gdbarch_stap_is_single_operand(struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
Definition: gdbarch.c:4475
#define S390_BC_GSD_REGNUM
static void initialize_tdesc_s390x_linux64v1(void)
static const struct regcache_map_entry s390_fpregmap[]
int offset
Definition: agent.c:65
void set_gdbarch_get_syscall_number(struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype get_syscall_number)
Definition: gdbarch.c:4281
static void s390_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
Definition: regcache.c:640
int code
Definition: ser-unix.c:239
#define S390_F6_REGNUM
#define S390_F3_REGNUM
#define TYPE_NFIELDS(thistype)
Definition: gdbtypes.h:1239
struct target_section * target_section_by_addr(struct target_ops *target, CORE_ADDR addr)
Definition: target.c:982
struct value * default_value_from_register(struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id)
Definition: findvar.c:821
#define S390_A11_REGNUM
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
Definition: gdbarch.c:2067
struct target_desc * tdesc_s390_linux32
Definition: s390-linux32.c:8
gdbarch * arch() const
Definition: regcache.c:221
#define S390_F12_REGNUM
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
enum register_status regcache_cooked_read(struct regcache *regcache, int regnum, gdb_byte *buf)
Definition: regcache.c:661
static pv_t s390_load(struct s390_prologue_data *data, int d2, unsigned int x2, unsigned int b2, CORE_ADDR size)
static struct value * s390_value_from_register(struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id)
static LONGEST extract_signed_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
Definition: defs.h:570
struct m32c_reg regs[M32C_MAX_NUM_REGS]
Definition: m32c-tdep.c:110
static void s390_displaced_step_fixup(struct gdbarch *gdbarch, struct displaced_step_closure *closure_, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
#define S390_R12_REGNUM
static int is_rs(bfd_byte *insn, int op, unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
enum bfd_endian byte_order
static int is_ri(bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
const struct target_desc * tdesc
Definition: i386-tdep.h:204
static void s390_gen_return_address(struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope)
struct m32c_reg * sp
Definition: m32c-tdep.c:119
static int is_rx(bfd_byte *insn, int op, unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
struct target_desc * tdesc_s390x_linux64
Definition: s390x-linux64.c:8
void set_gdbarch_valid_disassembler_options(struct gdbarch *gdbarch, const disasm_options_t *valid_disassembler_options)
Definition: gdbarch.c:5074
void ax_const_l(struct agent_expr *x, LONGEST l)
Definition: ax-general.c:229
struct tdesc_arch_data * tdesc_data_alloc(void)
static int s390_record_vr(struct gdbarch *gdbarch, struct regcache *regcache, int i)
#define S390_V30_REGNUM
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
Definition: regcache.c:1004
void frame_base_append_sniffer(struct gdbarch *gdbarch, frame_base_sniffer_ftype *sniffer)
Definition: frame-base.c:82
#define S390_V19_REGNUM
#define S390_F7_REGNUM
#define S390_F1_REGNUM
#define S390_F4_REGNUM
unsigned long long ULONGEST
Definition: common-types.h:53
#define S390_A9_REGNUM
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
Definition: frame-unwind.c:184
void trad_frame_set_unknown(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:133
#define S390_V22_REGNUM
const struct tdesc_feature * tdesc_find_feature(const struct target_desc *target_desc, const char *name)
int register_size(struct gdbarch *gdbarch, int regnum)
Definition: regcache.c:164
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
Definition: gdbarch.c:1756
static int s390_all_but_pc_registers_record(struct regcache *regcache)
#define gdb_stdlog
Definition: utils.h:349
struct type * value_type(const struct value *value)
Definition: value.c:1095
CORE_ADDR addr
Definition: frame.c:128
static const struct regset s390_upper_regset
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
Definition: gdbarch.c:1606
static struct value * s390_trad_frame_prev_register(struct frame_info *this_frame, struct trad_frame_saved_reg saved_regs[], int regnum)
enum register_status regcache_cooked_read_part(struct regcache *regcache, int regnum, int offset, int len, gdb_byte *buf)
Definition: regcache.c:972
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
Definition: gdbarch.c:2738
#define S390_V0_LOWER_REGNUM
void dwarf2_frame_set_init_reg(struct gdbarch *gdbarch, void(*init_reg)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, struct frame_info *))
Definition: dwarf2-frame.c:743
void set_tdesc_pseudo_register_reggroup_p(struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p)
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
Definition: gdbarch.c:1772
#define S390_V20_REGNUM
void ax_zero_ext(struct agent_expr *x, int n)
Definition: ax-general.c:172
#define S390_MAX_INSTR_SIZE
#define S390_R13_REGNUM
int default_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
Definition: reggroups.c:192
struct reggroup *const save_reggroup
Definition: reggroups.c:319
#define TYPE_LENGTH(thistype)
Definition: gdbtypes.h:1235
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
Definition: gdbarch.c:1841
pv_t pv_subtract(pv_t a, pv_t b)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
Definition: regcache.c:612
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
Definition: gdbarch.c:2381
const struct regset s390_gsbc_regset
#define S390_R5_REGNUM
CORE_ADDR get_pc_function_start(CORE_ADDR pc)
Definition: blockframe.c:86
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
Definition: corefile.c:326
struct type * builtin_uint64
Definition: gdbtypes.h:1541
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
Definition: gdbarch.c:2888
struct value * allocate_optimized_out_value(struct type *type)
Definition: value.c:1077
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
Definition: gdbarch.c:3647
pv_t fetch(pv_t addr, CORE_ADDR size)
ptid_t ptid() const
Definition: regcache.h:325
struct target_desc * tdesc_s390x_te_linux64
void register_gdbarch_init(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init)
Definition: gdbarch.c:5299
static int s390_adjust_frame_regnum(struct gdbarch *gdbarch, int num, int eh_frame_p)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
Definition: corefile.c:394
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
Definition: gdbarch.c:2772
#define S390_R8_REGNUM
static struct gdbarch_data * tdesc_data
buf_displaced_step_closure s390_displaced_step_closure
#define S390_A12_REGNUM
static const struct regcache_map_entry s390_regmap_tdb[]
struct target_desc * tdesc_s390_linux64
Definition: s390-linux64.c:8
static const struct frame_base s390_frame_base
#define s390_sizeof_tdbregset
static void s390_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buf)
enum s390_abi_kind abi
enum bfd_endian byte_order
Definition: gdbarch.c:137
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
Definition: gdbarch.c:2173
void set_gdbarch_max_insn_length(struct gdbarch *gdbarch, ULONGEST max_insn_length)
Definition: gdbarch.c:3916
int record_full_arch_list_add_end(void)
Definition: record-full.c:522
void set_gdbarch_core_read_description(struct gdbarch *gdbarch, gdbarch_core_read_description_ftype core_read_description)
Definition: gdbarch.c:4072
pv_t pv_add(pv_t a, pv_t b)
int tdesc_has_registers(const struct target_desc *target_desc)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
Definition: gdbarch.c:2292
int pv_is_constant(pv_t a)
static void store_signed_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, LONGEST val)
Definition: defs.h:597
void error(const char *fmt,...)
Definition: errors.c:38
pv_t pv_register(int reg, CORE_ADDR k)
#define S390_V18_REGNUM
size_t size
Definition: go32-nat.c:242
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, struct gdbarch_tdep *tdep)
Definition: gdbarch.c:361
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype inner_than)
Definition: gdbarch.c:2837
#define S390_R15_REGNUM
static void initialize_tdesc_s390x_te_linux64(void)
static int s390_prologue_frame_unwind_cache(struct frame_info *this_frame, struct s390_unwind_cache *info)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
Definition: frame.c:2691
long long LONGEST
Definition: common-types.h:52
const struct regset s390_gs_regset
static void s390_sigtramp_frame_this_id(struct frame_info *this_frame, void **this_prologue_cache, struct frame_id *this_id)
Definition: regcache.h:157
void regcache_cooked_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
Definition: regcache.c:873
static enum register_status s390_pseudo_register_read(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buf)
int tdesc_unnumbered_register(const struct tdesc_feature *feature, const char *name)
#define S390_F15_REGNUM
static const struct regcache_map_entry s390_regmap_vxrs_low[]
static enum return_value_convention s390_return_value(struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *out, const gdb_byte *in)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
Definition: defs.h:604
#define HWCAP_S390_VX
static struct value * s390_stub_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
struct type * builtin_int
Definition: gdbtypes.h:1503
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
Definition: regcache.c:831
enum register_status regcache_raw_read_signed(struct regcache *regcache, int regnum, LONGEST *val)
Definition: regcache.c:586
void set_gdbarch_guess_tracepoint_registers(struct gdbarch *gdbarch, gdbarch_guess_tracepoint_registers_ftype guess_tracepoint_registers)
Definition: gdbarch.c:4680
#define S390_BC_GSEPLA_REGNUM