Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Oct 2001 08:11:33 -0500 (CDT)
From:      Mike Silbersack <silby@silby.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Dan Nelson <dnelson@allantgroup.com>, <freebsd-arch@FreeBSD.ORG>
Subject:   Re: Reading physical memory in a cross-platform way
Message-ID:  <20011003080703.F19313-100000@achilles.silby.com>
In-Reply-To: <20011003212829.R97858-100000@delplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wed, 3 Oct 2001, Bruce Evans wrote:

> > True, but I still don't want to spread MD-ish code across the kernel.  So,
> > I whipped up the patch I proposed.  This introduces "maxmembytes", which
> > contains the size of ram in bytes.  I think I've updated all architectures
> > properly, but I've only tested on i386.  Could someone working on
> > alpha/ia64/sparc check to make sure that it doesn't break compilation?
> >
> > Unless there are objections, I'll probably commit it in a few days.
>
> No thanks.  This spreads MI-ish code across all arches.
>
> Note that physmem is already used in MI code, in vfs_bio_alloc() and
> vm_ksubmap_init().  vfs_bio_alloc() is not actually MI -- machine-
> dependencies in this code include the magic number 16384 (64MB in
> i386 pages).  vm_ksubmap_init() uses btoc() (bytes to clicks) to
> do the reverse conversion to the one you want.
>
> Bruce

Hrm.  Yes, physmem is used in those functions, but it requires quite a bit
of conversion.  I'm going to be calculating these values in about 4
seperate files, and I don't want to clutter each calculation with the
conversion.  Doesn't it make more sense from a portability perspective to
keep the calculations entirely within machdep.c so that just a simple
variable can be exported?

If not, where should I centralize the calculation?

There's one more small issue: at least on i386, physmem reports a value a
few MB below the actual size, while maxmem reports the correct value.  So,
using physmem is less than desireable for me in this case.

Mike "Silby" Silbersack


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011003080703.F19313-100000>