X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fsh%2Fboot%2Fcompressed%2Fmisc.c;h=df65e305acf78b14710efa0ddc32998207fc9fbb;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=1ed7425a44678d474e3b2c188249f07d16533f54;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c index 1ed7425a4..df65e305a 100644 --- a/arch/sh/boot/compressed/misc.c +++ b/arch/sh/boot/compressed/misc.c @@ -1,7 +1,7 @@ /* * arch/sh/boot/compressed/misc.c - * - * This is a collection of several routines from gzip-1.0.3 + * + * This is a collection of several routines from gzip-1.0.3 * adapted for Linux. * * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 @@ -11,8 +11,9 @@ * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000 */ -#include #include +#include +#include #ifdef CONFIG_SH_STANDARD_BIOS #include #endif @@ -52,7 +53,7 @@ static unsigned outcnt = 0; /* bytes in output buffer */ #define RESERVED 0xC0 /* bit 6,7: reserved */ #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) - + /* Diagnostic functions */ #ifdef DEBUG # define Assert(cond,msg) {if(!(cond)) error(msg);} @@ -75,7 +76,7 @@ static void flush_window(void); static void error(char *m); static void gzip_mark(void **); static void gzip_release(void **); - + extern char input_data[]; extern int input_len; @@ -83,20 +84,19 @@ static long bytes_out = 0; static uch *output_data; static unsigned long output_ptr = 0; - static void *malloc(int size); static void free(void *where); static void error(char *m); static void gzip_mark(void **); static void gzip_release(void **); - -static void puts(const char *); - + +int puts(const char *); + extern int _text; /* Defined in vmlinux.lds.S */ extern int _end; static unsigned long free_mem_ptr; static unsigned long free_mem_end_ptr; - + #define HEAP_SIZE 0x10000 #include "../../../../lib/inflate.c" @@ -134,7 +134,7 @@ static void gzip_release(void **ptr) } #ifdef CONFIG_SH_STANDARD_BIOS -static int strlen(const char *s) +size_t strlen(const char *s) { int i = 0; @@ -143,14 +143,17 @@ static int strlen(const char *s) return i; } -void puts(const char *s) +int puts(const char *s) { - sh_bios_console_write(s, strlen(s)); + int len = strlen(s); + sh_bios_console_write(s, len); + return len; } #else -void puts(const char *s) +int puts(const char *s) { - /* This should be updated to use the sh-sci routines */ + /* This should be updated to use the sh-sci routines */ + return 0; } #endif @@ -198,9 +201,9 @@ static void flush_window(void) ulg c = crc; /* temporary variable */ unsigned n; uch *in, *out, ch; - + in = window; - out = &output_data[output_ptr]; + out = &output_data[output_ptr]; for (n = 0; n < outcnt; n++) { ch = *out++ = *in++; c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); @@ -227,7 +230,7 @@ long* stack_start = &user_stack[STACK_SIZE]; void decompress_kernel(void) { output_data = 0; - output_ptr = (unsigned long)&_text+0x20001000; + output_ptr = P2SEGADDR((unsigned long)&_text+PAGE_SIZE); free_mem_ptr = (unsigned long)&_end; free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;