From owner-freebsd-arch Wed Oct 3 6:11:37 2001 Delivered-To: freebsd-arch@freebsd.org Received: from silby.com (cb34181-a.mdsn1.wi.home.com [24.14.173.39]) by hub.freebsd.org (Postfix) with ESMTP id 743C637B407 for ; Wed, 3 Oct 2001 06:11:34 -0700 (PDT) Received: (qmail 19353 invoked by uid 1000); 3 Oct 2001 13:11:33 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Oct 2001 13:11:33 -0000 Date: Wed, 3 Oct 2001 08:11:33 -0500 (CDT) From: Mike Silbersack To: Bruce Evans Cc: Dan Nelson , Subject: Re: Reading physical memory in a cross-platform way In-Reply-To: <20011003212829.R97858-100000@delplex.bde.org> Message-ID: <20011003080703.F19313-100000@achilles.silby.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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