diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-25 17:09:41 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-25 17:09:41 -0500 |
commit | 2741ecb4ce5c2d430b5c44b0a169038338c21df5 (patch) | |
tree | 4aa71d7551184ee88f32c7f3660d821133058c32 /arch/arm/boot/compressed | |
parent | bc85e585c6d0fab4bde12d60964b2f25802c3163 (diff) | |
parent | 5de813b6cd06460b337f9da9afe316823cf3ef45 (diff) |
Merge branch 'misc2' into devel
Diffstat (limited to 'arch/arm/boot/compressed')
-rw-r--r-- | arch/arm/boot/compressed/Makefile | 6 | ||||
-rw-r--r-- | arch/arm/boot/compressed/decompress.c | 45 | ||||
-rw-r--r-- | arch/arm/boot/compressed/misc.c | 109 | ||||
-rw-r--r-- | arch/arm/boot/compressed/vmlinux.lds.in | 8 |
4 files changed, 64 insertions, 104 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 2d4d88ba73bf..97c89e7de7d3 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | # | 5 | # |
6 | 6 | ||
7 | HEAD = head.o | 7 | HEAD = head.o |
8 | OBJS = misc.o | 8 | OBJS = misc.o decompress.o |
9 | FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c | 9 | FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c |
10 | 10 | ||
11 | # | 11 | # |
@@ -106,10 +106,6 @@ lib1funcs = $(obj)/lib1funcs.o | |||
106 | $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE | 106 | $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE |
107 | $(call cmd,shipped) | 107 | $(call cmd,shipped) |
108 | 108 | ||
109 | # Don't allow any static data in misc.o, which | ||
110 | # would otherwise mess up our GOT table | ||
111 | CFLAGS_misc.o := -Dstatic= | ||
112 | |||
113 | $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ | 109 | $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ |
114 | $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE | 110 | $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE |
115 | $(call if_changed,ld) | 111 | $(call if_changed,ld) |
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c new file mode 100644 index 000000000000..0da382f33157 --- /dev/null +++ b/arch/arm/boot/compressed/decompress.c | |||
@@ -0,0 +1,45 @@ | |||
1 | #define _LINUX_STRING_H_ | ||
2 | |||
3 | #include <linux/compiler.h> /* for inline */ | ||
4 | #include <linux/types.h> /* for size_t */ | ||
5 | #include <linux/stddef.h> /* for NULL */ | ||
6 | #include <linux/linkage.h> | ||
7 | #include <asm/string.h> | ||
8 | |||
9 | extern unsigned long free_mem_ptr; | ||
10 | extern unsigned long free_mem_end_ptr; | ||
11 | extern void error(char *); | ||
12 | |||
13 | #define STATIC static | ||
14 | |||
15 | #define ARCH_HAS_DECOMP_WDOG | ||
16 | |||
17 | /* Diagnostic functions */ | ||
18 | #ifdef DEBUG | ||
19 | # define Assert(cond,msg) {if(!(cond)) error(msg);} | ||
20 | # define Trace(x) fprintf x | ||
21 | # define Tracev(x) {if (verbose) fprintf x ;} | ||
22 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | ||
23 | # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} | ||
24 | # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} | ||
25 | #else | ||
26 | # define Assert(cond,msg) | ||
27 | # define Trace(x) | ||
28 | # define Tracev(x) | ||
29 | # define Tracevv(x) | ||
30 | # define Tracec(c,x) | ||
31 | # define Tracecv(c,x) | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_KERNEL_GZIP | ||
35 | #include "../../../../lib/decompress_inflate.c" | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_KERNEL_LZO | ||
39 | #include "../../../../lib/decompress_unlzo.c" | ||
40 | #endif | ||
41 | |||
42 | void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) | ||
43 | { | ||
44 | decompress(input, len, NULL, NULL, output, NULL, error); | ||
45 | } | ||
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 | } |
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in index a5924b9b88bd..7ca9ecff652f 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.in +++ b/arch/arm/boot/compressed/vmlinux.lds.in | |||
@@ -14,6 +14,13 @@ SECTIONS | |||
14 | /DISCARD/ : { | 14 | /DISCARD/ : { |
15 | *(.ARM.exidx*) | 15 | *(.ARM.exidx*) |
16 | *(.ARM.extab*) | 16 | *(.ARM.extab*) |
17 | /* | ||
18 | * Discard any r/w data - this produces a link error if we have any, | ||
19 | * which is required for PIC decompression. Local data generates | ||
20 | * GOTOFF relocations, which prevents it being relocated independently | ||
21 | * of the text/got segments. | ||
22 | */ | ||
23 | *(.data) | ||
17 | } | 24 | } |
18 | 25 | ||
19 | . = TEXT_START; | 26 | . = TEXT_START; |
@@ -40,7 +47,6 @@ SECTIONS | |||
40 | .got : { *(.got) } | 47 | .got : { *(.got) } |
41 | _got_end = .; | 48 | _got_end = .; |
42 | .got.plt : { *(.got.plt) } | 49 | .got.plt : { *(.got.plt) } |
43 | .data : { *(.data) } | ||
44 | _edata = .; | 50 | _edata = .; |
45 | 51 | ||
46 | . = BSS_START; | 52 | . = BSS_START; |