Skip to contentSkip to conversation

hw/nios2/boot: Remove dead code (big endian check)

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Feb 25, 2020 – Mar 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/nios2/boot: Remove dead code (big endian check)

We only build the little-endian softmmu configuration (all Nios II processors are only little endian). Checking for big endian is pointless, remove the unused code.

---
 hw/nios2/boot.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
hw/nios2/boot.c +2 -7
index 88224aa84c..000f8205d6 100644
@@ -140,16 +140,11 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
     if (kernel_filename) {
         int kernel_size, fdt_size;
         uint64_t entry, low, high;
-        int big_endian = 0;
-
-#ifdef TARGET_WORDS_BIGENDIAN
-        big_endian = 1;
-#endif
 
         /* Boots a kernel elf binary. */
         kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
                                &entry, &low, &high, NULL,
-                               big_endian, EM_ALTERA_NIOS2, 0, 0);
+                               0, EM_ALTERA_NIOS2, 0, 0);
         if ((uint32_t)entry == 0xc0000000) {
             /*
              * The Nios II processor reference guide documents that the
@@ -160,7 +155,7 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
             kernel_size = load_elf(kernel_filename, NULL,
                                    translate_kernel_address, NULL,
                                    &entry, NULL, NULL, NULL,
-                                   big_endian, EM_ALTERA_NIOS2, 0, 0);
+                                   0, EM_ALTERA_NIOS2, 0, 0);
             boot_info.bootstrap_pc = ddr_base + 0xc0000000 +
                 (entry & 0x07ffffff);
         } else {
Signature · 1 line
2.21.1
Reviewed-by on v1 1/1
#1 lore raw

Le 25/02/2020 à 12:51, Philippe Mathieu-Daudé a écrit :

Quoted 33 lines

We only build the little-endian softmmu configuration (all Nios II processors are only little endian). Checking for big endian is pointless, remove the unused code.

---
 hw/nios2/boot.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
hw/nios2/boot.c +1 -6
index 88224aa84c..000f8205d6 100644
@@ -140,16 +140,11 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
     if (kernel_filename) {
         int kernel_size, fdt_size;
         uint64_t entry, low, high;
-        int big_endian = 0;
-
-#ifdef TARGET_WORDS_BIGENDIAN
-        big_endian = 1;
-#endif
 
         /* Boots a kernel elf binary. */
         kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
                                &entry, &low, &high, NULL,
-                               big_endian, EM_ALTERA_NIOS2, 0, 0);
+                               0, EM_ALTERA_NIOS2, 0, 0);
         if ((uint32_t)entry == 0xc0000000) {
             /*
              * The Nios II processor reference guide documents that the

hw/nios2/boot.c void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base, · line 161

Quoted 8 lines
hw/nios2/boot.c +1 -1
@@ -160,7 +155,7 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
             kernel_size = load_elf(kernel_filename, NULL,
                                    translate_kernel_address, NULL,
                                    &entry, NULL, NULL, NULL,
-                                   big_endian, EM_ALTERA_NIOS2, 0, 0);
+                                   0, EM_ALTERA_NIOS2, 0, 0);
             boot_info.bootstrap_pc = ddr_base + 0xc0000000 +
                 (entry & 0x07ffffff);
         } else {