Commit 7d890df3 authored by Juergen Gross's avatar Juergen Gross Committed by Colin Watson

xen: Use elfnote defines instead of plain numbers

In order to avoid using plain integers for the ELF notes use the
available Xen include instead.
Signed-off-by: 's avatarJuergen Gross <jgross@suse.com>
Reviewed-by: 's avatarDaniel Kiper <daniel.kiper@oracle.com>
Tested-by: Hans van Kranenburg's avatarHans van Kranenburg <hans@knorrie.org>

Origin: upstream, https://git.savannah.gnu.org/cgit/grub.git/commit/?id=9bce25213a44553c71527776f65fabc3b729c2f3
Bug-Debian: https://bugs.debian.org/776450
Last-Update: 2019-01-07

Patch-Name: xen-pvh-elfnote-defines.patch
parent 3e0cb631
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include <grub/util/install.h> #include <grub/util/install.h>
#include <grub/util/mkimage.h> #include <grub/util/mkimage.h>
#include <xen/elfnote.h>
#pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-align"
/* These structures are defined according to the CHRP binding to IEEE1275, /* These structures are defined according to the CHRP binding to IEEE1275,
...@@ -312,7 +314,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc ...@@ -312,7 +314,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr; note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); 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_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); ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
...@@ -323,7 +325,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc ...@@ -323,7 +325,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr; note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); 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_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); ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
...@@ -334,7 +336,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc ...@@ -334,7 +336,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr; note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); 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_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); ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
...@@ -345,7 +347,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc ...@@ -345,7 +347,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr; note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); 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_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); ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
...@@ -356,7 +358,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc ...@@ -356,7 +358,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr; note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); 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_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); ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
...@@ -369,7 +371,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc ...@@ -369,7 +371,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
note_ptr = (Elf_Nhdr *) ptr; note_ptr = (Elf_Nhdr *) ptr;
note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); 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_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); ptr += sizeof (Elf_Nhdr);
memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME));
ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment