ia64/xen-unstable

changeset 13561:d86a96ca47a3

[XEN] Consolidate multiple defintions of ELFNOTE_* accessor macros

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Mon Jan 22 15:40:12 2007 +0000 (2007-01-22)
parents de6c4f72b65b
children cc819d81be2a
files xen/common/elf.c xen/common/kexec.c xen/include/xen/elf.h
line diff
     1.1 --- a/xen/common/elf.c	Mon Jan 22 15:31:27 2007 +0000
     1.2 +++ b/xen/common/elf.c	Mon Jan 22 15:40:12 2007 +0000
     1.3 @@ -99,12 +99,6 @@ static unsigned long long xen_guest_nume
     1.4      return value;
     1.5  }
     1.6  
     1.7 -/*
     1.8 - * Interface to the Xen ELF notes.
     1.9 - */
    1.10 -#define ELFNOTE_NAME(_n_)   ((const char*)(_n_) + sizeof(*(_n_)))
    1.11 -#define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
    1.12 -#define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
    1.13  
    1.14  static int is_xen_elfnote_section(const char *image, const Elf_Shdr *shdr)
    1.15  {
    1.16 @@ -115,7 +109,7 @@ static int is_xen_elfnote_section(const 
    1.17  
    1.18      for ( note = (const Elf_Note *)(image + shdr->sh_offset);
    1.19            note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
    1.20 -          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
    1.21 +          note = ELFNOTE_NEXT(note) )
    1.22      {
    1.23          if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
    1.24              return 1;
    1.25 @@ -134,7 +128,7 @@ static const Elf_Note *xen_elfnote_looku
    1.26  
    1.27      for ( note = (const Elf_Note *)dsi->__elfnote_section;
    1.28            note < (const Elf_Note *)dsi->__elfnote_section_end;
    1.29 -          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
    1.30 +          note = ELFNOTE_NEXT(note) )
    1.31      {
    1.32          if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
    1.33              continue;
     2.1 --- a/xen/common/kexec.c	Mon Jan 22 15:31:27 2007 +0000
     2.2 +++ b/xen/common/kexec.c	Mon Jan 22 15:40:12 2007 +0000
     2.3 @@ -26,11 +26,6 @@
     2.4  
     2.5  typedef long ret_t;
     2.6  
     2.7 -#define ELFNOTE_ALIGN(_n_) (((_n_)+3)&~3)
     2.8 -#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_)))
     2.9 -#define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + ELFNOTE_ALIGN((_n_)->namesz))
    2.10 -#define ELFNOTE_NEXT(_n_) ((Elf_Note *)(ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz)))
    2.11 -
    2.12  static DEFINE_PER_CPU(void *, crash_notes);
    2.13  
    2.14  static Elf_Note *xen_crash_note;
     3.1 --- a/xen/include/xen/elf.h	Mon Jan 22 15:31:27 2007 +0000
     3.2 +++ b/xen/include/xen/elf.h	Mon Jan 22 15:40:12 2007 +0000
     3.3 @@ -517,6 +517,11 @@ typedef struct {
     3.4  #define AuxInfo		Aux64Info
     3.5  #endif
     3.6  
     3.7 +#define ELFNOTE_ALIGN(_n_) (((_n_)+3)&~3)
     3.8 +#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_)))
     3.9 +#define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + ELFNOTE_ALIGN((_n_)->namesz))
    3.10 +#define ELFNOTE_NEXT(_n_) ((Elf_Note *)(ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz)))
    3.11 +
    3.12  struct domain_setup_info;
    3.13  extern int loadelfimage(struct domain_setup_info *);
    3.14  extern int parseelfimage(struct domain_setup_info *);