aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-28 18:07:55 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-28 18:07:55 -0400
commitcb28a1bbdb4790378e7366d6c9ee1d2340b84f92 (patch)
tree316436f77dac75335fd2c3ef5f109e71606c50d3 /arch/cris
parentb6d4f7e3ef25beb8c658c97867d98883e69dc544 (diff)
parentf934fb19ef34730263e6afc01e8ec27a8a71470f (diff)
Merge branch 'linus' into core/generic-dma-coherent
Conflicts: arch/x86/Kconfig Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/cris')
-rw-r--r--arch/cris/arch-v10/boot/Makefile1
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile14
-rw-r--r--arch/cris/arch-v10/boot/compressed/decompress.ld3
-rw-r--r--arch/cris/arch-v10/boot/compressed/head.S98
-rw-r--r--arch/cris/arch-v10/boot/compressed/misc.c170
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile9
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c2
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c20
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c79
-rw-r--r--arch/cris/arch-v10/mm/init.c2
-rw-r--r--arch/cris/arch-v32/boot/Makefile1
-rw-r--r--arch/cris/arch-v32/boot/compressed/Makefile6
-rw-r--r--arch/cris/arch-v32/boot/compressed/misc.c39
-rw-r--r--arch/cris/arch-v32/boot/rescue/Makefile3
-rw-r--r--arch/cris/arch-v32/drivers/pcf8563.c2
-rw-r--r--arch/cris/arch-v32/kernel/kgdb.c60
-rw-r--r--arch/cris/arch-v32/mm/init.c2
-rw-r--r--arch/cris/kernel/profile.c17
-rw-r--r--arch/cris/mm/init.c30
19 files changed, 196 insertions, 362 deletions
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
index 20c83a53caf3..217203014433 100644
--- a/arch/cris/arch-v10/boot/Makefile
+++ b/arch/cris/arch-v10/boot/Makefile
@@ -2,7 +2,6 @@
2# arch/cris/arch-v10/boot/Makefile 2# arch/cris/arch-v10/boot/Makefile
3# 3#
4 4
5OBJCOPY = objcopy-cris
6OBJCOPYFLAGS = -O binary --remove-section=.bss 5OBJCOPYFLAGS = -O binary --remove-section=.bss
7 6
8subdir- := compressed rescue 7subdir- := compressed rescue
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
index 4a031cb27eb9..08d943ce4be7 100644
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ b/arch/cris/arch-v10/boot/compressed/Makefile
@@ -2,12 +2,10 @@
2# arch/cris/arch-v10/boot/compressed/Makefile 2# arch/cris/arch-v10/boot/compressed/Makefile
3# 3#
4 4
5CC = gcc-cris -melf $(LINUXINCLUDE) 5asflags-y += $(LINUXINCLUDE)
6ccflags-y += -O2 6ccflags-y += -O2 $(LINUXINCLUDE)
7LD = ld-cris 7ldflags-y += -T $(srctree)/$(obj)/decompress.ld
8ldflags-y += -T $(obj)/decompress.ld
9OBJECTS = $(obj)/head.o $(obj)/misc.o 8OBJECTS = $(obj)/head.o $(obj)/misc.o
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 9OBJCOPYFLAGS = -O binary --remove-section=.bss
12 10
13quiet_cmd_image = BUILD $@ 11quiet_cmd_image = BUILD $@
@@ -21,12 +19,6 @@ $(obj)/decompress.o: $(OBJECTS) FORCE
21$(obj)/decompress.bin: $(obj)/decompress.o FORCE 19$(obj)/decompress.bin: $(obj)/decompress.o FORCE
22 $(call if_changed,objcopy) 20 $(call if_changed,objcopy)
23 21
24$(obj)/head.o: $(obj)/head.S .config
25 @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
26
27$(obj)/misc.o: $(obj)/misc.c .config
28 @$(CC) -D__KERNEL__ -c $< -o $@
29
30$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE 22$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
31 $(call if_changed,image) 23 $(call if_changed,image)
32 24
diff --git a/arch/cris/arch-v10/boot/compressed/decompress.ld b/arch/cris/arch-v10/boot/compressed/decompress.ld
index 0b0a14fe6177..e80f4594d543 100644
--- a/arch/cris/arch-v10/boot/compressed/decompress.ld
+++ b/arch/cris/arch-v10/boot/compressed/decompress.ld
@@ -1,4 +1,5 @@
1OUTPUT_FORMAT(elf32-us-cris) 1/* OUTPUT_FORMAT(elf32-us-cris) */
2OUTPUT_FORMAT(elf32-cris)
2 3
3MEMORY 4MEMORY
4 { 5 {
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S
index 610bdb237553..981fbae84959 100644
--- a/arch/cris/arch-v10/boot/compressed/head.S
+++ b/arch/cris/arch-v10/boot/compressed/head.S
@@ -15,77 +15,77 @@
15#define COMMAND_LINE_MAGIC 0x87109563 15#define COMMAND_LINE_MAGIC 0x87109563
16 16
17 ;; Exported symbols 17 ;; Exported symbols
18
19 .globl _input_data
20 18
21 19 .globl input_data
20
21
22 .text 22 .text
23 23
24 nop 24 nop
25 di 25 di
26 26
27;; We need to initialze DRAM registers before we start using the DRAM 27;; We need to initialze DRAM registers before we start using the DRAM
28 28
29 cmp.d RAM_INIT_MAGIC, r8 ; Already initialized? 29 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
30 beq dram_init_finished 30 beq dram_init_finished
31 nop 31 nop
32 32
33#include "../../lib/dram_init.S" 33#include "../../lib/dram_init.S"
34 34
35dram_init_finished: 35dram_init_finished:
36 36
37 ;; Initiate the PA and PB ports 37 ;; Initiate the PA and PB ports
38 38
39 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0 39 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
40 move.b r0, [R_PORT_PA_DATA] 40 move.b $r0, [R_PORT_PA_DATA]
41 41
42 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0 42 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
43 move.b r0, [R_PORT_PA_DIR] 43 move.b $r0, [R_PORT_PA_DIR]
44 44
45 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0 45 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
46 move.b r0, [R_PORT_PB_DATA] 46 move.b $r0, [R_PORT_PB_DATA]
47 47
48 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0 48 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
49 move.b r0, [R_PORT_PB_DIR] 49 move.b $r0, [R_PORT_PB_DIR]
50 50
51 ;; Setup the stack to a suitably high address. 51 ;; Setup the stack to a suitably high address.
52 ;; We assume 8 MB is the minimum DRAM in an eLinux 52 ;; We assume 8 MB is the minimum DRAM in an eLinux
53 ;; product and put the sp at the top for now. 53 ;; product and put the sp at the top for now.
54 54
55 move.d 0x40800000, sp 55 move.d 0x40800000, $sp
56 56
57 ;; Figure out where the compressed piggyback image is 57 ;; Figure out where the compressed piggyback image is
58 ;; in the flash (since we wont try to copy it to DRAM 58 ;; in the flash (since we wont try to copy it to DRAM
59 ;; before unpacking). It is at _edata, but in flash. 59 ;; before unpacking). It is at _edata, but in flash.
60 ;; Use (_edata - basse) as offset to the current PC. 60 ;; Use (_edata - basse) as offset to the current PC.
61 61
62basse: move.d pc, r5 62basse: move.d $pc, $r5
63 and.d 0x7fffffff, r5 ; strip any non-cache bit 63 and.d 0x7fffffff, $r5 ; strip any non-cache bit
64 subq 2, r5 ; compensate for the move.d pc instr 64 subq 2, $r5 ; compensate for the move.d $pc instr
65 move.d r5, r0 ; save for later - flash address of 'basse' 65 move.d $r5, $r0 ; save for later - flash address of 'basse'
66 add.d _edata, r5 66 add.d _edata, $r5
67 sub.d basse, r5 ; r5 = flash address of '_edata' 67 sub.d basse, $r5 ; $r5 = flash address of '_edata'
68 68
69 ;; Copy text+data to DRAM 69 ;; Copy text+data to DRAM
70 70
71 move.d basse, r1 ; destination 71 move.d basse, $r1 ; destination
72 move.d _edata, r2 ; end destination 72 move.d _edata, $r2 ; end destination
731: move.w [r0+], r3 731: move.w [$r0+], $r3
74 move.w r3, [r1+] 74 move.w $r3, [$r1+]
75 cmp.d r2, r1 75 cmp.d $r2, $r1
76 bcs 1b 76 bcs 1b
77 nop 77 nop
78 78
79 move.d r5, [_input_data] ; for the decompressor 79 move.d $r5, [input_data] ; for the decompressor
80 80
81 81
82 ;; Clear the decompressors BSS (between _edata and _end) 82 ;; Clear the decompressors BSS (between _edata and _end)
83 83
84 moveq 0, r0 84 moveq 0, $r0
85 move.d _edata, r1 85 move.d _edata, $r1
86 move.d _end, r2 86 move.d _end, $r2
871: move.w r0, [r1+] 871: move.w $r0, [$r1+]
88 cmp.d r2, r1 88 cmp.d $r2, $r1
89 bcs 1b 89 bcs 1b
90 nop 90 nop
91 91
@@ -94,16 +94,16 @@ basse: move.d pc, r5
94 move.d $r10, [$r12] 94 move.d $r10, [$r12]
95 move.d _cmd_line_addr, $r12 95 move.d _cmd_line_addr, $r12
96 move.d $r11, [$r12] 96 move.d $r11, [$r12]
97
98 ;; Do the decompression and save compressed size in _inptr
99 97
100 jsr _decompress_kernel 98 ;; Do the decompression and save compressed size in inptr
101 99
102 ;; Put start address of root partition in r9 so the kernel can use it 100 jsr decompress_kernel
101
102 ;; Put start address of root partition in $r9 so the kernel can use it
103 ;; when mounting from flash 103 ;; when mounting from flash
104 104
105 move.d [_input_data], r9 ; flash address of compressed kernel 105 move.d [input_data], $r9 ; flash address of compressed kernel
106 add.d [_inptr], r9 ; size of compressed kernel 106 add.d [inptr], $r9 ; size of compressed kernel
107 107
108 ;; Restore command line magic and address. 108 ;; Restore command line magic and address.
109 move.d _cmd_line_magic, $r10 109 move.d _cmd_line_magic, $r10
@@ -112,12 +112,12 @@ basse: move.d pc, r5
112 move.d [$r11], $r11 112 move.d [$r11], $r11
113 113
114 ;; Enter the decompressed kernel 114 ;; Enter the decompressed kernel
115 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized 115 move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
116 jump 0x40004000 ; kernel is linked to this address 116 jump 0x40004000 ; kernel is linked to this address
117 117
118 .data 118 .data
119 119
120_input_data: 120input_data:
121 .dword 0 ; used by the decompressor 121 .dword 0 ; used by the decompressor
122_cmd_line_magic: 122_cmd_line_magic:
123 .dword 0 123 .dword 0
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
index 9a43ab19391e..d933c89889db 100644
--- a/arch/cris/arch-v10/boot/compressed/misc.c
+++ b/arch/cris/arch-v10/boot/compressed/misc.c
@@ -29,12 +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, 33void *memcpy(void *__dest, __const void *__src, size_t __n);
34 size_t __n);
35
36#define memzero(s, n) memset ((s), 0, (n))
37 34
35#define memzero(s, n) memset((s), 0, (n))
38 36
39typedef unsigned char uch; 37typedef unsigned char uch;
40typedef unsigned short ush; 38typedef unsigned short ush;
@@ -62,79 +60,57 @@ static unsigned outcnt = 0; /* bytes in output buffer */
62#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ 60#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
63#define RESERVED 0xC0 /* bit 6,7: reserved */ 61#define RESERVED 0xC0 /* bit 6,7: reserved */
64 62
65#define get_byte() inbuf[inptr++] 63#define get_byte() (inbuf[inptr++])
66 64
67/* Diagnostic functions */ 65/* Diagnostic functions */
68#ifdef DEBUG 66#ifdef DEBUG
69# define Assert(cond,msg) {if(!(cond)) error(msg);} 67# define Assert(cond, msg) do { \
68 if (!(cond)) \
69 error(msg); \
70 } while (0)
70# define Trace(x) fprintf x 71# define Trace(x) fprintf x
71# define Tracev(x) {if (verbose) fprintf x ;} 72# define Tracev(x) do { \
72# define Tracevv(x) {if (verbose>1) fprintf x ;} 73 if (verbose) \
73# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} 74 fprintf x; \
74# 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)
75#else 88#else
76# define Assert(cond,msg) 89# define Assert(cond, msg)
77# define Trace(x) 90# define Trace(x)
78# define Tracev(x) 91# define Tracev(x)
79# define Tracevv(x) 92# define Tracevv(x)
80# define Tracec(c,x) 93# define Tracec(c, x)
81# define Tracecv(c,x) 94# define Tracecv(c, x)
82#endif 95#endif
83 96
84static int fill_inbuf(void);
85static void flush_window(void); 97static void flush_window(void);
86static void error(char *m); 98static void error(char *m);
87static void gzip_mark(void **);
88static void gzip_release(void **);
89 99
90extern char *input_data; /* lives in head.S */ 100extern char *input_data; /* lives in head.S */
91 101
92static long bytes_out = 0; 102static long bytes_out = 0;
93static uch *output_data; 103static uch *output_data;
94static unsigned long output_ptr = 0; 104static unsigned long output_ptr = 0;
95
96static void *malloc(int size);
97static void free(void *where);
98static void error(char *m);
99static void gzip_mark(void **);
100static void gzip_release(void **);
101
102static void puts(const char *); 105static void puts(const char *);
103 106
104/* the "heap" is put directly after the BSS ends, at end */ 107/* the "heap" is put directly after the BSS ends, at end */
105
106extern int end;
107static long free_mem_ptr = (long)&end;
108
109#include "../../../../../lib/inflate.c"
110
111static void *malloc(int size)
112{
113 void *p;
114
115 if (size <0) error("Malloc error");
116
117 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
118
119 p = (void *)free_mem_ptr;
120 free_mem_ptr += size;
121
122 return p;
123}
124
125static void free(void *where)
126{ /* Don't care */
127}
128 108
129static void gzip_mark(void **ptr) 109extern int _end;
130{ 110static long free_mem_ptr = (long)&_end;
131 *ptr = (void *) free_mem_ptr; 111static long free_mem_end_ptr;
132}
133 112
134static void gzip_release(void **ptr) 113#include "../../../../../lib/inflate.c"
135{
136 free_mem_ptr = (long) *ptr;
137}
138 114
139/* decompressor info and error messages to serial console */ 115/* decompressor info and error messages to serial console */
140 116
@@ -142,44 +118,47 @@ static void
142puts(const char *s) 118puts(const char *s)
143{ 119{
144#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 120#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
145 while(*s) { 121 while (*s) {
146#ifdef CONFIG_ETRAX_DEBUG_PORT0 122#ifdef CONFIG_ETRAX_DEBUG_PORT0
147 while(!(*R_SERIAL0_STATUS & (1 << 5))) ; 123 while (!(*R_SERIAL0_STATUS & (1 << 5))) ;
148 *R_SERIAL0_TR_DATA = *s++; 124 *R_SERIAL0_TR_DATA = *s++;
149#endif 125#endif
150#ifdef CONFIG_ETRAX_DEBUG_PORT1 126#ifdef CONFIG_ETRAX_DEBUG_PORT1
151 while(!(*R_SERIAL1_STATUS & (1 << 5))) ; 127 while (!(*R_SERIAL1_STATUS & (1 << 5))) ;
152 *R_SERIAL1_TR_DATA = *s++; 128 *R_SERIAL1_TR_DATA = *s++;
153#endif 129#endif
154#ifdef CONFIG_ETRAX_DEBUG_PORT2 130#ifdef CONFIG_ETRAX_DEBUG_PORT2
155 while(!(*R_SERIAL2_STATUS & (1 << 5))) ; 131 while (!(*R_SERIAL2_STATUS & (1 << 5))) ;
156 *R_SERIAL2_TR_DATA = *s++; 132 *R_SERIAL2_TR_DATA = *s++;
157#endif 133#endif
158#ifdef CONFIG_ETRAX_DEBUG_PORT3 134#ifdef CONFIG_ETRAX_DEBUG_PORT3
159 while(!(*R_SERIAL3_STATUS & (1 << 5))) ; 135 while (!(*R_SERIAL3_STATUS & (1 << 5))) ;
160 *R_SERIAL3_TR_DATA = *s++; 136 *R_SERIAL3_TR_DATA = *s++;
161#endif 137#endif
162 } 138 }
163#endif 139#endif
164} 140}
165 141
166void* 142void *memset(void *s, int c, size_t n)
167memset(void* s, int c, size_t n)
168{ 143{
169 int i; 144 int i;
170 char *ss = (char*)s; 145 char *ss = (char *)s;
171 146
172 for (i=0;i<n;i++) ss[i] = c; 147 for (i = 0; i < n; i++)
148 ss[i] = c;
149
150 return s;
173} 151}
174 152
175void* 153void *memcpy(void *__dest, __const void *__src, size_t __n)
176memcpy(void* __dest, __const void* __src,
177 size_t __n)
178{ 154{
179 int i; 155 int i;
180 char *d = (char *)__dest, *s = (char *)__src; 156 char *d = (char *)__dest, *s = (char *)__src;
181 157
182 for (i=0;i<__n;i++) d[i] = s[i]; 158 for (i = 0; i < __n; i++)
159 d[i] = s[i];
160
161 return __dest;
183} 162}
184 163
185/* =========================================================================== 164/* ===========================================================================
@@ -187,46 +166,44 @@ memcpy(void* __dest, __const void* __src,
187 * (Used for the decompressed data only.) 166 * (Used for the decompressed data only.)
188 */ 167 */
189 168
190static void 169static void flush_window(void)
191flush_window()
192{ 170{
193 ulg c = crc; /* temporary variable */ 171 ulg c = crc; /* temporary variable */
194 unsigned n; 172 unsigned n;
195 uch *in, *out, ch; 173 uch *in, *out, ch;
196 174
197 in = window; 175 in = window;
198 out = &output_data[output_ptr]; 176 out = &output_data[output_ptr];
199 for (n = 0; n < outcnt; n++) { 177 for (n = 0; n < outcnt; n++) {
200 ch = *out++ = *in++; 178 ch = *out = *in;
201 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 179 out++;
202 } 180 in++;
203 crc = c; 181 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
204 bytes_out += (ulg)outcnt; 182 }
205 output_ptr += (ulg)outcnt; 183 crc = c;
206 outcnt = 0; 184 bytes_out += (ulg)outcnt;
185 output_ptr += (ulg)outcnt;
186 outcnt = 0;
207} 187}
208 188
209static void 189static void error(char *x)
210error(char *x)
211{ 190{
212 puts("\n\n"); 191 puts("\n\n");
213 puts(x); 192 puts(x);
214 puts("\n\n -- System halted\n"); 193 puts("\n\n -- System halted\n");
215 194
216 while(1); /* Halt */ 195 while (1); /* Halt */
217} 196}
218 197
219void 198void setup_normal_output_buffer(void)
220setup_normal_output_buffer()
221{ 199{
222 output_data = (char *)KERNEL_LOAD_ADR; 200 output_data = (char *)KERNEL_LOAD_ADR;
223} 201}
224 202
225void 203void decompress_kernel(void)
226decompress_kernel()
227{ 204{
228 char revision; 205 char revision;
229 206
230 /* input_data is set in head.S */ 207 /* input_data is set in head.S */
231 inbuf = input_data; 208 inbuf = input_data;
232 209
@@ -257,11 +234,10 @@ decompress_kernel()
257 234
258 makecrc(); 235 makecrc();
259 236
260 __asm__ volatile ("move vr,%0" : "=rm" (revision)); 237 __asm__ volatile ("move $vr,%0" : "=rm" (revision));
261 if (revision < 10) 238 if (revision < 10) {
262 {
263 puts("You need an ETRAX 100LX to run linux 2.6\n"); 239 puts("You need an ETRAX 100LX to run linux 2.6\n");
264 while(1); 240 while (1);
265 } 241 }
266 242
267 puts("Uncompressing Linux...\n"); 243 puts("Uncompressing Linux...\n");
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
index 2e5045b9e19c..07688da92708 100644
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ b/arch/cris/arch-v10/boot/rescue/Makefile
@@ -2,12 +2,9 @@
2# Makefile for rescue (bootstrap) code 2# Makefile for rescue (bootstrap) code
3# 3#
4 4
5CC = gcc-cris -mlinux $(LINUXINCLUDE) 5ccflags-y += -O2 $(LINUXINCLUDE)
6ccflags-y += -O2 6asflags-y += $(LINUXINCLUDE)
7asflags-y += -traditional 7ldflags-y += -T $(srctree)/$(obj)/rescue.ld
8LD = gcc-cris -mlinux -nostdlib
9ldflags-y += -T $(obj)/rescue.ld
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 8OBJCOPYFLAGS = -O binary --remove-section=.bss
12obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 9obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
13OBJECT := $(obj)/head.o 10OBJECT := $(obj)/head.o
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index 52103d16dc6c..8769dc914073 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -233,7 +233,7 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
233 233
234 if (copy_to_user((struct rtc_time *) arg, &tm, 234 if (copy_to_user((struct rtc_time *) arg, &tm,
235 sizeof tm)) { 235 sizeof tm)) {
236 spin_unlock(&rtc_lock); 236 mutex_unlock(&rtc_lock);
237 return -EFAULT; 237 return -EFAULT;
238 } 238 }
239 239
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 04d5eee2c90c..3dc6e91ba39e 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -426,12 +426,18 @@ static int dummy_write(struct tty_struct * tty,
426 return count; 426 return count;
427} 427}
428 428
429static int 429static int dummy_write_room(struct tty_struct *tty)
430dummy_write_room(struct tty_struct *tty)
431{ 430{
432 return 8192; 431 return 8192;
433} 432}
434 433
434static const struct tty_operations dummy_ops = {
435 .open = dummy_open,
436 .close = dummy_close,
437 .write = dummy_write,
438 .write_room = dummy_write_room,
439};
440
435void __init 441void __init
436init_dummy_console(void) 442init_dummy_console(void)
437{ 443{
@@ -444,14 +450,14 @@ init_dummy_console(void)
444 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL; 450 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
445 dummy_driver.subtype = SERIAL_TYPE_NORMAL; 451 dummy_driver.subtype = SERIAL_TYPE_NORMAL;
446 dummy_driver.init_termios = tty_std_termios; 452 dummy_driver.init_termios = tty_std_termios;
453 /* Normally B9600 default... */
447 dummy_driver.init_termios.c_cflag = 454 dummy_driver.init_termios.c_cflag =
448 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ 455 B115200 | CS8 | CREAD | HUPCL | CLOCAL;
449 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 456 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
457 dummy_driver.init_termios.c_ispeed = 115200;
458 dummy_driver.init_termios.c_ospeed = 115200;
450 459
451 dummy_driver.open = dummy_open; 460 dummy_driver.ops = &dummy_ops;
452 dummy_driver.close = dummy_close;
453 dummy_driver.write = dummy_write;
454 dummy_driver.write_room = dummy_write_room;
455 if (tty_register_driver(&dummy_driver)) 461 if (tty_register_driver(&dummy_driver))
456 panic("Couldn't register dummy serial driver\n"); 462 panic("Couldn't register dummy serial driver\n");
457} 463}
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index a3ca55150745..6fea45f2e40c 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -278,14 +278,6 @@ void putDebugChar (int val);
278 278
279void enableDebugIRQ (void); 279void enableDebugIRQ (void);
280 280
281/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
282 represented by int x. */
283static char highhex (int x);
284
285/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
286 represented by int x. */
287static char lowhex (int x);
288
289/* Returns the integer equivalent of a hexadecimal character. */ 281/* Returns the integer equivalent of a hexadecimal character. */
290static int hex (char ch); 282static int hex (char ch);
291 283
@@ -356,9 +348,6 @@ extern unsigned char executing_task;
356/* Run-length encoding maximum length. Send 64 at most. */ 348/* Run-length encoding maximum length. Send 64 at most. */
357#define RUNLENMAX 64 349#define RUNLENMAX 64
358 350
359/* Definition of all valid hexadecimal characters */
360static const char hexchars[] = "0123456789abcdef";
361
362/* The inbound/outbound buffers used in packet I/O */ 351/* The inbound/outbound buffers used in packet I/O */
363static char remcomInBuffer[BUFMAX]; 352static char remcomInBuffer[BUFMAX];
364static char remcomOutBuffer[BUFMAX]; 353static char remcomOutBuffer[BUFMAX];
@@ -499,8 +488,8 @@ gdb_cris_strtol (const char *s, char **endptr, int base)
499 char *sd; 488 char *sd;
500 int x = 0; 489 int x = 0;
501 490
502 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1) 491 for (s1 = (char*)s; (sd = gdb_cris_memchr(hex_asc, *s1, base)) != NULL; ++s1)
503 x = x * base + (sd - hexchars); 492 x = x * base + (sd - hex_asc);
504 493
505 if (endptr) 494 if (endptr)
506 { 495 {
@@ -670,22 +659,6 @@ read_register (char regno, unsigned int *valptr)
670} 659}
671 660
672/********************************** Packet I/O ******************************/ 661/********************************** Packet I/O ******************************/
673/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
674 represented by int x. */
675static inline char
676highhex(int x)
677{
678 return hexchars[(x >> 4) & 0xf];
679}
680
681/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
682 represented by int x. */
683static inline char
684lowhex(int x)
685{
686 return hexchars[x & 0xf];
687}
688
689/* Returns the integer equivalent of a hexadecimal character. */ 662/* Returns the integer equivalent of a hexadecimal character. */
690static int 663static int
691hex (char ch) 664hex (char ch)
@@ -721,8 +694,7 @@ mem2hex(char *buf, unsigned char *mem, int count)
721 /* Valid mem address. */ 694 /* Valid mem address. */
722 for (i = 0; i < count; i++) { 695 for (i = 0; i < count; i++) {
723 ch = *mem++; 696 ch = *mem++;
724 *buf++ = highhex (ch); 697 buf = pack_hex_byte(buf, ch);
725 *buf++ = lowhex (ch);
726 } 698 }
727 } 699 }
728 700
@@ -857,9 +829,9 @@ putpacket(char *buffer)
857 src++; 829 src++;
858 } 830 }
859 } 831 }
860 putDebugChar ('#'); 832 putDebugChar('#');
861 putDebugChar (highhex (checksum)); 833 putDebugChar(hex_asc_hi(checksum));
862 putDebugChar (lowhex (checksum)); 834 putDebugChar(hex_asc_lo(checksum));
863 } while(kgdb_started && (getDebugChar() != '+')); 835 } while(kgdb_started && (getDebugChar() != '+'));
864} 836}
865 837
@@ -895,9 +867,8 @@ stub_is_stopped(int sigval)
895 867
896 /* Send trap type (converted to signal) */ 868 /* Send trap type (converted to signal) */
897 869
898 *ptr++ = 'T'; 870 *ptr++ = 'T';
899 *ptr++ = highhex (sigval); 871 ptr = pack_hex_byte(ptr, sigval);
900 *ptr++ = lowhex (sigval);
901 872
902 /* Send register contents. We probably only need to send the 873 /* Send register contents. We probably only need to send the
903 * PC, frame pointer and stack pointer here. Other registers will be 874 * PC, frame pointer and stack pointer here. Other registers will be
@@ -910,9 +881,7 @@ stub_is_stopped(int sigval)
910 status = read_register (regno, &reg_cont); 881 status = read_register (regno, &reg_cont);
911 882
912 if (status == SUCCESS) { 883 if (status == SUCCESS) {
913 884 ptr = pack_hex_byte(ptr, regno);
914 *ptr++ = highhex (regno);
915 *ptr++ = lowhex (regno);
916 *ptr++ = ':'; 885 *ptr++ = ':';
917 886
918 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, 887 ptr = mem2hex(ptr, (unsigned char *)&reg_cont,
@@ -937,8 +906,8 @@ stub_is_stopped(int sigval)
937 /* Store thread:r...; with the executing task TID. */ 906 /* Store thread:r...; with the executing task TID. */
938 gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:"); 907 gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:");
939 pos += gdb_cris_strlen ("thread:"); 908 pos += gdb_cris_strlen ("thread:");
940 remcomOutBuffer[pos++] = highhex (executing_task); 909 remcomOutBuffer[pos++] = hex_asc_hi(executing_task);
941 remcomOutBuffer[pos++] = lowhex (executing_task); 910 remcomOutBuffer[pos++] = hex_asc_lo(executing_task);
942 gdb_cris_strcpy (&remcomOutBuffer[pos], ";"); 911 gdb_cris_strcpy (&remcomOutBuffer[pos], ";");
943#endif 912#endif
944 913
@@ -1126,8 +1095,8 @@ handle_exception (int sigval)
1126 Success: SAA, where AA is the signal number. 1095 Success: SAA, where AA is the signal number.
1127 Failure: void. */ 1096 Failure: void. */
1128 remcomOutBuffer[0] = 'S'; 1097 remcomOutBuffer[0] = 'S';
1129 remcomOutBuffer[1] = highhex (sigval); 1098 remcomOutBuffer[1] = hex_asc_hi(sigval);
1130 remcomOutBuffer[2] = lowhex (sigval); 1099 remcomOutBuffer[2] = hex_asc_lo(sigval);
1131 remcomOutBuffer[3] = 0; 1100 remcomOutBuffer[3] = 0;
1132 break; 1101 break;
1133 1102
@@ -1224,23 +1193,23 @@ handle_exception (int sigval)
1224 case 'C': 1193 case 'C':
1225 /* Identify the remote current thread. */ 1194 /* Identify the remote current thread. */
1226 gdb_cris_strcpy (&remcomOutBuffer[0], "QC"); 1195 gdb_cris_strcpy (&remcomOutBuffer[0], "QC");
1227 remcomOutBuffer[2] = highhex (current_thread_c); 1196 remcomOutBuffer[2] = hex_asc_hi(current_thread_c);
1228 remcomOutBuffer[3] = lowhex (current_thread_c); 1197 remcomOutBuffer[3] = hex_asc_lo(current_thread_c);
1229 remcomOutBuffer[4] = '\0'; 1198 remcomOutBuffer[4] = '\0';
1230 break; 1199 break;
1231 case 'L': 1200 case 'L':
1232 gdb_cris_strcpy (&remcomOutBuffer[0], "QM"); 1201 gdb_cris_strcpy (&remcomOutBuffer[0], "QM");
1233 /* Reply with number of threads. */ 1202 /* Reply with number of threads. */
1234 if (os_is_started()) { 1203 if (os_is_started()) {
1235 remcomOutBuffer[2] = highhex (number_of_tasks); 1204 remcomOutBuffer[2] = hex_asc_hi(number_of_tasks);
1236 remcomOutBuffer[3] = lowhex (number_of_tasks); 1205 remcomOutBuffer[3] = hex_asc_lo(number_of_tasks);
1237 } 1206 }
1238 else { 1207 else {
1239 remcomOutBuffer[2] = highhex (0); 1208 remcomOutBuffer[2] = hex_asc_hi(0);
1240 remcomOutBuffer[3] = lowhex (1); 1209 remcomOutBuffer[3] = hex_asc_lo(1);
1241 } 1210 }
1242 /* Done with the reply. */ 1211 /* Done with the reply. */
1243 remcomOutBuffer[4] = lowhex (1); 1212 remcomOutBuffer[4] = hex_asc_lo(1);
1244 pos = 5; 1213 pos = 5;
1245 /* Expects the argument thread id. */ 1214 /* Expects the argument thread id. */
1246 for (; pos < (5 + HEXCHARS_IN_THREAD_ID); pos++) 1215 for (; pos < (5 + HEXCHARS_IN_THREAD_ID); pos++)
@@ -1251,16 +1220,16 @@ handle_exception (int sigval)
1251 for (thread_id = 0; thread_id < number_of_tasks; thread_id++) { 1220 for (thread_id = 0; thread_id < number_of_tasks; thread_id++) {
1252 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1; 1221 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1253 for (; pos < nextpos; pos ++) 1222 for (; pos < nextpos; pos ++)
1254 remcomOutBuffer[pos] = lowhex (0); 1223 remcomOutBuffer[pos] = hex_asc_lo(0);
1255 remcomOutBuffer[pos++] = lowhex (thread_id); 1224 remcomOutBuffer[pos++] = hex_asc_lo(thread_id);
1256 } 1225 }
1257 } 1226 }
1258 else { 1227 else {
1259 /* Store the thread identifier of the boot task. */ 1228 /* Store the thread identifier of the boot task. */
1260 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1; 1229 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1261 for (; pos < nextpos; pos ++) 1230 for (; pos < nextpos; pos ++)
1262 remcomOutBuffer[pos] = lowhex (0); 1231 remcomOutBuffer[pos] = hex_asc_lo(0);
1263 remcomOutBuffer[pos++] = lowhex (current_thread_c); 1232 remcomOutBuffer[pos++] = hex_asc_lo(current_thread_c);
1264 } 1233 }
1265 remcomOutBuffer[pos] = '\0'; 1234 remcomOutBuffer[pos] = '\0';
1266 break; 1235 break;
diff --git a/arch/cris/arch-v10/mm/init.c b/arch/cris/arch-v10/mm/init.c
index e0fcd1a9bfd5..742fd1974c2e 100644
--- a/arch/cris/arch-v10/mm/init.c
+++ b/arch/cris/arch-v10/mm/init.c
@@ -182,7 +182,7 @@ paging_init(void)
182 * mem_map page array. 182 * mem_map page array.
183 */ 183 */
184 184
185 free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0); 185 free_area_init_node(0, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
186} 186}
187 187
188/* Initialize remaps of some I/O-ports. It is important that this 188/* Initialize remaps of some I/O-ports. It is important that this
diff --git a/arch/cris/arch-v32/boot/Makefile b/arch/cris/arch-v32/boot/Makefile
index 3f91349c5f12..99896ad60b30 100644
--- a/arch/cris/arch-v32/boot/Makefile
+++ b/arch/cris/arch-v32/boot/Makefile
@@ -2,7 +2,6 @@
2# arch/cris/arch-v32/boot/Makefile 2# arch/cris/arch-v32/boot/Makefile
3# 3#
4 4
5OBJCOPY = objcopy-cris
6OBJCOPYFLAGS = -O binary -R .note -R .comment 5OBJCOPYFLAGS = -O binary -R .note -R .comment
7 6
8subdir- := compressed rescue 7subdir- := compressed rescue
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 2c8c2c3039c5..d6335f26083b 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -2,14 +2,10 @@
2# arch/cris/arch-v32/boot/compressed/Makefile 2# arch/cris/arch-v32/boot/compressed/Makefile
3# 3#
4 4
5CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
6asflags-y += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch 5asflags-y += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch
7ccflags-y += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch 6ccflags-y += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch
8LD = gcc-cris -mlinux -march=v32 -nostdlib 7ldflags-y += -T $(srctree)/$(obj)/decompress.ld
9ldflags-y += -T $(obj)/decompress.ld
10obj-y = head.o misc.o
11OBJECTS = $(obj)/head.o $(obj)/misc.o 8OBJECTS = $(obj)/head.o $(obj)/misc.o
12OBJCOPY = objcopy-cris
13OBJCOPYFLAGS = -O binary --remove-section=.bss 9OBJCOPYFLAGS = -O binary --remove-section=.bss
14 10
15quiet_cmd_image = BUILD $@ 11quiet_cmd_image = BUILD $@
diff --git a/arch/cris/arch-v32/boot/compressed/misc.c b/arch/cris/arch-v32/boot/compressed/misc.c
index 55b2695c5d70..3595e16e82bc 100644
--- a/arch/cris/arch-v32/boot/compressed/misc.c
+++ b/arch/cris/arch-v32/boot/compressed/misc.c
@@ -89,20 +89,14 @@ static unsigned outcnt = 0; /* bytes in output buffer */
89 89
90static void flush_window(void); 90static void flush_window(void);
91static void error(char *m); 91static void error(char *m);
92static void gzip_mark(void **);
93static void gzip_release(void **);
94 92
95extern char *input_data; /* lives in head.S */ 93extern char *input_data; /* lives in head.S */
96 94
97static long bytes_out = 0; 95static long bytes_out;
98static uch *output_data; 96static uch *output_data;
99static unsigned long output_ptr = 0; 97static unsigned long output_ptr;
100 98
101static void *malloc(int size);
102static void free(void *where);
103static void error(char *m); 99static void error(char *m);
104static void gzip_mark(void **);
105static void gzip_release(void **);
106 100
107static void puts(const char *); 101static void puts(const char *);
108 102
@@ -110,37 +104,10 @@ static void puts(const char *);
110 104
111extern int _end; 105extern int _end;
112static long free_mem_ptr = (long)&_end; 106static long free_mem_ptr = (long)&_end;
107static long free_mem_end_ptr;
113 108
114#include "../../../../../lib/inflate.c" 109#include "../../../../../lib/inflate.c"
115 110
116static void *malloc(int size)
117{
118 void *p;
119
120 if (size <0) error("Malloc error");
121
122 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
123
124 p = (void *)free_mem_ptr;
125 free_mem_ptr += size;
126
127 return p;
128}
129
130static void free(void *where)
131{ /* Don't care */
132}
133
134static void gzip_mark(void **ptr)
135{
136 *ptr = (void *) free_mem_ptr;
137}
138
139static void gzip_release(void **ptr)
140{
141 free_mem_ptr = (long) *ptr;
142}
143
144/* decompressor info and error messages to serial console */ 111/* decompressor info and error messages to serial console */
145 112
146static inline void 113static inline void
diff --git a/arch/cris/arch-v32/boot/rescue/Makefile b/arch/cris/arch-v32/boot/rescue/Makefile
index c0987795dcb7..44ae0ad61f90 100644
--- a/arch/cris/arch-v32/boot/rescue/Makefile
+++ b/arch/cris/arch-v32/boot/rescue/Makefile
@@ -7,9 +7,8 @@ ccflags-y += -O2 -I $(srctree)/include/asm/arch/mach/ \
7 -I $(srctree)/include/asm/arch 7 -I $(srctree)/include/asm/arch
8asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch 8asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
9LD = gcc-cris -mlinux -march=v32 -nostdlib 9LD = gcc-cris -mlinux -march=v32 -nostdlib
10ldflags-y += -T $(obj)/rescue.ld 10ldflags-y += -T $(srctree)/$(obj)/rescue.ld
11LDPOSTFLAGS = -lgcc 11LDPOSTFLAGS = -lgcc
12OBJCOPY = objcopy-cris
13OBJCOPYFLAGS = -O binary --remove-section=.bss 12OBJCOPYFLAGS = -O binary --remove-section=.bss
14obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 13obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
15OBJECT := $(obj)/head.o 14OBJECT := $(obj)/head.o
diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
index 53db3870ba04..f263ab571221 100644
--- a/arch/cris/arch-v32/drivers/pcf8563.c
+++ b/arch/cris/arch-v32/drivers/pcf8563.c
@@ -229,7 +229,7 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
229 229
230 if (copy_to_user((struct rtc_time *) arg, &tm, 230 if (copy_to_user((struct rtc_time *) arg, &tm,
231 sizeof tm)) { 231 sizeof tm)) {
232 spin_unlock(&rtc_lock); 232 mutex_unlock(&rtc_lock);
233 return -EFAULT; 233 return -EFAULT;
234 } 234 }
235 235
diff --git a/arch/cris/arch-v32/kernel/kgdb.c b/arch/cris/arch-v32/kernel/kgdb.c
index 4e2e2e271efb..8bd5a5bc0dc7 100644
--- a/arch/cris/arch-v32/kernel/kgdb.c
+++ b/arch/cris/arch-v32/kernel/kgdb.c
@@ -398,14 +398,6 @@ void putDebugChar(int val)
398} 398}
399#endif 399#endif
400 400
401/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
402 represented by int x. */
403static char highhex(int x);
404
405/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
406 represented by int x. */
407static char lowhex(int x);
408
409/* Returns the integer equivalent of a hexadecimal character. */ 401/* Returns the integer equivalent of a hexadecimal character. */
410static int hex(char ch); 402static int hex(char ch);
411 403
@@ -464,9 +456,6 @@ void breakpoint(void);
464/* Run-length encoding maximum length. Send 64 at most. */ 456/* Run-length encoding maximum length. Send 64 at most. */
465#define RUNLENMAX 64 457#define RUNLENMAX 64
466 458
467/* Definition of all valid hexadecimal characters */
468static const char hexchars[] = "0123456789abcdef";
469
470/* The inbound/outbound buffers used in packet I/O */ 459/* The inbound/outbound buffers used in packet I/O */
471static char input_buffer[BUFMAX]; 460static char input_buffer[BUFMAX];
472static char output_buffer[BUFMAX]; 461static char output_buffer[BUFMAX];
@@ -550,8 +539,8 @@ gdb_cris_strtol(const char *s, char **endptr, int base)
550 char *sd; 539 char *sd;
551 int x = 0; 540 int x = 0;
552 541
553 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1) 542 for (s1 = (char*)s; (sd = gdb_cris_memchr(hex_asc, *s1, base)) != NULL; ++s1)
554 x = x * base + (sd - hexchars); 543 x = x * base + (sd - hex_asc);
555 544
556 if (endptr) { 545 if (endptr) {
557 /* Unconverted suffix is stored in endptr unless endptr is NULL. */ 546 /* Unconverted suffix is stored in endptr unless endptr is NULL. */
@@ -655,22 +644,6 @@ read_register(char regno, unsigned int *valptr)
655} 644}
656 645
657/********************************** Packet I/O ******************************/ 646/********************************** Packet I/O ******************************/
658/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
659 represented by int x. */
660static inline char
661highhex(int x)
662{
663 return hexchars[(x >> 4) & 0xf];
664}
665
666/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
667 represented by int x. */
668static inline char
669lowhex(int x)
670{
671 return hexchars[x & 0xf];
672}
673
674/* Returns the integer equivalent of a hexadecimal character. */ 647/* Returns the integer equivalent of a hexadecimal character. */
675static int 648static int
676hex(char ch) 649hex(char ch)
@@ -704,8 +677,7 @@ mem2hex(char *buf, unsigned char *mem, int count)
704 /* Valid mem address. */ 677 /* Valid mem address. */
705 for (i = 0; i < count; i++) { 678 for (i = 0; i < count; i++) {
706 ch = *mem++; 679 ch = *mem++;
707 *buf++ = highhex (ch); 680 buf = pack_hex_byte(buf, ch);
708 *buf++ = lowhex (ch);
709 } 681 }
710 } 682 }
711 /* Terminate properly. */ 683 /* Terminate properly. */
@@ -723,8 +695,7 @@ mem2hex_nbo(char *buf, unsigned char *mem, int count)
723 mem += count - 1; 695 mem += count - 1;
724 for (i = 0; i < count; i++) { 696 for (i = 0; i < count; i++) {
725 ch = *mem--; 697 ch = *mem--;
726 *buf++ = highhex (ch); 698 buf = pack_hex_byte(buf, ch);
727 *buf++ = lowhex (ch);
728 } 699 }
729 700
730 /* Terminate properly. */ 701 /* Terminate properly. */
@@ -862,8 +833,8 @@ putpacket(char *buffer)
862 } 833 }
863 } 834 }
864 putDebugChar('#'); 835 putDebugChar('#');
865 putDebugChar(highhex (checksum)); 836 putDebugChar(hex_asc_hi(checksum));
866 putDebugChar(lowhex (checksum)); 837 putDebugChar(hex_asc_lo(checksum));
867 } while(kgdb_started && (getDebugChar() != '+')); 838 } while(kgdb_started && (getDebugChar() != '+'));
868} 839}
869 840
@@ -909,8 +880,7 @@ stub_is_stopped(int sigval)
909 /* Send trap type (converted to signal) */ 880 /* Send trap type (converted to signal) */
910 881
911 *ptr++ = 'T'; 882 *ptr++ = 'T';
912 *ptr++ = highhex(sigval); 883 ptr = pack_hex_byte(ptr, sigval);
913 *ptr++ = lowhex(sigval);
914 884
915 if (((reg.exs & 0xff00) >> 8) == 0xc) { 885 if (((reg.exs & 0xff00) >> 8) == 0xc) {
916 886
@@ -1018,30 +988,26 @@ stub_is_stopped(int sigval)
1018 } 988 }
1019 /* Only send PC, frame and stack pointer. */ 989 /* Only send PC, frame and stack pointer. */
1020 read_register(PC, &reg_cont); 990 read_register(PC, &reg_cont);
1021 *ptr++ = highhex(PC); 991 ptr = pack_hex_byte(PC);
1022 *ptr++ = lowhex(PC);
1023 *ptr++ = ':'; 992 *ptr++ = ':';
1024 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]); 993 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]);
1025 *ptr++ = ';'; 994 *ptr++ = ';';
1026 995
1027 read_register(R8, &reg_cont); 996 read_register(R8, &reg_cont);
1028 *ptr++ = highhex(R8); 997 ptr = pack_hex_byte(R8);
1029 *ptr++ = lowhex(R8);
1030 *ptr++ = ':'; 998 *ptr++ = ':';
1031 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]); 999 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]);
1032 *ptr++ = ';'; 1000 *ptr++ = ';';
1033 1001
1034 read_register(SP, &reg_cont); 1002 read_register(SP, &reg_cont);
1035 *ptr++ = highhex(SP); 1003 ptr = pack_hex_byte(SP);
1036 *ptr++ = lowhex(SP);
1037 *ptr++ = ':'; 1004 *ptr++ = ':';
1038 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]); 1005 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]);
1039 *ptr++ = ';'; 1006 *ptr++ = ';';
1040 1007
1041 /* Send ERP as well; this will save us an entire register fetch in some cases. */ 1008 /* Send ERP as well; this will save us an entire register fetch in some cases. */
1042 read_register(ERP, &reg_cont); 1009 read_register(ERP, &reg_cont);
1043 *ptr++ = highhex(ERP); 1010 ptr = pack_hex_byte(ERP);
1044 *ptr++ = lowhex(ERP);
1045 *ptr++ = ':'; 1011 *ptr++ = ':';
1046 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]); 1012 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]);
1047 *ptr++ = ';'; 1013 *ptr++ = ';';
@@ -1533,8 +1499,8 @@ handle_exception(int sigval)
1533 Success: SAA, where AA is the signal number. 1499 Success: SAA, where AA is the signal number.
1534 Failure: void. */ 1500 Failure: void. */
1535 output_buffer[0] = 'S'; 1501 output_buffer[0] = 'S';
1536 output_buffer[1] = highhex(sigval); 1502 output_buffer[1] = hex_asc_hi(sigval);
1537 output_buffer[2] = lowhex(sigval); 1503 output_buffer[2] = hex_asc_lo(sigval);
1538 output_buffer[3] = 0; 1504 output_buffer[3] = 0;
1539 break; 1505 break;
1540 1506
diff --git a/arch/cris/arch-v32/mm/init.c b/arch/cris/arch-v32/mm/init.c
index 5a9ac5834647..8a34b8b74293 100644
--- a/arch/cris/arch-v32/mm/init.c
+++ b/arch/cris/arch-v32/mm/init.c
@@ -162,7 +162,7 @@ paging_init(void)
162 * substantially higher than 0, like us (we start at PAGE_OFFSET). This 162 * substantially higher than 0, like us (we start at PAGE_OFFSET). This
163 * saves space in the mem_map page array. 163 * saves space in the mem_map page array.
164 */ 164 */
165 free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0); 165 free_area_init_node(0, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
166 166
167 mem_map = contig_page_data.node_mem_map; 167 mem_map = contig_page_data.node_mem_map;
168} 168}
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
index 44f7b4f79476..9aa571169bcc 100644
--- a/arch/cris/kernel/profile.c
+++ b/arch/cris/kernel/profile.c
@@ -35,19 +35,16 @@ read_cris_profile(struct file *file, char __user *buf,
35 size_t count, loff_t *ppos) 35 size_t count, loff_t *ppos)
36{ 36{
37 unsigned long p = *ppos; 37 unsigned long p = *ppos;
38 ssize_t ret;
38 39
39 if (p > SAMPLE_BUFFER_SIZE) 40 ret = simple_read_from_buffer(buf, count, ppos, sample_buffer,
40 return 0; 41 SAMPLE_BUFFER_SIZE);
42 if (ret < 0)
43 return ret;
41 44
42 if (p + count > SAMPLE_BUFFER_SIZE) 45 memset(sample_buffer + p, 0, ret);
43 count = SAMPLE_BUFFER_SIZE - p;
44 if (copy_to_user(buf, sample_buffer + p,count))
45 return -EFAULT;
46 46
47 memset(sample_buffer + p, 0, count); 47 return ret;
48 *ppos += count;
49
50 return count;
51} 48}
52 49
53static ssize_t 50static ssize_t
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 5b06ffa15e34..2fdd212eb250 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -19,36 +19,6 @@ unsigned long empty_zero_page;
19extern char _stext, _edata, _etext; /* From linkerscript */ 19extern char _stext, _edata, _etext; /* From linkerscript */
20extern char __init_begin, __init_end; 20extern char __init_begin, __init_end;
21 21
22void
23show_mem(void)
24{
25 int i,free = 0,total = 0,cached = 0, reserved = 0, nonshared = 0;
26 int shared = 0;
27
28 printk("\nMem-info:\n");
29 show_free_areas();
30 i = max_mapnr;
31 while (i-- > 0) {
32 total++;
33 if (PageReserved(mem_map+i))
34 reserved++;
35 else if (PageSwapCache(mem_map+i))
36 cached++;
37 else if (!page_count(mem_map+i))
38 free++;
39 else if (page_count(mem_map+i) == 1)
40 nonshared++;
41 else
42 shared += page_count(mem_map+i) - 1;
43 }
44 printk("%d pages of RAM\n",total);
45 printk("%d free pages\n",free);
46 printk("%d reserved pages\n",reserved);
47 printk("%d pages nonshared\n",nonshared);
48 printk("%d pages shared\n",shared);
49 printk("%d pages swap cached\n",cached);
50}
51
52void __init 22void __init
53mem_init(void) 23mem_init(void)
54{ 24{