diff options
author | Bastian Blank <bastian@waldi.eu.org> | 2013-04-18 12:49:54 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-04-22 12:46:30 +0100 |
commit | 592d3ef961cafda917a7f123999dc04d426254ee (patch) | |
tree | 98f82705cbb7348589b2c2630f069dc25e05ed5b /xen/common | |
parent | 071c61e7367987a9f71dc18c3c58a5dba659a5c8 (diff) | |
download | xen-592d3ef961cafda917a7f123999dc04d426254ee.tar.gz xen-592d3ef961cafda917a7f123999dc04d426254ee.tar.bz2 xen-592d3ef961cafda917a7f123999dc04d426254ee.zip |
libxc: Add unsafe decompressors
Add decompressors based on hypervisor code. This are used in mini-os by
pv-grub.
This enables pv-grub to boot kernels compressed with e.g. xz, which are
becoming more common.
Signed-off-by: Bastian Blank <waldi@debian.org>
Adjusted to use terminology "unsafe" rather than "trusted" to indicate
that the user had better sanitise the data (or not care, as in stub
domains) as suggested by Tim Deegan. This was effectively a sed script.
Minimise the changes to hypervisor code by moving the "compat layer" into the
relevant libxc source files (which include the Xen ones).
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'xen/common')
-rw-r--r-- | xen/common/decompress.h | 13 | ||||
-rw-r--r-- | xen/common/lzo.c | 3 | ||||
-rw-r--r-- | xen/common/unlzma.c | 2 | ||||
-rw-r--r-- | xen/common/unlzo.c | 3 | ||||
-rw-r--r-- | xen/common/xz/private.h | 3 |
5 files changed, 24 insertions, 0 deletions
diff --git a/xen/common/decompress.h b/xen/common/decompress.h index bd62b5dc74..61e83e518a 100644 --- a/xen/common/decompress.h +++ b/xen/common/decompress.h @@ -1,3 +1,5 @@ +#ifdef __XEN__ + #include <xen/config.h> #include <xen/cache.h> #include <xen/decompress.h> @@ -15,3 +17,14 @@ #define large_malloc xmalloc_bytes #define large_free xfree + +#else + +#define STATIC static +#define INIT +#define INITDATA + +#define large_malloc malloc +#define large_free free + +#endif diff --git a/xen/common/lzo.c b/xen/common/lzo.c index eeb200b281..f1213d2dbe 100644 --- a/xen/common/lzo.c +++ b/xen/common/lzo.c @@ -68,7 +68,10 @@ * Richard Purdie <rpurdie@openedhand.com> */ +#ifdef __XEN__ #include <xen/types.h> +#endif + #include <xen/lzo.h> #define get_unaligned(_p) (*(_p)) #define put_unaligned(_val,_p) (*(_p)=_val) diff --git a/xen/common/unlzma.c b/xen/common/unlzma.c index 719fd0d5c8..4d043308f9 100644 --- a/xen/common/unlzma.c +++ b/xen/common/unlzma.c @@ -54,7 +54,9 @@ static long long INIT read_int(unsigned char *ptr, int size) * Copyright (c) 1999-2005 Igor Pavlov */ +#ifdef __XEN__ #include <xen/compiler.h> +#endif #define LZMA_IOBUF_SIZE 0x10000 diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c index 57d16f3cca..fc794b0538 100644 --- a/xen/common/unlzo.c +++ b/xen/common/unlzo.c @@ -32,7 +32,10 @@ #include "decompress.h" #include <xen/lzo.h> + +#ifdef __XEN__ #include <asm/byteorder.h> +#endif #if 1 /* ndef CONFIG_??? */ static inline u16 INIT get_unaligned_be16(void *p) diff --git a/xen/common/xz/private.h b/xen/common/xz/private.h index 369bcb3d4a..7ea2489229 100644 --- a/xen/common/xz/private.h +++ b/xen/common/xz/private.h @@ -10,8 +10,11 @@ #ifndef XZ_PRIVATE_H #define XZ_PRIVATE_H +#ifdef __XEN__ #include <xen/kernel.h> #include <asm/byteorder.h> +#endif + #define get_le32(p) le32_to_cpup((const uint32_t *)(p)) #if 1 /* ndef CONFIG_??? */ |