[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 17/20] xen: use elfnote defines instead of plain numbers
From: |
Juergen Gross |
Subject: |
[PATCH v5 17/20] xen: use elfnote defines instead of plain numbers |
Date: |
Wed, 21 Nov 2018 15:28:52 +0100 |
In order to avoid using plain integers for the ELF notes use the
available Xen include instead.
Signed-off-by: Juergen Gross <address@hidden>
Reviewed-by: Daniel Kiper <address@hidden>
---
V5: new patch (Daniel Kiper)
---
util/grub-mkimagexx.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index a483c674c..784ed1a52 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -48,6 +48,8 @@
#include <grub/util/install.h>
#include <grub/util/mkimage.h>
+#include <xen/elfnote.h>
+
#pragma GCC diagnostic ignored "-Wcast-align"
#define GRUB_MKIMAGEXX
@@ -341,7 +343,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct
grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME));
note_ptr->n_descsz = grub_host_to_target32 (sizeof (PACKAGE_NAME));
- note_ptr->n_type = grub_host_to_target32 (6);
+ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_GUEST_OS);
ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
@@ -352,7 +354,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct
grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME));
note_ptr->n_descsz = grub_host_to_target32 (sizeof ("generic"));
- note_ptr->n_type = grub_host_to_target32 (8);
+ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_LOADER);
ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
@@ -363,7 +365,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct
grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME));
note_ptr->n_descsz = grub_host_to_target32 (sizeof ("xen-3.0"));
- note_ptr->n_type = grub_host_to_target32 (5);
+ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_XEN_VERSION);
ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
@@ -374,7 +376,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct
grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME));
note_ptr->n_descsz = grub_host_to_target32 (image_target->voidp_sizeof);
- note_ptr->n_type = grub_host_to_target32 (1);
+ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_ENTRY);
ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
@@ -385,7 +387,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct
grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME));
note_ptr->n_descsz = grub_host_to_target32 (image_target->voidp_sizeof);
- note_ptr->n_type = grub_host_to_target32 (3);
+ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_VIRT_BASE);
ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
@@ -398,7 +400,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct
grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof
(GRUB_XEN_NOTE_NAME));
note_ptr->n_descsz = grub_host_to_target32 (sizeof ("yes,bimodal"));
- note_ptr->n_type = grub_host_to_target32 (9);
+ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_PAE_MODE);
ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
--
2.16.4
- [PATCH v5 04/20] xen: prepare common code for Xen PVH support, (continued)
- [PATCH v5 04/20] xen: prepare common code for Xen PVH support, Juergen Gross, 2018/11/21
- [PATCH v5 08/20] xen: add PVH specific defines to offset.h, Juergen Gross, 2018/11/21
- [PATCH v5 09/20] xen: add basic hooks for PVH in current code, Juergen Gross, 2018/11/21
- [PATCH v5 05/20] xen: add some dummy headers for PVH mode, Juergen Gross, 2018/11/21
- [PATCH v5 01/20] xen: add some xen headers, Juergen Gross, 2018/11/21
- [PATCH v5 16/20] grub-module-verifier: Ignore all_video for xenpvh, Juergen Gross, 2018/11/21
- [PATCH v5 17/20] xen: use elfnote defines instead of plain numbers,
Juergen Gross <=
- [PATCH v5 19/20] xen_pvh: support grub-install for xen_pvh, Juergen Gross, 2018/11/21
- [PATCH v5 18/20] xen_pvh: support building a standalone image, Juergen Gross, 2018/11/21
- [PATCH v5 11/20] xen: setup hypercall page for PVH, Juergen Gross, 2018/11/21
- [PATCH v5 15/20] xen_pvh: add build runes for grub-core, Juergen Gross, 2018/11/21