aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10
diff options
context:
space:
mode:
authorJesper Nilsson <jesper@jni.nu>2008-06-30 18:13:54 -0400
committerJesper Nilsson <jesper@jni.nu>2008-06-30 18:13:54 -0400
commitfea72637c665f2143adcf8455fffa55160c2cad2 (patch)
tree101b5fb5e40eb3d0ef8f4b0fd8b574311652d33e /arch/cris/arch-v10
parent53e43d014cb7d5a3bd53dbdbf0e74977e7dda923 (diff)
parentf3c4b53d5ec6bd2ae0f284c1e6371bff545f0f80 (diff)
Merge branch 'build_fix' into cris
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile2
-rw-r--r--arch/cris/arch-v10/boot/compressed/misc.c127
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile2
3 files changed, 72 insertions, 59 deletions
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
index 9ec5f87d5157..08d943ce4be7 100644
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ b/arch/cris/arch-v10/boot/compressed/Makefile
@@ -4,7 +4,7 @@
4 4
5asflags-y += $(LINUXINCLUDE) 5asflags-y += $(LINUXINCLUDE)
6ccflags-y += -O2 $(LINUXINCLUDE) 6ccflags-y += -O2 $(LINUXINCLUDE)
7ldflags-y += -T $(obj)/decompress.ld 7ldflags-y += -T $(srctree)/$(obj)/decompress.ld
8OBJECTS = $(obj)/head.o $(obj)/misc.o 8OBJECTS = $(obj)/head.o $(obj)/misc.o
9OBJCOPYFLAGS = -O binary --remove-section=.bss 9OBJCOPYFLAGS = -O binary --remove-section=.bss
10 10
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
index 59961f20fabb..18e13bce1400 100644
--- a/arch/cris/arch-v10/boot/compressed/misc.c
+++ b/arch/cris/arch-v10/boot/compressed/misc.c
@@ -29,11 +29,10 @@
29#define OF(args) args 29#define OF(args) args
30#define STATIC static 30#define STATIC static
31 31
32void* memset(void* s, int c, size_t n); 32void *memset(void *s, int c, size_t n);
33void* memcpy(void* __dest, __const void* __src, size_t __n); 33void *memcpy(void *__dest, __const void *__src, size_t __n);
34
35#define memzero(s, n) memset ((s), 0, (n))
36 34
35#define memzero(s, n) memset((s), 0, (n))
37 36
38typedef unsigned char uch; 37typedef unsigned char uch;
39typedef unsigned short ush; 38typedef unsigned short ush;
@@ -61,23 +60,38 @@ static unsigned outcnt = 0; /* bytes in output buffer */
61#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ 60#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
62#define RESERVED 0xC0 /* bit 6,7: reserved */ 61#define RESERVED 0xC0 /* bit 6,7: reserved */
63 62
64#define get_byte() inbuf[inptr++] 63#define get_byte() (inbuf[inptr++])
65 64
66/* Diagnostic functions */ 65/* Diagnostic functions */
67#ifdef DEBUG 66#ifdef DEBUG
68# define Assert(cond,msg) {if(!(cond)) error(msg);} 67# define Assert(cond, msg) do { \
68 if (!(cond)) \
69 error(msg); \
70 } while (0)
69# define Trace(x) fprintf x 71# define Trace(x) fprintf x
70# define Tracev(x) {if (verbose) fprintf x ;} 72# define Tracev(x) do { \
71# define Tracevv(x) {if (verbose>1) fprintf x ;} 73 if (verbose) \
72# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} 74 fprintf x; \
73# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} 75 } while (0)
76# define Tracevv(x) do { \
77 if (verbose > 1) \
78 fprintf x; \
79 } while (0)
80# define Tracec(c, x) do { \
81 if (verbose && (c)) \
82 fprintf x; \
83 } while (0)
84# define Tracecv(c, x) do { \
85 if (verbose > 1 && (c)) \
86 fprintf x; \
87 } while (0)
74#else 88#else
75# define Assert(cond,msg) 89# define Assert(cond, msg)
76# define Trace(x) 90# define Trace(x)
77# define Tracev(x) 91# define Tracev(x)
78# define Tracevv(x) 92# define Tracevv(x)
79# define Tracec(c,x) 93# define Tracec(c, x)
80# define Tracecv(c,x) 94# define Tracecv(c, x)
81#endif 95#endif
82 96
83static void flush_window(void); 97static void flush_window(void);
@@ -88,26 +102,27 @@ extern char *input_data; /* lives in head.S */
88static long bytes_out = 0; 102static long bytes_out = 0;
89static uch *output_data; 103static uch *output_data;
90static unsigned long output_ptr = 0; 104static unsigned long output_ptr = 0;
91 105
92static void *malloc(int size); 106static void *malloc(int size);
93static void free(void *where); 107static void free(void *where);
94static void gzip_mark(void **); 108static void gzip_mark(void **);
95static void gzip_release(void **); 109static void gzip_release(void **);
96 110
97static void puts(const char *); 111static void puts(const char *);
98 112
99/* the "heap" is put directly after the BSS ends, at end */ 113/* the "heap" is put directly after the BSS ends, at end */
100 114
101extern int _end; 115extern int _end;
102static long free_mem_ptr = (long)&_end; 116static long free_mem_ptr = (long)&_end;
103 117
104#include "../../../../../lib/inflate.c" 118#include "../../../../../lib/inflate.c"
105 119
106static void *malloc(int size) 120static void *malloc(int size)
107{ 121{
108 void *p; 122 void *p;
109 123
110 if (size <0) error("Malloc error"); 124 if (size < 0)
125 error("Malloc error");
111 126
112 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ 127 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
113 128
@@ -137,48 +152,47 @@ static void
137puts(const char *s) 152puts(const char *s)
138{ 153{
139#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 154#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
140 while(*s) { 155 while (*s) {
141#ifdef CONFIG_ETRAX_DEBUG_PORT0 156#ifdef CONFIG_ETRAX_DEBUG_PORT0
142 while(!(*R_SERIAL0_STATUS & (1 << 5))) ; 157 while (!(*R_SERIAL0_STATUS & (1 << 5))) ;
143 *R_SERIAL0_TR_DATA = *s++; 158 *R_SERIAL0_TR_DATA = *s++;
144#endif 159#endif
145#ifdef CONFIG_ETRAX_DEBUG_PORT1 160#ifdef CONFIG_ETRAX_DEBUG_PORT1
146 while(!(*R_SERIAL1_STATUS & (1 << 5))) ; 161 while (!(*R_SERIAL1_STATUS & (1 << 5))) ;
147 *R_SERIAL1_TR_DATA = *s++; 162 *R_SERIAL1_TR_DATA = *s++;
148#endif 163#endif
149#ifdef CONFIG_ETRAX_DEBUG_PORT2 164#ifdef CONFIG_ETRAX_DEBUG_PORT2
150 while(!(*R_SERIAL2_STATUS & (1 << 5))) ; 165 while (!(*R_SERIAL2_STATUS & (1 << 5))) ;
151 *R_SERIAL2_TR_DATA = *s++; 166 *R_SERIAL2_TR_DATA = *s++;
152#endif 167#endif
153#ifdef CONFIG_ETRAX_DEBUG_PORT3 168#ifdef CONFIG_ETRAX_DEBUG_PORT3
154 while(!(*R_SERIAL3_STATUS & (1 << 5))) ; 169 while (!(*R_SERIAL3_STATUS & (1 << 5))) ;
155 *R_SERIAL3_TR_DATA = *s++; 170 *R_SERIAL3_TR_DATA = *s++;
156#endif 171#endif
157 } 172 }
158#endif 173#endif
159} 174}
160 175
161void* 176void *memset(void *s, int c, size_t n)
162memset(void* s, int c, size_t n)
163{ 177{
164 int i; 178 int i;
165 char *ss = (char*)s; 179 char *ss = (char *)s;
166 180
167 for (i=0;i<n;i++) ss[i] = c; 181 for (i = 0; i < n; i++)
182 ss[i] = c;
168 183
169 return s; 184 return s;
170} 185}
171 186
172void* 187void *memcpy(void *__dest, __const void *__src, size_t __n)
173memcpy(void* __dest, __const void* __src,
174 size_t __n)
175{ 188{
176 int i; 189 int i;
177 char *d = (char *)__dest, *s = (char *)__src; 190 char *d = (char *)__dest, *s = (char *)__src;
178 191
179 for (i=0;i<__n;i++) d[i] = s[i]; 192 for (i = 0; i < __n; i++)
193 d[i] = s[i];
180 194
181 return __dest; 195 return __dest;
182} 196}
183 197
184/* =========================================================================== 198/* ===========================================================================
@@ -186,33 +200,33 @@ memcpy(void* __dest, __const void* __src,
186 * (Used for the decompressed data only.) 200 * (Used for the decompressed data only.)
187 */ 201 */
188 202
189static void 203static void flush_window(void)
190flush_window()
191{ 204{
192 ulg c = crc; /* temporary variable */ 205 ulg c = crc; /* temporary variable */
193 unsigned n; 206 unsigned n;
194 uch *in, *out, ch; 207 uch *in, *out, ch;
195 208
196 in = window; 209 in = window;
197 out = &output_data[output_ptr]; 210 out = &output_data[output_ptr];
198 for (n = 0; n < outcnt; n++) { 211 for (n = 0; n < outcnt; n++) {
199 ch = *out++ = *in++; 212 ch = *out = *in;
200 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 213 out++;
201 } 214 in++;
202 crc = c; 215 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
203 bytes_out += (ulg)outcnt; 216 }
204 output_ptr += (ulg)outcnt; 217 crc = c;
205 outcnt = 0; 218 bytes_out += (ulg)outcnt;
219 output_ptr += (ulg)outcnt;
220 outcnt = 0;
206} 221}
207 222
208static void 223static void error(char *x)
209error(char *x)
210{ 224{
211 puts("\n\n"); 225 puts("\n\n");
212 puts(x); 226 puts(x);
213 puts("\n\n -- System halted\n"); 227 puts("\n\n -- System halted\n");
214 228
215 while(1); /* Halt */ 229 while (1); /* Halt */
216} 230}
217 231
218void setup_normal_output_buffer(void) 232void setup_normal_output_buffer(void)
@@ -223,7 +237,7 @@ void setup_normal_output_buffer(void)
223void decompress_kernel(void) 237void decompress_kernel(void)
224{ 238{
225 char revision; 239 char revision;
226 240
227 /* input_data is set in head.S */ 241 /* input_data is set in head.S */
228 inbuf = input_data; 242 inbuf = input_data;
229 243
@@ -255,10 +269,9 @@ void decompress_kernel(void)
255 makecrc(); 269 makecrc();
256 270
257 __asm__ volatile ("move $vr,%0" : "=rm" (revision)); 271 __asm__ volatile ("move $vr,%0" : "=rm" (revision));
258 if (revision < 10) 272 if (revision < 10) {
259 {
260 puts("You need an ETRAX 100LX to run linux 2.6\n"); 273 puts("You need an ETRAX 100LX to run linux 2.6\n");
261 while(1); 274 while (1);
262 } 275 }
263 276
264 puts("Uncompressing Linux...\n"); 277 puts("Uncompressing Linux...\n");
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
index bea8b9c2a7cf..07688da92708 100644
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ b/arch/cris/arch-v10/boot/rescue/Makefile
@@ -4,7 +4,7 @@
4 4
5ccflags-y += -O2 $(LINUXINCLUDE) 5ccflags-y += -O2 $(LINUXINCLUDE)
6asflags-y += $(LINUXINCLUDE) 6asflags-y += $(LINUXINCLUDE)
7ldflags-y += -T $(obj)/rescue.ld 7ldflags-y += -T $(srctree)/$(obj)/rescue.ld
8OBJCOPYFLAGS = -O binary --remove-section=.bss 8OBJCOPYFLAGS = -O binary --remove-section=.bss
9obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 9obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
10OBJECT := $(obj)/head.o 10OBJECT := $(obj)/head.o