On 01/08/2011 12:58 PM, Chris Samuel wrote:
> On my Toshiba Libretto 70CT Pentium notebook with 32MB of RAM I
> see this on my lsmmap:
>
> base_addr = 0x100000, length = 0x1f20000, type = 0x1
>
> ..and yes, I have this same issue with Squeeze.
>
>   
Please try the attached patch
> This is with grub-pc 1.98+20100804-11 after debootstrapping an
> install after removing the harddisk.
>
> cheers!
> Chris
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

=== modified file 'grub-core/kern/i386/pc/init.c'
--- grub-core/kern/i386/pc/init.c	2010-09-18 22:04:31 +0000
+++ grub-core/kern/i386/pc/init.c	2011-01-08 12:23:55 +0000
@@ -140,36 +140,27 @@
       }
 }
 
-/*
- *
- * grub_get_conv_memsize(i) :  return the conventional memory size in KB.
- *	BIOS call "INT 12H" to get conventional memory size
- *      The return value in AX.
- */
-static inline grub_uint16_t
-grub_get_conv_memsize (void)
-{
-  struct grub_bios_int_registers regs;
-
-  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
-  grub_bios_interrupt (0x12, &regs);
-  return regs.eax & 0xffff;
-}
-
 void
 grub_machine_init (void)
 {
   int i;
+#if 0
   int grub_lower_mem;
+#endif
 
   /* Initialize the console as early as possible.  */
   grub_console_init ();
 
+  /* This sanity check is useless since top of GRUB_MEMORY_MACHINE_RESERVED_END
+     is used for stack and if it's unavailable we wouldn't have gotten so far.
+   */
+#if 0
   grub_lower_mem = grub_get_conv_memsize () << 10;
 
   /* Sanity check.  */
   if (grub_lower_mem < GRUB_MEMORY_MACHINE_RESERVED_END)
     grub_fatal ("too small memory");
+#endif
 
 /* FIXME: This prevents loader/i386/linux.c from using low memory.  When our
    heap implements support for requesting a chunk in low memory, this should

=== modified file 'grub-core/kern/i386/pc/mmap.c'
--- grub-core/kern/i386/pc/mmap.c	2010-09-18 22:04:31 +0000
+++ grub-core/kern/i386/pc/mmap.c	2011-01-08 12:25:10 +0000
@@ -37,6 +37,22 @@
 
 
 /*
+ *
+ * grub_get_conv_memsize(i) :  return the conventional memory size in KB.
+ *	BIOS call "INT 12H" to get conventional memory size
+ *      The return value in AX.
+ */
+static inline grub_uint16_t
+grub_get_conv_memsize (void)
+{
+  struct grub_bios_int_registers regs;
+
+  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+  grub_bios_interrupt (0x12, &regs);
+  return regs.eax & 0xffff;
+}
+
+/*
  * grub_get_ext_memsize() :  return the extended memory size in KB.
  *	BIOS call "INT 15H, AH=88H" to get extended memory size
  *	The return value in AX.
@@ -155,6 +171,9 @@
     {
       grub_uint32_t eisa_mmap = grub_get_eisa_mmap ();
 
+      hook (0x0, ((grub_uint32_t) grub_get_conv_memsize ()) << 10,
+	    GRUB_MEMORY_AVAILABLE);
+
       if (eisa_mmap)
 	{
 	  if (hook (0x100000, (eisa_mmap & 0xFFFF) << 10,
@@ -162,7 +181,8 @@
 	    hook (0x1000000, eisa_mmap & ~0xFFFF, GRUB_MEMORY_AVAILABLE);
 	}
       else
-	hook (0x100000, grub_get_ext_memsize () << 10, GRUB_MEMORY_AVAILABLE);
+	hook (0x100000, ((grub_uint32_t) grub_get_ext_memsize ()) << 10,
+	      GRUB_MEMORY_AVAILABLE);
     }
 
   return 0;

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to