]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/h8300/boot/compressed/misc.c
h8300: zImage alignment fix
[mirror_ubuntu-artful-kernel.git] / arch / h8300 / boot / compressed / misc.c
CommitLineData
06706c96
YS
1/*
2 * arch/h8300/boot/compressed/misc.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Adapted for h8300 by Yoshinori Sato 2006
10 */
11
12#include <asm/uaccess.h>
13
14/*
15 * gzip declarations
16 */
17
18#define OF(args) args
19#define STATIC static
20
21#undef memset
22#undef memcpy
23#define memzero(s, n) memset((s), (0), (n))
24
25extern int _end;
26static unsigned long free_mem_ptr;
27static unsigned long free_mem_end_ptr;
28
29extern char input_data[];
30extern int input_len;
78f02cac 31extern char output[];
06706c96
YS
32
33#define HEAP_SIZE 0x10000
34
35#include "../../../../lib/decompress_inflate.c"
36
37void *memset(void *s, int c, size_t n)
38{
39 int i;
40 char *ss = (char *)s;
41
42 for (i = 0; i < n; i++)
43 ss[i] = c;
44 return s;
45}
46
47void *memcpy(void *dest, const void *src, size_t n)
48{
49 int i;
50 char *d = (char *)dest, *s = (char *)src;
51
52 for (i = 0; i < n; i++)
53 d[i] = s[i];
54 return dest;
55}
56
57static void error(char *x)
58{
06706c96
YS
59 while (1)
60 ; /* Halt */
61}
62
06706c96
YS
63void decompress_kernel(void)
64{
65 free_mem_ptr = (unsigned long)&_end;
66 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
67
2d3862d2 68 __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
06706c96 69}