On 12/4/21 10:29, Song Gao wrote: > Signed-off-by: Song Gao <gaos...@loongson.cn> > Signed-off-by: Xiaojuan Yang <yangxiaoj...@loongson.cn> > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > --- > include/elf.h | 2 ++ > linux-user/elfload.c | 58 > +++++++++++++++++++++++++++++++++++++ > linux-user/loongarch64/target_elf.h | 12 ++++++++ > 3 files changed, 72 insertions(+) > create mode 100644 linux-user/loongarch64/target_elf.h
> +/* See linux kernel: arch/loongarch/include/asm/reg.h. */ > +enum { > + TARGET_EF_R0 = 0, > + TARGET_EF_CSR_ERA = TARGET_EF_R0 + 32, > + TARGET_EF_CSR_BADVADDR = TARGET_EF_R0 + 33, > +}; > + > +/* See linux kernel: arch/loongarch/kernel/process.c:loongarch_dump_regs64. > */ > +static void elf_core_copy_regs(target_elf_gregset_t *regs, > + const CPULoongArchState *env) > +{ > + int i; > + > + for (i = 0; i < TARGET_EF_R0; i++) { > + (*regs)[i] = 0; > + } Dead code... Removing it: Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> > + (*regs)[TARGET_EF_R0] = 0; > + > + for (i = 1; i < ARRAY_SIZE(env->gpr); i++) { > + (*regs)[TARGET_EF_R0 + i] = tswapreg(env->gpr[i]); > + } > + > + (*regs)[TARGET_EF_CSR_ERA] = tswapreg(env->pc); > + (*regs)[TARGET_EF_CSR_BADVADDR] = tswapreg(env->badaddr); > +}