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/ppc/target_elf.h |  3 +++
 linux-user/elfload.c        | 22 ----------------------
 linux-user/ppc/elfload.c    | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h
index 4203a89d66..dd8a65b1fa 100644
--- a/linux-user/ppc/target_elf.h
+++ b/linux-user/ppc/target_elf.h
@@ -11,4 +11,7 @@
 #define HAVE_ELF_HWCAP          1
 #define HAVE_ELF_HWCAP2         1
 
+/* See linux kernel: arch/powerpc/include/asm/elf.h.  */
+#define ELF_NREG                48
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 9ac530800e..0bfcbcf78d 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -353,28 +353,6 @@ static const VdsoImageInfo *vdso_image_info(uint32_t 
elf_flags)
         NEW_AUX_ENT(AT_UCACHEBSIZE, 0);                 \
     } while (0)
 
-/* See linux kernel: arch/powerpc/include/asm/elf.h.  */
-#define ELF_NREG 48
-
-void elf_core_copy_regs(target_ulong *regs, const CPUPPCState *env)
-{
-    int i;
-    target_ulong ccr = 0;
-
-    for (i = 0; i < ARRAY_SIZE(env->gpr); i++) {
-        regs[i] = tswapl(env->gpr[i]);
-    }
-
-    regs[32] = tswapl(env->nip);
-    regs[33] = tswapl(env->msr);
-    regs[35] = tswapl(env->ctr);
-    regs[36] = tswapl(env->lr);
-    regs[37] = tswapl(cpu_read_xer(env));
-
-    ccr = ppc_get_cr(env);
-    regs[38] = tswapl(ccr);
-}
-
 #define ELF_EXEC_PAGESIZE       4096
 
 #ifndef TARGET_PPC64
diff --git a/linux-user/ppc/elfload.c b/linux-user/ppc/elfload.c
index a214675650..9ebe252b3e 100644
--- a/linux-user/ppc/elfload.c
+++ b/linux-user/ppc/elfload.c
@@ -129,3 +129,22 @@ abi_ulong get_elf_hwcap2(CPUState *cs)
 
     return features;
 }
+
+void elf_core_copy_regs(target_ulong *regs, const CPUPPCState *env)
+{
+    int i;
+    target_ulong ccr = 0;
+
+    for (i = 0; i < ARRAY_SIZE(env->gpr); i++) {
+        regs[i] = tswapl(env->gpr[i]);
+    }
+
+    regs[32] = tswapl(env->nip);
+    regs[33] = tswapl(env->msr);
+    regs[35] = tswapl(env->ctr);
+    regs[36] = tswapl(env->lr);
+    regs[37] = tswapl(cpu_read_xer(env));
+
+    ccr = ppc_get_cr(env);
+    regs[38] = tswapl(ccr);
+}
-- 
2.43.0


Reply via email to