Move elf_core_copy_regs to elfload.c.
Move ELF_NREG to target_elf.h.

Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
 linux-user/s390x/target_elf.h |  3 +++
 linux-user/elfload.c          | 28 ----------------------------
 linux-user/s390x/elfload.c    | 25 +++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/linux-user/s390x/target_elf.h b/linux-user/s390x/target_elf.h
index cebace949a..f83fdbbddf 100644
--- a/linux-user/s390x/target_elf.h
+++ b/linux-user/s390x/target_elf.h
@@ -10,4 +10,7 @@
 
 #define HAVE_ELF_HWCAP          1
 
+/* See linux kernel: arch/s390/include/uapi/asm/ptrace.h (s390_regs).  */
+#define ELF_NREG                27
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index bc1a06a651..80f5c967da 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -453,34 +453,6 @@ static const VdsoImageInfo *vdso_image_info(uint32_t 
elf_flags)
 #define ELF_DATA       ELFDATA2MSB
 #define ELF_ARCH       EM_S390
 
-/* See linux kernel: arch/s390/include/uapi/asm/ptrace.h (s390_regs).  */
-#define ELF_NREG 27
-
-enum {
-    TARGET_REG_PSWM = 0,
-    TARGET_REG_PSWA = 1,
-    TARGET_REG_GPRS = 2,
-    TARGET_REG_ARS = 18,
-    TARGET_REG_ORIG_R2 = 26,
-};
-
-void elf_core_copy_regs(target_ulong *regs, const CPUS390XState *env)
-{
-    int i;
-    uint32_t *aregs;
-
-    regs[TARGET_REG_PSWM] = tswapl(env->psw.mask);
-    regs[TARGET_REG_PSWA] = tswapl(env->psw.addr);
-    for (i = 0; i < 16; i++) {
-        regs[TARGET_REG_GPRS + i] = tswapl(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 ELF_EXEC_PAGESIZE 4096
 
 #define VDSO_HEADER "vdso.c.inc"
diff --git a/linux-user/s390x/elfload.c b/linux-user/s390x/elfload.c
index 79ceaba51d..38d72a36f9 100644
--- a/linux-user/s390x/elfload.c
+++ b/linux-user/s390x/elfload.c
@@ -66,3 +66,28 @@ const char *elf_hwcap_str(uint32_t bit)
 
     return bit < ARRAY_SIZE(hwcap_str) ? hwcap_str[bit] : NULL;
 }
+
+enum {
+    TARGET_REG_PSWM = 0,
+    TARGET_REG_PSWA = 1,
+    TARGET_REG_GPRS = 2,
+    TARGET_REG_ARS = 18,
+    TARGET_REG_ORIG_R2 = 26,
+};
+
+void elf_core_copy_regs(target_ulong *regs, const CPUS390XState *env)
+{
+    int i;
+    uint32_t *aregs;
+
+    regs[TARGET_REG_PSWM] = tswapl(env->psw.mask);
+    regs[TARGET_REG_PSWA] = tswapl(env->psw.addr);
+    for (i = 0; i < 16; i++) {
+        regs[TARGET_REG_GPRS + i] = tswapl(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;
+}
-- 
2.43.0


Reply via email to