[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1 of 8] tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment



On Fri, May 13, 2011 at 02:42:30PM +0100, Ian Campbell wrote:
> # HG changeset patch
> # User Ian Campbell <ian.campbell@xxxxxxxxxx>
> # Date 1305294079 -3600
> # Node ID c5c7ae5f33b16ee03535e9c688ad9bee2510b2b6
> # Parent  9476bc07db2c654b266ab1f1c9ff0c65f401d74d
> tools: libxc: allow HVM firmware to be loaded at an arbitrary alignment
> 
> Enables direct loading of e.g. seabios.elf.
> 
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> 
> diff -r 9476bc07db2c -r c5c7ae5f33b1 tools/libxc/xc_hvm_build.c
> --- a/tools/libxc/xc_hvm_build.c      Fri May 13 14:41:19 2011 +0100
> +++ b/tools/libxc/xc_hvm_build.c      Fri May 13 14:41:19 2011 +0100
> @@ -88,7 +88,9 @@ static int loadelfimage(
>      struct elf_binary *elf, uint32_t dom, unsigned long *parray)
>  {
>      privcmd_mmap_entry_t *entries = NULL;
> -    size_t pages = (elf->pend - elf->pstart + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +    unsigned long pfn_start = elf->pstart >> PAGE_SHIFT;
> +    unsigned long pfn_end = (elf->pend + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +    size_t pages = pfn_end - pfn_start;
>      int i, rc = -1;
>  
>      /* Map address space for initial elf image. */
> @@ -105,6 +107,8 @@ static int loadelfimage(
>      if ( elf->dest == NULL )
>          goto err;
>  
> +    elf->dest += elf->pstart & 4095;

Whoa. Decimal numbers! Threw me off when I saw this - so used to 0xfff. :-)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.