On Thursday 08 January 2004 18:03, Glenn A Diehl wrote:

> Anyway, this isn't a very good fix, but it does shed light on the
> problem.  Is there a correct way of making grub VMALLOC_RESERVE aware?

Use the value from the kernel header, patch attached.

-- 
Member AFFS, WYLUG, SWP (UK), ANL, Leeds SA, Leeds Anti-war coalition
No to software patents!    No to DRM/EUCD - hands off our computers!
Index: stage2/boot.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/boot.c,v
retrieving revision 1.44
diff -u -r1.44 boot.c
--- stage2/boot.c	18 Mar 2003 21:07:35 -0000	1.44
+++ stage2/boot.c	9 Jan 2004 14:05:28 -0000
@@ -332,10 +332,8 @@
 		switch (errnum)
 		  {
 		  case ERR_NUMBER_OVERFLOW:
-		    /* If an overflow occurs, use the maximum address for
-		       initrd instead. This is good, because MAXINT is
-		       greater than LINUX_INITRD_MAX_ADDRESS.  */
-		    linux_mem_size = LINUX_INITRD_MAX_ADDRESS;
+		    /* If an overflow occurs, use MAXINT instead */
+		    linux_mem_size = MAXINT;
 		    errnum = ERR_NONE;
 		    break;
 		
@@ -357,7 +355,7 @@
 		  
 		      /* Check an overflow.  */
 		      if (linux_mem_size > (MAXINT >> shift))
-			linux_mem_size = LINUX_INITRD_MAX_ADDRESS;
+			linux_mem_size = MAXINT;
 		      else
 			linux_mem_size <<= shift;
 		    }
@@ -785,7 +783,7 @@
 load_initrd (char *initrd)
 {
   int len;
-  unsigned long moveto;
+  unsigned long moveto, initrd_max_address;
   struct linux_kernel_header *lh
     = (struct linux_kernel_header *) (cur_addr - LINUX_SETUP_MOVE_SIZE);
   
@@ -802,6 +800,11 @@
       grub_close ();
       goto fail;
     }
+    
+  if (lh->version >= 0x203)
+    initrd_max_address = lh->initrd_max_address;
+  else
+    initrd_max_address = LINUX_INITRD_MAX_ADDRESS;
 
   if (linux_mem_size)
     moveto = linux_mem_size;
@@ -809,8 +812,8 @@
     moveto = (mbi.mem_upper + 0x400) << 10;
   
   moveto = (moveto - len) & 0xfffff000;
-  if (moveto + len >= LINUX_INITRD_MAX_ADDRESS)
-    moveto = (LINUX_INITRD_MAX_ADDRESS - len) & 0xfffff000;
+  if (moveto + len >= initrd_max_address)
+    moveto = (initrd_max_address - len) & 0xfffff000;
   
   /* XXX: Linux 2.3.xx has a bug in the memory range check, so avoid
      the last page.
Index: stage2/shared.h
===================================================================
RCS file: /cvsroot/grub/grub/stage2/shared.h,v
retrieving revision 1.93
diff -u -r1.93 shared.h
--- stage2/shared.h	18 Mar 2003 23:51:59 -0000	1.93
+++ stage2/shared.h	9 Jan 2004 14:05:31 -0000
@@ -403,6 +403,7 @@
   unsigned short heap_end_ptr;		/* Free memory after setup end */
   unsigned short pad1;			/* Unused */
   char *cmd_line_ptr;			/* Points to the kernel command line */
+  unsigned long initrd_max_address;	/* Maximum initrd address */
 } __attribute__ ((packed));
 
 /* Memory map address range descriptor used by GET_MMAP_ENTRY. */

Attachment: pgp00000.pgp
Description: signature

_______________________________________________
Bug-grub mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-grub

Reply via email to