[LinuxBIOS] filo and v3

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Tue Oct 2 18:02:33 CEST 2007


On 02.10.2007 17:51, ron minnich wrote:
> This patch fixes the obvious bugs but filo self-relocation still
> fails. I need an ack.
> 
> ron
> 
> 
> ------------------------------------------------------------------------
> 
> 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 <rminnich at gmail.com>

Except for the comments below:
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

> Index: main/linuxbios.c
> ===================================================================
> --- main/linuxbios.c	(revision 35)
> +++ main/linuxbios.c	(working copy)
> @@ -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 = 0;

Use NULL instead?

>  	found = 0;
>  	if (!found) {
>  		found = find_lb_table(phys_to_virt(0x00000), phys_to_virt(0x01000), &lb_table);
> Index: i386/sys_info.c
> ===================================================================
> --- i386/sys_info.c	(revision 35)
> +++ i386/sys_info.c	(working copy)
> @@ -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,8 @@
>  	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 */

Can you change the comment to explain why?

> +	info->memrange = fakememrange;
>  	info->memrange[0].base = 0;
>  	info->memrange[0].size = 640*1024;
>  	info->memrange[1].base = 1024*1024;


-- 
http://www.hailfinger.org/




More information about the coreboot mailing list