diff mbox series

hw/x86: add a couple of comments explaining how the kernel image is parsed

Message ID 20240719134937.3643-1-anisinha@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/x86: add a couple of comments explaining how the kernel image is parsed | expand

Commit Message

Ani Sinha July 19, 2024, 1:49 p.m. UTC
Cosmetic: add comments in x86_load_linux() pointing to the kernel documentation
so that users can better understand the code.

CC: qemu-trivial@nongnu.org
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 hw/i386/x86-common.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Zhao Liu July 21, 2024, 2:47 p.m. UTC | #1
On Fri, Jul 19, 2024 at 07:19:37PM +0530, Ani Sinha wrote:
> Date: Fri, 19 Jul 2024 19:19:37 +0530
> From: Ani Sinha <anisinha@redhat.com>
> Subject: [PATCH] hw/x86: add a couple of comments explaining how the kernel
>  image is parsed
> X-Mailer: git-send-email 2.42.0
> 
> Cosmetic: add comments in x86_load_linux() pointing to the kernel documentation
> so that users can better understand the code.
> 
> CC: qemu-trivial@nongnu.org
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>  hw/i386/x86-common.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
diff mbox series

Patch

diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index c0c66a0eb5..992ea1f25e 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -665,8 +665,11 @@  void x86_load_linux(X86MachineState *x86ms,
         exit(1);
     }
 
-    /* kernel protocol version */
-    if (ldl_p(header + 0x202) == 0x53726448) {
+    /*
+     * 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);
     } else {
         /*