--- linux/include/linux/pagemap.h.page Thu Jan 28 17:43:17 1999 +++ linux/include/linux/pagemap.h Mon Mar 8 07:37:54 1999 @@ -17,13 +17,13 @@ return PAGE_OFFSET + PAGE_SIZE * (page - mem_map); } -#define PAGE_HASH_BITS 11 -#define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) - #define PAGE_AGE_VALUE 16 - extern unsigned long page_cache_size; /* # of pages currently in the hash table */ -extern struct page * page_hash_table[PAGE_HASH_SIZE]; +extern struct page ** page_hash_table; +extern unsigned long page_hash_size; +extern unsigned long page_hash_mask; +extern unsigned long page_hash_bits; +extern long page_cache_init(long, long); /* * We use a power-of-two hash table to avoid a modulus, @@ -35,8 +35,8 @@ { #define i (((unsigned long) inode)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1))) #define o (offset >> PAGE_SHIFT) -#define s(x) ((x)+((x)>>PAGE_HASH_BITS)) - return s(i+o) & (PAGE_HASH_SIZE-1); +#define s(x) ((x)+((x)>>page_hash_bits)) + return s(i+o) & page_hash_mask; #undef i #undef o #undef s --- linux/init/main.c.page Mon Feb 22 22:44:53 1999 +++ linux/init/main.c Mon Mar 8 07:37:54 1999 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1149,6 +1150,7 @@ initrd_start = 0; } #endif + memory_start = page_cache_init(memory_start, memory_end); mem_init(memory_start,memory_end); kmem_cache_sizes_init(); #ifdef CONFIG_PROC_FS --- linux/mm/filemap.c.page Mon Feb 22 22:44:53 1999 +++ linux/mm/filemap.c Mon Mar 8 07:37:54 1999 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,7 @@ #include #include +#include /* * Shared mappings implemented 30.11.1994. It's not fully working yet, @@ -32,7 +34,45 @@ */ unsigned long page_cache_size = 0; -struct page * page_hash_table[PAGE_HASH_SIZE]; +unsigned long page_hash_size = 0; +unsigned long page_hash_bits = 0; +unsigned long page_hash_mask = 0; +struct page ** page_hash_table = NULL; + +/* + * The init function that starts off our page cache + */ +long __init page_cache_init( long mem_begin, long mem_end ) +{ + long cache_begin; + long i; + + for(i=0; i < sizeof(long) * 8; i++) + if(virt_to_phys((void *)mem_end) & (1<= (0x9f000 - page_hash_size))) ) + { + /* + * Our structure would fall into the middle of the upper + * BIOS area of the computer, go above it to the 1MB mark + * and start from there + */ + cache_begin = (long)phys_to_virt(0x100000); + } + page_hash_table = (struct page **)cache_begin; + memset(page_hash_table, 0, page_hash_size * sizeof(void)); + printk(KERN_INFO "page_cache_init: allocated %ldk of RAM with %ld hash " + "buckets.\n", (page_hash_size * sizeof(void *)) / 1024, + page_hash_size); + return(cache_begin + (page_hash_size * sizeof(void *))); +} /* * Simple routines for both non-shared and shared mappings.