patch-2.1.44 linux/arch/m68k/boot/amiga/linuxboot.c

Next file: linux/arch/m68k/config.in
Previous file: linux/arch/m68k/boot/amiga/bootstrap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.43/linux/arch/m68k/boot/amiga/linuxboot.c linux/arch/m68k/boot/amiga/linuxboot.c
@@ -22,9 +22,11 @@
  *  for more details.
  *
  *  History:
+ *	11 Jun 1997 Fix for unpadded gzipped ramdisks with bootinfo interface
+ *		    version 1.0
  *	27 Mar 1997 FPU-less machines couldn't boot kernels that use bootinfo
  *		    interface version 1.0 (Geert)
- *	03 Feb 1997 Implemented kernel decompression (Geert, based on Roman's
+ *	 3 Feb 1997 Implemented kernel decompression (Geert, based on Roman's
  *		    code for ataboot)
  *	30 Dec 1996 Reverted the CPU detection to the old scheme
  *		    New boot parameter override scheme (Geert)
@@ -55,7 +57,6 @@
 #include <stddef.h>
 #include <string.h>
 #include <errno.h>
-#include <sys/types.h>
 
 #include <linux/a.out.h>
 #include <linux/elf.h>
@@ -70,6 +71,10 @@
 #undef custom
 #define custom ((*(volatile struct CUSTOM *)(CUSTOM_PHYSADDR)))
 
+/* a.out linkage conventions */
+#undef SYMBOL_NAME_STR
+#define SYMBOL_NAME_STR(X) "_"#X
+
 /* temporary stack size */
 #define TEMP_STACKSIZE	(256)
 
@@ -130,10 +135,9 @@
 static int add_bi_string(u_short tag, const u_char *s);
 static int check_bootinfo_version(const char *memptr);
 static void start_kernel(void (*startfunc)(), char *stackp, char *memptr,
-			 u_long start_mem, u_long mem_size, u_long rd_size,
-			 u_long kernel_size) __attribute__ ((noreturn));
+			 u_long start_mem, u_long kernel_size, u_long rd_dest,
+			 u_long rd_size) __attribute__ ((noreturn));
 asmlinkage u_long maprommed(void);
-asmlinkage u_long check346(void);
 #ifdef ZKERNEL
 static int load_zkernel(int fd);
 static int KRead(int fd, void *buf, int cnt);
@@ -682,7 +686,7 @@
     if (debugflag) {
 	if (bi.ramdisk.size)
 	    Printf("RAM disk at 0x%08lx, size is %ldK\n",
-		   (u_long)memptr+kernel_size, bi.ramdisk.size>>10);
+		   (u_long)memptr+kernel_size+bi_size, bi.ramdisk.size>>10);
 
 	if (elf_kernel) {
 	    PutChar('\n');
@@ -703,11 +707,11 @@
 	Printf("\nKernel entry is 0x%08lx\n", elf_kernel ? kexec_elf.e_entry :
 							   kexec.a_entry);
 
-	Printf("ramdisk dest top is 0x%08lx\n", start_mem+mem_size);
+	Printf("ramdisk dest is 0x%08lx\n", bi.ramdisk.addr);
 	Printf("ramdisk lower limit is 0x%08lx\n",
-	       (u_long)(memptr+kernel_size));
+	       (u_long)memptr+kernel_size+bi_size);
 	Printf("ramdisk src top is 0x%08lx\n",
-	       (u_long)(memptr+kernel_size)+rd_size);
+	       (u_long)memptr+kernel_size+bi_size+rd_size);
 
 	Puts("\nType a key to continue the Linux/m68k boot...");
 	GetChar();
@@ -743,7 +747,7 @@
 
     /* execute the copy-and-go code (from CHIP RAM) */
     start_kernel(startfunc, (char *)stack+TEMP_STACKSIZE, memptr, start_mem,
-		 mem_size, rd_size, kernel_size);
+		 kernel_size, bi.ramdisk.addr, rd_size);
 
     /* Clean up and exit in case of a failure */
 Fail:
@@ -1065,6 +1069,7 @@
 	compat_bootinfo.memory[i].size = bi.memory[i].size;
     }
     if (bi.ramdisk.size) {
+	bi.ramdisk.addr &= 0xfffffc00;
 	compat_bootinfo.ramdisk_size = (bi.ramdisk.size+1023)/1024;
 	compat_bootinfo.ramdisk_addr = bi.ramdisk.addr;
     } else {
@@ -1151,14 +1156,14 @@
      */
 
 static void start_kernel(void (*startfunc)(), char *stackp, char *memptr,
-			 u_long start_mem, u_long mem_size, u_long rd_size,
-			 u_long kernel_size)
+			 u_long start_mem, u_long kernel_size, u_long rd_dest,
+			 u_long rd_size)
 {
     register void (*a0)() __asm("a0") = startfunc;
     register char *a2 __asm("a2") = stackp;
     register char *a3 __asm("a3") = memptr;
     register u_long a4 __asm("a4") = start_mem;
-    register u_long d0 __asm("d0") = mem_size;
+    register u_long d0 __asm("d0") = rd_dest;
     register u_long d1 __asm("d1") = rd_size;
     register u_long d2 __asm("d2") = kernel_size;
     register u_long d3 __asm("d3") = bi_size;
@@ -1182,7 +1187,7 @@
      *
      *	    a3 = memptr
      *	    a4 = start_mem
-     *	    d0 = mem_size
+     *	    d0 = rd_dest
      *	    d1 = rd_size
      *	    d2 = kernel_size
      *	    d3 = bi_size
@@ -1210,18 +1215,16 @@
 	dbra	d7,1b		|     *dest++ = *src++
 
 				| /* copy the ramdisk to the top of memory */
-				| /* (from back to front) */
-	movel	a4,a1		| dest = (u_long *)(start_mem+mem_size);
-	addl	d0,a1
-	movel	a3,a2		| limit = (u_long *)(memptr+kernel_size +
-	addl	d2,a2		|		     bi_size);
-	addl	d3,a2
-	movel	a2,a0		| src = (u_long *)((u_long)limit+rd_size);
-	addl	d1,a0
+	movel	a3,a0		| src = (u_long *)(memptr+kernel_size+bi_size);
+	addl	d2,a0
+	addl	d3,a0
+	movel	d0,a1		| dest = (u_long *)rd_dest;
+	movel	a0,a2		| limit = (u_long *)(memptr+kernel_size+
+	addl	d1,a2		|		     bi_size+rd_size);
 1:	cmpl	a0,a2
-	beqs	2f		| while (src > limit)
-	moveb	a0@-,a1@-	|     *--dest = *--src;
-	bras	1b
+	jeq	2f		| while (src > limit)
+	moveb	a0@+,a1@+	|     *dest++ = *src++;
+	jra	1b
 2:
 				| /* jump to start of kernel */
 	movel	a4,a0		| jump_to (start_mem);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov