# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Node ID cc006f78cbe20d0b84f7e80c2b1fac6c9eb7dc29
# Parent d389123fad85966deb081e169b368f04256516e2
[TOOLS] Cleanups to domU ELF loader.
- Remove debugging statements.
- Cope better with archtectures where neither ELF notes or __xen_guest
are needed or required.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
tools/libxc/xc_load_bin.c | 2 +-
tools/libxc/xc_load_elf.c | 26 ++++++++++----------------
tools/libxc/xg_private.h | 2 +-
3 files changed, 12 insertions(+), 18 deletions(-)
diff -r d389123fad85 -r cc006f78cbe2 tools/libxc/xc_load_bin.c
--- a/tools/libxc/xc_load_bin.c Wed Aug 23 17:25:11 2006 +0100
+++ b/tools/libxc/xc_load_bin.c Wed Aug 23 18:35:21 2006 +0100
@@ -227,7 +227,7 @@ static int parsebinimage(const char *ima
dsi->v_kernstart = dsi->v_start;
dsi->v_kernend = dsi->v_end;
dsi->v_kernentry = image_info->entry_addr;
- dsi->__xen_guest_string = "";
+ dsi->__xen_guest_string = NULL;
return 0;
}
diff -r d389123fad85 -r cc006f78cbe2 tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Wed Aug 23 17:25:11 2006 +0100
+++ b/tools/libxc/xc_load_elf.c Wed Aug 23 18:35:21 2006 +0100
@@ -109,15 +109,13 @@ static const char *xen_guest_string(stru
{
const char *p = xen_guest_lookup(dsi, type);
- DPRINTF("found __xen_guest entry for type %#x = \"%s\"\n",
- type, p);
-
/*
* We special case this since the __xen_guest_section treats the
* mere precense of the BSD_SYMTAB string as true or false.
*/
if ( type == XEN_ELFNOTE_BSD_SYMTAB )
return p ? "yes" : "no";
+
return p;
}
@@ -140,9 +138,6 @@ static unsigned long long xen_guest_nume
*/
if (type == XEN_ELFNOTE_HYPERCALL_PAGE)
value = dsi->v_start + (value<<PAGE_SHIFT);
-
- DPRINTF("found __xen_guest entry for type %#x = %#llx\n",
- type, value);
*defined = 1;
return value;
@@ -177,6 +172,9 @@ static Elf_Note *xen_elfnote_lookup(stru
{
Elf_Note *note;
+ if ( !dsi->__elfnote_section )
+ return NULL;
+
for ( note = (Elf_Note *)dsi->__elfnote_section;
note < (Elf_Note *)dsi->__elfnote_section_end;
note = ELFNOTE_NEXT(note) )
@@ -188,7 +186,6 @@ static Elf_Note *xen_elfnote_lookup(stru
return note;
}
- DPRINTF("unable to find Xen ELF note with type %#x\n", type);
return NULL;
}
@@ -202,9 +199,6 @@ const char *xen_elfnote_string(struct do
note = xen_elfnote_lookup(dsi, type);
if ( note == NULL )
return NULL;
-
- DPRINTF("found Xen ELF note type %#x = \"%s\"\n",
- type, (char *)ELFNOTE_DESC(note));
return (const char *)ELFNOTE_DESC(note);
}
@@ -297,7 +291,6 @@ static int parseelfimage(const char *ima
shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
if ( !is_xen_elfnote_section(image, shdr) )
continue;
- DPRINTF("found note section containing Xen entries\n");
dsi->__elfnote_section = (void *)image + shdr->sh_offset;
dsi->__elfnote_section_end =
(void *)image + shdr->sh_offset + shdr->sh_size;
@@ -312,7 +305,6 @@ static int parseelfimage(const char *ima
shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
if ( is_xen_guest_section(shdr, shstrtab) )
{
- DPRINTF("found a legacy __xen_guest section\n");
dsi->__xen_guest_string = (char *)image + shdr->sh_offset;
break;
}
@@ -343,16 +335,18 @@ static int parseelfimage(const char *ima
}
else
{
-#ifdef __ia64__
- dsi->__elfnote_section = NULL;
- dsi->__xen_guest_string = "";
-#else
+#if defined(__x86_64__) || defined(__i386__)
ERROR("Not a Xen-ELF image: "
"No ELF notes or '__xen_guest' section found.");
return -EINVAL;
#endif
}
+ /*
+ * If we have ELF notes then PAE=yes implies that we must support
+ * the extended cr3 syntax. Otherwise we need to find the
+ * [extended-cr3] syntax in the __xen_guest string.
+ */
dsi->pae_kernel = PAEKERN_no;
if ( dsi->__elfnote_section )
{
diff -r d389123fad85 -r cc006f78cbe2 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h Wed Aug 23 17:25:11 2006 +0100
+++ b/tools/libxc/xg_private.h Wed Aug 23 18:35:21 2006 +0100
@@ -159,7 +159,7 @@ struct domain_setup_info
* pickup the correct one and retain backwards compatibility.
*/
void *__elfnote_section, *__elfnote_section_end;
- char *__xen_guest_string;
+ const char *__xen_guest_string;
};
typedef int (*parseimagefunc)(const char *image, unsigned long image_size,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|