diff options
Diffstat (limited to 'arch/arm/boot/compressed/misc.c')
-rw-r--r-- | arch/arm/boot/compressed/misc.c | 109 |
1 files changed, 11 insertions, 98 deletions
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 56a0d116d271..d32bc71c1f78 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c | |||
@@ -23,8 +23,8 @@ unsigned int __machine_arch_type; | |||
23 | #include <linux/compiler.h> /* for inline */ | 23 | #include <linux/compiler.h> /* for inline */ |
24 | #include <linux/types.h> /* for size_t */ | 24 | #include <linux/types.h> /* for size_t */ |
25 | #include <linux/stddef.h> /* for NULL */ | 25 | #include <linux/stddef.h> /* for NULL */ |
26 | #include <asm/string.h> | ||
27 | #include <linux/linkage.h> | 26 | #include <linux/linkage.h> |
27 | #include <asm/string.h> | ||
28 | 28 | ||
29 | #include <asm/unaligned.h> | 29 | #include <asm/unaligned.h> |
30 | 30 | ||
@@ -117,57 +117,7 @@ static void putstr(const char *ptr) | |||
117 | 117 | ||
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | #define __ptr_t void * | 120 | void *memcpy(void *__dest, __const void *__src, size_t __n) |
121 | |||
122 | #define memzero(s,n) __memzero(s,n) | ||
123 | |||
124 | /* | ||
125 | * Optimised C version of memzero for the ARM. | ||
126 | */ | ||
127 | void __memzero (__ptr_t s, size_t n) | ||
128 | { | ||
129 | union { void *vp; unsigned long *ulp; unsigned char *ucp; } u; | ||
130 | int i; | ||
131 | |||
132 | u.vp = s; | ||
133 | |||
134 | for (i = n >> 5; i > 0; i--) { | ||
135 | *u.ulp++ = 0; | ||
136 | *u.ulp++ = 0; | ||
137 | *u.ulp++ = 0; | ||
138 | *u.ulp++ = 0; | ||
139 | *u.ulp++ = 0; | ||
140 | *u.ulp++ = 0; | ||
141 | *u.ulp++ = 0; | ||
142 | *u.ulp++ = 0; | ||
143 | } | ||
144 | |||
145 | if (n & 1 << 4) { | ||
146 | *u.ulp++ = 0; | ||
147 | *u.ulp++ = 0; | ||
148 | *u.ulp++ = 0; | ||
149 | *u.ulp++ = 0; | ||
150 | } | ||
151 | |||
152 | if (n & 1 << 3) { | ||
153 | *u.ulp++ = 0; | ||
154 | *u.ulp++ = 0; | ||
155 | } | ||
156 | |||
157 | if (n & 1 << 2) | ||
158 | *u.ulp++ = 0; | ||
159 | |||
160 | if (n & 1 << 1) { | ||
161 | *u.ucp++ = 0; | ||
162 | *u.ucp++ = 0; | ||
163 | } | ||
164 | |||
165 | if (n & 1) | ||
166 | *u.ucp++ = 0; | ||
167 | } | ||
168 | |||
169 | static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, | ||
170 | size_t __n) | ||
171 | { | 121 | { |
172 | int i = 0; | 122 | int i = 0; |
173 | unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src; | 123 | unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src; |
@@ -204,59 +154,20 @@ static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, | |||
204 | /* | 154 | /* |
205 | * gzip delarations | 155 | * gzip delarations |
206 | */ | 156 | */ |
207 | #define STATIC static | ||
208 | |||
209 | /* Diagnostic functions */ | ||
210 | #ifdef DEBUG | ||
211 | # define Assert(cond,msg) {if(!(cond)) error(msg);} | ||
212 | # define Trace(x) fprintf x | ||
213 | # define Tracev(x) {if (verbose) fprintf x ;} | ||
214 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | ||
215 | # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} | ||
216 | # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} | ||
217 | #else | ||
218 | # define Assert(cond,msg) | ||
219 | # define Trace(x) | ||
220 | # define Tracev(x) | ||
221 | # define Tracevv(x) | ||
222 | # define Tracec(c,x) | ||
223 | # define Tracecv(c,x) | ||
224 | #endif | ||
225 | |||
226 | static void error(char *m); | ||
227 | |||
228 | extern char input_data[]; | 157 | extern char input_data[]; |
229 | extern char input_data_end[]; | 158 | extern char input_data_end[]; |
230 | 159 | ||
231 | static unsigned char *output_data; | 160 | unsigned char *output_data; |
232 | static unsigned long output_ptr; | 161 | unsigned long output_ptr; |
233 | |||
234 | static void error(char *m); | ||
235 | 162 | ||
236 | static void putstr(const char *); | 163 | unsigned long free_mem_ptr; |
237 | 164 | unsigned long free_mem_end_ptr; | |
238 | static unsigned long free_mem_ptr; | ||
239 | static unsigned long free_mem_end_ptr; | ||
240 | |||
241 | #ifdef STANDALONE_DEBUG | ||
242 | #define NO_INFLATE_MALLOC | ||
243 | #endif | ||
244 | |||
245 | #define ARCH_HAS_DECOMP_WDOG | ||
246 | |||
247 | #ifdef CONFIG_KERNEL_GZIP | ||
248 | #include "../../../../lib/decompress_inflate.c" | ||
249 | #endif | ||
250 | |||
251 | #ifdef CONFIG_KERNEL_LZO | ||
252 | #include "../../../../lib/decompress_unlzo.c" | ||
253 | #endif | ||
254 | 165 | ||
255 | #ifndef arch_error | 166 | #ifndef arch_error |
256 | #define arch_error(x) | 167 | #define arch_error(x) |
257 | #endif | 168 | #endif |
258 | 169 | ||
259 | static void error(char *x) | 170 | void error(char *x) |
260 | { | 171 | { |
261 | arch_error(x); | 172 | arch_error(x); |
262 | 173 | ||
@@ -272,6 +183,8 @@ asmlinkage void __div0(void) | |||
272 | error("Attempting division by 0!"); | 183 | error("Attempting division by 0!"); |
273 | } | 184 | } |
274 | 185 | ||
186 | extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)); | ||
187 | |||
275 | #ifndef STANDALONE_DEBUG | 188 | #ifndef STANDALONE_DEBUG |
276 | 189 | ||
277 | unsigned long | 190 | unsigned long |
@@ -292,8 +205,8 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, | |||
292 | output_ptr = get_unaligned_le32(tmp); | 205 | output_ptr = get_unaligned_le32(tmp); |
293 | 206 | ||
294 | putstr("Uncompressing Linux..."); | 207 | putstr("Uncompressing Linux..."); |
295 | decompress(input_data, input_data_end - input_data, | 208 | do_decompress(input_data, input_data_end - input_data, |
296 | NULL, NULL, output_data, NULL, error); | 209 | output_data, error); |
297 | putstr(" done, booting the kernel.\n"); | 210 | putstr(" done, booting the kernel.\n"); |
298 | return output_ptr; | 211 | return output_ptr; |
299 | } | 212 | } |