Subject: Re: G4, 2GB RAM report (fwd)
To: None <port-macppc@netbsd.org, port-powerpc@netbsd.org>
From: Tsubai Masanari <tsubai@iri.co.jp>
List: port-powerpc
Date: 08/10/2000 22:35:11
>For folks only on port-powerpc, the current powerpc pmap doesn't size
>things well when the machine has 2GB of memory. It calculates the number
>of bytes in the system in an integer quantity. 2GB > INT_MAX, so bad
>things happen.

The Programming Environments Manual says:

7.6.1.2  Page Table Size

...
In a 32-bit implementation, the minimum size for a page table is 64 Kbytes
(2^10 PTEGs of 64 bytes each). However, it is recommended that the total
number of PTEGs in the page table be at least half the number of physical
page frames to be mapped. While avoidance of hash collisions cannot be ...

So,

	if (physmem < 0x800)
		ptab_cnt = 0x400;
	else {
#ifdef HTABENTS
		ptab_cnt = HTABENTS;
#else
		ptab_cnt = (physmem + 1) / 2;
		/* Align 2^n. */
		for (i = 0; i < 32; i++)
			if ((1U << i) >= ptab_cnt) {
				ptab_cnt = 1 << i;
				break;
			}
#endif /* HTABENTS */
	}

Comments?