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: Juergen Gross <jgross@suse.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Tested-by: Hans van Kranenburg <hans@knorrie.org>
This commit is contained in:
parent
10279afb14
commit
0d20904338
1 changed files with 8 additions and 6 deletions
|
@ -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"
|
||||||
|
|
||||||
#define GRUB_MKIMAGEXX
|
#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 = (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);
|
||||||
|
@ -352,7 +354,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);
|
||||||
|
@ -363,7 +365,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);
|
||||||
|
@ -374,7 +376,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);
|
||||||
|
@ -385,7 +387,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);
|
||||||
|
@ -398,7 +400,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);
|
||||||
|
|
Loading…
Reference in a new issue