Subject: Re: Exporting USRSTACK, VM_MIN_ADDRESS and VM_MAXUSER_ADDRESS
To: Ben Harris <bjh21@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 01/02/2001 10:33:17
Ben Harris wrote:

> It seems that libkvm has cause to want to know the values of USRSTACK,
> VM_MIN_ADDRESS and VM_MAXUSER_ADDRESS.  On some MACHINE_ARCHs, these
> aren't constant, so libkvm has to work them out at runtime.  At the
> moment, it gets uses (__ps_strings + 1) for USRSTACK and
> VM_MAXUSER_ADDRESS, and 0 for VM_MIN_ADDRESS.  This won't work, though,
> for a libkvm to run on both NetBSD/arm26 and NetBSD/arm32, since they
> define VM_MIN_ADDRESS as 0x8000 and 0x1000 respectively, since the bottom
> logical page on each system is reserved for the CPU exception vectors.
> 
> Now, it would be possible for libkvm to detect the type of system it's
> running on and to adjust its idea of min_uva to match, but it would seem
> more sensible to make this information available by some common
> mechanism.  A sysctl is the obvious way, but should it be three new
> sysctls or an addition to struct uvmexp_sysctl?  Should I even be doing
> this at all?

It appears that the only place min_uva is used is to test if the address
of the argv/envp strings is too low.  Given that this typically only
happens when using ps on a crash dump (because that code path isn't used
when running ps on a live kernel) and sysctl queries the current running
kernel this means that you may not be able to run ps on a crash dump
created on an arm26 system on an arm32 system, in the unlikely event
that the address of the ps strings is in the first however-many kB of
the text of a process...

Perhaps just better to set min_uva to either the lower of the two
possible values, or even just set it to 0?

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/