1 /*
2 * Copyright (c) 2015-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #ifndef HAVE_S390_COMPAT_REGS
9 typedef struct {
10 uint32_t mask;
11 uint32_t addr;
12 } ATTRIBUTE_ALIGNED(8) psw_compat_t;
13
14 typedef struct {
15 psw_compat_t psw;
16 uint32_t gprs[NUM_GPRS];
17 uint32_t acrs[NUM_ACRS];
18 uint32_t orig_gpr2;
19 } s390_compat_regs;
20 #endif
21
22 static union {
23 s390_compat_regs s390_regs;
24 s390_regs s390x_regs;
25 } s390x_regs_union;
26
27 #define s390_regset s390x_regs_union.s390_regs
28 #define s390x_regset s390x_regs_union.s390x_regs
29
30 static struct iovec s390x_io = {
31 .iov_base = &s390x_regs_union,
32 };
33
34
35 #define ARCH_REGS_FOR_GETREGSET s390x_regs_union
36 #define ARCH_IOVEC_FOR_GETREGSET s390x_io
37 #define ARCH_PC_REG \
38 (s390x_io.iov_len == sizeof(s390_regset) ? \
39 s390_regset.psw.addr : s390x_regset.psw.addr)
40 #define ARCH_SP_REG \
41 (s390x_io.iov_len == sizeof(s390_regset) ? \
42 s390_regset.gprs[15] : s390x_regset.gprs[15])
43
44 #define ARCH_PERSONALITY_0_IOV_SIZE sizeof(s390x_regset)
45 #define ARCH_PERSONALITY_1_IOV_SIZE sizeof(s390_regset)