diff mbox series

[1/2] hw/mips: Simplify loading 64-bit ELF kernels

Message ID 20200927163943.614604-2-f4bug@amsat.org
State New
Headers show
Series hw/mips: Code simplifications | expand

Commit Message

Philippe Mathieu-Daudé Sept. 27, 2020, 4:39 p.m. UTC
Since 82790064116 ("Cast ELF datatypes properly to host 64bit types")
we don't need to sign-extend the entry_point address. Remove this
unnecessary code.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/mipssim.c | 6 +-----
 hw/mips/r4k.c     | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

Comments

Richard Henderson Oct. 5, 2020, 1:36 p.m. UTC | #1
On 9/27/20 11:39 AM, Philippe Mathieu-Daudé wrote:
> Since 82790064116 ("Cast ELF datatypes properly to host 64bit types")

> we don't need to sign-extend the entry_point address. Remove this

> unnecessary code.

> 

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

>  hw/mips/mipssim.c | 6 +-----

>  hw/mips/r4k.c     | 6 +-----

>  2 files changed, 2 insertions(+), 10 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c
index 1b3b7622035..3aeb1207e1a 100644
--- a/hw/mips/mipssim.c
+++ b/hw/mips/mipssim.c
@@ -76,11 +76,7 @@  static int64_t load_kernel(void)
                            (uint64_t *)&entry, NULL,
                            (uint64_t *)&kernel_high, NULL, big_endian,
                            EM_MIPS, 1, 0);
-    if (kernel_size >= 0) {
-        if ((entry & ~0x7fffffffULL) == 0x80000000) {
-            entry = (int32_t)entry;
-        }
-    } else {
+    if (kernel_size < 0) {
         error_report("could not load kernel '%s': %s",
                      loaderparams.kernel_filename,
                      load_elf_strerror(kernel_size));
diff --git a/hw/mips/r4k.c b/hw/mips/r4k.c
index 3487013a4a1..74f916a3982 100644
--- a/hw/mips/r4k.c
+++ b/hw/mips/r4k.c
@@ -101,11 +101,7 @@  static int64_t load_kernel(void)
                            (uint64_t *)&entry, NULL,
                            (uint64_t *)&kernel_high, NULL, big_endian,
                            EM_MIPS, 1, 0);
-    if (kernel_size >= 0) {
-        if ((entry & ~0x7fffffffULL) == 0x80000000) {
-            entry = (int32_t)entry;
-        }
-    } else {
+    if (kernel_size < 0) {
         error_report("could not load kernel '%s': %s",
                      loaderparams.kernel_filename,
                      load_elf_strerror(kernel_size));