Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Oct 2001 22:46:04 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Mike Silbersack <silby@silby.com>
Cc:        freebsd-arch@FreeBSD.ORG
Subject:   Re: Reading physical memory in a cross-platform way
Message-ID:  <20011001224604.A29573@dan.emsphone.com>
In-Reply-To: <20011001222555.S7118-100000@achilles.silby.com>
References:  <20011001222450.A39302@dan.emsphone.com> <20011001222555.S7118-100000@achilles.silby.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 01), Mike Silbersack said:
> On Mon, 1 Oct 2001, Dan Nelson wrote:
> > It looks like 'physmem' (aka the hw.physmem sysctl) is defined the
> > same way on all the systems; are you looking for something else?
> >
> > --
> > 	Dan Nelson
> > 	dnelson@allantgroup.com
> 
> physmem != hw.physmem.  The sysctl is actually the output of a function,
> not a simple int or the like.

Yeah, but look at the function (i386 as an example):

static int
sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
{
    int error = sysctl_handle_int(oidp, 0, ctob(physmem), req);
    return (error);
}

So the physmem value is just in pages; even though the different
platforms use ctob() or <mach>_ptob(), the macros all expand to 
((x) << PAGE_SHIFT).  

Junior Kernel Hacker project: convert alpha and ia64 to use ctob() in
the name of consistency :)

-- 
	Dan Nelson
	dnelson@allantgroup.com

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?20011001224604.A29573>