Subject: Re: Uninitalized kernel variable uvm_maxkaddr
To: None <amatus@gnu.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 05/31/2005 18:26:10
--9UV9rz0O2dU/yYYn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 31, 2005 at 06:57:57AM -0700, Amatus wrote:
> Hi all, uvm_maxkaddr is never initalized before it's used. It's first
> use is in uvm_pageboot_alloc() (at least on i386) where it's compared
> against:
>         if (uvm_maxkaddr < (addr + size)) {
>                 uvm_maxkaddr =3D pmap_growkernel(addr + size);
>                 if (uvm_maxkaddr < (addr + size))
>                         panic("uvm_pageboot_alloc: pmap_growkernel()
> failed");
>         }
>=20
> It doesn't cause a problem because it seems to always be 0 on boot and
> is then set to a more reasonable value (something like 0xc100000000).
> It seems to me it should be initalized in pmap_bootstrap(). Can someone
> tell me why this isn't the case?

I can't speak as to _if_ it should be initialized earlier, but it will=20
always be initialized to zero. It doesn't just "seem" to, but it will=20
always be zero.

Its definition is:

vaddr_t uvm_maxkaddr;

which will cause it to be in the bss section, which will always be zeroed=
=20
on load.

Take care,

Bill

--9UV9rz0O2dU/yYYn
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFCnQ6yWz+3JHUci9cRAotJAJ0WYROUFwwos+cgsXzkuDho3toxvACfeJLJ
JjsVAsMWghlgfGVhocQ3m64=
=+TKB
-----END PGP SIGNATURE-----

--9UV9rz0O2dU/yYYn--