1778cb929SIan Campbell /* 2778cb929SIan Campbell * misc.c 3778cb929SIan Campbell * 4778cb929SIan Campbell * This is a collection of several routines from gzip-1.0.3 5778cb929SIan Campbell * adapted for Linux. 6778cb929SIan Campbell * 7778cb929SIan Campbell * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 8778cb929SIan Campbell * puts by Nick Holloway 1993, better puts by Martin Mares 1995 9778cb929SIan Campbell * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 10778cb929SIan Campbell */ 11778cb929SIan Campbell 12778cb929SIan Campbell /* 13778cb929SIan Campbell * we have to be careful, because no indirections are allowed here, and 14778cb929SIan Campbell * paravirt_ops is a kind of one. As it will only run in baremetal anyway, 15778cb929SIan Campbell * we just keep it from happening 16778cb929SIan Campbell */ 17778cb929SIan Campbell #undef CONFIG_PARAVIRT 18099e1377SIan Campbell #ifdef CONFIG_X86_32 19099e1377SIan Campbell #define _ASM_DESC_H_ 1 20099e1377SIan Campbell #endif 21099e1377SIan Campbell 22778cb929SIan Campbell #ifdef CONFIG_X86_64 23778cb929SIan Campbell #define _LINUX_STRING_H_ 1 24778cb929SIan Campbell #define __LINUX_BITMAP_H 1 25778cb929SIan Campbell #endif 26778cb929SIan Campbell 27778cb929SIan Campbell #include <linux/linkage.h> 28778cb929SIan Campbell #include <linux/screen_info.h> 29099e1377SIan Campbell #include <linux/elf.h> 30*020878acSPaolo Ciarrocchi #include <linux/io.h> 31778cb929SIan Campbell #include <asm/page.h> 32778cb929SIan Campbell #include <asm/boot.h> 3323968f71SKristian Høgsberg #include <asm/bootparam.h> 34778cb929SIan Campbell 35778cb929SIan Campbell /* WARNING!! 36778cb929SIan Campbell * This code is compiled with -fPIC and it is relocated dynamically 37778cb929SIan Campbell * at run time, but no relocation processing is performed. 38778cb929SIan Campbell * This means that it is not safe to place pointers in static structures. 39778cb929SIan Campbell */ 40778cb929SIan Campbell 41778cb929SIan Campbell /* 42778cb929SIan Campbell * Getting to provable safe in place decompression is hard. 43778cb929SIan Campbell * Worst case behaviours need to be analyzed. 44778cb929SIan Campbell * Background information: 45778cb929SIan Campbell * 46778cb929SIan Campbell * The file layout is: 47778cb929SIan Campbell * magic[2] 48778cb929SIan Campbell * method[1] 49778cb929SIan Campbell * flags[1] 50778cb929SIan Campbell * timestamp[4] 51778cb929SIan Campbell * extraflags[1] 52778cb929SIan Campbell * os[1] 53778cb929SIan Campbell * compressed data blocks[N] 54778cb929SIan Campbell * crc[4] orig_len[4] 55778cb929SIan Campbell * 56778cb929SIan Campbell * resulting in 18 bytes of non compressed data overhead. 57778cb929SIan Campbell * 58778cb929SIan Campbell * Files divided into blocks 59778cb929SIan Campbell * 1 bit (last block flag) 60778cb929SIan Campbell * 2 bits (block type) 61778cb929SIan Campbell * 621180e01dSIngo Molnar * 1 block occurs every 32K -1 bytes or when there 50% compression 631180e01dSIngo Molnar * has been achieved. The smallest block type encoding is always used. 64778cb929SIan Campbell * 65778cb929SIan Campbell * stored: 66778cb929SIan Campbell * 32 bits length in bytes. 67778cb929SIan Campbell * 68778cb929SIan Campbell * fixed: 69778cb929SIan Campbell * magic fixed tree. 70778cb929SIan Campbell * symbols. 71778cb929SIan Campbell * 72778cb929SIan Campbell * dynamic: 73778cb929SIan Campbell * dynamic tree encoding. 74778cb929SIan Campbell * symbols. 75778cb929SIan Campbell * 76778cb929SIan Campbell * 77778cb929SIan Campbell * The buffer for decompression in place is the length of the 78778cb929SIan Campbell * uncompressed data, plus a small amount extra to keep the algorithm safe. 79778cb929SIan Campbell * The compressed data is placed at the end of the buffer. The output 80778cb929SIan Campbell * pointer is placed at the start of the buffer and the input pointer 81778cb929SIan Campbell * is placed where the compressed data starts. Problems will occur 82778cb929SIan Campbell * when the output pointer overruns the input pointer. 83778cb929SIan Campbell * 84778cb929SIan Campbell * The output pointer can only overrun the input pointer if the input 85778cb929SIan Campbell * pointer is moving faster than the output pointer. A condition only 86778cb929SIan Campbell * triggered by data whose compressed form is larger than the uncompressed 87778cb929SIan Campbell * form. 88778cb929SIan Campbell * 89778cb929SIan Campbell * The worst case at the block level is a growth of the compressed data 90778cb929SIan Campbell * of 5 bytes per 32767 bytes. 91778cb929SIan Campbell * 92778cb929SIan Campbell * The worst case internal to a compressed block is very hard to figure. 93778cb929SIan Campbell * The worst case can at least be boundined by having one bit that represents 94778cb929SIan Campbell * 32764 bytes and then all of the rest of the bytes representing the very 95778cb929SIan Campbell * very last byte. 96778cb929SIan Campbell * 97778cb929SIan Campbell * All of which is enough to compute an amount of extra data that is required 98778cb929SIan Campbell * to be safe. To avoid problems at the block level allocating 5 extra bytes 991180e01dSIngo Molnar * per 32767 bytes of data is sufficient. To avoind problems internal to a 1001180e01dSIngo Molnar * block adding an extra 32767 bytes (the worst case uncompressed block size) 1011180e01dSIngo Molnar * is sufficient, to ensure that in the worst case the decompressed data for 102778cb929SIan Campbell * block will stop the byte before the compressed data for a block begins. 103778cb929SIan Campbell * To avoid problems with the compressed data's meta information an extra 18 104778cb929SIan Campbell * bytes are needed. Leading to the formula: 105778cb929SIan Campbell * 106778cb929SIan Campbell * extra_bytes = (uncompressed_size >> 12) + 32768 + 18 + decompressor_size. 107778cb929SIan Campbell * 108778cb929SIan Campbell * Adding 8 bytes per 32K is a bit excessive but much easier to calculate. 109778cb929SIan Campbell * Adding 32768 instead of 32767 just makes for round numbers. 110778cb929SIan Campbell * Adding the decompressor_size is necessary as it musht live after all 111778cb929SIan Campbell * of the data as well. Last I measured the decompressor is about 14K. 112778cb929SIan Campbell * 10K of actual data and 4K of bss. 113778cb929SIan Campbell * 114778cb929SIan Campbell */ 115778cb929SIan Campbell 116778cb929SIan Campbell /* 117778cb929SIan Campbell * gzip declarations 118778cb929SIan Campbell */ 119778cb929SIan Campbell 120778cb929SIan Campbell #define OF(args) args 121778cb929SIan Campbell #define STATIC static 122778cb929SIan Campbell 123778cb929SIan Campbell #undef memset 124778cb929SIan Campbell #undef memcpy 125778cb929SIan Campbell #define memzero(s, n) memset((s), 0, (n)) 126778cb929SIan Campbell 127778cb929SIan Campbell typedef unsigned char uch; 128778cb929SIan Campbell typedef unsigned short ush; 129778cb929SIan Campbell typedef unsigned long ulg; 130778cb929SIan Campbell 1311180e01dSIngo Molnar /* 1321180e01dSIngo Molnar * Window size must be at least 32k, and a power of two. 1331180e01dSIngo Molnar * We don't actually have a window just a huge output buffer, 1341180e01dSIngo Molnar * so we report a 2G window size, as that should always be 1351180e01dSIngo Molnar * larger than our output buffer: 136778cb929SIan Campbell */ 1371180e01dSIngo Molnar #define WSIZE 0x80000000 138778cb929SIan Campbell 1391180e01dSIngo Molnar /* Input buffer: */ 1401180e01dSIngo Molnar static unsigned char *inbuf; 141778cb929SIan Campbell 1421180e01dSIngo Molnar /* Sliding window buffer (and final output buffer): */ 1431180e01dSIngo Molnar static unsigned char *window; 1441180e01dSIngo Molnar 1451180e01dSIngo Molnar /* Valid bytes in inbuf: */ 1461180e01dSIngo Molnar static unsigned insize; 1471180e01dSIngo Molnar 1481180e01dSIngo Molnar /* Index of next byte to be processed in inbuf: */ 1491180e01dSIngo Molnar static unsigned inptr; 1501180e01dSIngo Molnar 1511180e01dSIngo Molnar /* Bytes in output buffer: */ 1521180e01dSIngo Molnar static unsigned outcnt; 153778cb929SIan Campbell 154778cb929SIan Campbell /* gzip flag byte */ 155778cb929SIan Campbell #define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ 1561180e01dSIngo Molnar #define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gz file */ 157778cb929SIan Campbell #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ 1581180e01dSIngo Molnar #define ORIG_NAM 0x08 /* bit 3 set: original file name present */ 159778cb929SIan Campbell #define COMMENT 0x10 /* bit 4 set: file comment present */ 160778cb929SIan Campbell #define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ 161778cb929SIan Campbell #define RESERVED 0xC0 /* bit 6, 7: reserved */ 162778cb929SIan Campbell 163778cb929SIan Campbell #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) 164778cb929SIan Campbell 165778cb929SIan Campbell /* Diagnostic functions */ 166778cb929SIan Campbell #ifdef DEBUG 1671180e01dSIngo Molnar # define Assert(cond, msg) do { if (!(cond)) error(msg); } while (0) 1681180e01dSIngo Molnar # define Trace(x) do { fprintf x; } while (0) 1691180e01dSIngo Molnar # define Tracev(x) do { if (verbose) fprintf x ; } while (0) 1701180e01dSIngo Molnar # define Tracevv(x) do { if (verbose > 1) fprintf x ; } while (0) 1711180e01dSIngo Molnar # define Tracec(c, x) do { if (verbose && (c)) fprintf x ; } while (0) 1721180e01dSIngo Molnar # define Tracecv(c, x) do { if (verbose > 1 && (c)) fprintf x ; } while (0) 173778cb929SIan Campbell #else 174778cb929SIan Campbell # define Assert(cond, msg) 175778cb929SIan Campbell # define Trace(x) 176778cb929SIan Campbell # define Tracev(x) 177778cb929SIan Campbell # define Tracevv(x) 178778cb929SIan Campbell # define Tracec(c, x) 179778cb929SIan Campbell # define Tracecv(c, x) 180778cb929SIan Campbell #endif 181778cb929SIan Campbell 182778cb929SIan Campbell static int fill_inbuf(void); 183778cb929SIan Campbell static void flush_window(void); 184778cb929SIan Campbell static void error(char *m); 185778cb929SIan Campbell 186778cb929SIan Campbell /* 187778cb929SIan Campbell * This is set up by the setup-routine at boot-time 188778cb929SIan Campbell */ 18923968f71SKristian Høgsberg static struct boot_params *real_mode; /* Pointer to real-mode data */ 1903b6b9293SKristian Høgsberg static int quiet; 191778cb929SIan Campbell 192778cb929SIan Campbell extern unsigned char input_data[]; 193778cb929SIan Campbell extern int input_len; 194778cb929SIan Campbell 195fd77c7caSPaolo Ciarrocchi static long bytes_out; 196778cb929SIan Campbell 197778cb929SIan Campbell static void *memset(void *s, int c, unsigned n); 198778cb929SIan Campbell static void *memcpy(void *dest, const void *src, unsigned n); 199778cb929SIan Campbell 2006bcb13b3SBen Collins static void __putstr(int, const char *); 2016bcb13b3SBen Collins #define putstr(__x) __putstr(0, __x) 202778cb929SIan Campbell 203778cb929SIan Campbell #ifdef CONFIG_X86_64 204778cb929SIan Campbell #define memptr long 205778cb929SIan Campbell #else 206778cb929SIan Campbell #define memptr unsigned 207778cb929SIan Campbell #endif 208778cb929SIan Campbell 209778cb929SIan Campbell static memptr free_mem_ptr; 210778cb929SIan Campbell static memptr free_mem_end_ptr; 211778cb929SIan Campbell 21203056c88SAlexander van Heukelum static char *vidmem; 213778cb929SIan Campbell static int vidport; 214778cb929SIan Campbell static int lines, cols; 215778cb929SIan Campbell 216778cb929SIan Campbell #include "../../../../lib/inflate.c" 217778cb929SIan Campbell 218778cb929SIan Campbell static void scroll(void) 219778cb929SIan Campbell { 220778cb929SIan Campbell int i; 221778cb929SIan Campbell 222778cb929SIan Campbell memcpy(vidmem, vidmem + cols * 2, (lines - 1) * cols * 2); 223778cb929SIan Campbell for (i = (lines - 1) * cols * 2; i < lines * cols * 2; i += 2) 224778cb929SIan Campbell vidmem[i] = ' '; 225778cb929SIan Campbell } 226778cb929SIan Campbell 2276bcb13b3SBen Collins static void __putstr(int error, const char *s) 228778cb929SIan Campbell { 229778cb929SIan Campbell int x, y, pos; 230778cb929SIan Campbell char c; 231778cb929SIan Campbell 2326bcb13b3SBen Collins #ifndef CONFIG_X86_VERBOSE_BOOTUP 2336bcb13b3SBen Collins if (!error) 2346bcb13b3SBen Collins return; 2356bcb13b3SBen Collins #endif 2366bcb13b3SBen Collins 237778cb929SIan Campbell #ifdef CONFIG_X86_32 23823968f71SKristian Høgsberg if (real_mode->screen_info.orig_video_mode == 0 && 23923968f71SKristian Høgsberg lines == 0 && cols == 0) 240778cb929SIan Campbell return; 241778cb929SIan Campbell #endif 242778cb929SIan Campbell 24323968f71SKristian Høgsberg x = real_mode->screen_info.orig_x; 24423968f71SKristian Høgsberg y = real_mode->screen_info.orig_y; 245778cb929SIan Campbell 246778cb929SIan Campbell while ((c = *s++) != '\0') { 247778cb929SIan Campbell if (c == '\n') { 248778cb929SIan Campbell x = 0; 249778cb929SIan Campbell if (++y >= lines) { 250778cb929SIan Campbell scroll(); 251778cb929SIan Campbell y--; 252778cb929SIan Campbell } 253778cb929SIan Campbell } else { 254778cb929SIan Campbell vidmem[(x + cols * y) * 2] = c; 255778cb929SIan Campbell if (++x >= cols) { 256778cb929SIan Campbell x = 0; 257778cb929SIan Campbell if (++y >= lines) { 258778cb929SIan Campbell scroll(); 259778cb929SIan Campbell y--; 260778cb929SIan Campbell } 261778cb929SIan Campbell } 262778cb929SIan Campbell } 263778cb929SIan Campbell } 264778cb929SIan Campbell 26523968f71SKristian Høgsberg real_mode->screen_info.orig_x = x; 26623968f71SKristian Høgsberg real_mode->screen_info.orig_y = y; 267778cb929SIan Campbell 268778cb929SIan Campbell pos = (x + cols * y) * 2; /* Update cursor position */ 269778cb929SIan Campbell outb(14, vidport); 270778cb929SIan Campbell outb(0xff & (pos >> 9), vidport+1); 271778cb929SIan Campbell outb(15, vidport); 272778cb929SIan Campbell outb(0xff & (pos >> 1), vidport+1); 273778cb929SIan Campbell } 274778cb929SIan Campbell 275778cb929SIan Campbell static void *memset(void *s, int c, unsigned n) 276778cb929SIan Campbell { 277778cb929SIan Campbell int i; 278778cb929SIan Campbell char *ss = s; 279778cb929SIan Campbell 280*020878acSPaolo Ciarrocchi for (i = 0; i < n; i++) 281*020878acSPaolo Ciarrocchi ss[i] = c; 282778cb929SIan Campbell return s; 283778cb929SIan Campbell } 284778cb929SIan Campbell 285778cb929SIan Campbell static void *memcpy(void *dest, const void *src, unsigned n) 286778cb929SIan Campbell { 287778cb929SIan Campbell int i; 288778cb929SIan Campbell const char *s = src; 289778cb929SIan Campbell char *d = dest; 290778cb929SIan Campbell 291*020878acSPaolo Ciarrocchi for (i = 0; i < n; i++) 292*020878acSPaolo Ciarrocchi d[i] = s[i]; 293778cb929SIan Campbell return dest; 294778cb929SIan Campbell } 295778cb929SIan Campbell 296778cb929SIan Campbell /* =========================================================================== 297778cb929SIan Campbell * Fill the input buffer. This is called only when the buffer is empty 298778cb929SIan Campbell * and at least one byte is really needed. 299778cb929SIan Campbell */ 300778cb929SIan Campbell static int fill_inbuf(void) 301778cb929SIan Campbell { 302778cb929SIan Campbell error("ran out of input data"); 303778cb929SIan Campbell return 0; 304778cb929SIan Campbell } 305778cb929SIan Campbell 306778cb929SIan Campbell /* =========================================================================== 307778cb929SIan Campbell * Write the output window window[0..outcnt-1] and update crc and bytes_out. 308778cb929SIan Campbell * (Used for the decompressed data only.) 309778cb929SIan Campbell */ 310778cb929SIan Campbell static void flush_window(void) 311778cb929SIan Campbell { 312778cb929SIan Campbell /* With my window equal to my output buffer 313778cb929SIan Campbell * I only need to compute the crc here. 314778cb929SIan Campbell */ 3151180e01dSIngo Molnar unsigned long c = crc; /* temporary variable */ 316778cb929SIan Campbell unsigned n; 3171180e01dSIngo Molnar unsigned char *in, ch; 318778cb929SIan Campbell 319778cb929SIan Campbell in = window; 320778cb929SIan Campbell for (n = 0; n < outcnt; n++) { 321778cb929SIan Campbell ch = *in++; 322778cb929SIan Campbell c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 323778cb929SIan Campbell } 324778cb929SIan Campbell crc = c; 3251180e01dSIngo Molnar bytes_out += (unsigned long)outcnt; 326778cb929SIan Campbell outcnt = 0; 327778cb929SIan Campbell } 328778cb929SIan Campbell 329778cb929SIan Campbell static void error(char *x) 330778cb929SIan Campbell { 3316bcb13b3SBen Collins __putstr(1, "\n\n"); 3326bcb13b3SBen Collins __putstr(1, x); 3336bcb13b3SBen Collins __putstr(1, "\n\n -- System halted"); 334778cb929SIan Campbell 335778cb929SIan Campbell while (1) 336778cb929SIan Campbell asm("hlt"); 337778cb929SIan Campbell } 338778cb929SIan Campbell 339099e1377SIan Campbell static void parse_elf(void *output) 340099e1377SIan Campbell { 341099e1377SIan Campbell #ifdef CONFIG_X86_64 342099e1377SIan Campbell Elf64_Ehdr ehdr; 343099e1377SIan Campbell Elf64_Phdr *phdrs, *phdr; 344099e1377SIan Campbell #else 345099e1377SIan Campbell Elf32_Ehdr ehdr; 346099e1377SIan Campbell Elf32_Phdr *phdrs, *phdr; 347099e1377SIan Campbell #endif 348099e1377SIan Campbell void *dest; 349099e1377SIan Campbell int i; 350099e1377SIan Campbell 351099e1377SIan Campbell memcpy(&ehdr, output, sizeof(ehdr)); 352099e1377SIan Campbell if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || 353099e1377SIan Campbell ehdr.e_ident[EI_MAG1] != ELFMAG1 || 354099e1377SIan Campbell ehdr.e_ident[EI_MAG2] != ELFMAG2 || 355fd77c7caSPaolo Ciarrocchi ehdr.e_ident[EI_MAG3] != ELFMAG3) { 356099e1377SIan Campbell error("Kernel is not a valid ELF file"); 357099e1377SIan Campbell return; 358099e1377SIan Campbell } 359099e1377SIan Campbell 3603b6b9293SKristian Høgsberg if (!quiet) 361099e1377SIan Campbell putstr("Parsing ELF... "); 362099e1377SIan Campbell 363099e1377SIan Campbell phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); 364099e1377SIan Campbell if (!phdrs) 365099e1377SIan Campbell error("Failed to allocate space for phdrs"); 366099e1377SIan Campbell 367099e1377SIan Campbell memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); 368099e1377SIan Campbell 369099e1377SIan Campbell for (i = 0; i < ehdr.e_phnum; i++) { 370099e1377SIan Campbell phdr = &phdrs[i]; 371099e1377SIan Campbell 372099e1377SIan Campbell switch (phdr->p_type) { 373099e1377SIan Campbell case PT_LOAD: 374099e1377SIan Campbell #ifdef CONFIG_RELOCATABLE 375099e1377SIan Campbell dest = output; 376099e1377SIan Campbell dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR); 377099e1377SIan Campbell #else 378099e1377SIan Campbell dest = (void *)(phdr->p_paddr); 379099e1377SIan Campbell #endif 380099e1377SIan Campbell memcpy(dest, 381099e1377SIan Campbell output + phdr->p_offset, 382099e1377SIan Campbell phdr->p_filesz); 383099e1377SIan Campbell break; 384099e1377SIan Campbell default: /* Ignore other PT_* */ break; 385099e1377SIan Campbell } 386099e1377SIan Campbell } 387099e1377SIan Campbell } 388099e1377SIan Campbell 389778cb929SIan Campbell asmlinkage void decompress_kernel(void *rmode, memptr heap, 3901180e01dSIngo Molnar unsigned char *input_data, 3911180e01dSIngo Molnar unsigned long input_len, 3921180e01dSIngo Molnar unsigned char *output) 393778cb929SIan Campbell { 394778cb929SIan Campbell real_mode = rmode; 395778cb929SIan Campbell 3963b6b9293SKristian Høgsberg if (real_mode->hdr.loadflags & QUIET_FLAG) 3973b6b9293SKristian Høgsberg quiet = 1; 3983b6b9293SKristian Høgsberg 39923968f71SKristian Høgsberg if (real_mode->screen_info.orig_video_mode == 7) { 400778cb929SIan Campbell vidmem = (char *) 0xb0000; 401778cb929SIan Campbell vidport = 0x3b4; 402778cb929SIan Campbell } else { 403778cb929SIan Campbell vidmem = (char *) 0xb8000; 404778cb929SIan Campbell vidport = 0x3d4; 405778cb929SIan Campbell } 406778cb929SIan Campbell 40723968f71SKristian Høgsberg lines = real_mode->screen_info.orig_video_lines; 40823968f71SKristian Høgsberg cols = real_mode->screen_info.orig_video_cols; 409778cb929SIan Campbell 410778cb929SIan Campbell window = output; /* Output buffer (Normally at 1M) */ 411778cb929SIan Campbell free_mem_ptr = heap; /* Heap */ 4127c539764SAlexander van Heukelum free_mem_end_ptr = heap + BOOT_HEAP_SIZE; 413778cb929SIan Campbell inbuf = input_data; /* Input buffer */ 414778cb929SIan Campbell insize = input_len; 415778cb929SIan Campbell inptr = 0; 416778cb929SIan Campbell 417778cb929SIan Campbell #ifdef CONFIG_X86_64 4181180e01dSIngo Molnar if ((unsigned long)output & (__KERNEL_ALIGN - 1)) 419778cb929SIan Campbell error("Destination address not 2M aligned"); 4201180e01dSIngo Molnar if ((unsigned long)output >= 0xffffffffffUL) 421778cb929SIan Campbell error("Destination address too large"); 422778cb929SIan Campbell #else 423778cb929SIan Campbell if ((u32)output & (CONFIG_PHYSICAL_ALIGN - 1)) 424778cb929SIan Campbell error("Destination address not CONFIG_PHYSICAL_ALIGN aligned"); 425778cb929SIan Campbell if (heap > ((-__PAGE_OFFSET-(512<<20)-1) & 0x7fffffff)) 426778cb929SIan Campbell error("Destination address too large"); 427778cb929SIan Campbell #ifndef CONFIG_RELOCATABLE 428778cb929SIan Campbell if ((u32)output != LOAD_PHYSICAL_ADDR) 429778cb929SIan Campbell error("Wrong destination address"); 430778cb929SIan Campbell #endif 431778cb929SIan Campbell #endif 432778cb929SIan Campbell 433778cb929SIan Campbell makecrc(); 4343b6b9293SKristian Høgsberg if (!quiet) 435778cb929SIan Campbell putstr("\nDecompressing Linux... "); 436778cb929SIan Campbell gunzip(); 437099e1377SIan Campbell parse_elf(output); 4383b6b9293SKristian Høgsberg if (!quiet) 439778cb929SIan Campbell putstr("done.\nBooting the kernel.\n"); 440778cb929SIan Campbell return; 441778cb929SIan Campbell } 442