aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/decompress
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /include/linux/decompress
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'include/linux/decompress')
-rw-r--r--include/linux/decompress/mm.h18
-rw-r--r--include/linux/decompress/unlzo.h10
2 files changed, 24 insertions, 4 deletions
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 12ff8c3f1d05..ad5ec1d0475e 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -14,18 +14,28 @@
14 14
15/* Code active when included from pre-boot environment: */ 15/* Code active when included from pre-boot environment: */
16 16
17/*
18 * Some architectures want to ensure there is no local data in their
19 * pre-boot environment, so that data can arbitarily relocated (via
20 * GOT references). This is achieved by defining STATIC_RW_DATA to
21 * be null.
22 */
23#ifndef STATIC_RW_DATA
24#define STATIC_RW_DATA static
25#endif
26
17/* A trivial malloc implementation, adapted from 27/* A trivial malloc implementation, adapted from
18 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 28 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
19 */ 29 */
20static unsigned long malloc_ptr; 30STATIC_RW_DATA unsigned long malloc_ptr;
21static int malloc_count; 31STATIC_RW_DATA int malloc_count;
22 32
23static void *malloc(int size) 33static void *malloc(int size)
24{ 34{
25 void *p; 35 void *p;
26 36
27 if (size < 0) 37 if (size < 0)
28 error("Malloc error"); 38 return NULL;
29 if (!malloc_ptr) 39 if (!malloc_ptr)
30 malloc_ptr = free_mem_ptr; 40 malloc_ptr = free_mem_ptr;
31 41
@@ -35,7 +45,7 @@ static void *malloc(int size)
35 malloc_ptr += size; 45 malloc_ptr += size;
36 46
37 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) 47 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
38 error("Out of memory"); 48 return NULL;
39 49
40 malloc_count++; 50 malloc_count++;
41 return p; 51 return p;
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h
new file mode 100644
index 000000000000..987229752519
--- /dev/null
+++ b/include/linux/decompress/unlzo.h
@@ -0,0 +1,10 @@
1#ifndef DECOMPRESS_UNLZO_H
2#define DECOMPRESS_UNLZO_H
3
4int unlzo(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *pos,
9 void(*error)(char *x));
10#endif