# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1177407287 -3600
# Node ID fe4784ff9fd3996bc7960a4e2b42ad56ecf5aef9
# Parent 4f7fd7d27fd08cfb76d88f5e2580f35f403ab347
hvmloader: Fix e820_collapse() to not lose E820 entries.
Fixes bugzilla bug #971.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
tools/firmware/hvmloader/util.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff -r 4f7fd7d27fd0 -r fe4784ff9fd3 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c Tue Apr 24 09:50:56 2007 +0100
+++ b/tools/firmware/hvmloader/util.c Tue Apr 24 10:34:47 2007 +0100
@@ -295,7 +295,7 @@ static void e820_collapse(void)
((ent[i].addr + ent[i].size) == ent[i+1].addr) )
{
ent[i].size += ent[i+1].size;
- memcpy(&ent[i+1], &ent[i+2], *E820_MAP_NR - i - 2);
+ memcpy(&ent[i+1], &ent[i+2], (*E820_MAP_NR-i-2) * sizeof(*ent));
(*E820_MAP_NR)--;
}
else
@@ -322,10 +322,10 @@ uint32_t e820_malloc(uint32_t size)
(addr != ent[i].addr) || /* starts above 4gb? */
((addr + size) < addr) ) /* ends above 4gb? */
continue;
-
+
if ( ent[i].size != size )
{
- memmove(&ent[i+1], &ent[i], (*E820_MAP_NR - i) * sizeof(*ent));
+ memmove(&ent[i+1], &ent[i], (*E820_MAP_NR-i) * sizeof(*ent));
(*E820_MAP_NR)++;
ent[i].size -= size;
addr += ent[i].size;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|