diff options
author | Yoshinori Sato <ysato@users.sourceforge.jp> | 2015-05-10 20:26:40 +0300 |
---|---|---|
committer | Yoshinori Sato <ysato@users.sourceforge.jp> | 2015-06-23 07:35:52 +0300 |
commit | 06706c96ed753f952e53fa9840fb38852d2fe37e (patch) | |
tree | b0c870e788d6f94d608d4b18d3fa9c002b2252fe /arch/h8300/boot/compressed/misc.c | |
parent | df2078b8daa7bb15cc8e3f791389b9f44e12bb25 (diff) | |
download | linux-06706c96ed753f952e53fa9840fb38852d2fe37e.tar.xz |
h8300: compressed image support
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Diffstat (limited to 'arch/h8300/boot/compressed/misc.c')
-rw-r--r-- | arch/h8300/boot/compressed/misc.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c new file mode 100644 index 000000000000..704274127c07 --- /dev/null +++ b/arch/h8300/boot/compressed/misc.c @@ -0,0 +1,74 @@ +/* + * arch/h8300/boot/compressed/misc.c + * + * This is a collection of several routines from gzip-1.0.3 + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * + * Adapted for h8300 by Yoshinori Sato 2006 + */ + +#include <asm/uaccess.h> + +/* + * gzip declarations + */ + +#define OF(args) args +#define STATIC static + +#undef memset +#undef memcpy +#define memzero(s, n) memset((s), (0), (n)) + +extern int _end; +static unsigned long free_mem_ptr; +static unsigned long free_mem_end_ptr; + +extern char input_data[]; +extern int input_len; +static unsigned char *output; + +#define HEAP_SIZE 0x10000 + +#include "../../../../lib/decompress_inflate.c" + +void *memset(void *s, int c, size_t n) +{ + int i; + char *ss = (char *)s; + + for (i = 0; i < n; i++) + ss[i] = c; + return s; +} + +void *memcpy(void *dest, const void *src, size_t n) +{ + int i; + char *d = (char *)dest, *s = (char *)src; + + for (i = 0; i < n; i++) + d[i] = s[i]; + return dest; +} + +static void error(char *x) +{ + + while (1) + ; /* Halt */ +} + +#define STACK_SIZE (4096) +long user_stack[STACK_SIZE]; +long *stack_start = &user_stack[STACK_SIZE]; + +void decompress_kernel(void) +{ + free_mem_ptr = (unsigned long)&_end; + free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; + + decompress(input_data, input_len, NULL, NULL, output, NULL, error); +} |