]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/h8300/boot/compressed/misc.c
Merge tag 'drm-misc-next-2017-01-09' of git://anongit.freedesktop.org/git/drm-misc...
[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
7c0f6ba6 12#include <linux/uaccess.h>
06706c96
YS
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
42b510eb 35#ifdef CONFIG_KERNEL_GZIP
06706c96 36#include "../../../../lib/decompress_inflate.c"
42b510eb
YS
37#endif
38
39#ifdef CONFIG_KERNEL_LZO
40#include "../../../../lib/decompress_unlzo.c"
41#endif
06706c96
YS
42
43void *memset(void *s, int c, size_t n)
44{
45 int i;
46 char *ss = (char *)s;
47
48 for (i = 0; i < n; i++)
49 ss[i] = c;
50 return s;
51}
52
53void *memcpy(void *dest, const void *src, size_t n)
54{
55 int i;
56 char *d = (char *)dest, *s = (char *)src;
57
58 for (i = 0; i < n; i++)
59 d[i] = s[i];
60 return dest;
61}
62
63static void error(char *x)
64{
06706c96
YS
65 while (1)
66 ; /* Halt */
67}
68
06706c96
YS
69void decompress_kernel(void)
70{
71 free_mem_ptr = (unsigned long)&_end;
72 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
73
2d3862d2 74 __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error);
06706c96 75}