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/sh4/target_elf.h | 3 +++ linux-user/elfload.c | 31 ------------------------------- linux-user/sh4/elfload.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/linux-user/sh4/target_elf.h b/linux-user/sh4/target_elf.h index badd0f5371..b0f1ece1e9 100644 --- a/linux-user/sh4/target_elf.h +++ b/linux-user/sh4/target_elf.h @@ -10,4 +10,7 @@ #define HAVE_ELF_HWCAP 1 +/* See linux kernel: arch/sh/include/asm/elf.h. */ +#define ELF_NREG 23 + #endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 2597fb8bc0..985c3e4e80 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -425,37 +425,6 @@ static const VdsoImageInfo *vdso_image_info(uint32_t elf_flags) #define ELF_CLASS ELFCLASS32 #define ELF_ARCH EM_SH -/* See linux kernel: arch/sh/include/asm/elf.h. */ -#define ELF_NREG 23 - -/* See linux kernel: arch/sh/include/asm/ptrace.h. */ -enum { - TARGET_REG_PC = 16, - TARGET_REG_PR = 17, - TARGET_REG_SR = 18, - TARGET_REG_GBR = 19, - TARGET_REG_MACH = 20, - TARGET_REG_MACL = 21, - TARGET_REG_SYSCALL = 22 -}; - -void elf_core_copy_regs(target_ulong *regs, const CPUSH4State *env) -{ - int i; - - for (i = 0; i < 16; i++) { - regs[i] = tswapl(env->gregs[i]); - } - - regs[TARGET_REG_PC] = tswapl(env->pc); - regs[TARGET_REG_PR] = tswapl(env->pr); - regs[TARGET_REG_SR] = tswapl(env->sr); - regs[TARGET_REG_GBR] = tswapl(env->gbr); - regs[TARGET_REG_MACH] = tswapl(env->mach); - regs[TARGET_REG_MACL] = tswapl(env->macl); - regs[TARGET_REG_SYSCALL] = 0; /* FIXME */ -} - #define ELF_EXEC_PAGESIZE 4096 #endif diff --git a/linux-user/sh4/elfload.c b/linux-user/sh4/elfload.c index 99ad4f6334..5592036461 100644 --- a/linux-user/sh4/elfload.c +++ b/linux-user/sh4/elfload.c @@ -36,3 +36,31 @@ abi_ulong get_elf_hwcap(CPUState *cs) return hwcap; } + +/* See linux kernel: arch/sh/include/asm/ptrace.h. */ +enum { + TARGET_REG_PC = 16, + TARGET_REG_PR = 17, + TARGET_REG_SR = 18, + TARGET_REG_GBR = 19, + TARGET_REG_MACH = 20, + TARGET_REG_MACL = 21, + TARGET_REG_SYSCALL = 22 +}; + +void elf_core_copy_regs(target_ulong *regs, const CPUSH4State *env) +{ + int i; + + for (i = 0; i < 16; i++) { + regs[i] = tswapl(env->gregs[i]); + } + + regs[TARGET_REG_PC] = tswapl(env->pc); + regs[TARGET_REG_PR] = tswapl(env->pr); + regs[TARGET_REG_SR] = tswapl(env->sr); + regs[TARGET_REG_GBR] = tswapl(env->gbr); + regs[TARGET_REG_MACH] = tswapl(env->mach); + regs[TARGET_REG_MACL] = tswapl(env->macl); + regs[TARGET_REG_SYSCALL] = 0; /* FIXME */ +} -- 2.43.0