ia64/xen-unstable

changeset 14902:fe4784ff9fd3

hvmloader: Fix e820_collapse() to not lose E820 entries.
Fixes bugzilla bug #971.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Apr 24 10:34:47 2007 +0100 (2007-04-24)
parents 4f7fd7d27fd0
children 8ff0df8ad587
files tools/firmware/hvmloader/util.c
line diff
     1.1 --- a/tools/firmware/hvmloader/util.c	Tue Apr 24 09:50:56 2007 +0100
     1.2 +++ b/tools/firmware/hvmloader/util.c	Tue Apr 24 10:34:47 2007 +0100
     1.3 @@ -295,7 +295,7 @@ static void e820_collapse(void)
     1.4               ((ent[i].addr + ent[i].size) == ent[i+1].addr) )
     1.5          {
     1.6              ent[i].size += ent[i+1].size;
     1.7 -            memcpy(&ent[i+1], &ent[i+2], *E820_MAP_NR - i - 2);
     1.8 +            memcpy(&ent[i+1], &ent[i+2], (*E820_MAP_NR-i-2) * sizeof(*ent));
     1.9              (*E820_MAP_NR)--;
    1.10          }
    1.11          else
    1.12 @@ -322,10 +322,10 @@ uint32_t e820_malloc(uint32_t size)
    1.13               (addr != ent[i].addr) ||     /* starts above 4gb? */
    1.14               ((addr + size) < addr) )     /* ends above 4gb? */
    1.15              continue;
    1.16 -        
    1.17 +
    1.18          if ( ent[i].size != size )
    1.19          {
    1.20 -            memmove(&ent[i+1], &ent[i], (*E820_MAP_NR - i) * sizeof(*ent));
    1.21 +            memmove(&ent[i+1], &ent[i], (*E820_MAP_NR-i) * sizeof(*ent));
    1.22              (*E820_MAP_NR)++;
    1.23              ent[i].size -= size;
    1.24              addr += ent[i].size;