Re: mem=16MB laptop testing

William Lee Irwin III
2003-10-15T12:48:12Z

On Wed, Oct 15, 2003 at 02:12:08PM +0200, Pavel Machek wrote:
> I do not think this wants to be fixed. It should remain compatible
> with 2.4.X, and if it is not that's a bug [and pretty dangerous & hard
> to debug one -- if you mark something as ram which is not, you get
> real bad data corruption].

2.4:
static void __init limit_regions (unsigned long long size)
{
unsigned long long current_addr = 0;
int i;

for (i = 0; i < e820.nr_map; i++) {
if (e820.map[i].type == E820_RAM) {
current_addr = e820.map[i].addr + e820.map[i].size;
if (current_addr >= size) {
e820.map[i].size -= current_addr-size;
e820.nr_map = i + 1;
return;
}
}
}
}

2.5:
static void __init limit_regions (unsigned long long size)
{
int i;
unsigned long long current_size = 0;

for (i = 0; i < e820.nr_map; i++) {
if (e820.map[i].type == E820_RAM) {
current_size += e820.map[i].size;
if (current_size >= size) {
e820.map[i].size -= current_size-size;
e820.nr_map = i + 1;
return;
}
}
}
}