[PATCH v2 57/95] linux-user: Move elf_core_copy_regs to openrisc/elfload.c

Richard Henderson posted 95 patches 3 months, 2 weeks ago
Maintainers: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>, Brian Cain <brian.cain@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>
There is a newer version of this series
[PATCH v2 57/95] linux-user: Move elf_core_copy_regs to openrisc/elfload.c
Posted by Richard Henderson 3 months, 2 weeks ago
Move elf_core_copy_regs to elfload.c.
Move ELF_NREG to target_elf.h.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/openrisc/target_elf.h |  3 +++
 linux-user/elfload.c             | 14 --------------
 linux-user/openrisc/elfload.c    | 11 +++++++++++
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_elf.h
index b34f2ff672..4ffe54fe87 100644
--- a/linux-user/openrisc/target_elf.h
+++ b/linux-user/openrisc/target_elf.h
@@ -8,4 +8,7 @@
 #ifndef OPENRISC_TARGET_ELF_H
 #define OPENRISC_TARGET_ELF_H
 
+/* See linux kernel arch/openrisc/include/asm/elf.h.  */
+#define ELF_NREG                34 /* gprs and pc, sr */
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 161118d855..2597fb8bc0 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -418,20 +418,6 @@ static const VdsoImageInfo *vdso_image_info(uint32_t elf_flags)
 
 #define ELF_EXEC_PAGESIZE 8192
 
-/* See linux kernel arch/openrisc/include/asm/elf.h.  */
-#define ELF_NREG 34 /* gprs and pc, sr */
-
-void elf_core_copy_regs(target_ulong *regs, const CPUOpenRISCState *env)
-{
-    int i;
-
-    for (i = 0; i < 32; i++) {
-        regs[i] = tswapl(cpu_get_gpr(env, i));
-    }
-    regs[32] = tswapl(env->pc);
-    regs[33] = tswapl(cpu_get_sr(env));
-}
-
 #endif /* TARGET_OPENRISC */
 
 #ifdef TARGET_SH4
diff --git a/linux-user/openrisc/elfload.c b/linux-user/openrisc/elfload.c
index b92442dfeb..9851f04d64 100644
--- a/linux-user/openrisc/elfload.c
+++ b/linux-user/openrisc/elfload.c
@@ -9,3 +9,14 @@ const char *get_elf_cpu_model(uint32_t eflags)
 {
     return "any";
 }
+
+void elf_core_copy_regs(target_ulong *regs, const CPUOpenRISCState *env)
+{
+    int i;
+
+    for (i = 0; i < 32; i++) {
+        regs[i] = tswapl(cpu_get_gpr(env, i));
+    }
+    regs[32] = tswapl(env->pc);
+    regs[33] = tswapl(cpu_get_sr(env));
+}
-- 
2.43.0