1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <inttypes.h> 4 #include <endian.h> 5 #include <stdint.h> 6 7 #include "xg_private.h" 8 #include "xc_dom_decompress_unsafe.h" 9 10 typedef uint8_t u8; 11 typedef uint32_t u32; 12 typedef uint16_t u16; 13 typedef uint64_t u64; 14 15 #define likely(a) a 16 #define noinline 17 #define unlikely(a) a 18 be16_to_cpup(const u16 * p)19static inline u16 be16_to_cpup(const u16 *p) 20 { 21 u16 v = *p; 22 #if BYTE_ORDER == LITTLE_ENDIAN 23 return (((v & 0x00ffU) << 8) | 24 ((v & 0xff00U) >> 8)); 25 #else 26 return v; 27 #endif 28 } 29 be32_to_cpup(const u32 * p)30static inline u32 be32_to_cpup(const u32 *p) 31 { 32 u32 v = *p; 33 #if BYTE_ORDER == LITTLE_ENDIAN 34 return (((v & 0x000000ffUL) << 24) | 35 ((v & 0x0000ff00UL) << 8) | 36 ((v & 0x00ff0000UL) >> 8) | 37 ((v & 0xff000000UL) >> 24)); 38 #else 39 return v; 40 #endif 41 } 42 43 #include "../../xen/common/lzo.c" 44 #include "../../xen/common/unlzo.c" 45 xc_try_lzo1x_decode(struct xc_dom_image * dom,void ** blob,size_t * size)46int xc_try_lzo1x_decode( 47 struct xc_dom_image *dom, void **blob, size_t *size) 48 { 49 return xc_dom_decompress_unsafe(unlzo, dom, blob, size); 50 } 51