qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v7 56/80] mips_malta: Add basic nanoMIPS boot co


From: Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH v7 56/80] mips_malta: Add basic nanoMIPS boot code for MIPS' Malta
Date: Mon, 6 Aug 2018 19:40:40 +0000

> From: Aleksandar Markovic <address@hidden>
> Sent: Monday, August 6, 2018 7:00 PM
> Subject: [PATCH v7 56/80] mips_malta: Add basic nanoMIPS boot code for MIPS' 
> Malta
> 
> From: Matthew Fortune <address@hidden>
> 
> Added very very basic nanoMIPS boot code but this is hacked in
> unconditionally currently.
> 
> Signed-off-by: Yongbok Kim <address@hidden>
> Signed-off-by: Aleksandar Markovic <address@hidden>
> Signed-off-by: Stefan Markovic <address@hidden>
> ---
>  hw/mips/mips_malta.c | 75 
> +++++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 69 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> 
> @@ -813,10 +865,16 @@ static int64_t load_kernel (void)
>                             NULL, (uint64_t *)&kernel_entry, NULL,
>                             (uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, 
> 0);
>      if (kernel_size < 0) {
> -        error_report("could not load kernel '%s': %s",
> -                     loaderparams.kernel_filename,
> -                     load_elf_strerror(kernel_size));
> -        exit(1);
> +        kernel_size = load_elf(loaderparams.kernel_filename,
> +                    cpu_mips_kseg0_to_phys, NULL,
> +                    (uint64_t *)&kernel_entry, NULL,
> +                    (uint64_t *)&kernel_high, big_endian, EM_NANOMIPS, 1, 0);
> +        if (kernel_size < 0) {
> +            error_report("could not load kernel '%s': %s",
> +                         loaderparams.kernel_filename,
> +                         load_elf_strerror(kernel_size));
> +            exit(1);
> +        }
>      }
> 

Instead of invoking load_elf() twice, in load_elf32 (aka glue(load_elf, SZ)), 
there should be something like this:

        case EM_MIPS:
        case EM_NANOMIPS:
            if ((ehdr.e_machine != EM_MIPS) &&
                (ehdr.e_machine != EM_NANOMIPS)) {
                    ret = ELF_LOAD_WRONG_ARCH;
                    goto fail;
                }
            }
            break;

In any case, Malta board should work with both EM_MIPS and EM_NANOMIPS. Please 
make sure both cases are well understood and tested.



reply via email to

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