Commit Graph
35 Commits
Author SHA1 Message Date
john.levon@sun.com 5c8a39cf80 Use strstr() to look for "bimodal" string in ELF notes, to allow guests to use
"yes,bimodal", so they are correctly identified as PAE on older hypervisors.

Signed-off-by: John Levon <john.levon@sun.com>
2007-01-08 12:54:41 -08:00
kfraser@localhost.localdomain f9396bbfe8 Improve consistency of type-attribute usage (volatile/const).
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-12-21 13:58:51 +00:00
kfraser@localhost.localdomain e6be7d74b9 Allow loading of ELF kernel images that support both PAE and non-PAE.
Also change the elf loader to not look for a strings section unless it
is needed.
Signed-off-by: Bruce Rogers <brogers@novell.com>
2006-12-14 10:29:44 +00:00
kfraser@localhost.localdomain b07ced9c1f [LIBXC] Add an error reporting API to the libxc library.
- 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>
2006-12-07 11:36:26 +00:00
Ian Campbell 9fd20b0666 Correct check for extended-cr3 support in __xen_guest fallback code.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
2006-10-10 10:06:56 +01:00
Alex Williamson a1041848b5 [PATCH] fix null pointer dereference in xen_guest_lookup()
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>
---
2006-08-27 06:56:01 +01:00
Ian Campbell 2cc329da26 [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@xensource.com>
2006-08-23 18:35:21 +01:00
Ian Campbell 15d8f355a2 [TOOLS] Allow tools to load kernels which use an ELF notes segment.
Compatability with kernels using the __xen_guest section is retained.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
2006-08-23 14:37:39 +01:00
kaf24@firebug.cl.cam.ac.uk 7eb542e462 [powerpc] add PowerPC support to libxc
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
2006-07-14 10:37:12 +01:00
kaf24@firebug.cl.cam.ac.uk 6b4c5ff3c8 Provide more specific and helpful error messages during ELF loading.
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
2006-06-30 22:19:08 +01:00
kaf24@firebug.cl.cam.ac.uk f4c633d8ec Allow 32-bit libxc to load 64-bit ELF files.
- 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>
2006-06-30 22:18:01 +01:00
kaf24@firebug.cl.cam.ac.uk b7207e32e4 Use address types in elf parser that match elf headers.
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>
2006-06-28 20:46:01 +01:00
kfraser@dhcp93.uk.xensource.com 7758dfc719 [TOOLS][BUILDER] Extend Elf header checks for multiple architectures.
Based on a patch from Hollis Blanchard.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-06-13 14:36:04 +01:00
kaf24@firebug.cl.cam.ac.uk ab8096f27d Represent PFNs with their own type, rather than 'unsigned long'.
('long' changes size and alignment between 32- and 64-bit ABIs.)
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
2006-06-06 09:48:17 +01:00
kaf24@firebug.cl.cam.ac.uk ad2de84676 Create new vmassist type 'pae_extended_cr3'. Only advertise
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>
2006-06-05 10:42:40 +01:00
kfraser@dhcp93.uk.xensource.com 3f2522e1ac Use a global build configuration file, and rework libxc Makefile for PPC.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
2006-05-31 11:31:52 +01:00
kaf24@firebug.cl.cam.ac.uk ed7041aaff [LOADER] More sanity checks when parsing Elf images to avoid
out-of-bounds array accesses when loading the image.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-05-21 20:15:58 +01:00
kaf24@firebug.cl.cam.ac.uk b9cede7418 [LOADER] Another change to the elf_paddr_offset/virt_base logic.
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>
2006-05-21 18:55:14 +01:00
kaf24@firebug.cl.cam.ac.uk e699658dbb [LOADER] Remove check for VIRT_BASE existence: it's not needed
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>
2006-05-21 09:55:15 +01:00
kaf24@firebug.cl.cam.ac.uk 73e9ee97b4 Theoretically a 0 VIRT_BASE is okay. Change the bail code when
parsing elf headers to bail only when VIRT_BASE is not specified
at all.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-05-17 23:41:59 +01:00
kaf24@firebug.cl.cam.ac.uk 86c03b97cb This patch fixes the Linux builder so that it dies gracefully when
trying to load malformed ELF images.
Signed-off-by: Aravindh Puthiyaparambil <aravindh.puthiyaparambil@unisys.com>
2006-05-17 23:19:18 +01:00
cl349@firebug.cl.cam.ac.uk 15efc30a11 Add support to domain builders for loading kernels with physical addresses 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>
2006-05-11 17:30:50 +01:00
kaf24@firebug.cl.cam.ac.uk c702fb4c9d Fix whitespace in libxc. Tabs are manually fixed.
Trailing whitespace removed with:
 perl -p -i -e 's/\s+$/\n/g' tools/libxc/*.[ch]

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
2006-04-15 10:07:31 +01:00
smh22@firebug.cl.cam.ac.uk 6ca8eebc9b Additional sanity / compatability checks during guest build.
Signed-off-by: Steven Hand <steven@xensource.com>
2006-04-07 15:58:00 +01:00
kaf24@firebug.cl.cam.ac.uk d2017c7b16 Clean up internal libxc functions to take 'const char *'
parameters where possible, to avoid unnecessary casts.

Signed-off-by: Keir Fraser <keir@xensource.com>
2006-03-09 14:35:36 +01:00
kaf24@firebug.cl.cam.ac.uk 99e957075c Indirect hypercalls through a hypercall transfer page.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-01-24 18:05:45 +01:00
cl349@firebug.cl.cam.ac.uk c4b7794669 Make version strings consistent across all interfaces.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2005-12-04 18:16:33 +01:00
kaf24@firebug.cl.cam.ac.uk d8263e8dba Fix Xen public interfaces and the tools to consistently
use stdint-format bitsize types (uint32_t and friends).

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-10-12 11:07:37 +01:00
kaf24@firebug.cl.cam.ac.uk e701d05c8a Re-indent libxc to avoid hard tabs. Also, fix the PAE
domain builder to correctly write PTEs that map pages
above 4GB.

Signed-off-by: Keir Fraser <keir@xensource.com>
2005-09-19 11:06:05 +00:00
cl349@firebug.cl.cam.ac.uk acc63faffa Break the building/save/restore code out into a separate library libxenguest.
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>
2005-08-25 00:51:20 +00:00
vh249@arcadians.cl.cam.ac.uk 3abb5c2914 remove pointless NULL checks before free()
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
2005-08-12 10:48:42 +00:00
kaf24@firebug.cl.cam.ac.uk 12b1a321bd Here is our latest patch to enable the Xen tools to
build and work with IA64 Xen.
Signed-off-by: Matt Chapman <matthewc@hp.com>
Acked-by: Dan Magenheimer <dan.magenheimer@hp.com>
2005-07-29 10:34:45 +00:00
kaf24@firebug.cl.cam.ac.uk 4b043a942c Initial tools support for 32-bit x86 pae.
Signed-off-by: Gerd Knorr <kraxel@suse.de>
2005-07-13 15:04:49 +00:00
cl349@firebug.cl.cam.ac.uk b94f8b3861 bitkeeper revision 1.1680 (42a4100bIstutWsVAoi7aPO8tLbFkA)
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>
2005-06-06 08:57:47 +00:00
cl349@firebug.cl.cam.ac.uk aac7970f26 bitkeeper revision 1.1665.4.1 (42a40cf0EmwulK0I8hNEb2dVbDEkvQ)
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>
2005-06-06 08:44:32 +00:00