qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v13 20/26] linux-user: Add LoongArch elf support


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v13 20/26] linux-user: Add LoongArch elf support
Date: Sat, 4 Dec 2021 18:05:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

On 12/4/21 10:29, Song Gao wrote:
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
> Reviewed-by: Richard Henderson <richard.henderson@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é <f4bug@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);
> +}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]