1 #include <stdio.h> 2 #include <endian.h> 3 #include <stdlib.h> 4 #include <stddef.h> 5 #include <stdint.h> 6 #include <inttypes.h> 7 8 #include "xg_private.h" 9 #include "xc_dom_decompress_unsafe.h" 10 11 // TODO 12 #define XZ_DEC_X86 13 14 typedef char bool_t; 15 typedef uint8_t u8; 16 typedef uint16_t u16; 17 typedef uint32_t u32; 18 typedef uint32_t __le32; 19 cpu_to_le32(const u32 v)20static inline u32 cpu_to_le32(const u32 v) 21 { 22 #if BYTE_ORDER == BIG_ENDIAN 23 return (((v & 0x000000ffUL) << 24) | 24 ((v & 0x0000ff00UL) << 8) | 25 ((v & 0x00ff0000UL) >> 8) | 26 ((v & 0xff000000UL) >> 24)); 27 #else 28 return v; 29 #endif 30 } 31 le32_to_cpup(const u32 * p)32static inline u32 le32_to_cpup(const u32 *p) 33 { 34 return cpu_to_le32(*p); 35 } 36 37 #define __force 38 #define always_inline 39 40 #include "../../xen/common/unxz.c" 41 xc_try_xz_decode(struct xc_dom_image * dom,void ** blob,size_t * size)42int xc_try_xz_decode( 43 struct xc_dom_image *dom, void **blob, size_t *size) 44 { 45 return xc_dom_decompress_unsafe(unxz, dom, blob, size); 46 } 47