Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138738
b: refs/heads/master
c: 5c0e6f0
h: refs/heads/master
v: v3
  • Loading branch information
Jan Beulich authored and Ingo Molnar committed Mar 13, 2009
1 parent 076febf commit 2675ce7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82034d6f59b4772f4233bbb61c670290803a9960
refs/heads/master: 5c0e6f035df983210e4d22213aed624ced502d3d
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void __init setup_bios_corruption_check(void)
u64 size;
addr = find_e820_area_size(addr, &size, PAGE_SIZE);

if (addr == 0)
if (!(addr + 1))
break;

if ((addr + size) > corruption_check_size)
Expand Down
32 changes: 25 additions & 7 deletions trunk/arch/x86/kernel/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,15 @@ static u64 __init e820_update_range_map(struct e820map *e820x, u64 start,
u64 size, unsigned old_type,
unsigned new_type)
{
int i;
unsigned int i, x;
u64 real_updated_size = 0;

BUG_ON(old_type == new_type);

if (size > (ULLONG_MAX - start))
size = ULLONG_MAX - start;

for (i = 0; i < e820.nr_map; i++) {
for (i = 0; i < e820x->nr_map; i++) {
struct e820entry *ei = &e820x->map[i];
u64 final_start, final_end;
if (ei->type != old_type)
Expand All @@ -446,14 +446,23 @@ static u64 __init e820_update_range_map(struct e820map *e820x, u64 start,
final_end = min(start + size, ei->addr + ei->size);
if (final_start >= final_end)
continue;
e820_add_region(final_start, final_end - final_start,
new_type);

x = e820x->nr_map;
if (x == ARRAY_SIZE(e820x->map)) {
printk(KERN_ERR "Too many memory map entries!\n");
break;
}
e820x->map[x].addr = final_start;
e820x->map[x].size = final_end - final_start;
e820x->map[x].type = new_type;
e820x->nr_map++;

real_updated_size += final_end - final_start;

ei->size -= final_end - final_start;
if (ei->addr < final_start)
continue;
ei->addr = final_end;
ei->size -= final_end - final_start;
}
return real_updated_size;
}
Expand Down Expand Up @@ -1020,8 +1029,8 @@ u64 __init find_e820_area_size(u64 start, u64 *sizep, u64 align)
continue;
return addr;
}
return -1UL;

return -1ULL;
}

/*
Expand All @@ -1034,13 +1043,22 @@ u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align)
u64 start;

start = startt;
while (size < sizet)
while (size < sizet && (start + 1))
start = find_e820_area_size(start, &size, align);

if (size < sizet)
return 0;

#ifdef CONFIG_X86_32
if (start >= MAXMEM)
return 0;
if (start + size > MAXMEM)
size = MAXMEM - start;
#endif

addr = round_down(start + size - sizet, align);
if (addr < start)
return 0;
e820_update_range(addr, sizet, E820_RAM, E820_RESERVED);
e820_update_range_saved(addr, sizet, E820_RAM, E820_RESERVED);
printk(KERN_INFO "update e820 for early_reserve_e820\n");
Expand Down

0 comments on commit 2675ce7

Please sign in to comment.