qemu-s390x
[Top][All Lists]
Advanced

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

Re: [PATCH 04/16] hw/i386: Use explicit little-endian LD/ST API


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 04/16] hw/i386: Use explicit little-endian LD/ST API
Date: Fri, 4 Oct 2024 10:41:53 +0200
User-agent: Mozilla Thunderbird

On 4/10/24 01:41, Philippe Mathieu-Daudé wrote:
The x86 architecture uses little endianness. Directly use
the little-endian LD/ST API.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  hw/i386/multiboot.c  | 36 ++++++++++++++++++------------------
  hw/i386/x86-common.c | 26 +++++++++++++-------------
  2 files changed, 31 insertions(+), 31 deletions(-)


diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 992ea1f25e9..daa6a5d500c 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -586,7 +586,7 @@ static bool load_elfboot(const char *kernel_filename,
      uint64_t elf_low, elf_high;
      int kernel_size;
- if (ldl_p(header) != 0x464c457f) {
+    if (ldl_le_p(header) != 0x464c457f) {
          return false; /* no elfboot */
      }
@@ -669,8 +669,8 @@ void x86_load_linux(X86MachineState *x86ms,
       * kernel protocol version.
       * Please see https://www.kernel.org/doc/Documentation/x86/boot.txt
       */
-    if (ldl_p(header + 0x202) == 0x53726448) /* Magic signature "HdrS" */ {
-        protocol = lduw_p(header + 0x206);
+    if (ldl_le_p(header + 0x202) == 0x53726448) /* Magic signature "HdrS" */ {
+        protocol = lduw_be_p(header + 0x206);

Oops.

      } else {
          /*
           * This could be a multiboot kernel. If it is, let's stop treating it
@@ -762,7 +762,7 @@ void x86_load_linux(X86MachineState *x86ms,
/* highest address for loading the initrd */
      if (protocol >= 0x20c &&
-        lduw_p(header + 0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) {
+        lduw_be_p(header + 0x236) & XLF_CAN_BE_LOADED_ABOVE_4G) {
          /*
           * Linux has supported initrd up to 4 GB for a very long time (2007,
           * long before XLF_CAN_BE_LOADED_ABOVE_4G which was added in 2013),




reply via email to

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