1 /* Target-dependent code for s390.
3 Copyright (C) 2001-2018 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "arch-utils.h"
24 #include "dwarf2-frame.h"
27 #include "frame-base.h"
28 #include "frame-unwind.h"
32 #include "linux-tdep.h"
35 #include "record-full.h"
37 #include "reggroups.h"
38 #include "s390-tdep.h"
39 #include "target-descriptions.h"
40 #include "trad-frame.h"
43 #include "features/s390-linux32.c"
44 #include "features/s390x-linux64.c"
46 /* Holds the current set of options to be passed to the disassembler. */
47 static char *s390_disassembler_options
;
51 constexpr gdb_byte s390_break_insn
[] = { 0x0, 0x1 };
53 typedef BP_MANIPULATION (s390_break_insn
) s390_breakpoint
;
55 /* Decoding S/390 instructions. */
57 /* Read a single instruction from address AT. */
60 s390_readinstruction (bfd_byte instr
[], CORE_ADDR at
)
62 static int s390_instrlen
[] = { 2, 4, 4, 6 };
65 if (target_read_memory (at
, &instr
[0], 2))
67 instrlen
= s390_instrlen
[instr
[0] >> 6];
70 if (target_read_memory (at
+ 2, &instr
[2], instrlen
- 2))
76 /* The functions below are for recognizing and decoding S/390
77 instructions of various formats. Each of them checks whether INSN
78 is an instruction of the given format, with the specified opcodes.
79 If it is, it sets the remaining arguments to the values of the
80 instruction's fields, and returns a non-zero value; otherwise, it
83 These functions' arguments appear in the order they appear in the
84 instruction, not in the machine-language form. So, opcodes always
85 come first, even though they're sometimes scattered around the
86 instructions. And displacements appear before base and extension
87 registers, as they do in the assembly syntax, not at the end, as
88 they do in the machine language.
90 Test for RI instruction format. */
93 is_ri (bfd_byte
*insn
, int op1
, int op2
, unsigned int *r1
, int *i2
)
95 if (insn
[0] == op1
&& (insn
[1] & 0xf) == op2
)
97 *r1
= (insn
[1] >> 4) & 0xf;
98 /* i2 is a 16-bit signed quantity. */
99 *i2
= (((insn
[2] << 8) | insn
[3]) ^ 0x8000) - 0x8000;
106 /* Test for RIL instruction format. See comment on is_ri for details. */
109 is_ril (bfd_byte
*insn
, int op1
, int op2
,
110 unsigned int *r1
, int *i2
)
112 if (insn
[0] == op1
&& (insn
[1] & 0xf) == op2
)
114 *r1
= (insn
[1] >> 4) & 0xf;
115 /* i2 is a signed quantity. If the host 'int' is 32 bits long,
116 no sign extension is necessary, but we don't want to assume
118 *i2
= (((insn
[2] << 24)
121 | (insn
[5])) ^ 0x80000000) - 0x80000000;
128 /* Test for RR instruction format. See comment on is_ri for details. */
131 is_rr (bfd_byte
*insn
, int op
, unsigned int *r1
, unsigned int *r2
)
135 *r1
= (insn
[1] >> 4) & 0xf;
143 /* Test for RRE instruction format. See comment on is_ri for details. */
146 is_rre (bfd_byte
*insn
, int op
, unsigned int *r1
, unsigned int *r2
)
148 if (((insn
[0] << 8) | insn
[1]) == op
)
150 /* Yes, insn[3]. insn[2] is unused in RRE format. */
151 *r1
= (insn
[3] >> 4) & 0xf;
159 /* Test for RS instruction format. See comment on is_ri for details. */
162 is_rs (bfd_byte
*insn
, int op
,
163 unsigned int *r1
, unsigned int *r3
, int *d2
, unsigned int *b2
)
167 *r1
= (insn
[1] >> 4) & 0xf;
169 *b2
= (insn
[2] >> 4) & 0xf;
170 *d2
= ((insn
[2] & 0xf) << 8) | insn
[3];
177 /* Test for RSY instruction format. See comment on is_ri for details. */
180 is_rsy (bfd_byte
*insn
, int op1
, int op2
,
181 unsigned int *r1
, unsigned int *r3
, int *d2
, unsigned int *b2
)
186 *r1
= (insn
[1] >> 4) & 0xf;
188 *b2
= (insn
[2] >> 4) & 0xf;
189 /* The 'long displacement' is a 20-bit signed integer. */
190 *d2
= ((((insn
[2] & 0xf) << 8) | insn
[3] | (insn
[4] << 12))
191 ^ 0x80000) - 0x80000;
198 /* Test for RX instruction format. See comment on is_ri for details. */
201 is_rx (bfd_byte
*insn
, int op
,
202 unsigned int *r1
, int *d2
, unsigned int *x2
, unsigned int *b2
)
206 *r1
= (insn
[1] >> 4) & 0xf;
208 *b2
= (insn
[2] >> 4) & 0xf;
209 *d2
= ((insn
[2] & 0xf) << 8) | insn
[3];
216 /* Test for RXY instruction format. See comment on is_ri for details. */
219 is_rxy (bfd_byte
*insn
, int op1
, int op2
,
220 unsigned int *r1
, int *d2
, unsigned int *x2
, unsigned int *b2
)
225 *r1
= (insn
[1] >> 4) & 0xf;
227 *b2
= (insn
[2] >> 4) & 0xf;
228 /* The 'long displacement' is a 20-bit signed integer. */
229 *d2
= ((((insn
[2] & 0xf) << 8) | insn
[3] | (insn
[4] << 12))
230 ^ 0x80000) - 0x80000;
237 /* A helper for s390_software_single_step, decides if an instruction
238 is a partial-execution instruction that needs to be executed until
239 completion when in record mode. If it is, returns 1 and writes
240 instruction length to a pointer. */
243 s390_is_partial_instruction (struct gdbarch
*gdbarch
, CORE_ADDR loc
, int *len
)
245 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
248 insn
= read_memory_integer (loc
, 2, byte_order
);
252 case 0xa8: /* MVCLE */
258 insn
= read_memory_integer (loc
+ 4, 2, byte_order
);
259 if ((insn
& 0xff) == 0x8e)
271 case 0xb255: /* MVST */
272 case 0xb263: /* CMPSC */
273 case 0xb2a5: /* TRE */
274 case 0xb2a6: /* CU21 */
275 case 0xb2a7: /* CU12 */
276 case 0xb9b0: /* CU14 */
277 case 0xb9b1: /* CU24 */
278 case 0xb9b2: /* CU41 */
279 case 0xb9b3: /* CU42 */
280 case 0xb92a: /* KMF */
281 case 0xb92b: /* KMO */
282 case 0xb92f: /* KMC */
283 case 0xb92d: /* KMCTR */
284 case 0xb92e: /* KM */
285 case 0xb93c: /* PPNO */
286 case 0xb990: /* TRTT */
287 case 0xb991: /* TRTO */
288 case 0xb992: /* TROT */
289 case 0xb993: /* TROO */
297 /* Implement the "software_single_step" gdbarch method, needed to single step
298 through instructions like MVCLE in record mode, to make sure they are
299 executed to completion. Without that, record will save the full length
300 of destination buffer on every iteration, even though the CPU will only
301 process about 4kiB of it each time, leading to O(n**2) memory and time
304 static std::vector
<CORE_ADDR
>
305 s390_software_single_step (struct regcache
*regcache
)
307 struct gdbarch
*gdbarch
= regcache
->arch ();
308 CORE_ADDR loc
= regcache_read_pc (regcache
);
309 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
313 /* Special handling only if recording. */
314 if (!record_full_is_used ())
317 /* First, match a partial instruction. */
318 if (!s390_is_partial_instruction (gdbarch
, loc
, &len
))
323 /* Second, look for a branch back to it. */
324 insn
= read_memory_integer (loc
, 2, byte_order
);
325 if (insn
!= 0xa714) /* BRC with mask 1 */
328 insn
= read_memory_integer (loc
+ 2, 2, byte_order
);
329 if (insn
!= (uint16_t) -(len
/ 2))
334 /* Found it, step past the whole thing. */
338 /* Displaced stepping. */
340 /* Return true if INSN is a non-branch RIL-b or RIL-c format
344 is_non_branch_ril (gdb_byte
*insn
)
346 gdb_byte op1
= insn
[0];
350 gdb_byte op2
= insn
[1] & 0x0f;
354 case 0x02: /* llhrl */
355 case 0x04: /* lghrl */
356 case 0x05: /* lhrl */
357 case 0x06: /* llghrl */
358 case 0x07: /* sthrl */
359 case 0x08: /* lgrl */
360 case 0x0b: /* stgrl */
361 case 0x0c: /* lgfrl */
363 case 0x0e: /* llgfrl */
364 case 0x0f: /* strl */
368 else if (op1
== 0xc6)
370 gdb_byte op2
= insn
[1] & 0x0f;
374 case 0x00: /* exrl */
375 case 0x02: /* pfdrl */
376 case 0x04: /* cghrl */
377 case 0x05: /* chrl */
378 case 0x06: /* clghrl */
379 case 0x07: /* clhrl */
380 case 0x08: /* cgrl */
381 case 0x0a: /* clgrl */
382 case 0x0c: /* cgfrl */
384 case 0x0e: /* clgfrl */
385 case 0x0f: /* clrl */
393 typedef buf_displaced_step_closure s390_displaced_step_closure
;
395 /* Implementation of gdbarch_displaced_step_copy_insn. */
397 static struct displaced_step_closure
*
398 s390_displaced_step_copy_insn (struct gdbarch
*gdbarch
,
399 CORE_ADDR from
, CORE_ADDR to
,
400 struct regcache
*regs
)
402 size_t len
= gdbarch_max_insn_length (gdbarch
);
403 std::unique_ptr
<s390_displaced_step_closure
> closure
404 (new s390_displaced_step_closure (len
));
405 gdb_byte
*buf
= closure
->buf
.data ();
407 read_memory (from
, buf
, len
);
409 /* Adjust the displacement field of PC-relative RIL instructions,
410 except branches. The latter are handled in the fixup hook. */
411 if (is_non_branch_ril (buf
))
415 offset
= extract_signed_integer (buf
+ 2, 4, BFD_ENDIAN_BIG
);
416 offset
= (from
- to
+ offset
* 2) / 2;
418 /* If the instruction is too far from the jump pad, punt. This
419 will usually happen with instructions in shared libraries.
420 We could probably support these by rewriting them to be
421 absolute or fully emulating them. */
422 if (offset
< INT32_MIN
|| offset
> INT32_MAX
)
424 /* Let the core fall back to stepping over the breakpoint
428 fprintf_unfiltered (gdb_stdlog
,
429 "displaced: can't displaced step "
430 "RIL instruction: offset %s out of range\n",
437 store_signed_integer (buf
+ 2, 4, BFD_ENDIAN_BIG
, offset
);
440 write_memory (to
, buf
, len
);
444 fprintf_unfiltered (gdb_stdlog
, "displaced: copy %s->%s: ",
445 paddress (gdbarch
, from
), paddress (gdbarch
, to
));
446 displaced_step_dump_bytes (gdb_stdlog
, buf
, len
);
449 return closure
.release ();
452 /* Fix up the state of registers and memory after having single-stepped
453 a displaced instruction. */
456 s390_displaced_step_fixup (struct gdbarch
*gdbarch
,
457 struct displaced_step_closure
*closure_
,
458 CORE_ADDR from
, CORE_ADDR to
,
459 struct regcache
*regs
)
461 /* Our closure is a copy of the instruction. */
462 s390_displaced_step_closure
*closure
463 = (s390_displaced_step_closure
*) closure_
;
464 gdb_byte
*insn
= closure
->buf
.data ();
465 static int s390_instrlen
[] = { 2, 4, 4, 6 };
466 int insnlen
= s390_instrlen
[insn
[0] >> 6];
468 /* Fields for various kinds of instructions. */
469 unsigned int b2
, r1
, r2
, x2
, r3
;
472 /* Get current PC and addressing mode bit. */
473 CORE_ADDR pc
= regcache_read_pc (regs
);
476 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
478 regcache_cooked_read_unsigned (regs
, S390_PSWA_REGNUM
, &amode
);
483 fprintf_unfiltered (gdb_stdlog
,
484 "displaced: (s390) fixup (%s, %s) pc %s len %d amode 0x%x\n",
485 paddress (gdbarch
, from
), paddress (gdbarch
, to
),
486 paddress (gdbarch
, pc
), insnlen
, (int) amode
);
488 /* Handle absolute branch and save instructions. */
489 if (is_rr (insn
, op_basr
, &r1
, &r2
)
490 || is_rx (insn
, op_bas
, &r1
, &d2
, &x2
, &b2
))
492 /* Recompute saved return address in R1. */
493 regcache_cooked_write_unsigned (regs
, S390_R0_REGNUM
+ r1
,
494 amode
| (from
+ insnlen
));
497 /* Handle absolute branch instructions. */
498 else if (is_rr (insn
, op_bcr
, &r1
, &r2
)
499 || is_rx (insn
, op_bc
, &r1
, &d2
, &x2
, &b2
)
500 || is_rr (insn
, op_bctr
, &r1
, &r2
)
501 || is_rre (insn
, op_bctgr
, &r1
, &r2
)
502 || is_rx (insn
, op_bct
, &r1
, &d2
, &x2
, &b2
)
503 || is_rxy (insn
, op1_bctg
, op2_brctg
, &r1
, &d2
, &x2
, &b2
)
504 || is_rs (insn
, op_bxh
, &r1
, &r3
, &d2
, &b2
)
505 || is_rsy (insn
, op1_bxhg
, op2_bxhg
, &r1
, &r3
, &d2
, &b2
)
506 || is_rs (insn
, op_bxle
, &r1
, &r3
, &d2
, &b2
)
507 || is_rsy (insn
, op1_bxleg
, op2_bxleg
, &r1
, &r3
, &d2
, &b2
))
509 /* Update PC iff branch was *not* taken. */
510 if (pc
== to
+ insnlen
)
511 regcache_write_pc (regs
, from
+ insnlen
);
514 /* Handle PC-relative branch and save instructions. */
515 else if (is_ri (insn
, op1_bras
, op2_bras
, &r1
, &i2
)
516 || is_ril (insn
, op1_brasl
, op2_brasl
, &r1
, &i2
))
519 regcache_write_pc (regs
, pc
- to
+ from
);
520 /* Recompute saved return address in R1. */
521 regcache_cooked_write_unsigned (regs
, S390_R0_REGNUM
+ r1
,
522 amode
| (from
+ insnlen
));
525 /* Handle LOAD ADDRESS RELATIVE LONG. */
526 else if (is_ril (insn
, op1_larl
, op2_larl
, &r1
, &i2
))
529 regcache_write_pc (regs
, from
+ insnlen
);
530 /* Recompute output address in R1. */
531 regcache_cooked_write_unsigned (regs
, S390_R0_REGNUM
+ r1
,
532 amode
| (from
+ i2
* 2));
535 /* If we executed a breakpoint instruction, point PC right back at it. */
536 else if (insn
[0] == 0x0 && insn
[1] == 0x1)
537 regcache_write_pc (regs
, from
);
539 /* For any other insn, adjust PC by negated displacement. PC then
540 points right after the original instruction, except for PC-relative
541 branches, where it points to the adjusted branch target. */
543 regcache_write_pc (regs
, pc
- to
+ from
);
546 fprintf_unfiltered (gdb_stdlog
,
547 "displaced: (s390) pc is now %s\n",
548 paddress (gdbarch
, regcache_read_pc (regs
)));
551 /* Implement displaced_step_hw_singlestep gdbarch method. */
554 s390_displaced_step_hw_singlestep (struct gdbarch
*gdbarch
,
555 struct displaced_step_closure
*closure
)
560 /* Prologue analysis. */
562 struct s390_prologue_data
{
565 struct pv_area
*stack
;
567 /* The size and byte-order of a GPR or FPR. */
570 enum bfd_endian byte_order
;
572 /* The general-purpose registers. */
573 pv_t gpr
[S390_NUM_GPRS
];
575 /* The floating-point registers. */
576 pv_t fpr
[S390_NUM_FPRS
];
578 /* The offset relative to the CFA where the incoming GPR N was saved
579 by the function prologue. 0 if not saved or unknown. */
580 int gpr_slot
[S390_NUM_GPRS
];
582 /* Likewise for FPRs. */
583 int fpr_slot
[S390_NUM_FPRS
];
585 /* Nonzero if the backchain was saved. This is assumed to be the
586 case when the incoming SP is saved at the current SP location. */
587 int back_chain_saved_p
;
590 /* Return the effective address for an X-style instruction, like:
594 Here, X2 and B2 are registers, and D2 is a signed 20-bit
595 constant; the effective address is the sum of all three. If either
596 X2 or B2 are zero, then it doesn't contribute to the sum --- this
597 means that r0 can't be used as either X2 or B2. */
600 s390_addr (struct s390_prologue_data
*data
,
601 int d2
, unsigned int x2
, unsigned int b2
)
605 result
= pv_constant (d2
);
607 result
= pv_add (result
, data
->gpr
[x2
]);
609 result
= pv_add (result
, data
->gpr
[b2
]);
614 /* Do a SIZE-byte store of VALUE to D2(X2,B2). */
617 s390_store (struct s390_prologue_data
*data
,
618 int d2
, unsigned int x2
, unsigned int b2
, CORE_ADDR size
,
621 pv_t addr
= s390_addr (data
, d2
, x2
, b2
);
624 /* Check whether we are storing the backchain. */
625 offset
= pv_subtract (data
->gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
], addr
);
627 if (pv_is_constant (offset
) && offset
.k
== 0)
628 if (size
== data
->gpr_size
629 && pv_is_register_k (value
, S390_SP_REGNUM
, 0))
631 data
->back_chain_saved_p
= 1;
635 /* Check whether we are storing a register into the stack. */
636 if (!data
->stack
->store_would_trash (addr
))
637 data
->stack
->store (addr
, size
, value
);
639 /* Note: If this is some store we cannot identify, you might think we
640 should forget our cached values, as any of those might have been hit.
642 However, we make the assumption that the register save areas are only
643 ever stored to once in any given function, and we do recognize these
644 stores. Thus every store we cannot recognize does not hit our data. */
647 /* Do a SIZE-byte load from D2(X2,B2). */
650 s390_load (struct s390_prologue_data
*data
,
651 int d2
, unsigned int x2
, unsigned int b2
, CORE_ADDR size
)
654 pv_t addr
= s390_addr (data
, d2
, x2
, b2
);
656 /* If it's a load from an in-line constant pool, then we can
657 simulate that, under the assumption that the code isn't
658 going to change between the time the processor actually
659 executed it creating the current frame, and the time when
660 we're analyzing the code to unwind past that frame. */
661 if (pv_is_constant (addr
))
663 struct target_section
*secp
;
664 secp
= target_section_by_addr (target_stack
, addr
.k
);
666 && (bfd_get_section_flags (secp
->the_bfd_section
->owner
,
667 secp
->the_bfd_section
)
669 return pv_constant (read_memory_integer (addr
.k
, size
,
673 /* Check whether we are accessing one of our save slots. */
674 return data
->stack
->fetch (addr
, size
);
677 /* Function for finding saved registers in a 'struct pv_area'; we pass
678 this to pv_area::scan.
680 If VALUE is a saved register, ADDR says it was saved at a constant
681 offset from the frame base, and SIZE indicates that the whole
682 register was saved, record its offset in the reg_offset table in
686 s390_check_for_saved (void *data_untyped
, pv_t addr
,
687 CORE_ADDR size
, pv_t value
)
689 struct s390_prologue_data
*data
= (struct s390_prologue_data
*) data_untyped
;
692 if (!pv_is_register (addr
, S390_SP_REGNUM
))
695 offset
= 16 * data
->gpr_size
+ 32 - addr
.k
;
697 /* If we are storing the original value of a register, we want to
698 record the CFA offset. If the same register is stored multiple
699 times, the stack slot with the highest address counts. */
701 for (i
= 0; i
< S390_NUM_GPRS
; i
++)
702 if (size
== data
->gpr_size
703 && pv_is_register_k (value
, S390_R0_REGNUM
+ i
, 0))
704 if (data
->gpr_slot
[i
] == 0
705 || data
->gpr_slot
[i
] > offset
)
707 data
->gpr_slot
[i
] = offset
;
711 for (i
= 0; i
< S390_NUM_FPRS
; i
++)
712 if (size
== data
->fpr_size
713 && pv_is_register_k (value
, S390_F0_REGNUM
+ i
, 0))
714 if (data
->fpr_slot
[i
] == 0
715 || data
->fpr_slot
[i
] > offset
)
717 data
->fpr_slot
[i
] = offset
;
722 /* Analyze the prologue of the function starting at START_PC, continuing at
723 most until CURRENT_PC. Initialize DATA to hold all information we find
724 out about the state of the registers and stack slots. Return the address
725 of the instruction after the last one that changed the SP, FP, or back
726 chain; or zero on error. */
729 s390_analyze_prologue (struct gdbarch
*gdbarch
,
731 CORE_ADDR current_pc
,
732 struct s390_prologue_data
*data
)
734 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
737 The address of the instruction after the last one that changed
738 the SP, FP, or back chain; zero if we got an error trying to
740 CORE_ADDR result
= start_pc
;
742 /* The current PC for our abstract interpretation. */
745 /* The address of the next instruction after that. */
748 pv_area
stack (S390_SP_REGNUM
, gdbarch_addr_bit (gdbarch
));
749 scoped_restore restore_stack
= make_scoped_restore (&data
->stack
, &stack
);
751 /* Set up everything's initial value. */
755 /* For the purpose of prologue tracking, we consider the GPR size to
756 be equal to the ABI word size, even if it is actually larger
757 (i.e. when running a 32-bit binary under a 64-bit kernel). */
758 data
->gpr_size
= word_size
;
760 data
->byte_order
= gdbarch_byte_order (gdbarch
);
762 for (i
= 0; i
< S390_NUM_GPRS
; i
++)
763 data
->gpr
[i
] = pv_register (S390_R0_REGNUM
+ i
, 0);
765 for (i
= 0; i
< S390_NUM_FPRS
; i
++)
766 data
->fpr
[i
] = pv_register (S390_F0_REGNUM
+ i
, 0);
768 for (i
= 0; i
< S390_NUM_GPRS
; i
++)
769 data
->gpr_slot
[i
] = 0;
771 for (i
= 0; i
< S390_NUM_FPRS
; i
++)
772 data
->fpr_slot
[i
] = 0;
774 data
->back_chain_saved_p
= 0;
777 /* Start interpreting instructions, until we hit the frame's
778 current PC or the first branch instruction. */
779 for (pc
= start_pc
; pc
> 0 && pc
< current_pc
; pc
= next_pc
)
781 bfd_byte insn
[S390_MAX_INSTR_SIZE
];
782 int insn_len
= s390_readinstruction (insn
, pc
);
784 bfd_byte dummy
[S390_MAX_INSTR_SIZE
] = { 0 };
785 bfd_byte
*insn32
= word_size
== 4 ? insn
: dummy
;
786 bfd_byte
*insn64
= word_size
== 8 ? insn
: dummy
;
788 /* Fields for various kinds of instructions. */
789 unsigned int b2
, r1
, r2
, x2
, r3
;
792 /* The values of SP and FP before this instruction,
793 for detecting instructions that change them. */
794 pv_t pre_insn_sp
, pre_insn_fp
;
795 /* Likewise for the flag whether the back chain was saved. */
796 int pre_insn_back_chain_saved_p
;
798 /* If we got an error trying to read the instruction, report it. */
805 next_pc
= pc
+ insn_len
;
807 pre_insn_sp
= data
->gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
808 pre_insn_fp
= data
->gpr
[S390_FRAME_REGNUM
- S390_R0_REGNUM
];
809 pre_insn_back_chain_saved_p
= data
->back_chain_saved_p
;
811 /* LHI r1, i2 --- load halfword immediate. */
812 /* LGHI r1, i2 --- load halfword immediate (64-bit version). */
813 /* LGFI r1, i2 --- load fullword immediate. */
814 if (is_ri (insn32
, op1_lhi
, op2_lhi
, &r1
, &i2
)
815 || is_ri (insn64
, op1_lghi
, op2_lghi
, &r1
, &i2
)
816 || is_ril (insn
, op1_lgfi
, op2_lgfi
, &r1
, &i2
))
817 data
->gpr
[r1
] = pv_constant (i2
);
819 /* LR r1, r2 --- load from register. */
820 /* LGR r1, r2 --- load from register (64-bit version). */
821 else if (is_rr (insn32
, op_lr
, &r1
, &r2
)
822 || is_rre (insn64
, op_lgr
, &r1
, &r2
))
823 data
->gpr
[r1
] = data
->gpr
[r2
];
825 /* L r1, d2(x2, b2) --- load. */
826 /* LY r1, d2(x2, b2) --- load (long-displacement version). */
827 /* LG r1, d2(x2, b2) --- load (64-bit version). */
828 else if (is_rx (insn32
, op_l
, &r1
, &d2
, &x2
, &b2
)
829 || is_rxy (insn32
, op1_ly
, op2_ly
, &r1
, &d2
, &x2
, &b2
)
830 || is_rxy (insn64
, op1_lg
, op2_lg
, &r1
, &d2
, &x2
, &b2
))
831 data
->gpr
[r1
] = s390_load (data
, d2
, x2
, b2
, data
->gpr_size
);
833 /* ST r1, d2(x2, b2) --- store. */
834 /* STY r1, d2(x2, b2) --- store (long-displacement version). */
835 /* STG r1, d2(x2, b2) --- store (64-bit version). */
836 else if (is_rx (insn32
, op_st
, &r1
, &d2
, &x2
, &b2
)
837 || is_rxy (insn32
, op1_sty
, op2_sty
, &r1
, &d2
, &x2
, &b2
)
838 || is_rxy (insn64
, op1_stg
, op2_stg
, &r1
, &d2
, &x2
, &b2
))
839 s390_store (data
, d2
, x2
, b2
, data
->gpr_size
, data
->gpr
[r1
]);
841 /* STD r1, d2(x2,b2) --- store floating-point register. */
842 else if (is_rx (insn
, op_std
, &r1
, &d2
, &x2
, &b2
))
843 s390_store (data
, d2
, x2
, b2
, data
->fpr_size
, data
->fpr
[r1
]);
845 /* STM r1, r3, d2(b2) --- store multiple. */
846 /* STMY r1, r3, d2(b2) --- store multiple (long-displacement
848 /* STMG r1, r3, d2(b2) --- store multiple (64-bit version). */
849 else if (is_rs (insn32
, op_stm
, &r1
, &r3
, &d2
, &b2
)
850 || is_rsy (insn32
, op1_stmy
, op2_stmy
, &r1
, &r3
, &d2
, &b2
)
851 || is_rsy (insn64
, op1_stmg
, op2_stmg
, &r1
, &r3
, &d2
, &b2
))
853 for (; r1
<= r3
; r1
++, d2
+= data
->gpr_size
)
854 s390_store (data
, d2
, 0, b2
, data
->gpr_size
, data
->gpr
[r1
]);
857 /* AHI r1, i2 --- add halfword immediate. */
858 /* AGHI r1, i2 --- add halfword immediate (64-bit version). */
859 /* AFI r1, i2 --- add fullword immediate. */
860 /* AGFI r1, i2 --- add fullword immediate (64-bit version). */
861 else if (is_ri (insn32
, op1_ahi
, op2_ahi
, &r1
, &i2
)
862 || is_ri (insn64
, op1_aghi
, op2_aghi
, &r1
, &i2
)
863 || is_ril (insn32
, op1_afi
, op2_afi
, &r1
, &i2
)
864 || is_ril (insn64
, op1_agfi
, op2_agfi
, &r1
, &i2
))
865 data
->gpr
[r1
] = pv_add_constant (data
->gpr
[r1
], i2
);
867 /* ALFI r1, i2 --- add logical immediate. */
868 /* ALGFI r1, i2 --- add logical immediate (64-bit version). */
869 else if (is_ril (insn32
, op1_alfi
, op2_alfi
, &r1
, &i2
)
870 || is_ril (insn64
, op1_algfi
, op2_algfi
, &r1
, &i2
))
871 data
->gpr
[r1
] = pv_add_constant (data
->gpr
[r1
],
872 (CORE_ADDR
)i2
& 0xffffffff);
874 /* AR r1, r2 -- add register. */
875 /* AGR r1, r2 -- add register (64-bit version). */
876 else if (is_rr (insn32
, op_ar
, &r1
, &r2
)
877 || is_rre (insn64
, op_agr
, &r1
, &r2
))
878 data
->gpr
[r1
] = pv_add (data
->gpr
[r1
], data
->gpr
[r2
]);
880 /* A r1, d2(x2, b2) -- add. */
881 /* AY r1, d2(x2, b2) -- add (long-displacement version). */
882 /* AG r1, d2(x2, b2) -- add (64-bit version). */
883 else if (is_rx (insn32
, op_a
, &r1
, &d2
, &x2
, &b2
)
884 || is_rxy (insn32
, op1_ay
, op2_ay
, &r1
, &d2
, &x2
, &b2
)
885 || is_rxy (insn64
, op1_ag
, op2_ag
, &r1
, &d2
, &x2
, &b2
))
886 data
->gpr
[r1
] = pv_add (data
->gpr
[r1
],
887 s390_load (data
, d2
, x2
, b2
, data
->gpr_size
));
889 /* SLFI r1, i2 --- subtract logical immediate. */
890 /* SLGFI r1, i2 --- subtract logical immediate (64-bit version). */
891 else if (is_ril (insn32
, op1_slfi
, op2_slfi
, &r1
, &i2
)
892 || is_ril (insn64
, op1_slgfi
, op2_slgfi
, &r1
, &i2
))
893 data
->gpr
[r1
] = pv_add_constant (data
->gpr
[r1
],
894 -((CORE_ADDR
)i2
& 0xffffffff));
896 /* SR r1, r2 -- subtract register. */
897 /* SGR r1, r2 -- subtract register (64-bit version). */
898 else if (is_rr (insn32
, op_sr
, &r1
, &r2
)
899 || is_rre (insn64
, op_sgr
, &r1
, &r2
))
900 data
->gpr
[r1
] = pv_subtract (data
->gpr
[r1
], data
->gpr
[r2
]);
902 /* S r1, d2(x2, b2) -- subtract. */
903 /* SY r1, d2(x2, b2) -- subtract (long-displacement version). */
904 /* SG r1, d2(x2, b2) -- subtract (64-bit version). */
905 else if (is_rx (insn32
, op_s
, &r1
, &d2
, &x2
, &b2
)
906 || is_rxy (insn32
, op1_sy
, op2_sy
, &r1
, &d2
, &x2
, &b2
)
907 || is_rxy (insn64
, op1_sg
, op2_sg
, &r1
, &d2
, &x2
, &b2
))
908 data
->gpr
[r1
] = pv_subtract (data
->gpr
[r1
],
909 s390_load (data
, d2
, x2
, b2
, data
->gpr_size
));
911 /* LA r1, d2(x2, b2) --- load address. */
912 /* LAY r1, d2(x2, b2) --- load address (long-displacement version). */
913 else if (is_rx (insn
, op_la
, &r1
, &d2
, &x2
, &b2
)
914 || is_rxy (insn
, op1_lay
, op2_lay
, &r1
, &d2
, &x2
, &b2
))
915 data
->gpr
[r1
] = s390_addr (data
, d2
, x2
, b2
);
917 /* LARL r1, i2 --- load address relative long. */
918 else if (is_ril (insn
, op1_larl
, op2_larl
, &r1
, &i2
))
919 data
->gpr
[r1
] = pv_constant (pc
+ i2
* 2);
921 /* BASR r1, 0 --- branch and save.
922 Since r2 is zero, this saves the PC in r1, but doesn't branch. */
923 else if (is_rr (insn
, op_basr
, &r1
, &r2
)
925 data
->gpr
[r1
] = pv_constant (next_pc
);
927 /* BRAS r1, i2 --- branch relative and save. */
928 else if (is_ri (insn
, op1_bras
, op2_bras
, &r1
, &i2
))
930 data
->gpr
[r1
] = pv_constant (next_pc
);
931 next_pc
= pc
+ i2
* 2;
933 /* We'd better not interpret any backward branches. We'll
939 /* BRC/BRCL -- branch relative on condition. Ignore "branch
940 never", branch to following instruction, and "conditional
941 trap" (BRC +2). Otherwise terminate search. */
942 else if (is_ri (insn
, op1_brc
, op2_brc
, &r1
, &i2
))
944 if (r1
!= 0 && i2
!= 1 && i2
!= 2)
947 else if (is_ril (insn
, op1_brcl
, op2_brcl
, &r1
, &i2
))
949 if (r1
!= 0 && i2
!= 3)
953 /* Terminate search when hitting any other branch instruction. */
954 else if (is_rr (insn
, op_basr
, &r1
, &r2
)
955 || is_rx (insn
, op_bas
, &r1
, &d2
, &x2
, &b2
)
956 || is_rr (insn
, op_bcr
, &r1
, &r2
)
957 || is_rx (insn
, op_bc
, &r1
, &d2
, &x2
, &b2
)
958 || is_ril (insn
, op1_brasl
, op2_brasl
, &r2
, &i2
))
963 /* An instruction we don't know how to simulate. The only
964 safe thing to do would be to set every value we're tracking
965 to 'unknown'. Instead, we'll be optimistic: we assume that
966 we *can* interpret every instruction that the compiler uses
967 to manipulate any of the data we're interested in here --
968 then we can just ignore anything else. */
971 /* Record the address after the last instruction that changed
972 the FP, SP, or backlink. Ignore instructions that changed
973 them back to their original values --- those are probably
974 restore instructions. (The back chain is never restored,
977 pv_t sp
= data
->gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
978 pv_t fp
= data
->gpr
[S390_FRAME_REGNUM
- S390_R0_REGNUM
];
980 if ((! pv_is_identical (pre_insn_sp
, sp
)
981 && ! pv_is_register_k (sp
, S390_SP_REGNUM
, 0)
982 && sp
.kind
!= pvk_unknown
)
983 || (! pv_is_identical (pre_insn_fp
, fp
)
984 && ! pv_is_register_k (fp
, S390_FRAME_REGNUM
, 0)
985 && fp
.kind
!= pvk_unknown
)
986 || pre_insn_back_chain_saved_p
!= data
->back_chain_saved_p
)
991 /* Record where all the registers were saved. */
992 data
->stack
->scan (s390_check_for_saved
, data
);
997 /* Advance PC across any function entry prologue instructions to reach
1001 s390_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
1003 struct s390_prologue_data data
;
1004 CORE_ADDR skip_pc
, func_addr
;
1006 if (find_pc_partial_function (pc
, NULL
, &func_addr
, NULL
))
1008 CORE_ADDR post_prologue_pc
1009 = skip_prologue_using_sal (gdbarch
, func_addr
);
1010 if (post_prologue_pc
!= 0)
1011 return std::max (pc
, post_prologue_pc
);
1014 skip_pc
= s390_analyze_prologue (gdbarch
, pc
, (CORE_ADDR
)-1, &data
);
1015 return skip_pc
? skip_pc
: pc
;
1018 /* Register handling. */
1020 /* ABI call-saved register information. */
1023 s390_register_call_saved (struct gdbarch
*gdbarch
, int regnum
)
1025 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1029 case ABI_LINUX_S390
:
1030 if ((regnum
>= S390_R6_REGNUM
&& regnum
<= S390_R15_REGNUM
)
1031 || regnum
== S390_F4_REGNUM
|| regnum
== S390_F6_REGNUM
1032 || regnum
== S390_A0_REGNUM
)
1037 case ABI_LINUX_ZSERIES
:
1038 if ((regnum
>= S390_R6_REGNUM
&& regnum
<= S390_R15_REGNUM
)
1039 || (regnum
>= S390_F8_REGNUM
&& regnum
<= S390_F15_REGNUM
)
1040 || (regnum
>= S390_A0_REGNUM
&& regnum
<= S390_A1_REGNUM
))
1049 /* The "guess_tracepoint_registers" gdbarch method. */
1052 s390_guess_tracepoint_registers (struct gdbarch
*gdbarch
,
1053 struct regcache
*regcache
,
1056 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1057 int sz
= register_size (gdbarch
, S390_PSWA_REGNUM
);
1058 gdb_byte
*reg
= (gdb_byte
*) alloca (sz
);
1059 ULONGEST pswm
, pswa
;
1061 /* Set PSWA from the location and a default PSWM (the only part we're
1062 unlikely to get right is the CC). */
1063 if (tdep
->abi
== ABI_LINUX_S390
)
1065 /* 31-bit PSWA needs high bit set (it's very unlikely the target
1066 was in 24-bit mode). */
1067 pswa
= addr
| 0x80000000UL
;
1068 pswm
= 0x070d0000UL
;
1073 pswm
= 0x0705000180000000ULL
;
1076 store_unsigned_integer (reg
, sz
, gdbarch_byte_order (gdbarch
), pswa
);
1077 regcache_raw_supply (regcache
, S390_PSWA_REGNUM
, reg
);
1079 store_unsigned_integer (reg
, sz
, gdbarch_byte_order (gdbarch
), pswm
);
1080 regcache_raw_supply (regcache
, S390_PSWM_REGNUM
, reg
);
1083 /* Return the name of register REGNO. Return the empty string for
1084 registers that shouldn't be visible. */
1087 s390_register_name (struct gdbarch
*gdbarch
, int regnum
)
1089 if (regnum
>= S390_V0_LOWER_REGNUM
1090 && regnum
<= S390_V15_LOWER_REGNUM
)
1092 return tdesc_register_name (gdbarch
, regnum
);
1095 /* DWARF Register Mapping. */
1097 static const short s390_dwarf_regmap
[] =
1099 /* 0-15: General Purpose Registers. */
1100 S390_R0_REGNUM
, S390_R1_REGNUM
, S390_R2_REGNUM
, S390_R3_REGNUM
,
1101 S390_R4_REGNUM
, S390_R5_REGNUM
, S390_R6_REGNUM
, S390_R7_REGNUM
,
1102 S390_R8_REGNUM
, S390_R9_REGNUM
, S390_R10_REGNUM
, S390_R11_REGNUM
,
1103 S390_R12_REGNUM
, S390_R13_REGNUM
, S390_R14_REGNUM
, S390_R15_REGNUM
,
1105 /* 16-31: Floating Point Registers / Vector Registers 0-15. */
1106 S390_F0_REGNUM
, S390_F2_REGNUM
, S390_F4_REGNUM
, S390_F6_REGNUM
,
1107 S390_F1_REGNUM
, S390_F3_REGNUM
, S390_F5_REGNUM
, S390_F7_REGNUM
,
1108 S390_F8_REGNUM
, S390_F10_REGNUM
, S390_F12_REGNUM
, S390_F14_REGNUM
,
1109 S390_F9_REGNUM
, S390_F11_REGNUM
, S390_F13_REGNUM
, S390_F15_REGNUM
,
1111 /* 32-47: Control Registers (not mapped). */
1112 -1, -1, -1, -1, -1, -1, -1, -1,
1113 -1, -1, -1, -1, -1, -1, -1, -1,
1115 /* 48-63: Access Registers. */
1116 S390_A0_REGNUM
, S390_A1_REGNUM
, S390_A2_REGNUM
, S390_A3_REGNUM
,
1117 S390_A4_REGNUM
, S390_A5_REGNUM
, S390_A6_REGNUM
, S390_A7_REGNUM
,
1118 S390_A8_REGNUM
, S390_A9_REGNUM
, S390_A10_REGNUM
, S390_A11_REGNUM
,
1119 S390_A12_REGNUM
, S390_A13_REGNUM
, S390_A14_REGNUM
, S390_A15_REGNUM
,
1121 /* 64-65: Program Status Word. */
1125 /* 66-67: Reserved. */
1128 /* 68-83: Vector Registers 16-31. */
1129 S390_V16_REGNUM
, S390_V18_REGNUM
, S390_V20_REGNUM
, S390_V22_REGNUM
,
1130 S390_V17_REGNUM
, S390_V19_REGNUM
, S390_V21_REGNUM
, S390_V23_REGNUM
,
1131 S390_V24_REGNUM
, S390_V26_REGNUM
, S390_V28_REGNUM
, S390_V30_REGNUM
,
1132 S390_V25_REGNUM
, S390_V27_REGNUM
, S390_V29_REGNUM
, S390_V31_REGNUM
,
1134 /* End of "official" DWARF registers. The remainder of the map is
1135 for GDB internal use only. */
1137 /* GPR Lower Half Access. */
1138 S390_R0_REGNUM
, S390_R1_REGNUM
, S390_R2_REGNUM
, S390_R3_REGNUM
,
1139 S390_R4_REGNUM
, S390_R5_REGNUM
, S390_R6_REGNUM
, S390_R7_REGNUM
,
1140 S390_R8_REGNUM
, S390_R9_REGNUM
, S390_R10_REGNUM
, S390_R11_REGNUM
,
1141 S390_R12_REGNUM
, S390_R13_REGNUM
, S390_R14_REGNUM
, S390_R15_REGNUM
,
1144 enum { s390_dwarf_reg_r0l
= ARRAY_SIZE (s390_dwarf_regmap
) - 16 };
1146 /* Convert DWARF register number REG to the appropriate register
1147 number used by GDB. */
1150 s390_dwarf_reg_to_regnum (struct gdbarch
*gdbarch
, int reg
)
1152 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1155 /* In a 32-on-64 debug scenario, debug info refers to the full
1156 64-bit GPRs. Note that call frame information still refers to
1157 the 32-bit lower halves, because s390_adjust_frame_regnum uses
1158 special register numbers to access GPRs. */
1159 if (tdep
->gpr_full_regnum
!= -1 && reg
>= 0 && reg
< 16)
1160 return tdep
->gpr_full_regnum
+ reg
;
1162 if (reg
>= 0 && reg
< ARRAY_SIZE (s390_dwarf_regmap
))
1163 gdb_reg
= s390_dwarf_regmap
[reg
];
1165 if (tdep
->v0_full_regnum
== -1)
1167 if (gdb_reg
>= S390_V16_REGNUM
&& gdb_reg
<= S390_V31_REGNUM
)
1172 if (gdb_reg
>= S390_F0_REGNUM
&& gdb_reg
<= S390_F15_REGNUM
)
1173 gdb_reg
= gdb_reg
- S390_F0_REGNUM
+ tdep
->v0_full_regnum
;
1179 /* Pseudo registers. */
1181 /* Check whether REGNUM indicates a coupled general purpose register.
1182 These pseudo-registers are composed of two adjacent gprs. */
1185 regnum_is_gpr_full (struct gdbarch_tdep
*tdep
, int regnum
)
1187 return (tdep
->gpr_full_regnum
!= -1
1188 && regnum
>= tdep
->gpr_full_regnum
1189 && regnum
<= tdep
->gpr_full_regnum
+ 15);
1192 /* Check whether REGNUM indicates a full vector register (v0-v15).
1193 These pseudo-registers are composed of f0-f15 and v0l-v15l. */
1196 regnum_is_vxr_full (struct gdbarch_tdep
*tdep
, int regnum
)
1198 return (tdep
->v0_full_regnum
!= -1
1199 && regnum
>= tdep
->v0_full_regnum
1200 && regnum
<= tdep
->v0_full_regnum
+ 15);
1203 /* 'float' values are stored in the upper half of floating-point
1204 registers, even though we are otherwise a big-endian platform. The
1205 same applies to a 'float' value within a vector. */
1207 static struct value
*
1208 s390_value_from_register (struct gdbarch
*gdbarch
, struct type
*type
,
1209 int regnum
, struct frame_id frame_id
)
1211 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1212 struct value
*value
= default_value_from_register (gdbarch
, type
,
1214 check_typedef (type
);
1216 if ((regnum
>= S390_F0_REGNUM
&& regnum
<= S390_F15_REGNUM
1217 && TYPE_LENGTH (type
) < 8)
1218 || regnum_is_vxr_full (tdep
, regnum
)
1219 || (regnum
>= S390_V16_REGNUM
&& regnum
<= S390_V31_REGNUM
))
1220 set_value_offset (value
, 0);
1225 /* Implement pseudo_register_name tdesc method. */
1228 s390_pseudo_register_name (struct gdbarch
*gdbarch
, int regnum
)
1230 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1232 if (regnum
== tdep
->pc_regnum
)
1235 if (regnum
== tdep
->cc_regnum
)
1238 if (regnum_is_gpr_full (tdep
, regnum
))
1240 static const char *full_name
[] = {
1241 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
1242 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
1244 return full_name
[regnum
- tdep
->gpr_full_regnum
];
1247 if (regnum_is_vxr_full (tdep
, regnum
))
1249 static const char *full_name
[] = {
1250 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
1251 "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15"
1253 return full_name
[regnum
- tdep
->v0_full_regnum
];
1256 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
1259 /* Implement pseudo_register_type tdesc method. */
1261 static struct type
*
1262 s390_pseudo_register_type (struct gdbarch
*gdbarch
, int regnum
)
1264 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1266 if (regnum
== tdep
->pc_regnum
)
1267 return builtin_type (gdbarch
)->builtin_func_ptr
;
1269 if (regnum
== tdep
->cc_regnum
)
1270 return builtin_type (gdbarch
)->builtin_int
;
1272 if (regnum_is_gpr_full (tdep
, regnum
))
1273 return builtin_type (gdbarch
)->builtin_uint64
;
1275 if (regnum_is_vxr_full (tdep
, regnum
))
1276 return tdesc_find_type (gdbarch
, "vec128");
1278 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
1281 /* Implement pseudo_register_read gdbarch method. */
1283 static enum register_status
1284 s390_pseudo_register_read (struct gdbarch
*gdbarch
, readable_regcache
*regcache
,
1285 int regnum
, gdb_byte
*buf
)
1287 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1288 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1289 int regsize
= register_size (gdbarch
, regnum
);
1292 if (regnum
== tdep
->pc_regnum
)
1294 enum register_status status
;
1296 status
= regcache
->raw_read (S390_PSWA_REGNUM
, &val
);
1297 if (status
== REG_VALID
)
1299 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1301 store_unsigned_integer (buf
, regsize
, byte_order
, val
);
1306 if (regnum
== tdep
->cc_regnum
)
1308 enum register_status status
;
1310 status
= regcache
->raw_read (S390_PSWM_REGNUM
, &val
);
1311 if (status
== REG_VALID
)
1313 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1314 val
= (val
>> 12) & 3;
1316 val
= (val
>> 44) & 3;
1317 store_unsigned_integer (buf
, regsize
, byte_order
, val
);
1322 if (regnum_is_gpr_full (tdep
, regnum
))
1324 enum register_status status
;
1327 regnum
-= tdep
->gpr_full_regnum
;
1329 status
= regcache
->raw_read (S390_R0_REGNUM
+ regnum
, &val
);
1330 if (status
== REG_VALID
)
1331 status
= regcache
->raw_read (S390_R0_UPPER_REGNUM
+ regnum
,
1333 if (status
== REG_VALID
)
1335 val
|= val_upper
<< 32;
1336 store_unsigned_integer (buf
, regsize
, byte_order
, val
);
1341 if (regnum_is_vxr_full (tdep
, regnum
))
1343 enum register_status status
;
1345 regnum
-= tdep
->v0_full_regnum
;
1347 status
= regcache
->raw_read (S390_F0_REGNUM
+ regnum
, buf
);
1348 if (status
== REG_VALID
)
1349 status
= regcache
->raw_read (S390_V0_LOWER_REGNUM
+ regnum
, buf
+ 8);
1353 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
1356 /* Implement pseudo_register_write gdbarch method. */
1359 s390_pseudo_register_write (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
1360 int regnum
, const gdb_byte
*buf
)
1362 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1363 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1364 int regsize
= register_size (gdbarch
, regnum
);
1367 if (regnum
== tdep
->pc_regnum
)
1369 val
= extract_unsigned_integer (buf
, regsize
, byte_order
);
1370 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1372 regcache_raw_read_unsigned (regcache
, S390_PSWA_REGNUM
, &psw
);
1373 val
= (psw
& 0x80000000) | (val
& 0x7fffffff);
1375 regcache_raw_write_unsigned (regcache
, S390_PSWA_REGNUM
, val
);
1379 if (regnum
== tdep
->cc_regnum
)
1381 val
= extract_unsigned_integer (buf
, regsize
, byte_order
);
1382 regcache_raw_read_unsigned (regcache
, S390_PSWM_REGNUM
, &psw
);
1383 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1384 val
= (psw
& ~((ULONGEST
)3 << 12)) | ((val
& 3) << 12);
1386 val
= (psw
& ~((ULONGEST
)3 << 44)) | ((val
& 3) << 44);
1387 regcache_raw_write_unsigned (regcache
, S390_PSWM_REGNUM
, val
);
1391 if (regnum_is_gpr_full (tdep
, regnum
))
1393 regnum
-= tdep
->gpr_full_regnum
;
1394 val
= extract_unsigned_integer (buf
, regsize
, byte_order
);
1395 regcache_raw_write_unsigned (regcache
, S390_R0_REGNUM
+ regnum
,
1397 regcache_raw_write_unsigned (regcache
, S390_R0_UPPER_REGNUM
+ regnum
,
1402 if (regnum_is_vxr_full (tdep
, regnum
))
1404 regnum
-= tdep
->v0_full_regnum
;
1405 regcache
->raw_write (S390_F0_REGNUM
+ regnum
, buf
);
1406 regcache
->raw_write (S390_V0_LOWER_REGNUM
+ regnum
, buf
+ 8);
1410 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
1413 /* Register groups. */
1415 /* Implement pseudo_register_reggroup_p tdesc method. */
1418 s390_pseudo_register_reggroup_p (struct gdbarch
*gdbarch
, int regnum
,
1419 struct reggroup
*group
)
1421 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1423 /* We usually save/restore the whole PSW, which includes PC and CC.
1424 However, some older gdbservers may not support saving/restoring
1425 the whole PSW yet, and will return an XML register description
1426 excluding those from the save/restore register groups. In those
1427 cases, we still need to explicitly save/restore PC and CC in order
1428 to push or pop frames. Since this doesn't hurt anything if we
1429 already save/restore the whole PSW (it's just redundant), we add
1430 PC and CC at this point unconditionally. */
1431 if (group
== save_reggroup
|| group
== restore_reggroup
)
1432 return regnum
== tdep
->pc_regnum
|| regnum
== tdep
->cc_regnum
;
1434 if (group
== vector_reggroup
)
1435 return regnum_is_vxr_full (tdep
, regnum
);
1437 if (group
== general_reggroup
&& regnum_is_vxr_full (tdep
, regnum
))
1440 return default_register_reggroup_p (gdbarch
, regnum
, group
);
1443 /* The "ax_pseudo_register_collect" gdbarch method. */
1446 s390_ax_pseudo_register_collect (struct gdbarch
*gdbarch
,
1447 struct agent_expr
*ax
, int regnum
)
1449 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1450 if (regnum
== tdep
->pc_regnum
)
1452 ax_reg_mask (ax
, S390_PSWA_REGNUM
);
1454 else if (regnum
== tdep
->cc_regnum
)
1456 ax_reg_mask (ax
, S390_PSWM_REGNUM
);
1458 else if (regnum_is_gpr_full (tdep
, regnum
))
1460 regnum
-= tdep
->gpr_full_regnum
;
1461 ax_reg_mask (ax
, S390_R0_REGNUM
+ regnum
);
1462 ax_reg_mask (ax
, S390_R0_UPPER_REGNUM
+ regnum
);
1464 else if (regnum_is_vxr_full (tdep
, regnum
))
1466 regnum
-= tdep
->v0_full_regnum
;
1467 ax_reg_mask (ax
, S390_F0_REGNUM
+ regnum
);
1468 ax_reg_mask (ax
, S390_V0_LOWER_REGNUM
+ regnum
);
1472 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
1477 /* The "ax_pseudo_register_push_stack" gdbarch method. */
1480 s390_ax_pseudo_register_push_stack (struct gdbarch
*gdbarch
,
1481 struct agent_expr
*ax
, int regnum
)
1483 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1484 if (regnum
== tdep
->pc_regnum
)
1486 ax_reg (ax
, S390_PSWA_REGNUM
);
1487 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1489 ax_zero_ext (ax
, 31);
1492 else if (regnum
== tdep
->cc_regnum
)
1494 ax_reg (ax
, S390_PSWM_REGNUM
);
1495 if (register_size (gdbarch
, S390_PSWA_REGNUM
) == 4)
1496 ax_const_l (ax
, 12);
1498 ax_const_l (ax
, 44);
1499 ax_simple (ax
, aop_rsh_unsigned
);
1500 ax_zero_ext (ax
, 2);
1502 else if (regnum_is_gpr_full (tdep
, regnum
))
1504 regnum
-= tdep
->gpr_full_regnum
;
1505 ax_reg (ax
, S390_R0_REGNUM
+ regnum
);
1506 ax_reg (ax
, S390_R0_UPPER_REGNUM
+ regnum
);
1507 ax_const_l (ax
, 32);
1508 ax_simple (ax
, aop_lsh
);
1509 ax_simple (ax
, aop_bit_or
);
1511 else if (regnum_is_vxr_full (tdep
, regnum
))
1513 /* Too large to stuff on the stack. */
1518 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
1523 /* The "gen_return_address" gdbarch method. Since this is supposed to be
1524 just a best-effort method, and we don't really have the means to run
1525 the full unwinder here, just collect the link register. */
1528 s390_gen_return_address (struct gdbarch
*gdbarch
,
1529 struct agent_expr
*ax
, struct axs_value
*value
,
1532 value
->type
= register_type (gdbarch
, S390_R14_REGNUM
);
1533 value
->kind
= axs_lvalue_register
;
1534 value
->u
.reg
= S390_R14_REGNUM
;
1537 /* Address handling. */
1539 /* Implement addr_bits_remove gdbarch method.
1540 Only used for ABI_LINUX_S390. */
1543 s390_addr_bits_remove (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
1545 return addr
& 0x7fffffff;
1548 /* Implement addr_class_type_flags gdbarch method.
1549 Only used for ABI_LINUX_ZSERIES. */
1552 s390_address_class_type_flags (int byte_size
, int dwarf2_addr_class
)
1555 return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
;
1560 /* Implement addr_class_type_flags_to_name gdbarch method.
1561 Only used for ABI_LINUX_ZSERIES. */
1564 s390_address_class_type_flags_to_name (struct gdbarch
*gdbarch
, int type_flags
)
1566 if (type_flags
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
)
1572 /* Implement addr_class_name_to_type_flags gdbarch method.
1573 Only used for ABI_LINUX_ZSERIES. */
1576 s390_address_class_name_to_type_flags (struct gdbarch
*gdbarch
,
1578 int *type_flags_ptr
)
1580 if (strcmp (name
, "mode32") == 0)
1582 *type_flags_ptr
= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
;
1589 /* Inferior function calls. */
1591 /* Dummy function calls. */
1593 /* Unwrap any single-field structs in TYPE and return the effective
1594 "inner" type. E.g., yield "float" for all these cases:
1598 struct { struct { float x; } x; };
1599 struct { struct { struct { float x; } x; } x; };
1601 However, if an inner type is smaller than MIN_SIZE, abort the
1604 static struct type
*
1605 s390_effective_inner_type (struct type
*type
, unsigned int min_size
)
1607 while (TYPE_CODE (type
) == TYPE_CODE_STRUCT
1608 && TYPE_NFIELDS (type
) == 1)
1610 struct type
*inner
= check_typedef (TYPE_FIELD_TYPE (type
, 0));
1612 if (TYPE_LENGTH (inner
) < min_size
)
1620 /* Return non-zero if TYPE should be passed like "float" or
1624 s390_function_arg_float (struct type
*type
)
1626 /* Note that long double as well as complex types are intentionally
1628 if (TYPE_LENGTH (type
) > 8)
1631 /* A struct containing just a float or double is passed like a float
1633 type
= s390_effective_inner_type (type
, 0);
1635 return (TYPE_CODE (type
) == TYPE_CODE_FLT
1636 || TYPE_CODE (type
) == TYPE_CODE_DECFLOAT
);
1639 /* Return non-zero if TYPE should be passed like a vector. */
1642 s390_function_arg_vector (struct type
*type
)
1644 if (TYPE_LENGTH (type
) > 16)
1647 /* Structs containing just a vector are passed like a vector. */
1648 type
= s390_effective_inner_type (type
, TYPE_LENGTH (type
));
1650 return TYPE_CODE (type
) == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type
);
1653 /* Determine whether N is a power of two. */
1656 is_power_of_two (unsigned int n
)
1658 return n
&& ((n
& (n
- 1)) == 0);
1661 /* For an argument whose type is TYPE and which is not passed like a
1662 float or vector, return non-zero if it should be passed like "int"
1666 s390_function_arg_integer (struct type
*type
)
1668 enum type_code code
= TYPE_CODE (type
);
1670 if (TYPE_LENGTH (type
) > 8)
1673 if (code
== TYPE_CODE_INT
1674 || code
== TYPE_CODE_ENUM
1675 || code
== TYPE_CODE_RANGE
1676 || code
== TYPE_CODE_CHAR
1677 || code
== TYPE_CODE_BOOL
1678 || code
== TYPE_CODE_PTR
1679 || TYPE_IS_REFERENCE (type
))
1682 return ((code
== TYPE_CODE_UNION
|| code
== TYPE_CODE_STRUCT
)
1683 && is_power_of_two (TYPE_LENGTH (type
)));
1686 /* Argument passing state: Internal data structure passed to helper
1687 routines of s390_push_dummy_call. */
1689 struct s390_arg_state
1691 /* Register cache, or NULL, if we are in "preparation mode". */
1692 struct regcache
*regcache
;
1693 /* Next available general/floating-point/vector register for
1694 argument passing. */
1696 /* Current pointer to copy area (grows downwards). */
1698 /* Current pointer to parameter area (grows upwards). */
1702 /* Prepare one argument ARG for a dummy call and update the argument
1703 passing state AS accordingly. If the regcache field in AS is set,
1704 operate in "write mode" and write ARG into the inferior. Otherwise
1705 run "preparation mode" and skip all updates to the inferior. */
1708 s390_handle_arg (struct s390_arg_state
*as
, struct value
*arg
,
1709 struct gdbarch_tdep
*tdep
, int word_size
,
1710 enum bfd_endian byte_order
, int is_unnamed
)
1712 struct type
*type
= check_typedef (value_type (arg
));
1713 unsigned int length
= TYPE_LENGTH (type
);
1714 int write_mode
= as
->regcache
!= NULL
;
1716 if (s390_function_arg_float (type
))
1718 /* The GNU/Linux for S/390 ABI uses FPRs 0 and 2 to pass
1719 arguments. The GNU/Linux for zSeries ABI uses 0, 2, 4, and
1721 if (as
->fr
<= (tdep
->abi
== ABI_LINUX_S390
? 2 : 6))
1723 /* When we store a single-precision value in an FP register,
1724 it occupies the leftmost bits. */
1726 regcache_cooked_write_part (as
->regcache
,
1727 S390_F0_REGNUM
+ as
->fr
,
1729 value_contents (arg
));
1734 /* When we store a single-precision value in a stack slot,
1735 it occupies the rightmost bits. */
1736 as
->argp
= align_up (as
->argp
+ length
, word_size
);
1738 write_memory (as
->argp
- length
, value_contents (arg
),
1742 else if (tdep
->vector_abi
== S390_VECTOR_ABI_128
1743 && s390_function_arg_vector (type
))
1745 static const char use_vr
[] = {24, 26, 28, 30, 25, 27, 29, 31};
1747 if (!is_unnamed
&& as
->vr
< ARRAY_SIZE (use_vr
))
1749 int regnum
= S390_V24_REGNUM
+ use_vr
[as
->vr
] - 24;
1752 regcache_cooked_write_part (as
->regcache
, regnum
,
1754 value_contents (arg
));
1760 write_memory (as
->argp
, value_contents (arg
), length
);
1761 as
->argp
= align_up (as
->argp
+ length
, word_size
);
1764 else if (s390_function_arg_integer (type
) && length
<= word_size
)
1766 /* Initialize it just to avoid a GCC false warning. */
1771 /* Place value in least significant bits of the register or
1772 memory word and sign- or zero-extend to full word size.
1773 This also applies to a struct or union. */
1774 val
= TYPE_UNSIGNED (type
)
1775 ? extract_unsigned_integer (value_contents (arg
),
1777 : extract_signed_integer (value_contents (arg
),
1778 length
, byte_order
);
1784 regcache_cooked_write_unsigned (as
->regcache
,
1785 S390_R0_REGNUM
+ as
->gr
,
1792 write_memory_unsigned_integer (as
->argp
, word_size
,
1794 as
->argp
+= word_size
;
1797 else if (s390_function_arg_integer (type
) && length
== 8)
1803 as
->regcache
->cooked_write (S390_R0_REGNUM
+ as
->gr
,
1804 value_contents (arg
));
1805 as
->regcache
->cooked_write (S390_R0_REGNUM
+ as
->gr
+ 1,
1806 value_contents (arg
) + word_size
);
1812 /* If we skipped r6 because we couldn't fit a DOUBLE_ARG
1813 in it, then don't go back and use it again later. */
1817 write_memory (as
->argp
, value_contents (arg
), length
);
1823 /* This argument type is never passed in registers. Place the
1824 value in the copy area and pass a pointer to it. Use 8-byte
1825 alignment as a conservative assumption. */
1826 as
->copy
= align_down (as
->copy
- length
, 8);
1828 write_memory (as
->copy
, value_contents (arg
), length
);
1833 regcache_cooked_write_unsigned (as
->regcache
,
1834 S390_R0_REGNUM
+ as
->gr
,
1841 write_memory_unsigned_integer (as
->argp
, word_size
,
1842 byte_order
, as
->copy
);
1843 as
->argp
+= word_size
;
1848 /* Put the actual parameter values pointed to by ARGS[0..NARGS-1] in
1849 place to be passed to a function, as specified by the "GNU/Linux
1850 for S/390 ELF Application Binary Interface Supplement".
1852 SP is the current stack pointer. We must put arguments, links,
1853 padding, etc. whereever they belong, and return the new stack
1856 If STRUCT_RETURN is non-zero, then the function we're calling is
1857 going to return a structure by value; STRUCT_ADDR is the address of
1858 a block we've allocated for it on the stack.
1860 Our caller has taken care of any type promotions needed to satisfy
1861 prototypes or the old K&R argument-passing rules. */
1864 s390_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
1865 struct regcache
*regcache
, CORE_ADDR bp_addr
,
1866 int nargs
, struct value
**args
, CORE_ADDR sp
,
1867 int struct_return
, CORE_ADDR struct_addr
)
1869 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1870 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
1871 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1873 struct s390_arg_state arg_state
, arg_prep
;
1874 CORE_ADDR param_area_start
, new_sp
;
1875 struct type
*ftype
= check_typedef (value_type (function
));
1877 if (TYPE_CODE (ftype
) == TYPE_CODE_PTR
)
1878 ftype
= check_typedef (TYPE_TARGET_TYPE (ftype
));
1881 arg_prep
.gr
= struct_return
? 3 : 2;
1885 arg_prep
.regcache
= NULL
;
1887 /* Initialize arg_state for "preparation mode". */
1888 arg_state
= arg_prep
;
1890 /* Update arg_state.copy with the start of the reference-to-copy area
1891 and arg_state.argp with the size of the parameter area. */
1892 for (i
= 0; i
< nargs
; i
++)
1893 s390_handle_arg (&arg_state
, args
[i
], tdep
, word_size
, byte_order
,
1894 TYPE_VARARGS (ftype
) && i
>= TYPE_NFIELDS (ftype
));
1896 param_area_start
= align_down (arg_state
.copy
- arg_state
.argp
, 8);
1898 /* Allocate the standard frame areas: the register save area, the
1899 word reserved for the compiler, and the back chain pointer. */
1900 new_sp
= param_area_start
- (16 * word_size
+ 32);
1902 /* Now we have the final stack pointer. Make sure we didn't
1903 underflow; on 31-bit, this would result in addresses with the
1904 high bit set, which causes confusion elsewhere. Note that if we
1905 error out here, stack and registers remain untouched. */
1906 if (gdbarch_addr_bits_remove (gdbarch
, new_sp
) != new_sp
)
1907 error (_("Stack overflow"));
1909 /* Pass the structure return address in general register 2. */
1911 regcache_cooked_write_unsigned (regcache
, S390_R2_REGNUM
, struct_addr
);
1913 /* Initialize arg_state for "write mode". */
1914 arg_state
= arg_prep
;
1915 arg_state
.argp
= param_area_start
;
1916 arg_state
.regcache
= regcache
;
1918 /* Write all parameters. */
1919 for (i
= 0; i
< nargs
; i
++)
1920 s390_handle_arg (&arg_state
, args
[i
], tdep
, word_size
, byte_order
,
1921 TYPE_VARARGS (ftype
) && i
>= TYPE_NFIELDS (ftype
));
1923 /* Store return PSWA. In 31-bit mode, keep addressing mode bit. */
1927 regcache_cooked_read_unsigned (regcache
, S390_PSWA_REGNUM
, &pswa
);
1928 bp_addr
= (bp_addr
& 0x7fffffff) | (pswa
& 0x80000000);
1930 regcache_cooked_write_unsigned (regcache
, S390_RETADDR_REGNUM
, bp_addr
);
1932 /* Store updated stack pointer. */
1933 regcache_cooked_write_unsigned (regcache
, S390_SP_REGNUM
, new_sp
);
1935 /* We need to return the 'stack part' of the frame ID,
1936 which is actually the top of the register save area. */
1937 return param_area_start
;
1940 /* Assuming THIS_FRAME is a dummy, return the frame ID of that
1941 dummy frame. The frame ID's base needs to match the TOS value
1942 returned by push_dummy_call, and the PC match the dummy frame's
1945 static struct frame_id
1946 s390_dummy_id (struct gdbarch
*gdbarch
, struct frame_info
*this_frame
)
1948 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
1949 CORE_ADDR sp
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
1950 sp
= gdbarch_addr_bits_remove (gdbarch
, sp
);
1952 return frame_id_build (sp
+ 16*word_size
+ 32,
1953 get_frame_pc (this_frame
));
1956 /* Implement frame_align gdbarch method. */
1959 s390_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
1961 /* Both the 32- and 64-bit ABI's say that the stack pointer should
1962 always be aligned on an eight-byte boundary. */
1966 /* Helper for s390_return_value: Set or retrieve a function return
1967 value if it resides in a register. */
1970 s390_register_return_value (struct gdbarch
*gdbarch
, struct type
*type
,
1971 struct regcache
*regcache
,
1972 gdb_byte
*out
, const gdb_byte
*in
)
1974 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1975 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
1976 int length
= TYPE_LENGTH (type
);
1977 int code
= TYPE_CODE (type
);
1979 if (code
== TYPE_CODE_FLT
|| code
== TYPE_CODE_DECFLOAT
)
1981 /* Float-like value: left-aligned in f0. */
1983 regcache_cooked_write_part (regcache
, S390_F0_REGNUM
,
1986 regcache_cooked_read_part (regcache
, S390_F0_REGNUM
,
1989 else if (code
== TYPE_CODE_ARRAY
)
1991 /* Vector: left-aligned in v24. */
1993 regcache_cooked_write_part (regcache
, S390_V24_REGNUM
,
1996 regcache_cooked_read_part (regcache
, S390_V24_REGNUM
,
1999 else if (length
<= word_size
)
2001 /* Integer: zero- or sign-extended in r2. */
2003 regcache_cooked_read_part (regcache
, S390_R2_REGNUM
,
2004 word_size
- length
, length
, out
);
2005 else if (TYPE_UNSIGNED (type
))
2006 regcache_cooked_write_unsigned
2007 (regcache
, S390_R2_REGNUM
,
2008 extract_unsigned_integer (in
, length
, byte_order
));
2010 regcache_cooked_write_signed
2011 (regcache
, S390_R2_REGNUM
,
2012 extract_signed_integer (in
, length
, byte_order
));
2014 else if (length
== 2 * word_size
)
2016 /* Double word: in r2 and r3. */
2019 regcache
->cooked_write (S390_R2_REGNUM
, in
);
2020 regcache
->cooked_write (S390_R3_REGNUM
, in
+ word_size
);
2024 regcache
->cooked_read (S390_R2_REGNUM
, out
);
2025 regcache
->cooked_read (S390_R3_REGNUM
, out
+ word_size
);
2029 internal_error (__FILE__
, __LINE__
, _("invalid return type"));
2032 /* Implement the 'return_value' gdbarch method. */
2034 static enum return_value_convention
2035 s390_return_value (struct gdbarch
*gdbarch
, struct value
*function
,
2036 struct type
*type
, struct regcache
*regcache
,
2037 gdb_byte
*out
, const gdb_byte
*in
)
2039 enum return_value_convention rvc
;
2041 type
= check_typedef (type
);
2043 switch (TYPE_CODE (type
))
2045 case TYPE_CODE_STRUCT
:
2046 case TYPE_CODE_UNION
:
2047 case TYPE_CODE_COMPLEX
:
2048 rvc
= RETURN_VALUE_STRUCT_CONVENTION
;
2050 case TYPE_CODE_ARRAY
:
2051 rvc
= (gdbarch_tdep (gdbarch
)->vector_abi
== S390_VECTOR_ABI_128
2052 && TYPE_LENGTH (type
) <= 16 && TYPE_VECTOR (type
))
2053 ? RETURN_VALUE_REGISTER_CONVENTION
2054 : RETURN_VALUE_STRUCT_CONVENTION
;
2057 rvc
= TYPE_LENGTH (type
) <= 8
2058 ? RETURN_VALUE_REGISTER_CONVENTION
2059 : RETURN_VALUE_STRUCT_CONVENTION
;
2062 if (in
!= NULL
|| out
!= NULL
)
2064 if (rvc
== RETURN_VALUE_REGISTER_CONVENTION
)
2065 s390_register_return_value (gdbarch
, type
, regcache
, out
, in
);
2066 else if (in
!= NULL
)
2067 error (_("Cannot set function return value."));
2069 error (_("Function return value unknown."));
2075 /* Frame unwinding. */
2077 /* Implmement the stack_frame_destroyed_p gdbarch method. */
2080 s390_stack_frame_destroyed_p (struct gdbarch
*gdbarch
, CORE_ADDR pc
)
2082 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2084 /* In frameless functions, there's no frame to destroy and thus
2085 we don't care about the epilogue.
2087 In functions with frame, the epilogue sequence is a pair of
2088 a LM-type instruction that restores (amongst others) the
2089 return register %r14 and the stack pointer %r15, followed
2090 by a branch 'br %r14' --or equivalent-- that effects the
2093 In that situation, this function needs to return 'true' in
2094 exactly one case: when pc points to that branch instruction.
2096 Thus we try to disassemble the one instructions immediately
2097 preceding pc and check whether it is an LM-type instruction
2098 modifying the stack pointer.
2100 Note that disassembling backwards is not reliable, so there
2101 is a slight chance of false positives here ... */
2104 unsigned int r1
, r3
, b2
;
2108 && !target_read_memory (pc
- 4, insn
, 4)
2109 && is_rs (insn
, op_lm
, &r1
, &r3
, &d2
, &b2
)
2110 && r3
== S390_SP_REGNUM
- S390_R0_REGNUM
)
2114 && !target_read_memory (pc
- 6, insn
, 6)
2115 && is_rsy (insn
, op1_lmy
, op2_lmy
, &r1
, &r3
, &d2
, &b2
)
2116 && r3
== S390_SP_REGNUM
- S390_R0_REGNUM
)
2120 && !target_read_memory (pc
- 6, insn
, 6)
2121 && is_rsy (insn
, op1_lmg
, op2_lmg
, &r1
, &r3
, &d2
, &b2
)
2122 && r3
== S390_SP_REGNUM
- S390_R0_REGNUM
)
2128 /* Implement unwind_pc gdbarch method. */
2131 s390_unwind_pc (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
2133 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2135 pc
= frame_unwind_register_unsigned (next_frame
, tdep
->pc_regnum
);
2136 return gdbarch_addr_bits_remove (gdbarch
, pc
);
2139 /* Implement unwind_sp gdbarch method. */
2142 s390_unwind_sp (struct gdbarch
*gdbarch
, struct frame_info
*next_frame
)
2145 sp
= frame_unwind_register_unsigned (next_frame
, S390_SP_REGNUM
);
2146 return gdbarch_addr_bits_remove (gdbarch
, sp
);
2149 /* Helper routine to unwind pseudo registers. */
2151 static struct value
*
2152 s390_unwind_pseudo_register (struct frame_info
*this_frame
, int regnum
)
2154 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2155 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2156 struct type
*type
= register_type (gdbarch
, regnum
);
2158 /* Unwind PC via PSW address. */
2159 if (regnum
== tdep
->pc_regnum
)
2163 val
= frame_unwind_register_value (this_frame
, S390_PSWA_REGNUM
);
2164 if (!value_optimized_out (val
))
2166 LONGEST pswa
= value_as_long (val
);
2168 if (TYPE_LENGTH (type
) == 4)
2169 return value_from_pointer (type
, pswa
& 0x7fffffff);
2171 return value_from_pointer (type
, pswa
);
2175 /* Unwind CC via PSW mask. */
2176 if (regnum
== tdep
->cc_regnum
)
2180 val
= frame_unwind_register_value (this_frame
, S390_PSWM_REGNUM
);
2181 if (!value_optimized_out (val
))
2183 LONGEST pswm
= value_as_long (val
);
2185 if (TYPE_LENGTH (type
) == 4)
2186 return value_from_longest (type
, (pswm
>> 12) & 3);
2188 return value_from_longest (type
, (pswm
>> 44) & 3);
2192 /* Unwind full GPRs to show at least the lower halves (as the
2193 upper halves are undefined). */
2194 if (regnum_is_gpr_full (tdep
, regnum
))
2196 int reg
= regnum
- tdep
->gpr_full_regnum
;
2199 val
= frame_unwind_register_value (this_frame
, S390_R0_REGNUM
+ reg
);
2200 if (!value_optimized_out (val
))
2201 return value_cast (type
, val
);
2204 return allocate_optimized_out_value (type
);
2207 /* Translate a .eh_frame register to DWARF register, or adjust a
2208 .debug_frame register. */
2211 s390_adjust_frame_regnum (struct gdbarch
*gdbarch
, int num
, int eh_frame_p
)
2213 /* See s390_dwarf_reg_to_regnum for comments. */
2214 return (num
>= 0 && num
< 16) ? num
+ s390_dwarf_reg_r0l
: num
;
2217 /* DWARF-2 frame unwinding. */
2219 /* Function to unwind a pseudo-register in dwarf2_frame unwinder. Used by
2220 s390_dwarf2_frame_init_reg. */
2222 static struct value
*
2223 s390_dwarf2_prev_register (struct frame_info
*this_frame
, void **this_cache
,
2226 return s390_unwind_pseudo_register (this_frame
, regnum
);
2229 /* Implement init_reg dwarf2_frame method. */
2232 s390_dwarf2_frame_init_reg (struct gdbarch
*gdbarch
, int regnum
,
2233 struct dwarf2_frame_state_reg
*reg
,
2234 struct frame_info
*this_frame
)
2236 /* The condition code (and thus PSW mask) is call-clobbered. */
2237 if (regnum
== S390_PSWM_REGNUM
)
2238 reg
->how
= DWARF2_FRAME_REG_UNDEFINED
;
2240 /* The PSW address unwinds to the return address. */
2241 else if (regnum
== S390_PSWA_REGNUM
)
2242 reg
->how
= DWARF2_FRAME_REG_RA
;
2244 /* Fixed registers are call-saved or call-clobbered
2245 depending on the ABI in use. */
2246 else if (regnum
< S390_NUM_REGS
)
2248 if (s390_register_call_saved (gdbarch
, regnum
))
2249 reg
->how
= DWARF2_FRAME_REG_SAME_VALUE
;
2251 reg
->how
= DWARF2_FRAME_REG_UNDEFINED
;
2254 /* We install a special function to unwind pseudos. */
2257 reg
->how
= DWARF2_FRAME_REG_FN
;
2258 reg
->loc
.fn
= s390_dwarf2_prev_register
;
2262 /* Frame unwinding. */
2264 /* Wrapper for trad_frame_get_prev_register to allow for s390 pseudo
2265 register translation. */
2268 s390_trad_frame_prev_register (struct frame_info
*this_frame
,
2269 struct trad_frame_saved_reg saved_regs
[],
2272 if (regnum
< S390_NUM_REGS
)
2273 return trad_frame_get_prev_register (this_frame
, saved_regs
, regnum
);
2275 return s390_unwind_pseudo_register (this_frame
, regnum
);
2278 /* Normal stack frames. */
2280 struct s390_unwind_cache
{
2283 CORE_ADDR frame_base
;
2284 CORE_ADDR local_base
;
2286 struct trad_frame_saved_reg
*saved_regs
;
2289 /* Unwind THIS_FRAME and write the information into unwind cache INFO using
2290 prologue analysis. Helper for s390_frame_unwind_cache. */
2293 s390_prologue_frame_unwind_cache (struct frame_info
*this_frame
,
2294 struct s390_unwind_cache
*info
)
2296 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2297 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2298 struct s390_prologue_data data
;
2299 pv_t
*fp
= &data
.gpr
[S390_FRAME_REGNUM
- S390_R0_REGNUM
];
2300 pv_t
*sp
= &data
.gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
2309 struct frame_info
*next_frame
;
2311 /* Try to find the function start address. If we can't find it, we don't
2312 bother searching for it -- with modern compilers this would be mostly
2313 pointless anyway. Trust that we'll either have valid DWARF-2 CFI data
2314 or else a valid backchain ... */
2315 if (!get_frame_func_if_available (this_frame
, &info
->func
))
2322 /* Try to analyze the prologue. */
2323 result
= s390_analyze_prologue (gdbarch
, func
,
2324 get_frame_pc (this_frame
), &data
);
2328 /* If this was successful, we should have found the instruction that
2329 sets the stack pointer register to the previous value of the stack
2330 pointer minus the frame size. */
2331 if (!pv_is_register (*sp
, S390_SP_REGNUM
))
2334 /* A frame size of zero at this point can mean either a real
2335 frameless function, or else a failure to find the prologue.
2336 Perform some sanity checks to verify we really have a
2337 frameless function. */
2340 /* If the next frame is a NORMAL_FRAME, this frame *cannot* have frame
2341 size zero. This is only possible if the next frame is a sentinel
2342 frame, a dummy frame, or a signal trampoline frame. */
2343 /* FIXME: cagney/2004-05-01: This sanity check shouldn't be
2344 needed, instead the code should simpliy rely on its
2346 next_frame
= get_next_frame (this_frame
);
2347 while (next_frame
&& get_frame_type (next_frame
) == INLINE_FRAME
)
2348 next_frame
= get_next_frame (next_frame
);
2350 && get_frame_type (get_next_frame (this_frame
)) == NORMAL_FRAME
)
2353 /* If we really have a frameless function, %r14 must be valid
2354 -- in particular, it must point to a different function. */
2355 reg
= get_frame_register_unsigned (this_frame
, S390_RETADDR_REGNUM
);
2356 reg
= gdbarch_addr_bits_remove (gdbarch
, reg
) - 1;
2357 if (get_pc_function_start (reg
) == func
)
2359 /* However, there is one case where it *is* valid for %r14
2360 to point to the same function -- if this is a recursive
2361 call, and we have stopped in the prologue *before* the
2362 stack frame was allocated.
2364 Recognize this case by looking ahead a bit ... */
2366 struct s390_prologue_data data2
;
2367 pv_t
*sp
= &data2
.gpr
[S390_SP_REGNUM
- S390_R0_REGNUM
];
2369 if (!(s390_analyze_prologue (gdbarch
, func
, (CORE_ADDR
)-1, &data2
)
2370 && pv_is_register (*sp
, S390_SP_REGNUM
)
2376 /* OK, we've found valid prologue data. */
2379 /* If the frame pointer originally also holds the same value
2380 as the stack pointer, we're probably using it. If it holds
2381 some other value -- even a constant offset -- it is most
2382 likely used as temp register. */
2383 if (pv_is_identical (*sp
, *fp
))
2384 frame_pointer
= S390_FRAME_REGNUM
;
2386 frame_pointer
= S390_SP_REGNUM
;
2388 /* If we've detected a function with stack frame, we'll still have to
2389 treat it as frameless if we're currently within the function epilog
2390 code at a point where the frame pointer has already been restored.
2391 This can only happen in an innermost frame. */
2392 /* FIXME: cagney/2004-05-01: This sanity check shouldn't be needed,
2393 instead the code should simpliy rely on its analysis. */
2394 next_frame
= get_next_frame (this_frame
);
2395 while (next_frame
&& get_frame_type (next_frame
) == INLINE_FRAME
)
2396 next_frame
= get_next_frame (next_frame
);
2398 && (next_frame
== NULL
2399 || get_frame_type (get_next_frame (this_frame
)) != NORMAL_FRAME
))
2401 /* See the comment in s390_stack_frame_destroyed_p on why this is
2402 not completely reliable ... */
2403 if (s390_stack_frame_destroyed_p (gdbarch
, get_frame_pc (this_frame
)))
2405 memset (&data
, 0, sizeof (data
));
2407 frame_pointer
= S390_SP_REGNUM
;
2411 /* Once we know the frame register and the frame size, we can unwind
2412 the current value of the frame register from the next frame, and
2413 add back the frame size to arrive that the previous frame's
2414 stack pointer value. */
2415 prev_sp
= get_frame_register_unsigned (this_frame
, frame_pointer
) + size
;
2416 cfa
= prev_sp
+ 16*word_size
+ 32;
2418 /* Set up ABI call-saved/call-clobbered registers. */
2419 for (i
= 0; i
< S390_NUM_REGS
; i
++)
2420 if (!s390_register_call_saved (gdbarch
, i
))
2421 trad_frame_set_unknown (info
->saved_regs
, i
);
2423 /* CC is always call-clobbered. */
2424 trad_frame_set_unknown (info
->saved_regs
, S390_PSWM_REGNUM
);
2426 /* Record the addresses of all register spill slots the prologue parser
2427 has recognized. Consider only registers defined as call-saved by the
2428 ABI; for call-clobbered registers the parser may have recognized
2431 for (i
= 0; i
< 16; i
++)
2432 if (s390_register_call_saved (gdbarch
, S390_R0_REGNUM
+ i
)
2433 && data
.gpr_slot
[i
] != 0)
2434 info
->saved_regs
[S390_R0_REGNUM
+ i
].addr
= cfa
- data
.gpr_slot
[i
];
2436 for (i
= 0; i
< 16; i
++)
2437 if (s390_register_call_saved (gdbarch
, S390_F0_REGNUM
+ i
)
2438 && data
.fpr_slot
[i
] != 0)
2439 info
->saved_regs
[S390_F0_REGNUM
+ i
].addr
= cfa
- data
.fpr_slot
[i
];
2441 /* Function return will set PC to %r14. */
2442 info
->saved_regs
[S390_PSWA_REGNUM
] = info
->saved_regs
[S390_RETADDR_REGNUM
];
2444 /* In frameless functions, we unwind simply by moving the return
2445 address to the PC. However, if we actually stored to the
2446 save area, use that -- we might only think the function frameless
2447 because we're in the middle of the prologue ... */
2449 && !trad_frame_addr_p (info
->saved_regs
, S390_PSWA_REGNUM
))
2451 info
->saved_regs
[S390_PSWA_REGNUM
].realreg
= S390_RETADDR_REGNUM
;
2454 /* Another sanity check: unless this is a frameless function,
2455 we should have found spill slots for SP and PC.
2456 If not, we cannot unwind further -- this happens e.g. in
2457 libc's thread_start routine. */
2460 if (!trad_frame_addr_p (info
->saved_regs
, S390_SP_REGNUM
)
2461 || !trad_frame_addr_p (info
->saved_regs
, S390_PSWA_REGNUM
))
2465 /* We use the current value of the frame register as local_base,
2466 and the top of the register save area as frame_base. */
2469 info
->frame_base
= prev_sp
+ 16*word_size
+ 32;
2470 info
->local_base
= prev_sp
- size
;
2476 /* Unwind THIS_FRAME and write the information into unwind cache INFO using
2477 back chain unwinding. Helper for s390_frame_unwind_cache. */
2480 s390_backchain_frame_unwind_cache (struct frame_info
*this_frame
,
2481 struct s390_unwind_cache
*info
)
2483 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2484 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2485 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2486 CORE_ADDR backchain
;
2491 /* Set up ABI call-saved/call-clobbered registers. */
2492 for (i
= 0; i
< S390_NUM_REGS
; i
++)
2493 if (!s390_register_call_saved (gdbarch
, i
))
2494 trad_frame_set_unknown (info
->saved_regs
, i
);
2496 /* CC is always call-clobbered. */
2497 trad_frame_set_unknown (info
->saved_regs
, S390_PSWM_REGNUM
);
2499 /* Get the backchain. */
2500 reg
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
2501 if (!safe_read_memory_integer (reg
, word_size
, byte_order
, &tmp
))
2503 backchain
= (CORE_ADDR
) tmp
;
2505 /* A zero backchain terminates the frame chain. As additional
2506 sanity check, let's verify that the spill slot for SP in the
2507 save area pointed to by the backchain in fact links back to
2510 && safe_read_memory_integer (backchain
+ 15*word_size
,
2511 word_size
, byte_order
, &sp
)
2512 && (CORE_ADDR
)sp
== backchain
)
2514 /* We don't know which registers were saved, but it will have
2515 to be at least %r14 and %r15. This will allow us to continue
2516 unwinding, but other prev-frame registers may be incorrect ... */
2517 info
->saved_regs
[S390_SP_REGNUM
].addr
= backchain
+ 15*word_size
;
2518 info
->saved_regs
[S390_RETADDR_REGNUM
].addr
= backchain
+ 14*word_size
;
2520 /* Function return will set PC to %r14. */
2521 info
->saved_regs
[S390_PSWA_REGNUM
]
2522 = info
->saved_regs
[S390_RETADDR_REGNUM
];
2524 /* We use the current value of the frame register as local_base,
2525 and the top of the register save area as frame_base. */
2526 info
->frame_base
= backchain
+ 16*word_size
+ 32;
2527 info
->local_base
= reg
;
2530 info
->func
= get_frame_pc (this_frame
);
2533 /* Unwind THIS_FRAME and return the corresponding unwind cache for
2534 s390_frame_unwind and s390_frame_base. */
2536 static struct s390_unwind_cache
*
2537 s390_frame_unwind_cache (struct frame_info
*this_frame
,
2538 void **this_prologue_cache
)
2540 struct s390_unwind_cache
*info
;
2542 if (*this_prologue_cache
)
2543 return (struct s390_unwind_cache
*) *this_prologue_cache
;
2545 info
= FRAME_OBSTACK_ZALLOC (struct s390_unwind_cache
);
2546 *this_prologue_cache
= info
;
2547 info
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
2549 info
->frame_base
= -1;
2550 info
->local_base
= -1;
2554 /* Try to use prologue analysis to fill the unwind cache.
2555 If this fails, fall back to reading the stack backchain. */
2556 if (!s390_prologue_frame_unwind_cache (this_frame
, info
))
2557 s390_backchain_frame_unwind_cache (this_frame
, info
);
2559 CATCH (ex
, RETURN_MASK_ERROR
)
2561 if (ex
.error
!= NOT_AVAILABLE_ERROR
)
2562 throw_exception (ex
);
2569 /* Implement this_id frame_unwind method for s390_frame_unwind. */
2572 s390_frame_this_id (struct frame_info
*this_frame
,
2573 void **this_prologue_cache
,
2574 struct frame_id
*this_id
)
2576 struct s390_unwind_cache
*info
2577 = s390_frame_unwind_cache (this_frame
, this_prologue_cache
);
2579 if (info
->frame_base
== -1)
2581 if (info
->func
!= -1)
2582 *this_id
= frame_id_build_unavailable_stack (info
->func
);
2586 *this_id
= frame_id_build (info
->frame_base
, info
->func
);
2589 /* Implement prev_register frame_unwind method for s390_frame_unwind. */
2591 static struct value
*
2592 s390_frame_prev_register (struct frame_info
*this_frame
,
2593 void **this_prologue_cache
, int regnum
)
2595 struct s390_unwind_cache
*info
2596 = s390_frame_unwind_cache (this_frame
, this_prologue_cache
);
2598 return s390_trad_frame_prev_register (this_frame
, info
->saved_regs
, regnum
);
2601 /* Default S390 frame unwinder. */
2603 static const struct frame_unwind s390_frame_unwind
= {
2605 default_frame_unwind_stop_reason
,
2607 s390_frame_prev_register
,
2609 default_frame_sniffer
2612 /* Code stubs and their stack frames. For things like PLTs and NULL
2613 function calls (where there is no true frame and the return address
2614 is in the RETADDR register). */
2616 struct s390_stub_unwind_cache
2618 CORE_ADDR frame_base
;
2619 struct trad_frame_saved_reg
*saved_regs
;
2622 /* Unwind THIS_FRAME and return the corresponding unwind cache for
2623 s390_stub_frame_unwind. */
2625 static struct s390_stub_unwind_cache
*
2626 s390_stub_frame_unwind_cache (struct frame_info
*this_frame
,
2627 void **this_prologue_cache
)
2629 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
2630 int word_size
= gdbarch_ptr_bit (gdbarch
) / 8;
2631 struct s390_stub_unwind_cache
*info
;
2634 if (*this_prologue_cache
)
2635 return (struct s390_stub_unwind_cache
*) *this_prologue_cache
;
2637 info
= FRAME_OBSTACK_ZALLOC (struct s390_stub_unwind_cache
);
2638 *this_prologue_cache
= info
;
2639 info
->saved_regs
= trad_frame_alloc_saved_regs (this_frame
);
2641 /* The return address is in register %r14. */
2642 info
->saved_regs
[S390_PSWA_REGNUM
].realreg
= S390_RETADDR_REGNUM
;
2644 /* Retrieve stack pointer and determine our frame base. */
2645 reg
= get_frame_register_unsigned (this_frame
, S390_SP_REGNUM
);
2646 info
->frame_base
= reg
+ 16*word_size
+ 32;
2651 /* Implement this_id frame_unwind method for s390_stub_frame_unwind. */
2654 s390_stub_frame_this_id (struct frame_info
*this_frame
,
2655 void **this_prologue_cache
,
2656 struct frame_id
*this_id
)
2658 struct s390_stub_unwind_cache
*info
2659 = s390_stub_frame_unwind_cache (this_frame
, this_prologue_cache
);
2660 *this_id
= frame_id_build (info
->frame_base
, get_frame_pc (this_frame
));
2663 /* Implement prev_register frame_unwind method for s390_stub_frame_unwind. */
2665 static struct value
*
2666 s390_stub_frame_prev_register (struct frame_info
*this_frame
,
2667 void **this_prologue_cache
, int regnum
)
2669 struct s390_stub_unwind_cache
*info
2670 = s390_stub_frame_unwind_cache (this_frame
, this_prologue_cache
);
2671 return s390_trad_frame_prev_register (this_frame
, info
->saved_regs
, regnum
);
2674 /* Implement sniffer frame_unwind method for s390_stub_frame_unwind. */
2677 s390_stub_frame_sniffer (const struct frame_unwind
*self
,
2678 struct frame_info
*this_frame
,
2679 void **this_prologue_cache
)
2681 CORE_ADDR addr_in_block
;
2682 bfd_byte insn
[S390_MAX_INSTR_SIZE
];
2684 /* If the current PC points to non-readable memory, we assume we
2685 have trapped due to an invalid function pointer call. We handle
2686 the non-existing current function like a PLT stub. */
2687 addr_in_block
= get_frame_address_in_block (this_frame
);
2688 if (in_plt_section (addr_in_block
)
2689 || s390_readinstruction (insn
, get_frame_pc (this_frame
)) < 0)
2694 /* S390 stub frame unwinder. */
2696 static const struct frame_unwind s390_stub_frame_unwind
= {
2698 default_frame_unwind_stop_reason
,
2699 s390_stub_frame_this_id
,
2700 s390_stub_frame_prev_register
,
2702 s390_stub_frame_sniffer
2705 /* Frame base handling. */
2708 s390_frame_base_address (struct frame_info
*this_frame
, void **this_cache
)
2710 struct s390_unwind_cache
*info
2711 = s390_frame_unwind_cache (this_frame
, this_cache
);
2712 return info
->frame_base
;
2716 s390_local_base_address (struct frame_info
*this_frame
, void **this_cache
)
2718 struct s390_unwind_cache
*info
2719 = s390_frame_unwind_cache (this_frame
, this_cache
);
2720 return info
->local_base
;
2723 static const struct frame_base s390_frame_base
= {
2725 s390_frame_base_address
,
2726 s390_local_base_address
,
2727 s390_local_base_address
2730 /* Process record-replay */
2732 /* Takes the intermediate sum of address calculations and masks off upper
2733 bits according to current addressing mode. */
2736 s390_record_address_mask (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2739 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2740 ULONGEST pswm
, pswa
;
2742 if (tdep
->abi
== ABI_LINUX_S390
)
2744 regcache_raw_read_unsigned (regcache
, S390_PSWA_REGNUM
, &pswa
);
2745 am
= pswa
>> 31 & 1;
2749 regcache_raw_read_unsigned (regcache
, S390_PSWM_REGNUM
, &pswm
);
2750 am
= pswm
>> 31 & 3;
2755 return val
& 0xffffff;
2757 return val
& 0x7fffffff;
2761 fprintf_unfiltered (gdb_stdlog
, "Warning: Addressing mode %d used.", am
);
2766 /* Calculates memory address using pre-calculated index, raw instruction word
2767 with b and d/dl fields, and raw instruction byte with dh field. Index and
2768 dh should be set to 0 if unused. */
2771 s390_record_calc_disp_common (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2772 ULONGEST x
, uint16_t bd
, int8_t dh
)
2774 uint8_t rb
= bd
>> 12 & 0xf;
2775 int32_t d
= (bd
& 0xfff) | ((int32_t)dh
<< 12);
2777 CORE_ADDR res
= d
+ x
;
2780 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ rb
, &b
);
2783 return s390_record_address_mask (gdbarch
, regcache
, res
);
2786 /* Calculates memory address using raw x, b + d/dl, dh fields from
2787 instruction. rx and dh should be set to 0 if unused. */
2790 s390_record_calc_disp (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2791 uint8_t rx
, uint16_t bd
, int8_t dh
)
2795 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ rx
, &x
);
2796 return s390_record_calc_disp_common (gdbarch
, regcache
, x
, bd
, dh
);
2799 /* Calculates memory address for VSCE[GF] instructions. */
2802 s390_record_calc_disp_vsce (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2803 uint8_t vx
, uint8_t el
, uint8_t es
, uint16_t bd
,
2804 int8_t dh
, CORE_ADDR
*res
)
2806 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2807 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2810 if (tdep
->v0_full_regnum
== -1 || el
* es
>= 16)
2813 regcache
->cooked_read (tdep
->v0_full_regnum
+ vx
, buf
);
2815 regcache
->raw_read (S390_V16_REGNUM
+ vx
- 16, buf
);
2816 x
= extract_unsigned_integer (buf
+ el
* es
, es
, byte_order
);
2817 *res
= s390_record_calc_disp_common (gdbarch
, regcache
, x
, bd
, dh
);
2821 /* Calculates memory address for instructions with relative long addressing. */
2824 s390_record_calc_rl (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2825 CORE_ADDR addr
, uint16_t i1
, uint16_t i2
)
2827 int32_t ri
= i1
<< 16 | i2
;
2828 return s390_record_address_mask (gdbarch
, regcache
, addr
+ (LONGEST
)ri
* 2);
2831 /* Population count helper. */
2833 static int s390_popcnt (unsigned int x
) {
2844 /* Record 64-bit register. */
2847 s390_record_gpr_g (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
2849 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2850 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
2852 if (tdep
->abi
== ABI_LINUX_S390
)
2853 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
2858 /* Record high 32 bits of a register. */
2861 s390_record_gpr_h (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
2863 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2864 if (tdep
->abi
== ABI_LINUX_S390
)
2866 if (record_full_arch_list_add_reg (regcache
, S390_R0_UPPER_REGNUM
+ i
))
2871 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
2877 /* Record vector register. */
2880 s390_record_vr (struct gdbarch
*gdbarch
, struct regcache
*regcache
, int i
)
2884 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ i
))
2886 if (record_full_arch_list_add_reg (regcache
, S390_V0_LOWER_REGNUM
+ i
))
2891 if (record_full_arch_list_add_reg (regcache
, S390_V16_REGNUM
+ i
- 16))
2897 /* Implement process_record gdbarch method. */
2900 s390_process_record (struct gdbarch
*gdbarch
, struct regcache
*regcache
,
2903 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
2904 uint16_t insn
[3] = {0};
2905 /* Instruction as bytes. */
2907 /* Instruction as nibbles. */
2909 /* Instruction vector registers. */
2911 CORE_ADDR oaddr
, oaddr2
, oaddr3
;
2914 /* if EX/EXRL instruction used, here's the reg parameter */
2916 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2918 /* Attempting to use EX or EXRL jumps back here */
2921 /* Read instruction. */
2922 insn
[0] = read_memory_unsigned_integer (addr
, 2, byte_order
);
2923 /* If execute was involved, do the adjustment. */
2925 insn
[0] |= ex
& 0xff;
2926 /* Two highest bits determine instruction size. */
2927 if (insn
[0] >= 0x4000)
2928 insn
[1] = read_memory_unsigned_integer (addr
+2, 2, byte_order
);
2930 /* Not necessary, but avoids uninitialized variable warnings. */
2932 if (insn
[0] >= 0xc000)
2933 insn
[2] = read_memory_unsigned_integer (addr
+4, 2, byte_order
);
2936 /* Split instruction into bytes and nibbles. */
2937 for (i
= 0; i
< 3; i
++)
2939 ibyte
[i
*2] = insn
[i
] >> 8 & 0xff;
2940 ibyte
[i
*2+1] = insn
[i
] & 0xff;
2942 for (i
= 0; i
< 6; i
++)
2944 inib
[i
*2] = ibyte
[i
] >> 4 & 0xf;
2945 inib
[i
*2+1] = ibyte
[i
] & 0xf;
2947 /* Compute vector registers, if applicable. */
2948 ivec
[0] = (inib
[9] >> 3 & 1) << 4 | inib
[2];
2949 ivec
[1] = (inib
[9] >> 2 & 1) << 4 | inib
[3];
2950 ivec
[2] = (inib
[9] >> 1 & 1) << 4 | inib
[4];
2951 ivec
[3] = (inib
[9] >> 0 & 1) << 4 | inib
[8];
2955 /* 0x00 undefined */
2958 /* E-format instruction */
2961 /* 0x00 undefined */
2962 /* 0x01 unsupported: PR - program return */
2963 /* 0x02 unsupported: UPT */
2964 /* 0x03 undefined */
2965 /* 0x04 privileged: PTFF - perform timing facility function */
2966 /* 0x05-0x06 undefined */
2967 /* 0x07 privileged: SCKPF - set clock programmable field */
2968 /* 0x08-0x09 undefined */
2970 case 0x0a: /* PFPO - perform floating point operation */
2971 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
2972 if (!(tmp
& 0x80000000u
))
2974 uint8_t ofc
= tmp
>> 16 & 0xff;
2977 case 0x00: /* HFP32 */
2978 case 0x01: /* HFP64 */
2979 case 0x05: /* BFP32 */
2980 case 0x06: /* BFP64 */
2981 case 0x08: /* DFP32 */
2982 case 0x09: /* DFP64 */
2983 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
))
2986 case 0x02: /* HFP128 */
2987 case 0x07: /* BFP128 */
2988 case 0x0a: /* DFP128 */
2989 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
))
2991 if (record_full_arch_list_add_reg (regcache
, S390_F2_REGNUM
))
2995 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PFPO OFC %02x at %s.\n",
2996 ofc
, paddress (gdbarch
, addr
));
3000 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3003 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
3005 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3009 case 0x0b: /* TAM - test address mode */
3010 case 0x0c: /* SAM24 - set address mode 24 */
3011 case 0x0d: /* SAM31 - set address mode 31 */
3012 case 0x0e: /* SAM64 - set address mode 64 */
3013 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3017 /* 0x0f-0xfe undefined */
3019 /* 0xff unsupported: TRAP */
3026 /* 0x02 undefined */
3027 /* 0x03 undefined */
3029 case 0x04: /* SPM - set program mask */
3030 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3034 case 0x05: /* BALR - branch and link */
3035 case 0x45: /* BAL - branch and link */
3036 case 0x06: /* BCTR - branch on count */
3037 case 0x46: /* BCT - branch on count */
3038 case 0x0d: /* BASR - branch and save */
3039 case 0x4d: /* BAS - branch and save */
3040 case 0x84: /* BRXH - branch relative on index high */
3041 case 0x85: /* BRXLE - branch relative on index low or equal */
3042 case 0x86: /* BXH - branch on index high */
3043 case 0x87: /* BXLE - branch on index low or equal */
3044 /* BA[SL]* use native-size destination for linkage info, BCT*, BRX*, BX*
3045 use 32-bit destination as counter. */
3046 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3050 case 0x07: /* BCR - branch on condition */
3051 case 0x47: /* BC - branch on condition */
3052 /* No effect other than PC transfer. */
3055 /* 0x08 undefined */
3056 /* 0x09 undefined */
3059 /* SVC - supervisor call */
3060 if (tdep
->s390_syscall_record
!= NULL
)
3062 if (tdep
->s390_syscall_record (regcache
, ibyte
[1]))
3067 printf_unfiltered (_("no syscall record support\n"));
3072 case 0x0b: /* BSM - branch and set mode */
3074 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3076 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3080 case 0x0c: /* BASSM - branch and save and set mode */
3081 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3083 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3087 case 0x0e: /* MVCL - move long [interruptible] */
3088 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
3089 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3090 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
3092 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3094 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3096 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3098 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3100 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3102 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3106 case 0x0f: /* CLCL - compare logical long [interruptible] */
3107 case 0xa9: /* CLCLE - compare logical long extended [partial] */
3108 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3110 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3112 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3114 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3116 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3120 case 0x10: /* LPR - load positive */
3121 case 0x11: /* LNR - load negative */
3122 case 0x12: /* LTR - load and test */
3123 case 0x13: /* LCR - load complement */
3124 case 0x14: /* NR - and */
3125 case 0x16: /* OR - or */
3126 case 0x17: /* XR - xor */
3127 case 0x1a: /* AR - add */
3128 case 0x1b: /* SR - subtract */
3129 case 0x1e: /* ALR - add logical */
3130 case 0x1f: /* SLR - subtract logical */
3131 case 0x54: /* N - and */
3132 case 0x56: /* O - or */
3133 case 0x57: /* X - xor */
3134 case 0x5a: /* A - add */
3135 case 0x5b: /* S - subtract */
3136 case 0x5e: /* AL - add logical */
3137 case 0x5f: /* SL - subtract logical */
3138 case 0x4a: /* AH - add halfword */
3139 case 0x4b: /* SH - subtract halfword */
3140 case 0x8a: /* SRA - shift right single */
3141 case 0x8b: /* SLA - shift left single */
3142 case 0xbf: /* ICM - insert characters under mask */
3143 /* 32-bit destination + flags */
3144 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3146 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3150 case 0x15: /* CLR - compare logical */
3151 case 0x55: /* CL - compare logical */
3152 case 0x19: /* CR - compare */
3153 case 0x29: /* CDR - compare */
3154 case 0x39: /* CER - compare */
3155 case 0x49: /* CH - compare halfword */
3156 case 0x59: /* C - compare */
3157 case 0x69: /* CD - compare */
3158 case 0x79: /* CE - compare */
3159 case 0x91: /* TM - test under mask */
3160 case 0x95: /* CLI - compare logical */
3161 case 0xbd: /* CLM - compare logical under mask */
3162 case 0xd5: /* CLC - compare logical */
3163 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3167 case 0x18: /* LR - load */
3168 case 0x48: /* LH - load halfword */
3169 case 0x58: /* L - load */
3170 case 0x41: /* LA - load address */
3171 case 0x43: /* IC - insert character */
3172 case 0x4c: /* MH - multiply halfword */
3173 case 0x71: /* MS - multiply single */
3174 case 0x88: /* SRL - shift right single logical */
3175 case 0x89: /* SLL - shift left single logical */
3176 /* 32-bit, 8-bit (IC), or native width (LA) destination, no flags */
3177 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3181 case 0x1c: /* MR - multiply */
3182 case 0x5c: /* M - multiply */
3183 case 0x1d: /* DR - divide */
3184 case 0x5d: /* D - divide */
3185 case 0x8c: /* SRDL - shift right double logical */
3186 case 0x8d: /* SLDL - shift left double logical */
3187 /* 32-bit pair destination, no flags */
3188 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3190 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3194 case 0x20: /* LPDR - load positive */
3195 case 0x30: /* LPER - load positive */
3196 case 0x21: /* LNDR - load negative */
3197 case 0x31: /* LNER - load negative */
3198 case 0x22: /* LTDR - load and test */
3199 case 0x32: /* LTER - load and test */
3200 case 0x23: /* LCDR - load complement */
3201 case 0x33: /* LCER - load complement */
3202 case 0x2a: /* ADR - add */
3203 case 0x3a: /* AER - add */
3204 case 0x6a: /* AD - add */
3205 case 0x7a: /* AE - add */
3206 case 0x2b: /* SDR - subtract */
3207 case 0x3b: /* SER - subtract */
3208 case 0x6b: /* SD - subtract */
3209 case 0x7b: /* SE - subtract */
3210 case 0x2e: /* AWR - add unnormalized */
3211 case 0x3e: /* AUR - add unnormalized */
3212 case 0x6e: /* AW - add unnormalized */
3213 case 0x7e: /* AU - add unnormalized */
3214 case 0x2f: /* SWR - subtract unnormalized */
3215 case 0x3f: /* SUR - subtract unnormalized */
3216 case 0x6f: /* SW - subtract unnormalized */
3217 case 0x7f: /* SU - subtract unnormalized */
3218 /* float destination + flags */
3219 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3221 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3225 case 0x24: /* HDR - halve */
3226 case 0x34: /* HER - halve */
3227 case 0x25: /* LDXR - load rounded */
3228 case 0x35: /* LEDR - load rounded */
3229 case 0x28: /* LDR - load */
3230 case 0x38: /* LER - load */
3231 case 0x68: /* LD - load */
3232 case 0x78: /* LE - load */
3233 case 0x2c: /* MDR - multiply */
3234 case 0x3c: /* MDER - multiply */
3235 case 0x6c: /* MD - multiply */
3236 case 0x7c: /* MDE - multiply */
3237 case 0x2d: /* DDR - divide */
3238 case 0x3d: /* DER - divide */
3239 case 0x6d: /* DD - divide */
3240 case 0x7d: /* DE - divide */
3241 /* float destination, no flags */
3242 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3246 case 0x26: /* MXR - multiply */
3247 case 0x27: /* MXDR - multiply */
3248 case 0x67: /* MXD - multiply */
3249 /* float pair destination, no flags */
3250 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3252 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
3256 case 0x36: /* AXR - add */
3257 case 0x37: /* SXR - subtract */
3258 /* float pair destination + flags */
3259 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
3261 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
3263 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3267 case 0x40: /* STH - store halfword */
3268 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
3269 if (record_full_arch_list_add_mem (oaddr
, 2))
3273 case 0x42: /* STC - store character */
3274 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
3275 if (record_full_arch_list_add_mem (oaddr
, 1))
3279 case 0x44: /* EX - execute */
3282 fprintf_unfiltered (gdb_stdlog
, "Warning: Double execute at %s.\n",
3283 paddress (gdbarch
, addr
));
3286 addr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
3289 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
3298 case 0x4e: /* CVD - convert to decimal */
3299 case 0x60: /* STD - store */
3300 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
3301 if (record_full_arch_list_add_mem (oaddr
, 8))
3305 case 0x4f: /* CVB - convert to binary */
3306 /* 32-bit gpr destination + FPC (DXC write) */
3307 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3309 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3313 case 0x50: /* ST - store */
3314 case 0x70: /* STE - store */
3315 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
3316 if (record_full_arch_list_add_mem (oaddr
, 4))
3320 case 0x51: /* LAE - load address extended */
3321 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3323 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[2]))
3327 /* 0x52 undefined */
3328 /* 0x53 undefined */
3330 /* 0x61-0x66 undefined */
3332 /* 0x72-0x77 undefined */
3334 /* 0x80 privileged: SSM - set system mask */
3335 /* 0x81 undefined */
3336 /* 0x82 privileged: LPSW - load PSW */
3337 /* 0x83 privileged: diagnose */
3339 case 0x8e: /* SRDA - shift right double */
3340 case 0x8f: /* SLDA - shift left double */
3341 /* 32-bit pair destination + flags */
3342 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3344 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3346 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3350 case 0x90: /* STM - store multiple */
3351 case 0x9b: /* STAM - store access multiple */
3352 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3353 if (inib
[2] <= inib
[3])
3354 n
= inib
[3] - inib
[2] + 1;
3356 n
= inib
[3] + 0x10 - inib
[2] + 1;
3357 if (record_full_arch_list_add_mem (oaddr
, n
* 4))
3361 case 0x92: /* MVI - move */
3362 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3363 if (record_full_arch_list_add_mem (oaddr
, 1))
3367 case 0x93: /* TS - test and set */
3368 case 0x94: /* NI - and */
3369 case 0x96: /* OI - or */
3370 case 0x97: /* XI - xor */
3371 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3372 if (record_full_arch_list_add_mem (oaddr
, 1))
3374 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3378 case 0x98: /* LM - load multiple */
3379 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
3380 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
3382 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3386 /* 0x99 privileged: TRACE */
3388 case 0x9a: /* LAM - load access multiple */
3389 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
3390 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
3392 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[3]))
3396 /* 0x9c-0x9f privileged and obsolete (old I/O) */
3397 /* 0xa0-0xa4 undefined */
3401 /* RI-format instruction */
3402 switch (ibyte
[0] << 4 | inib
[3])
3404 case 0xa50: /* IIHH - insert immediate */
3405 case 0xa51: /* IIHL - insert immediate */
3406 /* high 32-bit destination */
3407 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
3411 case 0xa52: /* IILH - insert immediate */
3412 case 0xa53: /* IILL - insert immediate */
3413 case 0xa75: /* BRAS - branch relative and save */
3414 case 0xa76: /* BRCT - branch relative on count */
3415 case 0xa78: /* LHI - load halfword immediate */
3416 case 0xa7c: /* MHI - multiply halfword immediate */
3417 /* 32-bit or native destination */
3418 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3422 case 0xa54: /* NIHH - and immediate */
3423 case 0xa55: /* NIHL - and immediate */
3424 case 0xa58: /* OIHH - or immediate */
3425 case 0xa59: /* OIHL - or immediate */
3426 /* high 32-bit destination + flags */
3427 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
3429 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3433 case 0xa56: /* NILH - and immediate */
3434 case 0xa57: /* NILL - and immediate */
3435 case 0xa5a: /* OILH - or immediate */
3436 case 0xa5b: /* OILL - or immediate */
3437 case 0xa7a: /* AHI - add halfword immediate */
3438 /* 32-bit destination + flags */
3439 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3441 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3445 case 0xa5c: /* LLIHH - load logical immediate */
3446 case 0xa5d: /* LLIHL - load logical immediate */
3447 case 0xa5e: /* LLILH - load logical immediate */
3448 case 0xa5f: /* LLILL - load logical immediate */
3449 case 0xa77: /* BRCTG - branch relative on count */
3450 case 0xa79: /* LGHI - load halfword immediate */
3451 case 0xa7d: /* MGHI - multiply halfword immediate */
3452 /* 64-bit destination */
3453 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
3457 case 0xa70: /* TMLH - test under mask */
3458 case 0xa71: /* TMLL - test under mask */
3459 case 0xa72: /* TMHH - test under mask */
3460 case 0xa73: /* TMHL - test under mask */
3461 case 0xa7e: /* CHI - compare halfword immediate */
3462 case 0xa7f: /* CGHI - compare halfword immediate */
3464 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3468 case 0xa74: /* BRC - branch relative on condition */
3469 /* no register change */
3472 case 0xa7b: /* AGHI - add halfword immediate */
3473 /* 64-bit destination + flags */
3474 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
3476 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3485 /* 0xa6 undefined */
3487 case 0xa8: /* MVCLE - move long extended [partial] */
3488 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
3489 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3490 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
3491 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3493 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
3495 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
3497 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
3499 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
3501 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3505 /* 0xaa-0xab undefined */
3506 /* 0xac privileged: STNSM - store then and system mask */
3507 /* 0xad privileged: STOSM - store then or system mask */
3508 /* 0xae privileged: SIGP - signal processor */
3509 /* 0xaf unsupported: MC - monitor call */
3510 /* 0xb0 undefined */
3511 /* 0xb1 privileged: LRA - load real address */
3516 /* S/RRD/RRE/RRF/IE-format instruction */
3519 /* 0xb200-0xb204 undefined or privileged */
3521 case 0xb205: /* STCK - store clock */
3522 case 0xb27c: /* STCKF - store clock fast */
3523 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3524 if (record_full_arch_list_add_mem (oaddr
, 8))
3526 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3530 /* 0xb206-0xb219 undefined, privileged, or unsupported */
3531 /* 0xb21a unsupported: CFC */
3532 /* 0xb21b-0xb221 undefined or privileged */
3534 case 0xb222: /* IPM - insert program mask */
3535 case 0xb24f: /* EAR - extract access */
3536 case 0xb252: /* MSR - multiply single */
3537 case 0xb2ec: /* ETND - extract transaction nesting depth */
3538 case 0xb38c: /* EFPC - extract fpc */
3539 case 0xb91f: /* LRVR - load reversed */
3540 case 0xb926: /* LBR - load byte */
3541 case 0xb927: /* LHR - load halfword */
3542 case 0xb994: /* LLCR - load logical character */
3543 case 0xb995: /* LLHR - load logical halfword */
3544 case 0xb9f2: /* LOCR - load on condition */
3545 /* 32-bit gpr destination */
3546 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3550 /* 0xb223-0xb22c privileged or unsupported */
3552 case 0xb22d: /* DXR - divide */
3553 case 0xb325: /* LXDR - load lengthened */
3554 case 0xb326: /* LXER - load lengthened */
3555 case 0xb336: /* SQXR - square root */
3556 case 0xb365: /* LXR - load */
3557 case 0xb367: /* FIXR - load fp integer */
3558 case 0xb376: /* LZXR - load zero */
3559 case 0xb3b6: /* CXFR - convert from fixed */
3560 case 0xb3c6: /* CXGR - convert from fixed */
3561 case 0xb3fe: /* IEXTR - insert biased exponent */
3562 /* float pair destination */
3563 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3565 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
3569 /* 0xb22e-0xb240 undefined, privileged, or unsupported */
3571 case 0xb241: /* CKSM - checksum [partial] */
3572 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3574 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
3576 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
3578 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3582 /* 0xb242-0xb243 undefined */
3584 case 0xb244: /* SQDR - square root */
3585 case 0xb245: /* SQER - square root */
3586 case 0xb324: /* LDER - load lengthened */
3587 case 0xb337: /* MEER - multiply */
3588 case 0xb366: /* LEXR - load rounded */
3589 case 0xb370: /* LPDFR - load positive */
3590 case 0xb371: /* LNDFR - load negative */
3591 case 0xb372: /* CSDFR - copy sign */
3592 case 0xb373: /* LCDFR - load complement */
3593 case 0xb374: /* LZER - load zero */
3594 case 0xb375: /* LZDR - load zero */
3595 case 0xb377: /* FIER - load fp integer */
3596 case 0xb37f: /* FIDR - load fp integer */
3597 case 0xb3b4: /* CEFR - convert from fixed */
3598 case 0xb3b5: /* CDFR - convert from fixed */
3599 case 0xb3c1: /* LDGR - load fpr from gr */
3600 case 0xb3c4: /* CEGR - convert from fixed */
3601 case 0xb3c5: /* CDGR - convert from fixed */
3602 case 0xb3f6: /* IEDTR - insert biased exponent */
3603 /* float destination */
3604 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3608 /* 0xb246-0xb24c: privileged or unsupported */
3610 case 0xb24d: /* CPYA - copy access */
3611 case 0xb24e: /* SAR - set access */
3612 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[6]))
3616 /* 0xb250-0xb251 undefined or privileged */
3617 /* 0xb253-0xb254 undefined or privileged */
3619 case 0xb255: /* MVST - move string [partial] */
3624 /* Read ending byte. */
3625 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
3627 /* Get address of second operand. */
3628 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[7], &tmp
);
3629 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3630 /* Search for ending byte and compute length. */
3633 if (target_read_memory (oaddr
, &cur
, 1))
3636 } while (cur
!= end
);
3637 /* Get address of first operand and record it. */
3638 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
3639 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3640 if (record_full_arch_list_add_mem (oaddr
, num
))
3642 /* Record the registers. */
3643 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3645 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
3647 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3652 /* 0xb256 undefined */
3654 case 0xb257: /* CUSE - compare until substring equal [interruptible] */
3655 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3657 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
3659 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
3661 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
3663 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3667 /* 0xb258-0xb25c undefined, privileged, or unsupported */
3669 case 0xb25d: /* CLST - compare logical string [partial] */
3670 case 0xb25e: /* SRST - search string [partial] */
3671 case 0xb9be: /* SRSTU - search string unicode [partial] */
3672 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3674 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
3676 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3680 /* 0xb25f-0xb262 undefined */
3682 case 0xb263: /* CMPSC - compression call [interruptible] */
3683 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
3684 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3685 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
3686 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3688 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3690 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
3692 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
3694 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
3696 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
3698 /* DXC may be written */
3699 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3701 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3705 /* 0xb264-0xb277 undefined, privileged, or unsupported */
3707 case 0xb278: /* STCKE - store clock extended */
3708 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3709 if (record_full_arch_list_add_mem (oaddr
, 16))
3711 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3715 /* 0xb279-0xb27b undefined or unsupported */
3716 /* 0xb27d-0xb298 undefined or privileged */
3718 case 0xb299: /* SRNM - set rounding mode */
3719 case 0xb2b8: /* SRNMB - set bfp rounding mode */
3720 case 0xb2b9: /* SRNMT - set dfp rounding mode */
3721 case 0xb29d: /* LFPC - load fpc */
3722 case 0xb2bd: /* LFAS - load fpc and signal */
3723 case 0xb384: /* SFPC - set fpc */
3724 case 0xb385: /* SFASR - set fpc and signal */
3725 case 0xb960: /* CGRT - compare and trap */
3726 case 0xb961: /* CLGRT - compare logical and trap */
3727 case 0xb972: /* CRT - compare and trap */
3728 case 0xb973: /* CLRT - compare logical and trap */
3729 /* fpc only - including possible DXC write for trapping insns */
3730 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3734 /* 0xb29a-0xb29b undefined */
3736 case 0xb29c: /* STFPC - store fpc */
3737 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3738 if (record_full_arch_list_add_mem (oaddr
, 4))
3742 /* 0xb29e-0xb2a4 undefined */
3744 case 0xb2a5: /* TRE - translate extended [partial] */
3745 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
3746 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3747 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
3748 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3750 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3752 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
3754 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3758 case 0xb2a6: /* CU21 - convert UTF-16 to UTF-8 [partial] */
3759 case 0xb2a7: /* CU12 - convert UTF-8 to UTF-16 [partial] */
3760 case 0xb9b0: /* CU14 - convert UTF-8 to UTF-32 [partial] */
3761 case 0xb9b1: /* CU24 - convert UTF-16 to UTF-32 [partial] */
3762 case 0xb9b2: /* CU41 - convert UTF-32 to UTF-8 [partial] */
3763 case 0xb9b3: /* CU42 - convert UTF-32 to UTF-16 [partial] */
3764 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
3765 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
3766 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
3767 if (record_full_arch_list_add_mem (oaddr
, tmp
))
3769 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
3771 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
3773 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
3775 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
3777 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3781 /* 0xb2a8-0xb2af undefined */
3783 case 0xb2b0: /* STFLE - store facility list extended */
3784 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
3785 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
3787 if (record_full_arch_list_add_mem (oaddr
, 8 * (tmp
+ 1)))
3789 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
))
3791 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3795 /* 0xb2b1-0xb2b7 undefined or privileged */
3796 /* 0xb2ba-0xb2bc undefined */
3797 /* 0xb2be-0xb2e7 undefined */
3798 /* 0xb2e9-0xb2eb undefined */
3799 /* 0xb2ed-0xb2f7 undefined */
3800 /* 0xb2f8 unsupported: TEND */
3801 /* 0xb2f9 undefined */
3803 case 0xb2e8: /* PPA - perform processor assist */
3804 case 0xb2fa: /* NIAI - next instruction access intent */
3805 /* no visible effects */
3808 /* 0xb2fb undefined */
3809 /* 0xb2fc unsupported: TABORT */
3810 /* 0xb2fd-0xb2fe undefined */
3811 /* 0xb2ff unsupported: TRAP */
3813 case 0xb300: /* LPEBR - load positive */
3814 case 0xb301: /* LNEBR - load negative */
3815 case 0xb303: /* LCEBR - load complement */
3816 case 0xb310: /* LPDBR - load positive */
3817 case 0xb311: /* LNDBR - load negative */
3818 case 0xb313: /* LCDBR - load complement */
3819 case 0xb350: /* TBEDR - convert hfp to bfp */
3820 case 0xb351: /* TBDR - convert hfp to bfp */
3821 case 0xb358: /* THDER - convert bfp to hfp */
3822 case 0xb359: /* THDR - convert bfp to hfp */
3823 /* float destination + flags */
3824 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3826 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3830 case 0xb304: /* LDEBR - load lengthened */
3831 case 0xb30c: /* MDEBR - multiply */
3832 case 0xb30d: /* DEBR - divide */
3833 case 0xb314: /* SQEBR - square root */
3834 case 0xb315: /* SQDBR - square root */
3835 case 0xb317: /* MEEBR - multiply */
3836 case 0xb31c: /* MDBR - multiply */
3837 case 0xb31d: /* DDBR - divide */
3838 case 0xb344: /* LEDBRA - load rounded */
3839 case 0xb345: /* LDXBRA - load rounded */
3840 case 0xb346: /* LEXBRA - load rounded */
3841 case 0xb357: /* FIEBRA - load fp integer */
3842 case 0xb35f: /* FIDBRA - load fp integer */
3843 case 0xb390: /* CELFBR - convert from logical */
3844 case 0xb391: /* CDLFBR - convert from logical */
3845 case 0xb394: /* CEFBR - convert from fixed */
3846 case 0xb395: /* CDFBR - convert from fixed */
3847 case 0xb3a0: /* CELGBR - convert from logical */
3848 case 0xb3a1: /* CDLGBR - convert from logical */
3849 case 0xb3a4: /* CEGBR - convert from fixed */
3850 case 0xb3a5: /* CDGBR - convert from fixed */
3851 case 0xb3d0: /* MDTR - multiply */
3852 case 0xb3d1: /* DDTR - divide */
3853 case 0xb3d4: /* LDETR - load lengthened */
3854 case 0xb3d5: /* LEDTR - load lengthened */
3855 case 0xb3d7: /* FIDTR - load fp integer */
3856 case 0xb3dd: /* LDXTR - load lengthened */
3857 case 0xb3f1: /* CDGTR - convert from fixed */
3858 case 0xb3f2: /* CDUTR - convert from unsigned packed */
3859 case 0xb3f3: /* CDSTR - convert from signed packed */
3860 case 0xb3f5: /* QADTR - quantize */
3861 case 0xb3f7: /* RRDTR - reround */
3862 case 0xb951: /* CDFTR - convert from fixed */
3863 case 0xb952: /* CDLGTR - convert from logical */
3864 case 0xb953: /* CDLFTR - convert from logical */
3865 /* float destination + fpc */
3866 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3868 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3872 case 0xb305: /* LXDBR - load lengthened */
3873 case 0xb306: /* LXEBR - load lengthened */
3874 case 0xb307: /* MXDBR - multiply */
3875 case 0xb316: /* SQXBR - square root */
3876 case 0xb34c: /* MXBR - multiply */
3877 case 0xb34d: /* DXBR - divide */
3878 case 0xb347: /* FIXBRA - load fp integer */
3879 case 0xb392: /* CXLFBR - convert from logical */
3880 case 0xb396: /* CXFBR - convert from fixed */
3881 case 0xb3a2: /* CXLGBR - convert from logical */
3882 case 0xb3a6: /* CXGBR - convert from fixed */
3883 case 0xb3d8: /* MXTR - multiply */
3884 case 0xb3d9: /* DXTR - divide */
3885 case 0xb3dc: /* LXDTR - load lengthened */
3886 case 0xb3df: /* FIXTR - load fp integer */
3887 case 0xb3f9: /* CXGTR - convert from fixed */
3888 case 0xb3fa: /* CXUTR - convert from unsigned packed */
3889 case 0xb3fb: /* CXSTR - convert from signed packed */
3890 case 0xb3fd: /* QAXTR - quantize */
3891 case 0xb3ff: /* RRXTR - reround */
3892 case 0xb959: /* CXFTR - convert from fixed */
3893 case 0xb95a: /* CXLGTR - convert from logical */
3894 case 0xb95b: /* CXLFTR - convert from logical */
3895 /* float pair destination + fpc */
3896 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3898 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
3900 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3904 case 0xb308: /* KEBR - compare and signal */
3905 case 0xb309: /* CEBR - compare */
3906 case 0xb318: /* KDBR - compare and signal */
3907 case 0xb319: /* CDBR - compare */
3908 case 0xb348: /* KXBR - compare and signal */
3909 case 0xb349: /* CXBR - compare */
3910 case 0xb3e0: /* KDTR - compare and signal */
3911 case 0xb3e4: /* CDTR - compare */
3912 case 0xb3e8: /* KXTR - compare and signal */
3913 case 0xb3ec: /* CXTR - compare */
3914 /* flags + fpc only */
3915 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3917 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3921 case 0xb302: /* LTEBR - load and test */
3922 case 0xb312: /* LTDBR - load and test */
3923 case 0xb30a: /* AEBR - add */
3924 case 0xb30b: /* SEBR - subtract */
3925 case 0xb31a: /* ADBR - add */
3926 case 0xb31b: /* SDBR - subtract */
3927 case 0xb3d2: /* ADTR - add */
3928 case 0xb3d3: /* SDTR - subtract */
3929 case 0xb3d6: /* LTDTR - load and test */
3930 /* float destination + flags + fpc */
3931 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3933 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3935 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3939 case 0xb30e: /* MAEBR - multiply and add */
3940 case 0xb30f: /* MSEBR - multiply and subtract */
3941 case 0xb31e: /* MADBR - multiply and add */
3942 case 0xb31f: /* MSDBR - multiply and subtract */
3943 /* float destination [RRD] + fpc */
3944 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
3946 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
3950 /* 0xb320-0xb323 undefined */
3951 /* 0xb327-0xb32d undefined */
3953 case 0xb32e: /* MAER - multiply and add */
3954 case 0xb32f: /* MSER - multiply and subtract */
3955 case 0xb338: /* MAYLR - multiply and add unnormalized */
3956 case 0xb339: /* MYLR - multiply unnormalized */
3957 case 0xb33c: /* MAYHR - multiply and add unnormalized */
3958 case 0xb33d: /* MYHR - multiply unnormalized */
3959 case 0xb33e: /* MADR - multiply and add */
3960 case 0xb33f: /* MSDR - multiply and subtract */
3961 /* float destination [RRD] */
3962 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
3966 /* 0xb330-0xb335 undefined */
3968 case 0xb33a: /* MAYR - multiply and add unnormalized */
3969 case 0xb33b: /* MYR - multiply unnormalized */
3970 /* float pair destination [RRD] */
3971 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
3973 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[4] | 2)))
3977 case 0xb340: /* LPXBR - load positive */
3978 case 0xb341: /* LNXBR - load negative */
3979 case 0xb343: /* LCXBR - load complement */
3980 case 0xb360: /* LPXR - load positive */
3981 case 0xb361: /* LNXR - load negative */
3982 case 0xb362: /* LTXR - load and test */
3983 case 0xb363: /* LCXR - load complement */
3984 /* float pair destination + flags */
3985 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
3987 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
3989 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
3993 case 0xb342: /* LTXBR - load and test */
3994 case 0xb34a: /* AXBR - add */
3995 case 0xb34b: /* SXBR - subtract */
3996 case 0xb3da: /* AXTR - add */
3997 case 0xb3db: /* SXTR - subtract */
3998 case 0xb3de: /* LTXTR - load and test */
3999 /* float pair destination + flags + fpc */
4000 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4002 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[6] | 2)))
4004 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4006 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4010 /* 0xb34e-0xb34f undefined */
4011 /* 0xb352 undefined */
4013 case 0xb353: /* DIEBR - divide to integer */
4014 case 0xb35b: /* DIDBR - divide to integer */
4015 /* two float destinations + flags + fpc */
4016 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[4]))
4018 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[6]))
4020 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4022 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4026 /* 0xb354-0xb356 undefined */
4027 /* 0xb35a undefined */
4029 /* 0xb35c-0xb35e undefined */
4030 /* 0xb364 undefined */
4031 /* 0xb368 undefined */
4033 case 0xb369: /* CXR - compare */
4034 case 0xb3f4: /* CEDTR - compare biased exponent */
4035 case 0xb3fc: /* CEXTR - compare biased exponent */
4036 case 0xb920: /* CGR - compare */
4037 case 0xb921: /* CLGR - compare logical */
4038 case 0xb930: /* CGFR - compare */
4039 case 0xb931: /* CLGFR - compare logical */
4040 case 0xb9cd: /* CHHR - compare high */
4041 case 0xb9cf: /* CLHHR - compare logical high */
4042 case 0xb9dd: /* CHLR - compare high */
4043 case 0xb9df: /* CLHLR - compare logical high */
4045 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4049 /* 0xb36a-0xb36f undefined */
4050 /* 0xb377-0xb37e undefined */
4051 /* 0xb380-0xb383 undefined */
4052 /* 0xb386-0xb38b undefined */
4053 /* 0xb38d-0xb38f undefined */
4054 /* 0xb393 undefined */
4055 /* 0xb397 undefined */
4057 case 0xb398: /* CFEBR - convert to fixed */
4058 case 0xb399: /* CFDBR - convert to fixed */
4059 case 0xb39a: /* CFXBR - convert to fixed */
4060 case 0xb39c: /* CLFEBR - convert to logical */
4061 case 0xb39d: /* CLFDBR - convert to logical */
4062 case 0xb39e: /* CLFXBR - convert to logical */
4063 case 0xb941: /* CFDTR - convert to fixed */
4064 case 0xb949: /* CFXTR - convert to fixed */
4065 case 0xb943: /* CLFDTR - convert to logical */
4066 case 0xb94b: /* CLFXTR - convert to logical */
4067 /* 32-bit gpr destination + flags + fpc */
4068 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4070 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4072 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4076 /* 0xb39b undefined */
4077 /* 0xb39f undefined */
4079 /* 0xb3a3 undefined */
4080 /* 0xb3a7 undefined */
4082 case 0xb3a8: /* CGEBR - convert to fixed */
4083 case 0xb3a9: /* CGDBR - convert to fixed */
4084 case 0xb3aa: /* CGXBR - convert to fixed */
4085 case 0xb3ac: /* CLGEBR - convert to logical */
4086 case 0xb3ad: /* CLGDBR - convert to logical */
4087 case 0xb3ae: /* CLGXBR - convert to logical */
4088 case 0xb3e1: /* CGDTR - convert to fixed */
4089 case 0xb3e9: /* CGXTR - convert to fixed */
4090 case 0xb942: /* CLGDTR - convert to logical */
4091 case 0xb94a: /* CLGXTR - convert to logical */
4092 /* 64-bit gpr destination + flags + fpc */
4093 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4095 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4097 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4101 /* 0xb3ab undefined */
4102 /* 0xb3af-0xb3b3 undefined */
4103 /* 0xb3b7 undefined */
4105 case 0xb3b8: /* CFER - convert to fixed */
4106 case 0xb3b9: /* CFDR - convert to fixed */
4107 case 0xb3ba: /* CFXR - convert to fixed */
4108 case 0xb998: /* ALCR - add logical with carry */
4109 case 0xb999: /* SLBR - subtract logical with borrow */
4110 case 0xb9f4: /* NRK - and */
4111 case 0xb9f6: /* ORK - or */
4112 case 0xb9f7: /* XRK - xor */
4113 case 0xb9f8: /* ARK - add */
4114 case 0xb9f9: /* SRK - subtract */
4115 case 0xb9fa: /* ALRK - add logical */
4116 case 0xb9fb: /* SLRK - subtract logical */
4117 /* 32-bit gpr destination + flags */
4118 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4120 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4124 case 0xb3c8: /* CGER - convert to fixed */
4125 case 0xb3c9: /* CGDR - convert to fixed */
4126 case 0xb3ca: /* CGXR - convert to fixed */
4127 case 0xb900: /* LPGR - load positive */
4128 case 0xb901: /* LNGR - load negative */
4129 case 0xb902: /* LTGR - load and test */
4130 case 0xb903: /* LCGR - load complement */
4131 case 0xb908: /* AGR - add */
4132 case 0xb909: /* SGR - subtract */
4133 case 0xb90a: /* ALGR - add logical */
4134 case 0xb90b: /* SLGR - subtract logical */
4135 case 0xb910: /* LPGFR - load positive */
4136 case 0xb911: /* LNGFR - load negative */
4137 case 0xb912: /* LTGFR - load and test */
4138 case 0xb913: /* LCGFR - load complement */
4139 case 0xb918: /* AGFR - add */
4140 case 0xb919: /* SGFR - subtract */
4141 case 0xb91a: /* ALGFR - add logical */
4142 case 0xb91b: /* SLGFR - subtract logical */
4143 case 0xb980: /* NGR - and */
4144 case 0xb981: /* OGR - or */
4145 case 0xb982: /* XGR - xor */
4146 case 0xb988: /* ALCGR - add logical with carry */
4147 case 0xb989: /* SLBGR - subtract logical with borrow */
4148 case 0xb9e1: /* POPCNT - population count */
4149 case 0xb9e4: /* NGRK - and */
4150 case 0xb9e6: /* OGRK - or */
4151 case 0xb9e7: /* XGRK - xor */
4152 case 0xb9e8: /* AGRK - add */
4153 case 0xb9e9: /* SGRK - subtract */
4154 case 0xb9ea: /* ALGRK - add logical */
4155 case 0xb9eb: /* SLGRK - subtract logical */
4156 case 0xb9ed: /* MSGRKC - multiply single 64x64 -> 64 */
4157 case 0xb9fd: /* MSRKC - multiply single 32x32 -> 32 */
4158 /* 64-bit gpr destination + flags */
4159 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4161 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4165 /* 0xb3bb-0xb3c0 undefined */
4166 /* 0xb3c2-0xb3c3 undefined */
4167 /* 0xb3c7 undefined */
4168 /* 0xb3cb-0xb3cc undefined */
4170 case 0xb3cd: /* LGDR - load gr from fpr */
4171 case 0xb3e2: /* CUDTR - convert to unsigned packed */
4172 case 0xb3e3: /* CSDTR - convert to signed packed */
4173 case 0xb3e5: /* EEDTR - extract biased exponent */
4174 case 0xb3e7: /* ESDTR - extract significance */
4175 case 0xb3ed: /* EEXTR - extract biased exponent */
4176 case 0xb3ef: /* ESXTR - extract significance */
4177 case 0xb904: /* LGR - load */
4178 case 0xb906: /* LGBR - load byte */
4179 case 0xb907: /* LGHR - load halfword */
4180 case 0xb90c: /* MSGR - multiply single */
4181 case 0xb90f: /* LRVGR - load reversed */
4182 case 0xb914: /* LGFR - load */
4183 case 0xb916: /* LLGFR - load logical */
4184 case 0xb917: /* LLGTR - load logical thirty one bits */
4185 case 0xb91c: /* MSGFR - multiply single 64<32 */
4186 case 0xb946: /* BCTGR - branch on count */
4187 case 0xb984: /* LLGCR - load logical character */
4188 case 0xb985: /* LLGHR - load logical halfword */
4189 case 0xb9e2: /* LOCGR - load on condition */
4190 /* 64-bit gpr destination */
4191 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4195 /* 0xb3ce-0xb3cf undefined */
4196 /* 0xb3e6 undefined */
4198 case 0xb3ea: /* CUXTR - convert to unsigned packed */
4199 case 0xb3eb: /* CSXTR - convert to signed packed */
4200 case 0xb90d: /* DSGR - divide single */
4201 case 0xb91d: /* DSGFR - divide single */
4202 case 0xb986: /* MLGR - multiply logical */
4203 case 0xb987: /* DLGR - divide logical */
4204 case 0xb9ec: /* MGRK - multiply 64x64 -> 128 */
4205 /* 64-bit gpr pair destination */
4206 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4208 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6] | 1))
4212 /* 0xb3ee undefined */
4213 /* 0xb3f0 undefined */
4214 /* 0xb3f8 undefined */
4216 /* 0xb905 privileged */
4218 /* 0xb90e unsupported: EREGG */
4220 /* 0xb915 undefined */
4222 case 0xb91e: /* KMAC - compute message authentication code [partial] */
4223 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4224 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4225 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4229 case 0x00: /* KMAC-Query */
4230 if (record_full_arch_list_add_mem (oaddr
, 16))
4234 case 0x01: /* KMAC-DEA */
4235 case 0x02: /* KMAC-TDEA-128 */
4236 case 0x03: /* KMAC-TDEA-192 */
4237 case 0x09: /* KMAC-Encrypted-DEA */
4238 case 0x0a: /* KMAC-Encrypted-TDEA-128 */
4239 case 0x0b: /* KMAC-Encrypted-TDEA-192 */
4240 if (record_full_arch_list_add_mem (oaddr
, 8))
4244 case 0x12: /* KMAC-AES-128 */
4245 case 0x13: /* KMAC-AES-192 */
4246 case 0x14: /* KMAC-AES-256 */
4247 case 0x1a: /* KMAC-Encrypted-AES-128 */
4248 case 0x1b: /* KMAC-Encrypted-AES-192 */
4249 case 0x1c: /* KMAC-Encrypted-AES-256 */
4250 if (record_full_arch_list_add_mem (oaddr
, 16))
4255 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMAC function %02x at %s.\n",
4256 (int)tmp
, paddress (gdbarch
, addr
));
4261 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4263 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4266 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4270 /* 0xb922-0xb924 undefined */
4271 /* 0xb925 privileged */
4272 /* 0xb928 privileged */
4274 case 0xb929: /* KMA - cipher message with authentication */
4275 case 0xb92a: /* KMF - cipher message with cipher feedback [partial] */
4276 case 0xb92b: /* KMO - cipher message with output feedback [partial] */
4277 case 0xb92f: /* KMC - cipher message with chaining [partial] */
4278 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4279 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4280 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4284 case 0x00: /* KM*-Query */
4285 if (record_full_arch_list_add_mem (oaddr
, 16))
4289 case 0x01: /* KM*-DEA */
4290 case 0x02: /* KM*-TDEA-128 */
4291 case 0x03: /* KM*-TDEA-192 */
4292 case 0x09: /* KM*-Encrypted-DEA */
4293 case 0x0a: /* KM*-Encrypted-TDEA-128 */
4294 case 0x0b: /* KM*-Encrypted-TDEA-192 */
4295 if (record_full_arch_list_add_mem (oaddr
, 8))
4299 case 0x12: /* KM*-AES-128 */
4300 case 0x13: /* KM*-AES-192 */
4301 case 0x14: /* KM*-AES-256 */
4302 case 0x1a: /* KM*-Encrypted-AES-128 */
4303 case 0x1b: /* KM*-Encrypted-AES-192 */
4304 case 0x1c: /* KM*-Encrypted-AES-256 */
4305 if (record_full_arch_list_add_mem (oaddr
, 16))
4309 case 0x43: /* KMC-PRNG */
4310 /* Only valid for KMC. */
4311 if (insn
[0] == 0xb92f)
4313 if (record_full_arch_list_add_mem (oaddr
, 8))
4317 /* For other instructions... */
4320 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KM* function %02x at %s.\n",
4321 (int)tmp
, paddress (gdbarch
, addr
));
4326 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4327 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4328 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
4329 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
4331 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4333 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4335 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4338 if (tmp
!= 0 && insn
[0] == 0xb929)
4340 if (record_full_arch_list_add_reg (regcache
,
4341 S390_R0_REGNUM
+ inib
[4]))
4343 if (record_full_arch_list_add_reg (regcache
,
4344 S390_R0_REGNUM
+ (inib
[4] | 1)))
4347 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4351 case 0xb92c: /* PCC - perform cryptographic computation [partial] */
4352 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4353 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4354 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4358 case 0x00: /* PCC-Query */
4359 if (record_full_arch_list_add_mem (oaddr
, 16))
4363 case 0x01: /* PCC-Compute-Last-Block-CMAC-Using-DEA */
4364 case 0x02: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-128 */
4365 case 0x03: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-192 */
4366 case 0x09: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-DEA */
4367 case 0x0a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-128 */
4368 case 0x0b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-192 */
4369 if (record_full_arch_list_add_mem (oaddr
+ 0x10, 8))
4373 case 0x12: /* PCC-Compute-Last-Block-CMAC-Using-AES-128 */
4374 case 0x13: /* PCC-Compute-Last-Block-CMAC-Using-AES-192 */
4375 case 0x14: /* PCC-Compute-Last-Block-CMAC-Using-AES-256 */
4376 case 0x1a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-128 */
4377 case 0x1b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-192 */
4378 case 0x1c: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-256 */
4379 if (record_full_arch_list_add_mem (oaddr
+ 0x18, 16))
4383 case 0x32: /* PCC-Compute-XTS-Parameter-Using-AES-128 */
4384 if (record_full_arch_list_add_mem (oaddr
+ 0x30, 32))
4388 case 0x34: /* PCC-Compute-XTS-Parameter-Using-AES-256 */
4389 if (record_full_arch_list_add_mem (oaddr
+ 0x40, 32))
4393 case 0x3a: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-128 */
4394 if (record_full_arch_list_add_mem (oaddr
+ 0x50, 32))
4398 case 0x3c: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-256 */
4399 if (record_full_arch_list_add_mem (oaddr
+ 0x60, 32))
4404 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PCC function %02x at %s.\n",
4405 (int)tmp
, paddress (gdbarch
, addr
));
4408 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4412 case 0xb92d: /* KMCTR - cipher message with counter [partial] */
4413 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4414 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4415 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4419 case 0x00: /* KMCTR-Query */
4420 if (record_full_arch_list_add_mem (oaddr
, 16))
4424 case 0x01: /* KMCTR-DEA */
4425 case 0x02: /* KMCTR-TDEA-128 */
4426 case 0x03: /* KMCTR-TDEA-192 */
4427 case 0x09: /* KMCTR-Encrypted-DEA */
4428 case 0x0a: /* KMCTR-Encrypted-TDEA-128 */
4429 case 0x0b: /* KMCTR-Encrypted-TDEA-192 */
4430 case 0x12: /* KMCTR-AES-128 */
4431 case 0x13: /* KMCTR-AES-192 */
4432 case 0x14: /* KMCTR-AES-256 */
4433 case 0x1a: /* KMCTR-Encrypted-AES-128 */
4434 case 0x1b: /* KMCTR-Encrypted-AES-192 */
4435 case 0x1c: /* KMCTR-Encrypted-AES-256 */
4439 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMCTR function %02x at %s.\n",
4440 (int)tmp
, paddress (gdbarch
, addr
));
4445 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4446 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4447 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
4448 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
4450 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4452 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4454 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4456 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[4]))
4459 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4463 case 0xb92e: /* KM - cipher message [partial] */
4464 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4465 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4466 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4470 case 0x00: /* KM-Query */
4471 if (record_full_arch_list_add_mem (oaddr
, 16))
4475 case 0x01: /* KM-DEA */
4476 case 0x02: /* KM-TDEA-128 */
4477 case 0x03: /* KM-TDEA-192 */
4478 case 0x09: /* KM-Encrypted-DEA */
4479 case 0x0a: /* KM-Encrypted-TDEA-128 */
4480 case 0x0b: /* KM-Encrypted-TDEA-192 */
4481 case 0x12: /* KM-AES-128 */
4482 case 0x13: /* KM-AES-192 */
4483 case 0x14: /* KM-AES-256 */
4484 case 0x1a: /* KM-Encrypted-AES-128 */
4485 case 0x1b: /* KM-Encrypted-AES-192 */
4486 case 0x1c: /* KM-Encrypted-AES-256 */
4489 case 0x32: /* KM-XTS-AES-128 */
4490 if (record_full_arch_list_add_mem (oaddr
+ 0x10, 16))
4494 case 0x34: /* KM-XTS-AES-256 */
4495 if (record_full_arch_list_add_mem (oaddr
+ 0x20, 16))
4499 case 0x3a: /* KM-XTS-Encrypted-AES-128 */
4500 if (record_full_arch_list_add_mem (oaddr
+ 0x30, 16))
4504 case 0x3c: /* KM-XTS-Encrypted-AES-256 */
4505 if (record_full_arch_list_add_mem (oaddr
+ 0x40, 16))
4510 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KM function %02x at %s.\n",
4511 (int)tmp
, paddress (gdbarch
, addr
));
4516 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4517 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4518 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1), &tmp
);
4519 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
4521 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4523 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4525 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4528 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4532 /* 0xb932-0xb93b undefined */
4534 case 0xb93c: /* PPNO - perform pseudorandom number operation [partial] */
4535 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4536 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4537 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4541 case 0x00: /* PPNO-Query */
4542 case 0x80: /* PPNO-Query */
4543 if (record_full_arch_list_add_mem (oaddr
, 16))
4547 case 0x03: /* PPNO-SHA-512-DRNG - generate */
4548 if (record_full_arch_list_add_mem (oaddr
, 240))
4550 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4551 oaddr2
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4552 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4553 if (record_full_arch_list_add_mem (oaddr2
, tmp
))
4555 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4557 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4561 case 0x83: /* PPNO-SHA-512-DRNG - seed */
4562 if (record_full_arch_list_add_mem (oaddr
, 240))
4564 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4566 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4571 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PPNO function %02x at %s.\n",
4572 (int)tmp
, paddress (gdbarch
, addr
));
4575 /* DXC may be written */
4576 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
4578 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4582 /* 0xb93d undefined */
4584 case 0xb93e: /* KIMD - compute intermediate message digest [partial] */
4585 case 0xb93f: /* KLMD - compute last message digest [partial] */
4586 regcache_raw_read_unsigned (regcache
, S390_R1_REGNUM
, &tmp
);
4587 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4588 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4592 case 0x00: /* K*MD-Query */
4593 if (record_full_arch_list_add_mem (oaddr
, 16))
4597 case 0x01: /* K*MD-SHA-1 */
4598 if (record_full_arch_list_add_mem (oaddr
, 20))
4602 case 0x02: /* K*MD-SHA-256 */
4603 if (record_full_arch_list_add_mem (oaddr
, 32))
4607 case 0x03: /* K*MD-SHA-512 */
4608 if (record_full_arch_list_add_mem (oaddr
, 64))
4612 case 0x41: /* KIMD-GHASH */
4613 /* Only valid for KIMD. */
4614 if (insn
[0] == 0xb93e)
4616 if (record_full_arch_list_add_mem (oaddr
, 16))
4623 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown KMAC function %02x at %s.\n",
4624 (int)tmp
, paddress (gdbarch
, addr
));
4629 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4631 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[7] | 1)))
4634 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4638 /* 0xb940 undefined */
4639 /* 0xb944-0xb945 undefined */
4640 /* 0xb947-0xb948 undefined */
4641 /* 0xb94c-0xb950 undefined */
4642 /* 0xb954-0xb958 undefined */
4643 /* 0xb95c-0xb95f undefined */
4644 /* 0xb962-0xb971 undefined */
4645 /* 0xb974-0xb97f undefined */
4647 case 0xb983: /* FLOGR - find leftmost one */
4648 /* 64-bit gpr pair destination + flags */
4649 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6]))
4651 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[6] | 1))
4653 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4657 /* 0xb98a privileged */
4658 /* 0xb98b-0xb98c undefined */
4660 case 0xb98d: /* EPSW - extract psw */
4661 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4664 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4668 /* 0xb98e-0xb98f privileged */
4670 case 0xb990: /* TRTT - translate two to two [partial] */
4671 case 0xb991: /* TRTO - translate two to one [partial] */
4672 case 0xb992: /* TROT - translate one to two [partial] */
4673 case 0xb993: /* TROO - translate one to one [partial] */
4674 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[6], &tmp
);
4675 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
4676 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1), &tmp
);
4677 /* tmp is source length, we want destination length. Adjust. */
4678 if (insn
[0] == 0xb991)
4680 if (insn
[0] == 0xb992)
4682 if (record_full_arch_list_add_mem (oaddr
, tmp
))
4684 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4686 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4688 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4690 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4694 case 0xb996: /* MLR - multiply logical */
4695 case 0xb997: /* DLR - divide logical */
4696 /* 32-bit gpr pair destination */
4697 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4699 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4703 /* 0xb99a-0xb9af unsupported, privileged, or undefined */
4704 /* 0xb9b4-0xb9bc undefined */
4706 case 0xb9bd: /* TRTRE - translate and test reverse extended [partial] */
4707 case 0xb9bf: /* TRTE - translate and test extended [partial] */
4708 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[6]))
4710 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[6] | 1)))
4712 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[7]))
4714 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4718 /* 0xb9c0-0xb9c7 undefined */
4720 case 0xb9c8: /* AHHHR - add high */
4721 case 0xb9c9: /* SHHHR - subtract high */
4722 case 0xb9ca: /* ALHHHR - add logical high */
4723 case 0xb9cb: /* SLHHHR - subtract logical high */
4724 case 0xb9d8: /* AHHLR - add high */
4725 case 0xb9d9: /* SHHLR - subtract high */
4726 case 0xb9da: /* ALHHLR - add logical high */
4727 case 0xb9db: /* SLHHLR - subtract logical high */
4728 /* 32-bit high gpr destination + flags */
4729 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[6]))
4731 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4735 /* 0xb9cc undefined */
4736 /* 0xb9ce undefined */
4737 /* 0xb9d0-0xb9d7 undefined */
4738 /* 0xb9dc undefined */
4739 /* 0xb9de undefined */
4741 case 0xb9e0: /* LOCFHR - load high on condition */
4742 /* 32-bit high gpr destination */
4743 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[6]))
4747 /* 0xb9e3 undefined */
4748 /* 0xb9e5 undefined */
4749 /* 0xb9ee-0xb9f1 undefined */
4750 /* 0xb9f3 undefined */
4751 /* 0xb9f5 undefined */
4752 /* 0xb9fc undefined */
4753 /* 0xb9fe -0xb9ff undefined */
4760 /* 0xb4-0xb5 undefined */
4761 /* 0xb6 privileged: STCTL - store control */
4762 /* 0xb7 privileged: LCTL - load control */
4763 /* 0xb8 undefined */
4765 case 0xba: /* CS - compare and swap */
4766 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4767 if (record_full_arch_list_add_mem (oaddr
, 4))
4769 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4771 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4775 case 0xbb: /* CDS - compare double and swap */
4776 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4777 if (record_full_arch_list_add_mem (oaddr
, 8))
4779 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4781 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
4783 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4787 /* 0xbc undefined */
4789 case 0xbe: /* STCM - store characters under mask */
4790 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4791 if (record_full_arch_list_add_mem (oaddr
, s390_popcnt (inib
[3])))
4800 /* RIL-format instruction */
4801 switch (ibyte
[0] << 4 | inib
[3])
4803 case 0xc00: /* LARL - load address relative long */
4804 case 0xc05: /* BRASL - branch relative and save long */
4805 case 0xc09: /* IILF - insert immediate */
4806 case 0xc21: /* MSFI - multiply single immediate */
4807 case 0xc42: /* LLHRL - load logical halfword relative long */
4808 case 0xc45: /* LHRL - load halfword relative long */
4809 case 0xc4d: /* LRL - load relative long */
4810 /* 32-bit or native gpr destination */
4811 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4815 case 0xc01: /* LGFI - load immediate */
4816 case 0xc0e: /* LLIHF - load logical immediate */
4817 case 0xc0f: /* LLILF - load logical immediate */
4818 case 0xc20: /* MSGFI - multiply single immediate */
4819 case 0xc44: /* LGHRL - load halfword relative long */
4820 case 0xc46: /* LLGHRL - load logical halfword relative long */
4821 case 0xc48: /* LGRL - load relative long */
4822 case 0xc4c: /* LGFRL - load relative long */
4823 case 0xc4e: /* LLGFRL - load logical relative long */
4824 /* 64-bit gpr destination */
4825 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4829 /* 0xc02-0xc03 undefined */
4831 case 0xc04: /* BRCL - branch relative on condition long */
4832 case 0xc62: /* PFDRL - prefetch data relative long */
4835 case 0xc06: /* XIHF - xor immediate */
4836 case 0xc0a: /* NIHF - and immediate */
4837 case 0xc0c: /* OIHF - or immediate */
4838 case 0xcc8: /* AIH - add immediate high */
4839 case 0xcca: /* ALSIH - add logical with signed immediate high */
4840 /* 32-bit high gpr destination + flags */
4841 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
4843 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4847 case 0xc07: /* XILF - xor immediate */
4848 case 0xc0b: /* NILF - and immediate */
4849 case 0xc0d: /* OILF - or immediate */
4850 case 0xc25: /* SLFI - subtract logical immediate */
4851 case 0xc29: /* AFI - add immediate */
4852 case 0xc2b: /* ALFI - add logical immediate */
4853 /* 32-bit gpr destination + flags */
4854 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4856 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4860 case 0xc08: /* IIHF - insert immediate */
4861 case 0xcc6: /* BRCTH - branch relative on count high */
4862 case 0xccb: /* ALSIHN - add logical with signed immediate high */
4863 /* 32-bit high gpr destination */
4864 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
4868 /* 0xc22-0xc23 undefined */
4870 case 0xc24: /* SLGFI - subtract logical immediate */
4871 case 0xc28: /* AGFI - add immediate */
4872 case 0xc2a: /* ALGFI - add logical immediate */
4873 /* 64-bit gpr destination + flags */
4874 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4876 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4880 /* 0xc26-0xc27 undefined */
4882 case 0xc2c: /* CGFI - compare immediate */
4883 case 0xc2d: /* CFI - compare immediate */
4884 case 0xc2e: /* CLGFI - compare logical immediate */
4885 case 0xc2f: /* CLFI - compare logical immediate */
4886 case 0xc64: /* CGHRL - compare halfword relative long */
4887 case 0xc65: /* CHRL - compare halfword relative long */
4888 case 0xc66: /* CLGHRL - compare logical halfword relative long */
4889 case 0xc67: /* CLHRL - compare logical halfword relative long */
4890 case 0xc68: /* CGRL - compare relative long */
4891 case 0xc6a: /* CLGRL - compare logical relative long */
4892 case 0xc6c: /* CGFRL - compare relative long */
4893 case 0xc6d: /* CRL - compare relative long */
4894 case 0xc6e: /* CLGFRL - compare logical relative long */
4895 case 0xc6f: /* CLRL - compare logical relative long */
4896 case 0xccd: /* CIH - compare immediate high */
4897 case 0xccf: /* CLIH - compare logical immediate high */
4899 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
4903 /* 0xc40-0xc41 undefined */
4904 /* 0xc43 undefined */
4906 case 0xc47: /* STHRL - store halfword relative long */
4907 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
4908 if (record_full_arch_list_add_mem (oaddr
, 2))
4912 /* 0xc49-0xc4a undefined */
4914 case 0xc4b: /* STGRL - store relative long */
4915 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
4916 if (record_full_arch_list_add_mem (oaddr
, 8))
4920 case 0xc4f: /* STRL - store relative long */
4921 oaddr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
4922 if (record_full_arch_list_add_mem (oaddr
, 4))
4926 case 0xc60: /* EXRL - execute relative long */
4929 fprintf_unfiltered (gdb_stdlog
, "Warning: Double execute at %s.\n",
4930 paddress (gdbarch
, addr
));
4933 addr
= s390_record_calc_rl (gdbarch
, regcache
, addr
, insn
[1], insn
[2]);
4936 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
4945 /* 0xc61 undefined */
4946 /* 0xc63 undefined */
4947 /* 0xc69 undefined */
4948 /* 0xc6b undefined */
4949 /* 0xcc0-0xcc5 undefined */
4950 /* 0xcc7 undefined */
4951 /* 0xcc9 undefined */
4952 /* 0xccc undefined */
4953 /* 0xcce undefined */
4960 /* 0xc1 undefined */
4961 /* 0xc3 undefined */
4963 case 0xc5: /* BPRP - branch prediction relative preload */
4964 case 0xc7: /* BPP - branch prediction preload */
4965 /* no visible effect */
4969 /* SSF-format instruction */
4970 switch (ibyte
[0] << 4 | inib
[3])
4972 /* 0xc80 unsupported */
4974 case 0xc81: /* ECTG - extract cpu time */
4975 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
4977 if (s390_record_gpr_g (gdbarch
, regcache
, 0))
4979 if (s390_record_gpr_g (gdbarch
, regcache
, 1))
4983 case 0xc82: /* CSST - compare and swap and store */
4986 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
4988 sc
= tmp
>> 8 & 0xff;
4990 /* First and third operands. */
4991 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
4994 case 0x00: /* 32-bit */
4995 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
4997 if (record_full_arch_list_add_mem (oaddr
, 4))
5001 case 0x01: /* 64-bit */
5002 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5004 if (record_full_arch_list_add_mem (oaddr
, 8))
5008 case 0x02: /* 128-bit */
5009 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5011 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5013 if (record_full_arch_list_add_mem (oaddr
, 16))
5018 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown CSST FC %02x at %s.\n",
5019 fc
, paddress (gdbarch
, addr
));
5023 /* Second operand. */
5024 oaddr2
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[2], 0);
5027 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown CSST FC %02x at %s.\n",
5028 sc
, paddress (gdbarch
, addr
));
5032 if (record_full_arch_list_add_mem (oaddr2
, 1 << sc
))
5036 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5041 /* 0xc83 undefined */
5043 case 0xc84: /* LPD - load pair disjoint */
5044 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5046 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5048 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5052 case 0xc85: /* LPDG - load pair disjoint */
5053 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5055 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5057 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5061 /* 0xc86-0xc8f undefined */
5068 /* 0xc9-0xcb undefined */
5069 /* 0xcd-0xcf undefined */
5071 case 0xd0: /* TRTR - translate and test reversed */
5072 case 0xdd: /* TRT - translate and test */
5073 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
5075 if (record_full_arch_list_add_reg (regcache
, S390_R2_REGNUM
))
5077 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5081 case 0xd1: /* MVN - move numbers */
5082 case 0xd2: /* MVC - move */
5083 case 0xd3: /* MVZ - move zones */
5084 case 0xdc: /* TR - translate */
5085 case 0xe8: /* MVCIN - move inverse */
5086 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5087 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5091 case 0xd4: /* NC - and */
5092 case 0xd6: /* OC - or*/
5093 case 0xd7: /* XC - xor */
5094 case 0xe2: /* UNPKU - unpack unicode */
5095 case 0xea: /* UNPKA - unpack ASCII */
5096 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5097 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5099 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5103 case 0xde: /* ED - edit */
5104 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5105 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5107 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5109 /* DXC may be written */
5110 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5114 case 0xdf: /* EDMK - edit and mark */
5115 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5116 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
5118 if (record_full_arch_list_add_reg (regcache
, S390_R1_REGNUM
))
5120 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5122 /* DXC may be written */
5123 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5127 /* 0xd8 undefined */
5128 /* 0xd9 unsupported: MVCK - move with key */
5129 /* 0xda unsupported: MVCP - move to primary */
5130 /* 0xdb unsupported: MVCS - move to secondary */
5131 /* 0xe0 undefined */
5133 case 0xe1: /* PKU - pack unicode */
5134 case 0xe9: /* PKA - pack ASCII */
5135 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5136 if (record_full_arch_list_add_mem (oaddr
, 16))
5145 /* RXY/RXE/RXF/RSL/RSY/SIY/V*-format instruction */
5146 switch (ibyte
[0] << 8 | ibyte
[5])
5148 /* 0xe300-0xe301 undefined */
5150 case 0xe302: /* LTG - load and test */
5151 case 0xe308: /* AG - add */
5152 case 0xe309: /* SG - subtract */
5153 case 0xe30a: /* ALG - add logical */
5154 case 0xe30b: /* SLG - subtract logical */
5155 case 0xe318: /* AGF - add */
5156 case 0xe319: /* SGF - subtract */
5157 case 0xe31a: /* ALGF - add logical */
5158 case 0xe31b: /* SLGF - subtract logical */
5159 case 0xe332: /* LTGF - load and test */
5160 case 0xe380: /* NG - and */
5161 case 0xe381: /* OG - or */
5162 case 0xe382: /* XG - xor */
5163 case 0xe388: /* ALCG - add logical with carry */
5164 case 0xe389: /* SLBG - subtract logical with borrow */
5165 case 0xeb0a: /* SRAG - shift right single */
5166 case 0xeb0b: /* SLAG - shift left single */
5167 /* 64-bit gpr destination + flags */
5168 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5170 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5174 /* 0xe303 privileged */
5176 case 0xe304: /* LG - load */
5177 case 0xe30c: /* MSG - multiply single */
5178 case 0xe30f: /* LRVG - load reversed */
5179 case 0xe314: /* LGF - load */
5180 case 0xe315: /* LGH - load halfword */
5181 case 0xe316: /* LLGF - load logical */
5182 case 0xe317: /* LLGT - load logical thirty one bits */
5183 case 0xe31c: /* MSGF - multiply single */
5184 case 0xe32a: /* LZRG - load and zero rightmost byte */
5185 case 0xe33a: /* LLZRGF - load logical and zero rightmost byte */
5186 case 0xe33c: /* MGH - multiply halfword 64x16mem -> 64 */
5187 case 0xe346: /* BCTG - branch on count */
5188 case 0xe377: /* LGB - load byte */
5189 case 0xe390: /* LLGC - load logical character */
5190 case 0xe391: /* LLGH - load logical halfword */
5191 case 0xeb0c: /* SRLG - shift right single logical */
5192 case 0xeb0d: /* SLLG - shift left single logical */
5193 case 0xeb1c: /* RLLG - rotate left single logical */
5194 case 0xeb44: /* BXHG - branch on index high */
5195 case 0xeb45: /* BXLEG - branch on index low or equal */
5196 case 0xeb4c: /* ECAG - extract cpu attribute */
5197 case 0xebe2: /* LOCG - load on condition */
5198 /* 64-bit gpr destination */
5199 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5203 /* 0xe305 undefined */
5205 case 0xe306: /* CVBY - convert to binary */
5206 /* 32-bit or native gpr destination + FPC (DXC write) */
5207 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5209 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5213 /* 0xe307 undefined */
5215 case 0xe30d: /* DSG - divide single */
5216 case 0xe31d: /* DSGF - divide single */
5217 case 0xe384: /* MG - multiply 64x64mem -> 128 */
5218 case 0xe386: /* MLG - multiply logical */
5219 case 0xe387: /* DLG - divide logical */
5220 case 0xe38f: /* LPQ - load pair from quadword */
5221 /* 64-bit gpr pair destination */
5222 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5224 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5228 case 0xe30e: /* CVBG - convert to binary */
5229 /* 64-bit gpr destination + FPC (DXC write) */
5230 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5232 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5236 /* 0xe310-0xe311 undefined */
5238 case 0xe312: /* LT - load and test */
5239 case 0xe338: /* AGH - add halfword to 64 bit value */
5240 case 0xe339: /* SGH - subtract halfword from 64 bit value */
5241 case 0xe353: /* MSC - multiply single 32x32mem -> 32 */
5242 case 0xe354: /* NY - and */
5243 case 0xe356: /* OY - or */
5244 case 0xe357: /* XY - xor */
5245 case 0xe35a: /* AY - add */
5246 case 0xe35b: /* SY - subtract */
5247 case 0xe35e: /* ALY - add logical */
5248 case 0xe35f: /* SLY - subtract logical */
5249 case 0xe37a: /* AHY - add halfword */
5250 case 0xe37b: /* SHY - subtract halfword */
5251 case 0xe383: /* MSGC - multiply single 64x64mem -> 64 */
5252 case 0xe398: /* ALC - add logical with carry */
5253 case 0xe399: /* SLB - subtract logical with borrow */
5254 case 0xe727: /* LCBB - load count to block bounduary */
5255 case 0xeb81: /* ICMY - insert characters under mask */
5256 case 0xebdc: /* SRAK - shift left single */
5257 case 0xebdd: /* SLAK - shift left single */
5258 /* 32/64-bit gpr destination + flags */
5259 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5261 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5265 /* 0xe313 privileged */
5267 case 0xe31e: /* LRV - load reversed */
5268 case 0xe31f: /* LRVH - load reversed */
5269 case 0xe33b: /* LZRF - load and zero rightmost byte */
5270 case 0xe351: /* MSY - multiply single */
5271 case 0xe358: /* LY - load */
5272 case 0xe371: /* LAY - load address */
5273 case 0xe373: /* ICY - insert character */
5274 case 0xe376: /* LB - load byte */
5275 case 0xe378: /* LHY - load */
5276 case 0xe37c: /* MHY - multiply halfword */
5277 case 0xe394: /* LLC - load logical character */
5278 case 0xe395: /* LLH - load logical halfword */
5279 case 0xeb1d: /* RLL - rotate left single logical */
5280 case 0xebde: /* SRLK - shift left single logical */
5281 case 0xebdf: /* SLLK - shift left single logical */
5282 case 0xebf2: /* LOC - load on condition */
5283 /* 32-bit or native gpr destination */
5284 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5288 case 0xe320: /* CG - compare */
5289 case 0xe321: /* CLG - compare logical */
5290 case 0xe330: /* CGF - compare */
5291 case 0xe331: /* CLGF - compare logical */
5292 case 0xe334: /* CGH - compare halfword */
5293 case 0xe355: /* CLY - compare logical */
5294 case 0xe359: /* CY - compare */
5295 case 0xe379: /* CHY - compare halfword */
5296 case 0xe3cd: /* CHF - compare high */
5297 case 0xe3cf: /* CLHF - compare logical high */
5298 case 0xeb20: /* CLMH - compare logical under mask high */
5299 case 0xeb21: /* CLMY - compare logical under mask */
5300 case 0xeb51: /* TMY - test under mask */
5301 case 0xeb55: /* CLIY - compare logical */
5302 case 0xebc0: /* TP - test decimal */
5303 case 0xed10: /* TCEB - test data class */
5304 case 0xed11: /* TCDB - test data class */
5305 case 0xed12: /* TCXB - test data class */
5306 case 0xed50: /* TDCET - test data class */
5307 case 0xed51: /* TDGET - test data group */
5308 case 0xed54: /* TDCDT - test data class */
5309 case 0xed55: /* TDGDT - test data group */
5310 case 0xed58: /* TDCXT - test data class */
5311 case 0xed59: /* TDGXT - test data group */
5313 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5317 /* 0xe322-0xe323 undefined */
5319 case 0xe324: /* STG - store */
5320 case 0xe325: /* NTSTG - nontransactional store */
5321 case 0xe326: /* CVDY - convert to decimal */
5322 case 0xe32f: /* STRVG - store reversed */
5323 case 0xebe3: /* STOCG - store on condition */
5324 case 0xed67: /* STDY - store */
5325 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
5326 if (record_full_arch_list_add_mem (oaddr
, 8))
5330 /* 0xe327-0xe329 undefined */
5331 /* 0xe32b-0xe32d undefined */
5333 case 0xe32e: /* CVDG - convert to decimal */
5334 case 0xe38e: /* STPQ - store pair to quadword */
5335 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
5336 if (record_full_arch_list_add_mem (oaddr
, 16))
5340 /* 0xe333 undefined */
5341 /* 0xe335 undefined */
5343 case 0xe336: /* PFD - prefetch data */
5346 /* 0xe337 undefined */
5347 /* 0xe33c-0xe33d undefined */
5349 case 0xe33e: /* STRV - store reversed */
5350 case 0xe350: /* STY - store */
5351 case 0xe3cb: /* STFH - store high */
5352 case 0xebe1: /* STOCFH - store high on condition */
5353 case 0xebf3: /* STOC - store on condition */
5354 case 0xed66: /* STEY - store */
5355 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
5356 if (record_full_arch_list_add_mem (oaddr
, 4))
5360 case 0xe33f: /* STRVH - store reversed */
5361 case 0xe370: /* STHY - store halfword */
5362 case 0xe3c7: /* STHH - store halfword high */
5363 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
5364 if (record_full_arch_list_add_mem (oaddr
, 2))
5368 /* 0xe340-0xe345 undefined */
5370 case 0xe347: /* BIC - branch indirect on condition */
5373 /* 0xe348-0xe34f undefined */
5374 /* 0xe352 undefined */
5376 case 0xe35c: /* MFY - multiply */
5377 case 0xe396: /* ML - multiply logical */
5378 case 0xe397: /* DL - divide logical */
5379 /* 32-bit gpr pair destination */
5380 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5382 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5386 /* 0xe35d undefined */
5387 /* 0xe360-0xe36f undefined */
5389 case 0xe372: /* STCY - store character */
5390 case 0xe3c3: /* STCH - store character high */
5391 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], ibyte
[4]);
5392 if (record_full_arch_list_add_mem (oaddr
, 1))
5396 /* 0xe374 undefined */
5398 case 0xe375: /* LAEY - load address extended */
5399 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5401 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[2]))
5405 /* 0xe37d-0xe37f undefined */
5407 case 0xe385: /* LGAT - load and trap */
5408 case 0xe39c: /* LLGTAT - load logical thirty one bits and trap */
5409 case 0xe39d: /* LLGFAT - load logical and trap */
5410 case 0xe650: /* VCVB - vector convert to binary 32 bit*/
5411 case 0xe652: /* VCVBG - vector convert to binary 64 bit*/
5412 case 0xe721: /* VLGV - vector load gr from vr element */
5413 /* 64-bit gpr destination + fpc for possible DXC write */
5414 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5416 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5420 /* 0xe38a-0xe38d undefined */
5421 /* 0xe392-0xe393 undefined */
5422 /* 0xe39a-0xe39b undefined */
5423 /* 0xe39e undefined */
5425 case 0xe39f: /* LAT - load and trap */
5426 /* 32-bit gpr destination + fpc for possible DXC write */
5427 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5429 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5433 /* 0xe3a0-0xe3bf undefined */
5435 case 0xe3c0: /* LBH - load byte high */
5436 case 0xe3c2: /* LLCH - load logical character high */
5437 case 0xe3c4: /* LHH - load halfword high */
5438 case 0xe3c6: /* LLHH - load logical halfword high */
5439 case 0xe3ca: /* LFH - load high */
5440 case 0xebe0: /* LOCFH - load high on condition */
5441 /* 32-bit high gpr destination */
5442 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5446 /* 0xe3c1 undefined */
5447 /* 0xe3c5 undefined */
5449 case 0xe3c8: /* LFHAT - load high and trap */
5450 /* 32-bit high gpr destination + fpc for possible DXC write */
5451 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5453 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5457 /* 0xe3c9 undefined */
5458 /* 0xe3cc undefined */
5459 /* 0xe3ce undefined */
5460 /* 0xe3d0-0xe3ff undefined */
5462 case 0xe634: /* VPKZ - vector pack zoned */
5463 case 0xe635: /* VLRL - vector load rightmost with immed. length */
5464 case 0xe637: /* VLRLR - vector load rightmost with length */
5465 case 0xe649: /* VLIP - vector load immediate decimal */
5466 case 0xe700: /* VLEB - vector load element */
5467 case 0xe701: /* VLEH - vector load element */
5468 case 0xe702: /* VLEG - vector load element */
5469 case 0xe703: /* VLEF - vector load element */
5470 case 0xe704: /* VLLEZ - vector load logical element and zero */
5471 case 0xe705: /* VLREP - vector load and replicate */
5472 case 0xe706: /* VL - vector load */
5473 case 0xe707: /* VLBB - vector load to block bounduary */
5474 case 0xe712: /* VGEG - vector gather element */
5475 case 0xe713: /* VGEF - vector gather element */
5476 case 0xe722: /* VLVG - vector load vr element from gr */
5477 case 0xe730: /* VESL - vector element shift left */
5478 case 0xe733: /* VERLL - vector element rotate left logical */
5479 case 0xe737: /* VLL - vector load with length */
5480 case 0xe738: /* VESRL - vector element shift right logical */
5481 case 0xe73a: /* VESRA - vector element shift right arithmetic */
5482 case 0xe740: /* VLEIB - vector load element immediate */
5483 case 0xe741: /* VLEIH - vector load element immediate */
5484 case 0xe742: /* VLEIG - vector load element immediate */
5485 case 0xe743: /* VLEIF - vector load element immediate */
5486 case 0xe744: /* VGBM - vector generate byte mask */
5487 case 0xe745: /* VREPI - vector replicate immediate */
5488 case 0xe746: /* VGM - vector generate mask */
5489 case 0xe74d: /* VREP - vector replicate */
5490 case 0xe750: /* VPOPCT - vector population count */
5491 case 0xe752: /* VCTZ - vector count trailing zeros */
5492 case 0xe753: /* VCLZ - vector count leading zeros */
5493 case 0xe756: /* VLR - vector load */
5494 case 0xe75f: /* VSEG -vector sign extend to doubleword */
5495 case 0xe760: /* VMRL - vector merge low */
5496 case 0xe761: /* VMRH - vector merge high */
5497 case 0xe762: /* VLVGP - vector load vr from grs disjoint */
5498 case 0xe764: /* VSUM - vector sum across word */
5499 case 0xe765: /* VSUMG - vector sum across doubleword */
5500 case 0xe766: /* VCKSM - vector checksum */
5501 case 0xe767: /* VSUMQ - vector sum across quadword */
5502 case 0xe768: /* VN - vector and */
5503 case 0xe769: /* VNC - vector and with complement */
5504 case 0xe76a: /* VO - vector or */
5505 case 0xe76b: /* VNO - vector nor */
5506 case 0xe76c: /* VNX - vector not exclusive or */
5507 case 0xe76d: /* VX - vector xor */
5508 case 0xe76e: /* VNN - vector nand */
5509 case 0xe76f: /* VOC - vector or with complement */
5510 case 0xe770: /* VESLV - vector element shift left */
5511 case 0xe772: /* VERIM - vector element rotate and insert under mask */
5512 case 0xe773: /* VERLLV - vector element rotate left logical */
5513 case 0xe774: /* VSL - vector shift left */
5514 case 0xe775: /* VSLB - vector shift left by byte */
5515 case 0xe777: /* VSLDB - vector shift left double by byte */
5516 case 0xe778: /* VESRLV - vector element shift right logical */
5517 case 0xe77a: /* VESRAV - vector element shift right arithmetic */
5518 case 0xe77c: /* VSRL - vector shift right logical */
5519 case 0xe77d: /* VSRLB - vector shift right logical by byte */
5520 case 0xe77e: /* VSRA - vector shift right arithmetic */
5521 case 0xe77f: /* VSRAB - vector shift right arithmetic by byte */
5522 case 0xe784: /* VPDI - vector permute doubleword immediate */
5523 case 0xe785: /* VBPERM - vector bit permute */
5524 case 0xe78c: /* VPERM - vector permute */
5525 case 0xe78d: /* VSEL - vector select */
5526 case 0xe78e: /* VFMS - vector fp multiply and subtract */
5527 case 0xe78f: /* VFMA - vector fp multiply and add */
5528 case 0xe794: /* VPK - vector pack */
5529 case 0xe79e: /* VFNMS - vector fp negative multiply and subtract */
5530 case 0xe79f: /* VFNMA - vector fp negative multiply and add */
5531 case 0xe7a1: /* VMLH - vector multiply logical high */
5532 case 0xe7a2: /* VML - vector multiply low */
5533 case 0xe7a3: /* VMH - vector multiply high */
5534 case 0xe7a4: /* VMLE - vector multiply logical even */
5535 case 0xe7a5: /* VMLO - vector multiply logical odd */
5536 case 0xe7a6: /* VME - vector multiply even */
5537 case 0xe7a7: /* VMO - vector multiply odd */
5538 case 0xe7a9: /* VMALH - vector multiply and add logical high */
5539 case 0xe7aa: /* VMAL - vector multiply and add low */
5540 case 0xe7ab: /* VMAH - vector multiply and add high */
5541 case 0xe7ac: /* VMALE - vector multiply and add logical even */
5542 case 0xe7ad: /* VMALO - vector multiply and add logical odd */
5543 case 0xe7ae: /* VMAE - vector multiply and add even */
5544 case 0xe7af: /* VMAO - vector multiply and add odd */
5545 case 0xe7b4: /* VGFM - vector Galois field multiply sum */
5546 case 0xe7b8: /* VMSL - vector multiply sum logical */
5547 case 0xe7b9: /* VACCC - vector add with carry compute carry */
5548 case 0xe7bb: /* VAC - vector add with carry */
5549 case 0xe7bc: /* VGFMA - vector Galois field multiply sum and accumulate */
5550 case 0xe7bd: /* VSBCBI - vector subtract with borrow compute borrow indication */
5551 case 0xe7bf: /* VSBI - vector subtract with borrow indication */
5552 case 0xe7c0: /* VCLGD - vector convert to logical 64-bit */
5553 case 0xe7c1: /* VCDLG - vector convert from logical 64-bit */
5554 case 0xe7c2: /* VCGD - vector convert to fixed 64-bit */
5555 case 0xe7c3: /* VCDG - vector convert from fixed 64-bit */
5556 case 0xe7c4: /* VLDE/VFLL - vector fp load lengthened */
5557 case 0xe7c5: /* VLED/VFLR - vector fp load rounded */
5558 case 0xe7c7: /* VFI - vector load fp integer */
5559 case 0xe7cc: /* VFPSO - vector fp perform sign operation */
5560 case 0xe7ce: /* VFSQ - vector fp square root */
5561 case 0xe7d4: /* VUPLL - vector unpack logical low */
5562 case 0xe7d6: /* VUPL - vector unpack low */
5563 case 0xe7d5: /* VUPLH - vector unpack logical high */
5564 case 0xe7d7: /* VUPH - vector unpack high */
5565 case 0xe7de: /* VLC - vector load complement */
5566 case 0xe7df: /* VLP - vector load positive */
5567 case 0xe7e2: /* VFA - vector fp subtract */
5568 case 0xe7e3: /* VFA - vector fp add */
5569 case 0xe7e5: /* VFD - vector fp divide */
5570 case 0xe7e7: /* VFM - vector fp multiply */
5571 case 0xe7ee: /* VFMIN - vector fp minimum */
5572 case 0xe7ef: /* VFMAX - vector fp maximum */
5573 case 0xe7f0: /* VAVGL - vector average logical */
5574 case 0xe7f1: /* VACC - vector add and compute carry */
5575 case 0xe7f2: /* VAVG - vector average */
5576 case 0xe7f3: /* VA - vector add */
5577 case 0xe7f5: /* VSCBI - vector subtract compute borrow indication */
5578 case 0xe7f7: /* VS - vector subtract */
5579 case 0xe7fc: /* VMNL - vector minimum logical */
5580 case 0xe7fd: /* VMXL - vector maximum logical */
5581 case 0xe7fe: /* VMN - vector minimum */
5582 case 0xe7ff: /* VMX - vector maximum */
5583 /* vector destination + FPC */
5584 if (s390_record_vr (gdbarch
, regcache
, ivec
[0]))
5586 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5590 case 0xe63d: /* VSTRL - vector store rightmost with immed. length */
5591 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5592 if (record_full_arch_list_add_mem (oaddr
, inib
[3] + 1))
5594 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5598 case 0xe708: /* VSTEB - vector store element */
5599 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
5600 if (record_full_arch_list_add_mem (oaddr
, 1))
5602 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5606 case 0xe709: /* VSTEH - vector store element */
5607 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
5608 if (record_full_arch_list_add_mem (oaddr
, 2))
5610 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5614 case 0xe70a: /* VSTEG - vector store element */
5615 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
5616 if (record_full_arch_list_add_mem (oaddr
, 8))
5618 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5622 case 0xe70b: /* VSTEF - vector store element */
5623 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
5624 if (record_full_arch_list_add_mem (oaddr
, 4))
5626 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5630 /* 0xe70c-0xe70d undefined */
5632 case 0xe70e: /* VST - vector store */
5633 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, inib
[3], insn
[1], 0);
5634 if (record_full_arch_list_add_mem (oaddr
, 16))
5636 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5640 /* 0xe70f-0xe711 undefined */
5641 /* 0xe714-0xe719 undefined */
5643 case 0xe71a: /* VSCEG - vector scatter element */
5644 if (s390_record_calc_disp_vsce (gdbarch
, regcache
, ivec
[1], inib
[8], 8, insn
[1], 0, &oaddr
))
5646 if (record_full_arch_list_add_mem (oaddr
, 8))
5648 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5652 case 0xe71b: /* VSCEF - vector scatter element */
5653 if (s390_record_calc_disp_vsce (gdbarch
, regcache
, ivec
[1], inib
[8], 4, insn
[1], 0, &oaddr
))
5655 if (record_full_arch_list_add_mem (oaddr
, 4))
5657 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5661 /* 0xe71c-0xe720 undefined */
5662 /* 0xe723-0xe726 undefined */
5663 /* 0xe728-0xe72f undefined */
5664 /* 0xe731-0xe732 undefined */
5665 /* 0xe734-0xe735 undefined */
5667 case 0xe736: /* VLM - vector load multiple */
5668 for (i
= ivec
[0]; i
!= ivec
[1]; i
++, i
&= 0x1f)
5669 if (s390_record_vr (gdbarch
, regcache
, i
))
5671 if (s390_record_vr (gdbarch
, regcache
, ivec
[1]))
5673 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5677 /* 0xe739 undefined */
5678 /* 0xe73b-0xe73d undefined */
5680 case 0xe73e: /* VSTM - vector store multiple */
5681 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5682 if (ivec
[0] <= ivec
[1])
5683 n
= ivec
[1] - ivec
[0] + 1;
5685 n
= ivec
[1] + 0x20 - ivec
[0] + 1;
5686 if (record_full_arch_list_add_mem (oaddr
, n
* 16))
5688 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5692 case 0xe63c: /* VUPKZ - vector unpack zoned */
5693 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5694 if (record_full_arch_list_add_mem (oaddr
, (ibyte
[1] + 1) & 31))
5696 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5700 case 0xe63f: /* VSTRLR - vector store rightmost with length */
5701 case 0xe73f: /* VSTL - vector store with length */
5702 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
5703 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[3], &tmp
);
5707 if (record_full_arch_list_add_mem (oaddr
, tmp
+ 1))
5709 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5713 /* 0xe747-0xe749 undefined */
5715 case 0xe658: /* VCVD - vector convert to decimal 32 bit */
5716 case 0xe659: /* VSRP - vector shift and round decimal */
5717 case 0xe65a: /* VCVDG - vector convert to decimal 64 bit*/
5718 case 0xe65b: /* VPSOP - vector perform sign operation decimal */
5719 case 0xe671: /* VAP - vector add decimal */
5720 case 0xe673: /* VSP - vector subtract decimal */
5721 case 0xe678: /* VMP - vector multiply decimal */
5722 case 0xe679: /* VMSP - vector multiply decimal */
5723 case 0xe67a: /* VDP - vector divide decimal */
5724 case 0xe67b: /* VRP - vector remainder decimal */
5725 case 0xe67e: /* VSDP - vector shift and divide decimal */
5726 case 0xe74a: /* VFTCI - vector fp test data class immediate */
5727 case 0xe75c: /* VISTR - vector isolate string */
5728 case 0xe780: /* VFEE - vector find element equal */
5729 case 0xe781: /* VFENE - vector find element not equal */
5730 case 0xe782: /* VFA - vector find any element equal */
5731 case 0xe78a: /* VSTRC - vector string range compare */
5732 case 0xe795: /* VPKLS - vector pack logical saturate */
5733 case 0xe797: /* VPKS - vector pack saturate */
5734 case 0xe7e8: /* VFCE - vector fp compare equal */
5735 case 0xe7ea: /* VFCHE - vector fp compare high or equal */
5736 case 0xe7eb: /* VFCH - vector fp compare high */
5737 case 0xe7f8: /* VCEQ - vector compare equal */
5738 case 0xe7f9: /* VCHL - vector compare high logical */
5739 case 0xe7fb: /* VCH - vector compare high */
5740 /* vector destination + flags + FPC */
5741 if (s390_record_vr (gdbarch
, regcache
, ivec
[0]))
5743 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5745 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5749 case 0xe65f: /* VTP - vector test decimal */
5751 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5753 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5757 /* 0xe74b-0xe74c undefined */
5758 /* 0xe74e-0xe74f undefined */
5759 /* 0xe751 undefined */
5760 /* 0xe754-0xe755 undefined */
5761 /* 0xe757-0xe75b undefined */
5762 /* 0xe75d-0xe75e undefined */
5763 /* 0xe763 undefined */
5764 /* 0xe771 undefined */
5765 /* 0xe776 undefined */
5766 /* 0xe779 undefined */
5767 /* 0xe77b undefined */
5768 /* 0xe783 undefined */
5769 /* 0xe786-0xe789 undefined */
5770 /* 0xe78b undefined */
5771 /* 0xe790-0xe793 undefined */
5772 /* 0xe796 undefined */
5773 /* 0xe798-0xe79d undefined */
5774 /* 0xe7a0 undefined */
5775 /* 0xe7a8 undefined */
5776 /* 0xe7b0-0xe7b3 undefined */
5777 /* 0xe7b5-0xe7b7 undefined */
5778 /* 0xe7ba undefined */
5779 /* 0xe7be undefined */
5780 /* 0xe7c6 undefined */
5781 /* 0xe7c8-0xe7c9 undefined */
5783 case 0xe677: /* VCP - vector compare decimal */
5784 case 0xe7ca: /* WFK - vector fp compare and signal scalar */
5785 case 0xe7cb: /* WFC - vector fp compare scalar */
5786 case 0xe7d8: /* VTM - vector test under mask */
5787 case 0xe7d9: /* VECL - vector element compare logical */
5788 case 0xe7db: /* VEC - vector element compare */
5789 case 0xed08: /* KEB - compare and signal */
5790 case 0xed09: /* CEB - compare */
5791 case 0xed18: /* KDB - compare and signal */
5792 case 0xed19: /* CDB - compare */
5793 /* flags + fpc only */
5794 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5796 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5800 /* 0xe7cd undefined */
5801 /* 0xe7cf-0xe7d3 undefined */
5802 /* 0xe7da undefined */
5803 /* 0xe7dc-0xe7dd undefined */
5804 /* 0xe7e0-0xe7e1 undefined */
5805 /* 0xe7e4 undefined */
5806 /* 0xe7e6 undefined */
5807 /* 0xe7e9 undefined */
5808 /* 0xe7ec-0xe7ed undefined */
5809 /* 0xe7f4 undefined */
5810 /* 0xe7f6 undefined */
5811 /* 0xe7fa undefined */
5813 /* 0xeb00-0xeb03 undefined */
5815 case 0xeb04: /* LMG - load multiple */
5816 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
5817 if (s390_record_gpr_g (gdbarch
, regcache
, i
))
5819 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
5823 /* 0xeb05-0xeb09 undefined */
5824 /* 0xeb0e undefined */
5825 /* 0xeb0f privileged: TRACG */
5826 /* 0xeb10-0xeb13 undefined */
5828 case 0xeb14: /* CSY - compare and swap */
5829 case 0xebf4: /* LAN - load and and */
5830 case 0xebf6: /* LAO - load and or */
5831 case 0xebf7: /* LAX - load and xor */
5832 case 0xebf8: /* LAA - load and add */
5833 case 0xebfa: /* LAAL - load and add logical */
5834 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5835 if (record_full_arch_list_add_mem (oaddr
, 4))
5837 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5839 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5843 /* 0xeb15-0xeb1b undefined */
5844 /* 0xeb1e-0xeb1f undefined */
5845 /* 0xeb22 undefined */
5847 case 0xeb23: /* CLT - compare logical and trap */
5848 case 0xeb2b: /* CLGT - compare logical and trap */
5849 /* fpc only - including possible DXC write for trapping insns */
5850 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
5854 case 0xeb24: /* STMG - store multiple */
5855 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5856 if (inib
[2] <= inib
[3])
5857 n
= inib
[3] - inib
[2] + 1;
5859 n
= inib
[3] + 0x10 - inib
[2] + 1;
5860 if (record_full_arch_list_add_mem (oaddr
, n
* 8))
5864 /* 0xeb25 privileged */
5866 case 0xeb26: /* STMH - store multiple high */
5867 case 0xeb90: /* STMY - store multiple */
5868 case 0xeb9b: /* STAMY - store access multiple */
5869 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5870 if (inib
[2] <= inib
[3])
5871 n
= inib
[3] - inib
[2] + 1;
5873 n
= inib
[3] + 0x10 - inib
[2] + 1;
5874 if (record_full_arch_list_add_mem (oaddr
, n
* 4))
5878 /* 0xeb27-0xeb2a undefined */
5880 case 0xeb2c: /* STCMH - store characters under mask */
5881 case 0xeb2d: /* STCMY - store characters under mask */
5882 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5883 if (record_full_arch_list_add_mem (oaddr
, s390_popcnt (inib
[3])))
5887 /* 0xeb2e undefined */
5888 /* 0xeb2f privileged */
5890 case 0xeb30: /* CSG - compare and swap */
5891 case 0xebe4: /* LANG - load and and */
5892 case 0xebe6: /* LAOG - load and or */
5893 case 0xebe7: /* LAXG - load and xor */
5894 case 0xebe8: /* LAAG - load and add */
5895 case 0xebea: /* LAALG - load and add logical */
5896 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5897 if (record_full_arch_list_add_mem (oaddr
, 8))
5899 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5901 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5905 case 0xeb31: /* CDSY - compare double and swap */
5906 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5907 if (record_full_arch_list_add_mem (oaddr
, 8))
5909 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5911 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5913 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5917 /* 0xeb32-0xeb3d undefined */
5919 case 0xeb3e: /* CDSG - compare double and swap */
5920 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5921 if (record_full_arch_list_add_mem (oaddr
, 16))
5923 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
5925 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2] | 1))
5927 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5931 /* 0xeb3f-0xeb43 undefined */
5932 /* 0xeb46-0xeb4b undefined */
5933 /* 0xeb4d-0xeb50 undefined */
5935 case 0xeb52: /* MVIY - move */
5936 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5937 if (record_full_arch_list_add_mem (oaddr
, 1))
5941 case 0xeb54: /* NIY - and */
5942 case 0xeb56: /* OIY - or */
5943 case 0xeb57: /* XIY - xor */
5944 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5945 if (record_full_arch_list_add_mem (oaddr
, 1))
5947 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5951 /* 0xeb53 undefined */
5952 /* 0xeb58-0xeb69 undefined */
5954 case 0xeb6a: /* ASI - add immediate */
5955 case 0xeb6e: /* ALSI - add immediate */
5956 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5957 if (record_full_arch_list_add_mem (oaddr
, 4))
5959 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5963 /* 0xeb6b-0xeb6d undefined */
5964 /* 0xeb6f-0xeb79 undefined */
5966 case 0xeb7a: /* AGSI - add immediate */
5967 case 0xeb7e: /* ALGSI - add immediate */
5968 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], ibyte
[4]);
5969 if (record_full_arch_list_add_mem (oaddr
, 8))
5971 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5975 /* 0xeb7b-0xeb7d undefined */
5976 /* 0xeb7f undefined */
5978 case 0xeb80: /* ICMH - insert characters under mask */
5979 /* 32-bit high gpr destination + flags */
5980 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
5982 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
5986 /* 0xeb82-0xeb8d undefined */
5988 case 0xeb8e: /* MVCLU - move long unicode [partial] */
5989 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ inib
[2], &tmp
);
5990 oaddr
= s390_record_address_mask (gdbarch
, regcache
, tmp
);
5991 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1), &tmp
);
5992 if (record_full_arch_list_add_mem (oaddr
, tmp
))
5994 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
5996 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
5998 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6000 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
6002 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6006 case 0xeb8f: /* CLCLU - compare logical long unicode [partial] */
6007 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6009 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[2] | 1)))
6011 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6013 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ (inib
[3] | 1)))
6015 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6019 /* 0xeb91-0xeb95 undefined */
6021 case 0xeb96: /* LMH - load multiple high */
6022 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6023 if (s390_record_gpr_h (gdbarch
, regcache
, i
))
6025 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[3]))
6029 /* 0xeb97 undefined */
6031 case 0xeb98: /* LMY - load multiple */
6032 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6033 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ i
))
6035 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6039 /* 0xeb99 undefined */
6041 case 0xeb9a: /* LAMY - load access multiple */
6042 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6043 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ i
))
6045 if (record_full_arch_list_add_reg (regcache
, S390_A0_REGNUM
+ inib
[3]))
6049 /* 0xeb9c-0xebbf undefined */
6050 /* 0xebc1-0xebdb undefined */
6051 /* 0xebe5 undefined */
6052 /* 0xebe9 undefined */
6053 /* 0xebeb-0xebf1 undefined */
6054 /* 0xebf5 undefined */
6055 /* 0xebf9 undefined */
6056 /* 0xebfb-0xebff undefined */
6058 /* 0xed00-0xed03 undefined */
6060 case 0xed04: /* LDEB - load lengthened */
6061 case 0xed0c: /* MDEB - multiply */
6062 case 0xed0d: /* DEB - divide */
6063 case 0xed14: /* SQEB - square root */
6064 case 0xed15: /* SQDB - square root */
6065 case 0xed17: /* MEEB - multiply */
6066 case 0xed1c: /* MDB - multiply */
6067 case 0xed1d: /* DDB - divide */
6068 /* float destination + fpc */
6069 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6071 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6075 case 0xed05: /* LXDB - load lengthened */
6076 case 0xed06: /* LXEB - load lengthened */
6077 case 0xed07: /* MXDB - multiply */
6078 /* float pair destination + fpc */
6079 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6081 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
6083 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6087 case 0xed0a: /* AEB - add */
6088 case 0xed0b: /* SEB - subtract */
6089 case 0xed1a: /* ADB - add */
6090 case 0xed1b: /* SDB - subtract */
6091 /* float destination + flags + fpc */
6092 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6094 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6096 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6100 case 0xed0e: /* MAEB - multiply and add */
6101 case 0xed0f: /* MSEB - multiply and subtract */
6102 case 0xed1e: /* MADB - multiply and add */
6103 case 0xed1f: /* MSDB - multiply and subtract */
6104 case 0xed40: /* SLDT - shift significand left */
6105 case 0xed41: /* SRDT - shift significand right */
6106 case 0xedaa: /* CDZT - convert from zoned */
6107 case 0xedae: /* CDPT - convert from packed */
6108 /* float destination [RXF] + fpc */
6109 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6111 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6115 /* 0xed13 undefined */
6116 /* 0xed16 undefined */
6117 /* 0xed20-0xed23 undefined */
6119 case 0xed24: /* LDE - load lengthened */
6120 case 0xed34: /* SQE - square root */
6121 case 0xed35: /* SQD - square root */
6122 case 0xed37: /* MEE - multiply */
6123 case 0xed64: /* LEY - load */
6124 case 0xed65: /* LDY - load */
6125 /* float destination */
6126 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6130 case 0xed25: /* LXD - load lengthened */
6131 case 0xed26: /* LXE - load lengthened */
6132 /* float pair destination */
6133 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[2]))
6135 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[2] | 2)))
6139 /* 0xed27-0xed2d undefined */
6141 case 0xed2e: /* MAE - multiply and add */
6142 case 0xed2f: /* MSE - multiply and subtract */
6143 case 0xed38: /* MAYL - multiply and add unnormalized */
6144 case 0xed39: /* MYL - multiply unnormalized */
6145 case 0xed3c: /* MAYH - multiply and add unnormalized */
6146 case 0xed3d: /* MYH - multiply unnormalized */
6147 case 0xed3e: /* MAD - multiply and add */
6148 case 0xed3f: /* MSD - multiply and subtract */
6149 /* float destination [RXF] */
6150 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6154 /* 0xed30-0xed33 undefined */
6155 /* 0xed36 undefined */
6157 case 0xed3a: /* MAY - multiply and add unnormalized */
6158 case 0xed3b: /* MY - multiply unnormalized */
6159 /* float pair destination [RXF] */
6160 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6162 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[8] | 2)))
6166 /* 0xed42-0xed47 undefind */
6168 case 0xed48: /* SLXT - shift significand left */
6169 case 0xed49: /* SRXT - shift significand right */
6170 case 0xedab: /* CXZT - convert from zoned */
6171 case 0xedaf: /* CXPT - convert from packed */
6172 /* float pair destination [RXF] + fpc */
6173 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ inib
[8]))
6175 if (record_full_arch_list_add_reg (regcache
, S390_F0_REGNUM
+ (inib
[8] | 2)))
6177 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6181 /* 0xed4a-0xed4f undefind */
6182 /* 0xed52-0xed53 undefind */
6183 /* 0xed56-0xed57 undefind */
6184 /* 0xed5a-0xed63 undefind */
6185 /* 0xed68-0xeda7 undefined */
6187 case 0xeda8: /* CZDT - convert to zoned */
6188 case 0xeda9: /* CZXT - convert to zoned */
6189 case 0xedac: /* CPDT - convert to packed */
6190 case 0xedad: /* CPXT - convert to packed */
6191 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6192 if (record_full_arch_list_add_mem (oaddr
, ibyte
[1] + 1))
6194 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6198 /* 0xedb0-0xedff undefined */
6205 /* 0xe4 undefined */
6208 /* SSE/SIL-format instruction */
6211 /* 0xe500-0xe543 undefined, privileged, or unsupported */
6213 case 0xe544: /* MVHHI - move */
6214 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6215 if (record_full_arch_list_add_mem (oaddr
, 2))
6219 /* 0xe545-0xe547 undefined */
6221 case 0xe548: /* MVGHI - move */
6222 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6223 if (record_full_arch_list_add_mem (oaddr
, 8))
6227 /* 0xe549-0xe54b undefined */
6229 case 0xe54c: /* MVHI - move */
6230 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6231 if (record_full_arch_list_add_mem (oaddr
, 4))
6235 /* 0xe54d-0xe553 undefined */
6237 case 0xe554: /* CHHSI - compare halfword immediate */
6238 case 0xe555: /* CLHHSI - compare logical immediate */
6239 case 0xe558: /* CGHSI - compare halfword immediate */
6240 case 0xe559: /* CLGHSI - compare logical immediate */
6241 case 0xe55c: /* CHSI - compare halfword immediate */
6242 case 0xe55d: /* CLFHSI - compare logical immediate */
6243 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6247 /* 0xe556-0xe557 undefined */
6248 /* 0xe55a-0xe55b undefined */
6249 /* 0xe55e-0xe55f undefined */
6251 case 0xe560: /* TBEGIN - transaction begin */
6252 /* The transaction will be immediately aborted after this
6253 instruction, due to single-stepping. This instruction is
6254 only supported so that the program can fail a few times
6255 and go to the non-transactional fallback. */
6258 /* Transaction diagnostic block - user. */
6259 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6260 if (record_full_arch_list_add_mem (oaddr
, 256))
6263 /* Transaction diagnostic block - supervisor. */
6264 if (record_full_arch_list_add_reg (regcache
, S390_TDB_DWORD0_REGNUM
))
6266 if (record_full_arch_list_add_reg (regcache
, S390_TDB_ABORT_CODE_REGNUM
))
6268 if (record_full_arch_list_add_reg (regcache
, S390_TDB_CONFLICT_TOKEN_REGNUM
))
6270 if (record_full_arch_list_add_reg (regcache
, S390_TDB_ATIA_REGNUM
))
6272 for (i
= 0; i
< 16; i
++)
6273 if (record_full_arch_list_add_reg (regcache
, S390_TDB_R0_REGNUM
+ i
))
6276 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6280 /* 0xe561 unsupported: TBEGINC */
6281 /* 0xe562-0xe5ff undefined */
6289 /* RIE/RIS/RRS-format instruction */
6290 switch (ibyte
[0] << 8 | ibyte
[5])
6292 /* 0xec00-0xec41 undefined */
6294 case 0xec42: /* LOCHI - load halfword immediate on condition */
6295 case 0xec51: /* RISBLG - rotate then insert selected bits low */
6296 /* 32-bit or native gpr destination */
6297 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6301 /* 0xec43 undefined */
6303 case 0xec44: /* BRXHG - branch relative on index high */
6304 case 0xec45: /* BRXLG - branch relative on index low or equal */
6305 case 0xec46: /* LOCGHI - load halfword immediate on condition */
6306 case 0xec59: /* RISBGN - rotate then insert selected bits */
6307 /* 64-bit gpr destination */
6308 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6312 /* 0xec47-0xec4d undefined */
6314 case 0xec4e: /* LOCHHI - load halfword immediate on condition */
6315 case 0xec5d: /* RISBHG - rotate then insert selected bits high */
6316 /* 32-bit high gpr destination */
6317 if (s390_record_gpr_h (gdbarch
, regcache
, inib
[2]))
6321 /* 0xec4f-0xec50 undefined */
6322 /* 0xec52-0xec53 undefined */
6324 case 0xec54: /* RNSBG - rotate then and selected bits */
6325 case 0xec55: /* RISBG - rotate then insert selected bits */
6326 case 0xec56: /* ROSBG - rotate then or selected bits */
6327 case 0xec57: /* RXSBG - rotate then xor selected bits */
6328 case 0xecd9: /* AGHIK - add immediate */
6329 case 0xecdb: /* ALGHSIK - add logical immediate */
6330 /* 64-bit gpr destination + flags */
6331 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6333 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6337 /* 0xec58 undefined */
6338 /* 0xec5a-0xec5c undefined */
6339 /* 0xec5e-0xec63 undefined */
6341 case 0xec64: /* CGRJ - compare and branch relative */
6342 case 0xec65: /* CLGRJ - compare logical and branch relative */
6343 case 0xec76: /* CRJ - compare and branch relative */
6344 case 0xec77: /* CLRJ - compare logical and branch relative */
6345 case 0xec7c: /* CGIJ - compare immediate and branch relative */
6346 case 0xec7d: /* CLGIJ - compare logical immediate and branch relative */
6347 case 0xec7e: /* CIJ - compare immediate and branch relative */
6348 case 0xec7f: /* CLIJ - compare logical immediate and branch relative */
6349 case 0xece4: /* CGRB - compare and branch */
6350 case 0xece5: /* CLGRB - compare logical and branch */
6351 case 0xecf6: /* CRB - compare and branch */
6352 case 0xecf7: /* CLRB - compare logical and branch */
6353 case 0xecfc: /* CGIB - compare immediate and branch */
6354 case 0xecfd: /* CLGIB - compare logical immediate and branch */
6355 case 0xecfe: /* CIB - compare immediate and branch */
6356 case 0xecff: /* CLIB - compare logical immediate and branch */
6359 /* 0xec66-0xec6f undefined */
6361 case 0xec70: /* CGIT - compare immediate and trap */
6362 case 0xec71: /* CLGIT - compare logical immediate and trap */
6363 case 0xec72: /* CIT - compare immediate and trap */
6364 case 0xec73: /* CLFIT - compare logical immediate and trap */
6365 /* fpc only - including possible DXC write for trapping insns */
6366 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6370 /* 0xec74-0xec75 undefined */
6371 /* 0xec78-0xec7b undefined */
6373 /* 0xec80-0xecd7 undefined */
6375 case 0xecd8: /* AHIK - add immediate */
6376 case 0xecda: /* ALHSIK - add logical immediate */
6377 /* 32-bit gpr destination + flags */
6378 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6380 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6384 /* 0xecdc-0xece3 undefined */
6385 /* 0xece6-0xecf5 undefined */
6386 /* 0xecf8-0xecfb undefined */
6393 case 0xee: /* PLO - perform locked operation */
6394 regcache_raw_read_unsigned (regcache
, S390_R0_REGNUM
, &tmp
);
6395 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6396 oaddr2
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[2], 0);
6399 uint8_t fc
= tmp
& 0xff;
6405 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6408 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6412 case 0x01: /* CLG */
6414 if (record_full_arch_list_add_mem (oaddr2
+ 0x08, 8))
6417 if (record_full_arch_list_add_mem (oaddr2
+ 0x28, 8))
6421 case 0x02: /* CLGR */
6423 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6426 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
6430 case 0x03: /* CLX */
6432 if (record_full_arch_list_add_mem (oaddr2
+ 0x00, 16))
6435 if (record_full_arch_list_add_mem (oaddr2
+ 0x20, 16))
6439 case 0x08: /* DCS */
6441 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[3]))
6444 case 0x0c: /* CSST */
6446 if (record_full_arch_list_add_mem (oaddr2
, 4))
6450 case 0x14: /* CSTST */
6452 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
6454 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6455 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6456 if (record_full_arch_list_add_mem (oaddr3
, 4))
6459 case 0x10: /* CSDST */
6461 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
6463 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6464 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6465 if (record_full_arch_list_add_mem (oaddr3
, 4))
6468 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
6470 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6471 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6472 if (record_full_arch_list_add_mem (oaddr3
, 4))
6478 if (record_full_arch_list_add_reg (regcache
, S390_R0_REGNUM
+ inib
[2]))
6481 if (record_full_arch_list_add_mem (oaddr
, 4))
6485 case 0x09: /* DCSG */
6487 if (record_full_arch_list_add_mem (oaddr2
+ 0x28, 8))
6491 case 0x15: /* CSTSTG */
6493 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
6495 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6496 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6497 if (record_full_arch_list_add_mem (oaddr3
, 8))
6500 case 0x11: /* CSDSTG */
6502 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
6504 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6505 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6506 if (record_full_arch_list_add_mem (oaddr3
, 8))
6509 case 0x0d: /* CSSTG */
6512 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
6514 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6515 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6516 if (record_full_arch_list_add_mem (oaddr3
, 8))
6519 case 0x05: /* CSG */
6521 if (record_full_arch_list_add_mem (oaddr2
+ 0x08, 8))
6524 if (record_full_arch_list_add_mem (oaddr
, 8))
6528 case 0x0a: /* DCSGR */
6530 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
6533 case 0x0e: /* CSSTGR */
6535 if (record_full_arch_list_add_mem (oaddr2
, 8))
6539 case 0x16: /* CSTSTGR */
6541 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
6543 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6544 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6545 if (record_full_arch_list_add_mem (oaddr3
, 8))
6548 case 0x12: /* CSDSTGR */
6550 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
6552 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6553 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6554 if (record_full_arch_list_add_mem (oaddr3
, 8))
6557 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
6559 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6560 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6561 if (record_full_arch_list_add_mem (oaddr3
, 8))
6564 case 0x06: /* CSGR */
6567 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[2]))
6570 if (record_full_arch_list_add_mem (oaddr
, 8))
6574 case 0x0b: /* DCSX */
6576 if (record_full_arch_list_add_mem (oaddr2
+ 0x20, 16))
6580 case 0x17: /* CSTSTX */
6582 if (target_read_memory (oaddr2
+ 0x88, buf
, 8))
6584 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6585 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6586 if (record_full_arch_list_add_mem (oaddr3
, 16))
6589 case 0x13: /* CSDSTX */
6591 if (target_read_memory (oaddr2
+ 0x68, buf
, 8))
6593 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6594 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6595 if (record_full_arch_list_add_mem (oaddr3
, 16))
6598 case 0x0f: /* CSSTX */
6601 if (target_read_memory (oaddr2
+ 0x48, buf
, 8))
6603 oaddr3
= extract_unsigned_integer (buf
, 8, byte_order
);
6604 oaddr3
= s390_record_address_mask (gdbarch
, regcache
, oaddr3
);
6605 if (record_full_arch_list_add_mem (oaddr3
, 16))
6608 case 0x07: /* CSX */
6610 if (record_full_arch_list_add_mem (oaddr2
+ 0x00, 16))
6613 if (record_full_arch_list_add_mem (oaddr
, 16))
6618 fprintf_unfiltered (gdb_stdlog
, "Warning: Unknown PLO FC %02x at %s.\n",
6619 fc
, paddress (gdbarch
, addr
));
6623 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6627 case 0xef: /* LMD - load multiple disjoint */
6628 for (i
= inib
[2]; i
!= inib
[3]; i
++, i
&= 0xf)
6629 if (s390_record_gpr_g (gdbarch
, regcache
, i
))
6631 if (s390_record_gpr_g (gdbarch
, regcache
, inib
[3]))
6635 case 0xf0: /* SRP - shift and round decimal */
6636 case 0xf8: /* ZAP - zero and add */
6637 case 0xfa: /* AP - add decimal */
6638 case 0xfb: /* SP - subtract decimal */
6639 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6640 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
6642 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6644 /* DXC may be written */
6645 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6649 case 0xf1: /* MVO - move with offset */
6650 case 0xf2: /* PACK - pack */
6651 case 0xf3: /* UNPK - unpack */
6652 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6653 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
6657 /* 0xf4-0xf7 undefined */
6659 case 0xf9: /* CP - compare decimal */
6660 if (record_full_arch_list_add_reg (regcache
, S390_PSWM_REGNUM
))
6662 /* DXC may be written */
6663 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6667 case 0xfc: /* MP - multiply decimal */
6668 case 0xfd: /* DP - divide decimal */
6669 oaddr
= s390_record_calc_disp (gdbarch
, regcache
, 0, insn
[1], 0);
6670 if (record_full_arch_list_add_mem (oaddr
, inib
[2] + 1))
6672 /* DXC may be written */
6673 if (record_full_arch_list_add_reg (regcache
, S390_FPC_REGNUM
))
6677 /* 0xfe-0xff undefined */
6681 fprintf_unfiltered (gdb_stdlog
, "Warning: Don't know how to record %04x "
6682 "at %s.\n", insn
[0], paddress (gdbarch
, addr
));
6686 if (record_full_arch_list_add_reg (regcache
, S390_PSWA_REGNUM
))
6688 if (record_full_arch_list_add_end ())
6693 /* Miscellaneous. */
6695 /* Implement gdbarch_gcc_target_options. GCC does not know "-m32" or
6696 "-mcmodel=large". */
6699 s390_gcc_target_options (struct gdbarch
*gdbarch
)
6701 return xstrdup (gdbarch_ptr_bit (gdbarch
) == 64 ? "-m64" : "-m31");
6704 /* Implement gdbarch_gnu_triplet_regexp. Target triplets are "s390-*"
6705 for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
6706 always "s390". Note that an s390x compiler supports "-m31" as
6710 s390_gnu_triplet_regexp (struct gdbarch
*gdbarch
)
6715 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
6719 s390_stap_is_single_operand (struct gdbarch
*gdbarch
, const char *s
)
6721 return ((isdigit (*s
) && s
[1] == '(' && s
[2] == '%') /* Displacement
6723 || *s
== '%' /* Register access. */
6724 || isdigit (*s
)); /* Literal number. */
6729 /* Validate the range of registers. NAMES must be known at compile time. */
6731 #define s390_validate_reg_range(feature, tdesc_data, start, names) \
6734 for (int i = 0; i < ARRAY_SIZE (names); i++) \
6735 if (!tdesc_numbered_register (feature, tdesc_data, start + i, names[i])) \
6740 /* Validate the target description. Also numbers registers contained in
6744 s390_tdesc_valid (struct gdbarch_tdep
*tdep
,
6745 struct tdesc_arch_data
*tdesc_data
)
6747 static const char *const psw
[] = {
6750 static const char *const gprs
[] = {
6751 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
6752 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
6754 static const char *const fprs
[] = {
6755 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
6756 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
6758 static const char *const acrs
[] = {
6759 "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
6760 "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15"
6762 static const char *const gprs_lower
[] = {
6763 "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l",
6764 "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
6766 static const char *const gprs_upper
[] = {
6767 "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
6768 "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
6770 static const char *const tdb_regs
[] = {
6771 "tdb0", "tac", "tct", "atia",
6772 "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
6773 "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
6775 static const char *const vxrs_low
[] = {
6776 "v0l", "v1l", "v2l", "v3l", "v4l", "v5l", "v6l", "v7l", "v8l",
6777 "v9l", "v10l", "v11l", "v12l", "v13l", "v14l", "v15l",
6779 static const char *const vxrs_high
[] = {
6780 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24",
6781 "v25", "v26", "v27", "v28", "v29", "v30", "v31",
6783 static const char *const gs_cb
[] = {
6784 "gsd", "gssm", "gsepla",
6786 static const char *const gs_bc
[] = {
6787 "bc_gsd", "bc_gssm", "bc_gsepla",
6790 const struct target_desc
*tdesc
= tdep
->tdesc
;
6791 const struct tdesc_feature
*feature
;
6793 if (!tdesc_has_registers (tdesc
))
6796 /* Core registers, i.e. general purpose and PSW. */
6797 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.core");
6798 if (feature
== NULL
)
6801 s390_validate_reg_range (feature
, tdesc_data
, S390_PSWM_REGNUM
, psw
);
6803 if (tdesc_unnumbered_register (feature
, "r0"))
6805 s390_validate_reg_range (feature
, tdesc_data
, S390_R0_REGNUM
, gprs
);
6809 tdep
->have_upper
= true;
6810 s390_validate_reg_range (feature
, tdesc_data
, S390_R0_REGNUM
,
6812 s390_validate_reg_range (feature
, tdesc_data
, S390_R0_UPPER_REGNUM
,
6816 /* Floating point registers. */
6817 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.fpr");
6818 if (feature
== NULL
)
6821 if (!tdesc_numbered_register (feature
, tdesc_data
, S390_FPC_REGNUM
, "fpc"))
6824 s390_validate_reg_range (feature
, tdesc_data
, S390_F0_REGNUM
, fprs
);
6826 /* Access control registers. */
6827 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.acr");
6828 if (feature
== NULL
)
6831 s390_validate_reg_range (feature
, tdesc_data
, S390_A0_REGNUM
, acrs
);
6833 /* Optional GNU/Linux-specific "registers". */
6834 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.linux");
6837 tdesc_numbered_register (feature
, tdesc_data
,
6838 S390_ORIG_R2_REGNUM
, "orig_r2");
6840 if (tdesc_numbered_register (feature
, tdesc_data
,
6841 S390_LAST_BREAK_REGNUM
, "last_break"))
6842 tdep
->have_linux_v1
= true;
6844 if (tdesc_numbered_register (feature
, tdesc_data
,
6845 S390_SYSTEM_CALL_REGNUM
, "system_call"))
6846 tdep
->have_linux_v2
= true;
6848 if (tdep
->have_linux_v2
&& !tdep
->have_linux_v1
)
6852 /* Transaction diagnostic block. */
6853 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.tdb");
6856 s390_validate_reg_range (feature
, tdesc_data
, S390_TDB_DWORD0_REGNUM
,
6858 tdep
->have_tdb
= true;
6861 /* Vector registers. */
6862 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.vx");
6865 s390_validate_reg_range (feature
, tdesc_data
, S390_V0_LOWER_REGNUM
,
6867 s390_validate_reg_range (feature
, tdesc_data
, S390_V16_REGNUM
,
6869 tdep
->have_vx
= true;
6872 /* Guarded-storage registers. */
6873 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.gs");
6876 s390_validate_reg_range (feature
, tdesc_data
, S390_GSD_REGNUM
, gs_cb
);
6877 tdep
->have_gs
= true;
6880 /* Guarded-storage broadcast control. */
6881 feature
= tdesc_find_feature (tdesc
, "org.gnu.gdb.s390.gsbc");
6886 s390_validate_reg_range (feature
, tdesc_data
, S390_BC_GSD_REGNUM
,
6893 /* Allocate and initialize new gdbarch_tdep. Caller is responsible to free
6894 memory after use. */
6896 static struct gdbarch_tdep
*
6897 s390_gdbarch_tdep_alloc ()
6899 struct gdbarch_tdep
*tdep
= XCNEW (struct gdbarch_tdep
);
6903 tdep
->abi
= ABI_NONE
;
6904 tdep
->vector_abi
= S390_VECTOR_ABI_NONE
;
6906 tdep
->gpr_full_regnum
= -1;
6907 tdep
->v0_full_regnum
= -1;
6908 tdep
->pc_regnum
= -1;
6909 tdep
->cc_regnum
= -1;
6911 tdep
->have_upper
= false;
6912 tdep
->have_linux_v1
= false;
6913 tdep
->have_linux_v2
= false;
6914 tdep
->have_tdb
= false;
6915 tdep
->have_vx
= false;
6916 tdep
->have_gs
= false;
6918 tdep
->s390_syscall_record
= NULL
;
6923 /* Set up gdbarch struct. */
6925 static struct gdbarch
*
6926 s390_gdbarch_init (struct gdbarch_info info
, struct gdbarch_list
*arches
)
6928 const struct target_desc
*tdesc
= info
.target_desc
;
6929 int first_pseudo_reg
, last_pseudo_reg
;
6930 static const char *const stap_register_prefixes
[] = { "%", NULL
};
6931 static const char *const stap_register_indirection_prefixes
[] = { "(",
6933 static const char *const stap_register_indirection_suffixes
[] = { ")",
6936 struct gdbarch_tdep
*tdep
= s390_gdbarch_tdep_alloc ();
6937 struct gdbarch
*gdbarch
= gdbarch_alloc (&info
, tdep
);
6938 struct tdesc_arch_data
*tdesc_data
= tdesc_data_alloc ();
6939 info
.tdesc_data
= tdesc_data
;
6941 set_gdbarch_believe_pcc_promotion (gdbarch
, 0);
6942 set_gdbarch_char_signed (gdbarch
, 0);
6944 /* S/390 GNU/Linux uses either 64-bit or 128-bit long doubles.
6945 We can safely let them default to 128-bit, since the debug info
6946 will give the size of type actually used in each case. */
6947 set_gdbarch_long_double_bit (gdbarch
, 128);
6948 set_gdbarch_long_double_format (gdbarch
, floatformats_ia64_quad
);
6951 /* Amount PC must be decremented by after a breakpoint. This is
6952 often the number of bytes returned by gdbarch_breakpoint_from_pc but not
6954 set_gdbarch_decr_pc_after_break (gdbarch
, 2);
6955 set_gdbarch_breakpoint_kind_from_pc (gdbarch
, s390_breakpoint::kind_from_pc
);
6956 set_gdbarch_sw_breakpoint_from_kind (gdbarch
, s390_breakpoint::bp_from_kind
);
6958 /* Displaced stepping. */
6959 set_gdbarch_displaced_step_copy_insn (gdbarch
,
6960 s390_displaced_step_copy_insn
);
6961 set_gdbarch_displaced_step_fixup (gdbarch
, s390_displaced_step_fixup
);
6962 set_gdbarch_displaced_step_location (gdbarch
, linux_displaced_step_location
);
6963 set_gdbarch_displaced_step_hw_singlestep (gdbarch
, s390_displaced_step_hw_singlestep
);
6964 set_gdbarch_software_single_step (gdbarch
, s390_software_single_step
);
6965 set_gdbarch_max_insn_length (gdbarch
, S390_MAX_INSTR_SIZE
);
6967 /* Prologue analysis. */
6968 set_gdbarch_skip_prologue (gdbarch
, s390_skip_prologue
);
6970 /* Register handling. */
6971 set_gdbarch_num_regs (gdbarch
, S390_NUM_REGS
);
6972 set_gdbarch_sp_regnum (gdbarch
, S390_SP_REGNUM
);
6973 set_gdbarch_fp0_regnum (gdbarch
, S390_F0_REGNUM
);
6974 set_gdbarch_guess_tracepoint_registers (gdbarch
,
6975 s390_guess_tracepoint_registers
);
6976 set_gdbarch_stab_reg_to_regnum (gdbarch
, s390_dwarf_reg_to_regnum
);
6977 set_gdbarch_dwarf2_reg_to_regnum (gdbarch
, s390_dwarf_reg_to_regnum
);
6978 set_gdbarch_value_from_register (gdbarch
, s390_value_from_register
);
6980 /* Pseudo registers. */
6981 set_gdbarch_pseudo_register_read (gdbarch
, s390_pseudo_register_read
);
6982 set_gdbarch_pseudo_register_write (gdbarch
, s390_pseudo_register_write
);
6983 set_tdesc_pseudo_register_name (gdbarch
, s390_pseudo_register_name
);
6984 set_tdesc_pseudo_register_type (gdbarch
, s390_pseudo_register_type
);
6985 set_tdesc_pseudo_register_reggroup_p (gdbarch
,
6986 s390_pseudo_register_reggroup_p
);
6987 set_gdbarch_ax_pseudo_register_collect (gdbarch
,
6988 s390_ax_pseudo_register_collect
);
6989 set_gdbarch_ax_pseudo_register_push_stack
6990 (gdbarch
, s390_ax_pseudo_register_push_stack
);
6991 set_gdbarch_gen_return_address (gdbarch
, s390_gen_return_address
);
6993 /* Inferior function calls. */
6994 set_gdbarch_push_dummy_call (gdbarch
, s390_push_dummy_call
);
6995 set_gdbarch_dummy_id (gdbarch
, s390_dummy_id
);
6996 set_gdbarch_frame_align (gdbarch
, s390_frame_align
);
6997 set_gdbarch_return_value (gdbarch
, s390_return_value
);
6999 /* Frame handling. */
7000 /* Stack grows downward. */
7001 set_gdbarch_inner_than (gdbarch
, core_addr_lessthan
);
7002 set_gdbarch_stack_frame_destroyed_p (gdbarch
, s390_stack_frame_destroyed_p
);
7003 dwarf2_frame_set_init_reg (gdbarch
, s390_dwarf2_frame_init_reg
);
7004 dwarf2_frame_set_adjust_regnum (gdbarch
, s390_adjust_frame_regnum
);
7005 dwarf2_append_unwinders (gdbarch
);
7006 set_gdbarch_unwind_pc (gdbarch
, s390_unwind_pc
);
7007 set_gdbarch_unwind_sp (gdbarch
, s390_unwind_sp
);
7009 switch (info
.bfd_arch_info
->mach
)
7011 case bfd_mach_s390_31
:
7012 set_gdbarch_addr_bits_remove (gdbarch
, s390_addr_bits_remove
);
7015 case bfd_mach_s390_64
:
7016 set_gdbarch_long_bit (gdbarch
, 64);
7017 set_gdbarch_long_long_bit (gdbarch
, 64);
7018 set_gdbarch_ptr_bit (gdbarch
, 64);
7019 set_gdbarch_address_class_type_flags (gdbarch
,
7020 s390_address_class_type_flags
);
7021 set_gdbarch_address_class_type_flags_to_name (gdbarch
,
7022 s390_address_class_type_flags_to_name
);
7023 set_gdbarch_address_class_name_to_type_flags (gdbarch
,
7024 s390_address_class_name_to_type_flags
);
7028 /* SystemTap functions. */
7029 set_gdbarch_stap_register_prefixes (gdbarch
, stap_register_prefixes
);
7030 set_gdbarch_stap_register_indirection_prefixes (gdbarch
,
7031 stap_register_indirection_prefixes
);
7032 set_gdbarch_stap_register_indirection_suffixes (gdbarch
,
7033 stap_register_indirection_suffixes
);
7035 set_gdbarch_disassembler_options (gdbarch
, &s390_disassembler_options
);
7036 set_gdbarch_valid_disassembler_options (gdbarch
,
7037 disassembler_options_s390 ());
7039 /* Process record-replay */
7040 set_gdbarch_process_record (gdbarch
, s390_process_record
);
7042 /* Miscellaneous. */
7043 set_gdbarch_stap_is_single_operand (gdbarch
, s390_stap_is_single_operand
);
7044 set_gdbarch_gcc_target_options (gdbarch
, s390_gcc_target_options
);
7045 set_gdbarch_gnu_triplet_regexp (gdbarch
, s390_gnu_triplet_regexp
);
7047 /* Initialize the OSABI. */
7048 gdbarch_init_osabi (info
, gdbarch
);
7050 /* Always create a default tdesc. Otherwise commands like 'set osabi'
7051 cause GDB to crash with an internal error when the user tries to set
7052 an unsupported OSABI. */
7053 if (!tdesc_has_registers (tdesc
))
7055 if (info
.bfd_arch_info
->mach
== bfd_mach_s390_31
)
7056 tdesc
= tdesc_s390_linux32
;
7058 tdesc
= tdesc_s390x_linux64
;
7060 tdep
->tdesc
= tdesc
;
7062 /* Check any target description for validity. */
7063 if (!s390_tdesc_valid (tdep
, tdesc_data
))
7065 tdesc_data_cleanup (tdesc_data
);
7067 gdbarch_free (gdbarch
);
7071 /* Determine vector ABI. */
7074 && info
.abfd
!= NULL
7075 && info
.abfd
->format
== bfd_object
7076 && bfd_get_flavour (info
.abfd
) == bfd_target_elf_flavour
7077 && bfd_elf_get_obj_attr_int (info
.abfd
, OBJ_ATTR_GNU
,
7078 Tag_GNU_S390_ABI_Vector
) == 2)
7079 tdep
->vector_abi
= S390_VECTOR_ABI_128
;
7082 /* Find a candidate among extant architectures. */
7083 for (arches
= gdbarch_list_lookup_by_info (arches
, &info
);
7085 arches
= gdbarch_list_lookup_by_info (arches
->next
, &info
))
7087 struct gdbarch_tdep
*tmp
= gdbarch_tdep (arches
->gdbarch
);
7090 /* A program can 'choose' not to use the vector registers when they
7091 are present. Leading to the same tdesc but different tdep and
7092 thereby a different gdbarch. */
7093 if (tmp
->vector_abi
!= tdep
->vector_abi
)
7096 tdesc_data_cleanup (tdesc_data
);
7098 gdbarch_free (gdbarch
);
7099 return arches
->gdbarch
;
7102 tdesc_use_registers (gdbarch
, tdep
->tdesc
, tdesc_data
);
7103 set_gdbarch_register_name (gdbarch
, s390_register_name
);
7105 /* Assign pseudo register numbers. */
7106 first_pseudo_reg
= gdbarch_num_regs (gdbarch
);
7107 last_pseudo_reg
= first_pseudo_reg
;
7108 if (tdep
->have_upper
)
7110 tdep
->gpr_full_regnum
= last_pseudo_reg
;
7111 last_pseudo_reg
+= 16;
7115 tdep
->v0_full_regnum
= last_pseudo_reg
;
7116 last_pseudo_reg
+= 16;
7118 tdep
->pc_regnum
= last_pseudo_reg
++;
7119 tdep
->cc_regnum
= last_pseudo_reg
++;
7120 set_gdbarch_pc_regnum (gdbarch
, tdep
->pc_regnum
);
7121 set_gdbarch_num_pseudo_regs (gdbarch
, last_pseudo_reg
- first_pseudo_reg
);
7123 /* Frame handling. */
7124 frame_base_append_sniffer (gdbarch
, dwarf2_frame_base_sniffer
);
7125 frame_unwind_append_unwinder (gdbarch
, &s390_stub_frame_unwind
);
7126 frame_unwind_append_unwinder (gdbarch
, &s390_frame_unwind
);
7127 frame_base_set_default (gdbarch
, &s390_frame_base
);
7133 _initialize_s390_tdep (void)
7135 /* Hook us into the gdbarch mechanism. */
7136 register_gdbarch_init (bfd_arch_s390
, s390_gdbarch_init
);
7138 initialize_tdesc_s390_linux32 ();
7139 initialize_tdesc_s390x_linux64 ();