Cast physmem to (uint64_t) so it works on a amd64 system with more than 4Gb ram.

undef btop if it was already included from other NetBSD header file.
This commit is contained in:
haad 2009-10-11 10:58:06 +00:00
parent 44fda7f84b
commit 4d85867fc4
2 changed files with 5 additions and 3 deletions

View File

@ -135,7 +135,9 @@
#ifdef __NetBSD__
#include <uvm/uvm.h>
#ifndef btop
#define btop(x) ((x) / PAGE_SIZE)
#endif
#define needfree (uvmexp.free < uvmexp.freetarg ? uvmexp.freetarg : 0)
#define buf_init arc_buf_init
#define freemem uvmexp.free
@ -867,7 +869,7 @@ buf_init(void)
* with an average 64K block size. The table will take up
* totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers).
*/
while (hsize * 65536 < physmem * PAGESIZE)
while (hsize * 65536 < (uint64_t)physmem * PAGESIZE)
hsize <<= 1;
retry:
buf_hash_table.ht_mask = hsize - 1;

View File

@ -237,13 +237,13 @@ dbuf_init(void)
uint64_t hsize = 1ULL << 16;
dbuf_hash_table_t *h = &dbuf_hash_table;
int i;
/*
* The hash table is big enough to fill all of physical memory
* with an average 4K block size. The table will take up
* totalmem*sizeof(void*)/4K (i.e. 2MB/GB with 8-byte pointers).
*/
while (hsize * 4096 < physmem * PAGESIZE)
while (hsize * 4096 < (uint64_t)physmem * PAGESIZE)
hsize <<= 1;
retry: