Hell[o]

> What happens if you increase HEAP_MIN_SIZE ?

Still fails I am affraid. I wonder is there any reason to use only
first 4MB for heap ? I guess higer memory areas can be still accessed
excluding 4-16 MB ?

I attached my proposed patch to solve this problem. It tires to
allocate 4MB heap at fixed position at 28MB (To avoid problems with
relocation later on) and if it fails use the grub_available_iterate()
as before. If should be used with ealier patch from this thread. I
tested it on Pegasos 1 (Only one machine), Pegasos 2 (With few OF
revisions starting from 2004 to 2006) and efika and it works quite
well.

-- 
--- Marcin 'Morgoth' Kurek ---
diff -urN grub2.org/kern/powerpc/ieee1275/init.c grub2/kern/powerpc/ieee1275/init.c
--- grub2.org/kern/powerpc/ieee1275/init.c	2007-10-03 16:34:07.091425889 +0200
+++ grub2/kern/powerpc/ieee1275/init.c	2007-10-03 14:27:39.000000000 +0200
@@ -34,7 +34,7 @@
 #include <grub/ieee1275/ieee1275.h>
 
 /* The minimal heap size we can live with. */
-#define HEAP_MIN_SIZE		(unsigned long) (2 * 1024 * 1024)
+#define HEAP_MIN_SIZE		(unsigned long) (3 * 1024 * 1024)
 
 /* The maximum heap size we're going to claim */
 #define HEAP_MAX_SIZE		(unsigned long) (4 * 1024 * 1024)
@@ -43,6 +43,11 @@
    seems to cause relocation problems with OSes that link at 4 MiB */
 #define HEAP_MAX_ADDR		(unsigned long) (4 * 1024 * 1024)
 
+/* Try to claim heap from static address before use grub_available_iterate
+   to help broken firmwares. */
+#define HEAP_STATIC_SIZE	(unsigned long) (4 * 1024 * 1024)
+#define HEAP_STATIC_ADDR	(unsigned long) (28 * 1024 * 1024)
+
 extern char _start[];
 extern char _end[];
 
@@ -157,6 +162,16 @@
     return 0;
   }
 
+  /* Firmware not always mark our executable as claimed */
+  grub_ieee1275_claim ((unsigned long) _start, _end - _start, 0, 0);
+
+  /* Try with static heap addr first */
+  if (grub_claimmap (HEAP_STATIC_ADDR, HEAP_STATIC_SIZE) == 0)
+    {
+      grub_mm_init_region ((void *) (grub_addr_t) HEAP_STATIC_ADDR, HEAP_STATIC_SIZE);
+      return;
+    }
+
   grub_available_iterate (heap_init);
 }
 
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to