[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 59/59] linux-user/elfload: add s390x core dumping support
From: |
Laurent Vivier |
Subject: |
[PULL 59/59] linux-user/elfload: add s390x core dumping support |
Date: |
Mon, 17 May 2021 20:14:24 +0200 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
Provide the following definitions required by the common code:
* ELF_NREG: with the value of sizeof(s390_regs) / sizeof(long).
* target_elf_gregset_t: define it like all the other arches do.
* elf_core_copy_regs(): similar to kernel's s390_regs_get().
* USE_ELF_CORE_DUMP.
* ELF_EXEC_PAGESIZE.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20210413205608.22587-1-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/elfload.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 9779263727ba..0e832b2649f6 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1375,6 +1375,39 @@ static inline void init_thread(struct target_pt_regs
*regs, struct image_info *i
regs->gprs[15] = infop->start_stack;
}
+/* See linux kernel: arch/s390/include/uapi/asm/ptrace.h (s390_regs). */
+#define ELF_NREG 27
+typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
+
+enum {
+ TARGET_REG_PSWM = 0,
+ TARGET_REG_PSWA = 1,
+ TARGET_REG_GPRS = 2,
+ TARGET_REG_ARS = 18,
+ TARGET_REG_ORIG_R2 = 26,
+};
+
+static void elf_core_copy_regs(target_elf_gregset_t *regs,
+ const CPUS390XState *env)
+{
+ int i;
+ uint32_t *aregs;
+
+ (*regs)[TARGET_REG_PSWM] = tswapreg(env->psw.mask);
+ (*regs)[TARGET_REG_PSWA] = tswapreg(env->psw.addr);
+ for (i = 0; i < 16; i++) {
+ (*regs)[TARGET_REG_GPRS + i] = tswapreg(env->regs[i]);
+ }
+ aregs = (uint32_t *)&((*regs)[TARGET_REG_ARS]);
+ for (i = 0; i < 16; i++) {
+ aregs[i] = tswap32(env->aregs[i]);
+ }
+ (*regs)[TARGET_REG_ORIG_R2] = 0;
+}
+
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE 4096
+
#endif /* TARGET_S390X */
#ifdef TARGET_RISCV
--
2.31.1
- [PULL 42/59] linux-user/s390x: Set psw.mask properly for the signal handler, (continued)
- [PULL 42/59] linux-user/s390x: Set psw.mask properly for the signal handler, Laurent Vivier, 2021/05/17
- [PULL 41/59] linux-user/s390x: Clean up single-use gotos in signal.c, Laurent Vivier, 2021/05/17
- [PULL 48/59] linux-user: Add copy_file_range to strace.list, Laurent Vivier, 2021/05/17
- [PULL 50/59] linux-user: use GDateTime for formatting timestamp for core file, Laurent Vivier, 2021/05/17
- [PULL 55/59] linux-user/alpha: Define TARGET_ARCH_HAS_KA_RESTORER, Laurent Vivier, 2021/05/17
- [PULL 44/59] linux-user/s390x: Fix frame_addr corruption in setup_frame, Laurent Vivier, 2021/05/17
- [PULL 51/59] linux-user/alpha: Fix rt sigframe return, Laurent Vivier, 2021/05/17
- [PULL 56/59] linux-user/alpha: Share code for TARGET_NR_sigaction, Laurent Vivier, 2021/05/17
- [PULL 52/59] linux-user/alpha: Rename the sigaction restorer field, Laurent Vivier, 2021/05/17
- [PULL 54/59] linux-user: Honor TARGET_ARCH_HAS_SA_RESTORER in do_syscall, Laurent Vivier, 2021/05/17
- [PULL 59/59] linux-user/elfload: add s390x core dumping support,
Laurent Vivier <=
- [PULL 47/59] linux-user/s390x: Handle vector regs in signal stack, Laurent Vivier, 2021/05/17
- [PULL 49/59] linux-user: Fix erroneous conversion in copy_file_range, Laurent Vivier, 2021/05/17
- [PULL 53/59] linux-user: Pass ka_restorer to do_sigaction, Laurent Vivier, 2021/05/17
- [PULL 57/59] linux-user: Tidy TARGET_NR_rt_sigaction, Laurent Vivier, 2021/05/17
- [PULL 38/59] linux-user/s390x: Fix sigcontext sregs value, Laurent Vivier, 2021/05/17
- Re: [PULL 00/59] Linux user for 6.1 patches, no-reply, 2021/05/17
- [PULL 00/59] Linux user for 6.1 patches, Laurent Vivier, 2021/05/18