/*
* 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
* Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000
*/
-#include <linux/config.h>
#include <asm/uaccess.h>
+#include <asm/addrspace.h>
+#include <asm/page.h>
#ifdef CONFIG_SH_STANDARD_BIOS
#include <asm/sh_bios.h>
#endif
#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);}
static void error(char *m);
static void gzip_mark(void **);
static void gzip_release(void **);
-
+
extern char input_data[];
extern int input_len;
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"
}
#ifdef CONFIG_SH_STANDARD_BIOS
-static int strlen(const char *s)
+size_t strlen(const char *s)
{
int i = 0;
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
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);
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;