WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] SeaBIOS/Xen: Compute the low RAM memory size in

To: Julian Pidancet <julian.pidancet@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] SeaBIOS/Xen: Compute the low RAM memory size in the BDA according to the e820
From: Kevin O'Connor <kevin@xxxxxxxxxxxx>
Date: Sun, 13 Nov 2011 20:11:36 -0500
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, seabios@xxxxxxxxxxx, ian.campbell@xxxxxxxxxx
Delivery-date: Sun, 13 Nov 2011 17:12:14 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <71d1cedea5b7f4c303c1b0d2a6e8c1520e843776.1321235039.git.julian.pidancet@xxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <71d1cedea5b7f4c303c1b0d2a6e8c1520e843776.1321235039.git.julian.pidancet@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Nov 14, 2011 at 01:50:05AM +0000, Julian Pidancet wrote:
> Some programs or ROMs like iPXE rely on the memory size field present
> in the BDA instead of e820 to relocate sections at the end of the low
> memory.
> Xen's hvmloader places an ACPI info table at 0x9F000 at the end of the
> usable RAM in low memory (just before the EBDA). The e820 table gets
> altered accordingly to protect the area where the table lives, but a ROM
> like iPXE only takes into account the memory size field in the BDA and
> consequently corrupts the table when relocating itself.

That wont work reliably - SeaBIOS (and option roms) can grow the EBDA.
It's not realistic to put a whole in the middle of the first 640k.

[...]
> diff --git a/src/memmap.c b/src/memmap.c
> index 20ccae0..36750f5 100644
> --- a/src/memmap.c
> +++ b/src/memmap.c
> @@ -7,6 +7,7 @@
>  #include "memmap.h" // struct e820entry
>  #include "util.h" // dprintf.h
>  #include "biosvar.h" // SET_EBDA
> +#include "config.h" // CONFIG_*
>  
>  
>  /****************************************************************
> @@ -133,6 +134,34 @@ add_e820(u64 start, u64 size, u32 type)
>      //dump_map();
>  }
>  
> +// Try to find the size of the usable RAM memory in the
> +// first megabyte of RAM.
> +u32
> +get_lowram_size(void)
> +{
> +    u32 lowram_end = 0;
> +
> +    int i;
> +    for (i=0; i<e820_count; i++) {
> +        struct e820entry *e = &e820_list[i];
> +        u64 e_end = e->start + e->size;
> +
> +        if (e->type != E820_RAM)
> +            continue;
> +
> +        if (e_end <= 0x100000 && /* 1M */
> +            e_end > lowram_end)

Shouldn't this read (e_end <= BUILD_LOWRAM_END)?  Otherwise, if for
some strange reason an e820 entry pointed to ram above 0xa0000 but
below 1meg, it would break things.

[...]
> --- a/src/post.c
> +++ b/src/post.c
> @@ -82,18 +82,21 @@ init_bda(void)
>      struct bios_data_area_s *bda = MAKE_FLATPTR(SEG_BDA, 0);
>      memset(bda, 0, sizeof(*bda));
>  
> -    int esize = EBDA_SIZE_START;
> -    SET_BDA(mem_size_kb, BUILD_LOWRAM_END/1024 - esize);
>      u16 ebda_seg = EBDA_SEGMENT_START;
>      SET_BDA(ebda_seg, ebda_seg);

As above, this doesn't look right - SeaBIOS will still locate the EBDA
at 9fc00 and nothing will stop it from growing it over the 9f000 area.

-Kevin

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel