patch-2.3.17 linux/arch/i386/mm/init.c
Next file: linux/arch/m68k/Makefile
Previous file: linux/arch/i386/kernel/traps.c
Back to the patch index
Back to the overall index
- Lines: 59
- Date:
Tue Sep 7 10:38:21 1999
- Orig file:
v2.3.16/linux/arch/i386/mm/init.c
- Orig date:
Tue Aug 31 17:29:12 1999
diff -u --recursive --new-file v2.3.16/linux/arch/i386/mm/init.c linux/arch/i386/mm/init.c
@@ -375,7 +375,6 @@
int datapages = 0;
int initpages = 0;
unsigned long tmp;
- unsigned long addr;
int i, avail;
end_mem &= PAGE_MASK;
@@ -413,17 +412,27 @@
/* walk the whitelist, unreserving good memory
*/
for (avail = i = 0; i < e820.nr_map; i++) {
+ unsigned long addr, end, size;
+
if (e820.map[i].type != 1) /* not usable memory */
continue;
- printk("memory region: %luk @ %08lx\n",
- ((long)(e820.map[i].size)) / 1024,
- (long)(e820.map[i].addr) );
- for (addr=PAGE_ALIGN(((long)(e820.map[i].addr)))+PAGE_OFFSET,
- tmp = 0;
- tmp < (unsigned long)(e820.map[i].size);
- tmp += PAGE_SIZE,
- addr += PAGE_SIZE) {
+ addr = e820.map[i].addr;
+ size = e820.map[i].size;
+
+ /* Overflow large memory reasonably gracefully */
+ if (addr != e820.map[i].addr)
+ continue;
+
+ printk("memory region: %luk @ %08lx\n", size >> 10, addr );
+
+ /* Make sure we don't get fractional pages */
+ end = (addr + size) & PAGE_MASK;
+ addr = PAGE_ALIGN(addr);
+ if (end <= addr)
+ continue;
+ size = end - addr;
+ for (addr = addr + PAGE_OFFSET ; size ; addr += PAGE_SIZE, size -= PAGE_SIZE) {
/* this little bit of grossness is for dealing
* with memory borrowing for system bookkeeping
* (smp stacks, zero page, kernel code, etc)
@@ -437,9 +446,11 @@
* in any case, we don't want to hack mem_map
* entries above end_mem.
*/
- if ( (addr < start_low_mem)
- || (addr >= HIGH_MEMORY && addr <= start_mem)
- || (addr > end_mem) )
+ if ( addr < start_low_mem )
+ continue;
+ if ( addr > end_mem )
+ continue;
+ if ( addr >= HIGH_MEMORY && addr <= start_mem )
continue;
avail++;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)