aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_load_elf.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove old elf-parsing code from tools and from Xen.kfraser@localhost.localdomain2007-02-151-684/+0
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [TOOLS] Avoid void* arithmetic when parsing elf notes.kfraser@localhost.localdomain2007-01-191-5/+5
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Use strstr() to look for "bimodal" string in ELF notes, to allow guests to usejohn.levon@sun.com2007-01-081-6/+8
| | | | | | "yes,bimodal", so they are correctly identified as PAE on older hypervisors. Signed-off-by: John Levon <john.levon@sun.com>
* Improve consistency of type-attribute usage (volatile/const).kfraser@localhost.localdomain2006-12-211-38/+47
| | | | | From: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* Allow loading of ELF kernel images that support both PAE and non-PAE.kfraser@localhost.localdomain2006-12-141-12/+16
| | | | | | Also change the elf loader to not look for a strings section unless it is needed. Signed-off-by: Bruce Rogers <brogers@novell.com>
* [LIBXC] Add an error reporting API to the libxc library.kfraser@localhost.localdomain2006-12-071-19/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - An 'xc_error' struct is used to pass around error details. Currently contains two members 'code' an enumeration of error types, and 'message' a free text description of the specific problem. - The xc_get_last_error() method returns a const pointer to the internal instance of this struct manged by libxc. By returning a const pointer we can add extra members to the end of the struct at any time without worrying about ABI of callers. This will let us provide more fine-grained info if needed in the future. - The xc_error instance is statically defined inside libxc and marked __thread. This ensures that errors are recorded per-thread, and that when dealing with errors we never need to call malloc - all storage needed is statically allocated. - The xc_clear_last_error() method resets any currently recorded error details - The xc_error_code_to_desc() method converts the integer error code into a generic user facing messsage. eg "Invalid kernel". Together with the 'message' field from xc_error, this provides the user visible feedback. eg "Invalid kernel: Non PAE-kernel on PAE host." - A callback can be registered with xc_set_error_handler to receive notification whenever an error is recorded, rather than querying for error details after the fact with xc_get_last_error - If built with -DDEBUG set, a default error handler will be registered which calls fprintf(stderr), thus maintaining current behaviour of logging errors to stderr during developer builds. - The python binding for libxc is updated to use xc_get_last_error to pull out error details whenever appropriate, instead of returning info based on 'errno' - The xc_set_error method is private to libxc internals, and is used for setting error details - The ERROR and PERROR macros have been updated to call xc_set_error automatically specifying XC_INTERNAL_ERROR as the error code. This gives a generic error report for all current failure points - Some uses of the ERROR macro have been replaced with explicit calls to xc_set_error to enable finer grained error reporting. In particular the code dealing with invalid kernel types uses this to report about PAE/architecture/wordsize mismatches The patch has been tested by calling xm create against a varietry of config files defining invalid kernels of various kinds. It has also been tested with libvirt talking to xend. In both cases the error messages were propagated all the way back up the stack. There is only one place where I need to do further work. The suspend & restore APIs in Xend invoke external helper programs rather than calling libxc directly. This means that error details are essentially lost. Since there is already code in XenD which scans STDERR from these programs I will investigate adapting this to extract actual error messages from these helpers. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Correct check for extended-cr3 support in __xen_guest fallback code.Ian Campbell2006-10-101-1/+1
| | | | | Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
* [PATCH] fix null pointer dereference in xen_guest_lookup()Alex Williamson2006-08-271-0/+3
| | | | | | | | | | | | The latest ELF changes have a null pointer dereference bug when you have neither an elf notes section nor a __xen_guest_string. This patch checks for the existence of the __xen_guest_string prior to using it. Please apply. Thanks, Alex Signed-off-by: Alex Williamson <alex.williamson@hp.com> ---
* [TOOLS] Cleanups to domU ELF loader.Ian Campbell2006-08-231-16/+10
| | | | | | | | - 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@xensource.com>
* [TOOLS] Allow tools to load kernels which use an ELF notes segment.Ian Campbell2006-08-231-53/+273
| | | | | | Compatability with kernels using the __xen_guest section is retained. Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
* [powerpc] add PowerPC support to libxckaf24@firebug.cl.cam.ac.uk2006-07-141-0/+4
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Provide more specific and helpful error messages during ELF loading.kaf24@firebug.cl.cam.ac.uk2006-06-301-7/+14
| | | | | | Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Allow 32-bit libxc to load 64-bit ELF files.kaf24@firebug.cl.cam.ac.uk2006-06-301-3/+3
| | | | | | | | | | | - use 64-bit integral types for addresses in struct domain_start_info - use stroull() to parse 64-bit values - remove redundant _p(a) definition and add a comment - printf format changes for the new types Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Use address types in elf parser that match elf headers.kaf24@firebug.cl.cam.ac.uk2006-06-281-1/+1
| | | | | | | | Necessary if a long is a different size to addresses in elf file being parsed. From: Jimi Xenidis <jimix@watson.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [TOOLS][BUILDER] Extend Elf header checks for multiple architectures.kfraser@dhcp93.uk.xensource.com2006-06-131-10/+22
| | | | | | Based on a patch from Hollis Blanchard. Signed-off-by: Keir Fraser <keir@xensource.com>
* Represent PFNs with their own type, rather than 'unsigned long'.kaf24@firebug.cl.cam.ac.uk2006-06-061-4/+4
| | | | | | ('long' changes size and alignment between 32- and 64-bit ABIs.) Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Create new vmassist type 'pae_extended_cr3'. Only advertisekaf24@firebug.cl.cam.ac.uk2006-06-051-2/+9
| | | | | | | | | pae_pgdir_above_4gb tp guests that have enabled this vmassist. Control tools ensure all PAE page directories are below 4GB unless the vmassist is enabled (triggered via an extended-cr3 option in guest Elf header). Signed-off-by: Keir Fraser <keir@xensource.com>
* Use a global build configuration file, and rework libxc Makefile for PPC.kfraser@dhcp93.uk.xensource.com2006-05-311-8/+0
| | | | | Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* [LOADER] More sanity checks when parsing Elf images to avoidkaf24@firebug.cl.cam.ac.uk2006-05-211-5/+12
| | | | | | out-of-bounds array accesses when loading the image. Signed-off-by: Keir Fraser <keir@xensource.com>
* [LOADER] Another change to the elf_paddr_offset/virt_base logic.kaf24@firebug.cl.cam.ac.uk2006-05-211-21/+19
| | | | | | | | | | | This avoids using zero to indicate 'undefined'. Instead we use an explicit boolean to indicate whether suitable defaults should be used. As well as making the logic clearer (I believe) it also avoids problems if anyone ever explicitly specifies virt_base (and also elf_paddr_offset) as zero. Signed-off-by: Keir Fraser <keir@xensource.com>
* [LOADER] Remove check for VIRT_BASE existence: it's not neededkaf24@firebug.cl.cam.ac.uk2006-05-211-11/+14
| | | | | | | | | to prevent xend crashign (when Aravindh's latest patch is applied) and breaks ia64. Also, ensure we set a reasonable default for elf_paddr_offset. Signed-off-by: Keir Fraser <keir@xensource.com>
* Theoretically a 0 VIRT_BASE is okay. Change the bail code whenkaf24@firebug.cl.cam.ac.uk2006-05-171-6/+4
| | | | | | | parsing elf headers to bail only when VIRT_BASE is not specified at all. Signed-off-by: Keir Fraser <keir@xensource.com>
* This patch fixes the Linux builder so that it dies gracefully whenkaf24@firebug.cl.cam.ac.uk2006-05-171-0/+11
| | | | | | trying to load malformed ELF images. Signed-off-by: Aravindh Puthiyaparambil <aravindh.puthiyaparambil@unisys.com>
* Add support to domain builders for loading kernels with physical addresses ↵cl349@firebug.cl.cam.ac.uk2006-05-111-14/+26
| | | | | | | | | | | | | | | | | | | | in the elf paddr and entry fields. Add a new __xen_guest header field to distinguish between kernels with the previous use of the paddr field and the new use. Add a new __xen_guest header field to control the kernel entry point, since the elf header entry field now points to a physical address. This header field is also useful for supporting alternative entry points in kernel images which run both on xen and native. Also add a kernel config option to control whether the resulting kernel should include compatibility code to run on Xen 3.0.2 or whether such code such be left out, resulting in a kernel which will only run on newer Xen versions. Default to having compatibility enabled. Kernels built with the new use of the elf header fields would otherwise not work on Xen versions prior to this changeset. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
* Fix whitespace in libxc. Tabs are manually fixed.kaf24@firebug.cl.cam.ac.uk2006-04-151-9/+9
| | | | | | | | Trailing whitespace removed with: perl -p -i -e 's/\s+$/\n/g' tools/libxc/*.[ch] Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
* Additional sanity / compatability checks during guest build. smh22@firebug.cl.cam.ac.uk2006-04-071-0/+15
| | | | | Signed-off-by: Steven Hand <steven@xensource.com>
* Clean up internal libxc functions to take 'const char *'kaf24@firebug.cl.cam.ac.uk2006-03-091-13/+14
| | | | | | | | parameters where possible, to avoid unnecessary casts. Signed-off-by: Keir Fraser <keir@xensource.com>
* Indirect hypercalls through a hypercall transfer page.kaf24@firebug.cl.cam.ac.uk2006-01-241-0/+3
| | | | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* Make version strings consistent across all interfaces.cl349@firebug.cl.cam.ac.uk2005-12-041-1/+1
| | | | | Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
* Fix Xen public interfaces and the tools to consistentlykaf24@firebug.cl.cam.ac.uk2005-10-121-4/+4
| | | | | | | | use stdint-format bitsize types (uint32_t and friends). Signed-off-by: Keir Fraser <keir@xensource.com>
* Re-indent libxc to avoid hard tabs. Also, fix the PAEkaf24@firebug.cl.cam.ac.uk2005-09-191-3/+13
| | | | | | | | | domain builder to correctly write PTEs that map pages above 4GB. Signed-off-by: Keir Fraser <keir@xensource.com>
* Break the building/save/restore code out into a separate library libxenguest.cl349@firebug.cl.cam.ac.uk2005-08-251-1/+1
| | | | | | | Also update the tools accordingly. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
* remove pointless NULL checks before free()vh249@arcadians.cl.cam.ac.uk2005-08-121-2/+1
| | | | | Signed-off-by: Vincent Hanquez <vincent@xensource.com>
* Here is our latest patch to enable the Xen tools tokaf24@firebug.cl.cam.ac.uk2005-07-291-1/+5
| | | | | | | build and work with IA64 Xen. Signed-off-by: Matt Chapman <matthewc@hp.com> Acked-by: Dan Magenheimer <dan.magenheimer@hp.com>
* Initial tools support for 32-bit x86 pae.kaf24@firebug.cl.cam.ac.uk2005-07-131-0/+2
| | | | | Signed-off-by: Gerd Knorr <kraxel@suse.de>
* bitkeeper revision 1.1680 (42a4100bIstutWsVAoi7aPO8tLbFkA)cl349@firebug.cl.cam.ac.uk2005-06-061-3/+3
| | | | | | | xc_load_elf.c, xc_load_bin.c: Fix missing rename (xc_*_probe -> probe_*) from previous commit. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
* bitkeeper revision 1.1665.4.1 (42a40cf0EmwulK0I8hNEb2dVbDEkvQ)cl349@firebug.cl.cam.ac.uk2005-06-061-0/+310
xc_private.h, xc_linux_build.c, Makefile: Add support for loading ``bin'' format images, as used by ReactOS. Move image probing/parsing/loading code out of domain builder to allow multiple image formats without having to duplicate the domain building code. xc_load_elf.c, xc_load_bin.c: new file xc_vmx_build.c: Cleanup. Signed-Off-By: Ge van Geldorp <gvg@reactos.com> Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>