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/xtensa/target_elf.h | 3 +++
linux-user/elfload.c | 35 ----------------------------------
linux-user/xtensa/elfload.c | 32 +++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/linux-user/xtensa/target_elf.h b/linux-user/xtensa/target_elf.h
index 2c55c22e14..f84fc9e6d1 100644
--- a/linux-user/xtensa/target_elf.h
+++ b/linux-user/xtensa/target_elf.h
@@ -8,4 +8,7 @@
#ifndef XTENSA_TARGET_ELF_H
#define XTENSA_TARGET_ELF_H
+/* See linux kernel: arch/xtensa/include/asm/elf.h. */
+#define ELF_NREG 128
+
#endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 80f5c967da..3ac0f89931 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -523,41 +523,6 @@ static bool init_guest_commpage(void)
#define ELF_CLASS ELFCLASS32
#define ELF_ARCH EM_XTENSA
-/* See linux kernel: arch/xtensa/include/asm/elf.h. */
-#define ELF_NREG 128
-
-enum {
- TARGET_REG_PC,
- TARGET_REG_PS,
- TARGET_REG_LBEG,
- TARGET_REG_LEND,
- TARGET_REG_LCOUNT,
- TARGET_REG_SAR,
- TARGET_REG_WINDOWSTART,
- TARGET_REG_WINDOWBASE,
- TARGET_REG_THREADPTR,
- TARGET_REG_AR0 = 64,
-};
-
-void elf_core_copy_regs(target_ulong *regs, const CPUXtensaState *env)
-{
- unsigned i;
-
- regs[TARGET_REG_PC] = tswapl(env->pc);
- regs[TARGET_REG_PS] = tswapl(env->sregs[PS] & ~PS_EXCM);
- regs[TARGET_REG_LBEG] = tswapl(env->sregs[LBEG]);
- regs[TARGET_REG_LEND] = tswapl(env->sregs[LEND]);
- regs[TARGET_REG_LCOUNT] = tswapl(env->sregs[LCOUNT]);
- regs[TARGET_REG_SAR] = tswapl(env->sregs[SAR]);
- regs[TARGET_REG_WINDOWSTART] = tswapl(env->sregs[WINDOW_START]);
- regs[TARGET_REG_WINDOWBASE] = tswapl(env->sregs[WINDOW_BASE]);
- regs[TARGET_REG_THREADPTR] = tswapl(env->uregs[THREADPTR]);
- xtensa_sync_phys_from_window((CPUXtensaState *)env);
- for (i = 0; i < env->config->nareg; ++i) {
- regs[TARGET_REG_AR0 + i] = tswapl(env->phys_regs[i]);
- }
-}
-
#define ELF_EXEC_PAGESIZE 4096
#endif /* TARGET_XTENSA */
diff --git a/linux-user/xtensa/elfload.c b/linux-user/xtensa/elfload.c
index e35ba69a10..e35de398da 100644
--- a/linux-user/xtensa/elfload.c
+++ b/linux-user/xtensa/elfload.c
@@ -9,3 +9,35 @@ const char *get_elf_cpu_model(uint32_t eflags)
{
return XTENSA_DEFAULT_CPU_MODEL;
}
+
+enum {
+ TARGET_REG_PC,
+ TARGET_REG_PS,
+ TARGET_REG_LBEG,
+ TARGET_REG_LEND,
+ TARGET_REG_LCOUNT,
+ TARGET_REG_SAR,
+ TARGET_REG_WINDOWSTART,
+ TARGET_REG_WINDOWBASE,
+ TARGET_REG_THREADPTR,
+ TARGET_REG_AR0 = 64,
+};
+
+void elf_core_copy_regs(target_ulong *regs, const CPUXtensaState *env)
+{
+ unsigned i;
+
+ regs[TARGET_REG_PC] = tswapl(env->pc);
+ regs[TARGET_REG_PS] = tswapl(env->sregs[PS] & ~PS_EXCM);
+ regs[TARGET_REG_LBEG] = tswapl(env->sregs[LBEG]);
+ regs[TARGET_REG_LEND] = tswapl(env->sregs[LEND]);
+ regs[TARGET_REG_LCOUNT] = tswapl(env->sregs[LCOUNT]);
+ regs[TARGET_REG_SAR] = tswapl(env->sregs[SAR]);
+ regs[TARGET_REG_WINDOWSTART] = tswapl(env->sregs[WINDOW_START]);
+ regs[TARGET_REG_WINDOWBASE] = tswapl(env->sregs[WINDOW_BASE]);
+ regs[TARGET_REG_THREADPTR] = tswapl(env->uregs[THREADPTR]);
+ xtensa_sync_phys_from_window((CPUXtensaState *)env);
+ for (i = 0; i < env->config->nareg; ++i) {
+ regs[TARGET_REG_AR0 + i] = tswapl(env->phys_regs[i]);
+ }
+}
--
2.43.0