Author: rminnich
Date: 2007-10-02 19:04:57 +0200 (Tue, 02 Oct 2007)
New Revision: 36

Modified:
   trunk/filo-0.5/i386/sys_info.c
   trunk/filo-0.5/main/linuxbios.c
Log:


1. fix spelling error. 
2. paranoid setting of info->memrange to 0
3. don't use malloc when it is not possible to use malloc. 

Signed-off-by: Ronald G. Minnich <[EMAIL PROTECTED]>
Acked-by: Carl-Daniel Hailfinger <[EMAIL PROTECTED]>


Modified: trunk/filo-0.5/i386/sys_info.c
===================================================================
--- trunk/filo-0.5/i386/sys_info.c      2007-09-23 22:33:38 UTC (rev 35)
+++ trunk/filo-0.5/i386/sys_info.c      2007-10-02 17:04:57 UTC (rev 36)
@@ -11,6 +11,8 @@
 {
     int i;
     unsigned long long total = 0;
+    /* this fake memory range covers the case that we can't find any LB 
structs. */
+    static struct memrange fakememrange[2];
 
     /* Pick up paramters given by bootloader to us */
     info->boot_type = boot_ctx->eax;
@@ -30,7 +32,12 @@
        printf("Can't get memory map from firmware. "
                "Using hardcoded default.\n");
        info->n_memranges = 2;
-       info->memrange = malloc(2 * sizeof(struct memrange));
+       /* NOTE: DO NOT USE MALLOC HERE *
+        * malloc structs are not initialized until this information is filled 
in. 
+         * Use of malloc will create a circular dependency. So use
+         * the static allocated above. 
+         */
+       info->memrange = fakememrange;
        info->memrange[0].base = 0;
        info->memrange[0].size = 640*1024;
        info->memrange[1].base = 1024*1024;

Modified: trunk/filo-0.5/main/linuxbios.c
===================================================================
--- trunk/filo-0.5/main/linuxbios.c     2007-09-23 22:33:38 UTC (rev 35)
+++ trunk/filo-0.5/main/linuxbios.c     2007-10-02 17:04:57 UTC (rev 36)
@@ -89,7 +89,7 @@
                }
                if (head->header_bytes != sizeof(*head))
                        continue;
-               debug("Found canidate at: %p\n", head);
+               debug("Found candidate at: %p\n", head);
                if (ipchksum((uint16_t *)head, sizeof(*head)) != 0) 
                        continue;
                debug("header checksum o.k.\n");
@@ -114,6 +114,7 @@
        struct lb_header *lb_table;
        int found;
        debug("Searching for LinuxBIOS tables...\n");
+       info->memrange = NULL;
        found = 0;
        if (!found) {
                found = find_lb_table(phys_to_virt(0x00000), 
phys_to_virt(0x01000), &lb_table);


-- 
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to