summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-02-19 20:16:12 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-02-19 20:16:12 -0800
commit483dd9ad015aed395374599b9047bc29591ad5dd (patch)
tree2ca8ca061c5a36f5354a39ece3b59190f10db7f8
parentbba30a6e7ffe92b5565faa7acca95c3ba6a72a4f (diff)
Be more careful about looking for gaps in the e820 table.
We really don't care about anything beyond the 4GB mark, so make the tests for that explicit (and add a comment), and use regular "unsigned long" for the gap information.
-rw-r--r--arch/i386/kernel/setup.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 5dc1c8be783b..fceece409085 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -1168,7 +1168,7 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
*/
static void __init register_memory(void)
{
- long long gapsize;
+ unsigned long gapsize;
unsigned long long last;
int i;
@@ -1191,13 +1191,21 @@ static void __init register_memory(void)
while (--i >= 0) {
unsigned long long start = e820.map[i].addr;
unsigned long long end = start + e820.map[i].size;
- long long gap = last - end;
- if (gap > gapsize) {
- gapsize = gap;
- pci_mem_start = ((unsigned long) end + 0xfffff) & ~0xfffff;
+ /*
+ * Since "last" is at most 4GB, we know we'll
+ * fit in 32 bits if this condition is true
+ */
+ if (last > end) {
+ unsigned long gap = last - end;
+
+ if (gap > gapsize) {
+ gapsize = gap;
+ pci_mem_start = ((unsigned long) end + 0xfffff) & ~0xfffff;
+ }
}
- last = start;
+ if (start < last)
+ last = start;
}
printk("Allocating PCI resources starting at %08lx\n", pci_mem_start);
}