Subject: Re: R140 w/8 MB and multiuser
To: Philip Blundell <philb@gnu.org>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm26
Date: 07/02/2001 23:58:03
On Mon, 2 Jul 2001, Philip Blundell wrote:

> >Having looked at memcreg.h a bit more, it seems there aren't all that many
> >bits spare in the page table entries.  With 4 KB pages, there are enough
> >for 256 physical pages (1 MB).  With 8 KB pages, 512 (4 MB), with 16 KB
> >pages, 1024 (16 MB) and with 32 KB pages, 2048 (64 MB).
>
> I don't really understand this.  Presumably this is some NetBSD thing, rather
> than being specific to MEMC?

No, it's a MEMC thing.  "Page table entries" is the wrong phrase really,
but my MEMC data sheet has gone into hiding, so I can't find the correct
term.  Anyway, what I'm talking about is the addresses you write to to set
the MEMC translation tables.  The address as received by the MEMC is 26
bits wide.  Three bits of this indicate that it's a translation-table
setting, and two contain the page protection level, which leaves 21 to
share between the logical and physical page numbers.  The number of
logical pages in the system is (1 << 25) / PAGE_SIZE, so the number of
bits needed to represent an LPN is 25 - PAGE_SHIFT.  Thus, the number of
bits left to represent the PPN is 21 - (25 - PAGE_SHIFT), the maximum
number of physical pages is 1 << (PAGE_SHIFT - 4), and hence the maximum
total memory is (1 << (PAGE_SHIFT - 4)) << PAGE_SHIFT) or
1 << (2 * PAGE_SHIFT - 4).  More usefully:

PAGE_SIZE	PAGE_SHIFT	Max phys mem
4 KB		12		1 MB
8 KB		13		4 MB
16 KB		14		16 MB
32 KB		15		64 MB

> >The last of those
> >would overflow the space for physically-mapped pages, though I suppose
> >that need not be a problem if the OS isn't confused by it.
>
> Yeah.  I think Linux depends on having all RAM physically mapped; I have no
> idea about NetBSD.

NetBSD in general doesn't need it, but NetBSD/arm26 does at present.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>