Date: Tue, 3 May 2011 20:43:39 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-hackers@freebsd.org, philip-freebsd1@soeberg.net Subject: Re: Runtime check for PAE option on BSD 6+ i386 Message-ID: <20110503174339.GI48734@deviant.kiev.zoral.com.ua> In-Reply-To: <201105031144.32862.jhb@freebsd.org> References: <4DBFFEC2.4010506@soeberg.net> <201105031144.32862.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Tue, May 03, 2011 at 11:44:32AM -0400, John Baldwin wrote:
> On Tuesday, May 03, 2011 9:10:26 am Philip Soeberg wrote:
> > Hi fellow FreeBSD hackers,
> >
> > I've been using the following poor-man's approach in my driver init for
> > ages in an attempt at detecting PAE option on BSD 6 (or greater) i386
> > kernels, as I depend on dmabus(9) but provide a loadable kernel module only.
> >
> > >>>
> > if (sizeof(void*) == 4) {
> > if (((uint64_t)(cnt.v_page_count * cnt.v_page_size) / 1073741824)
> > >= 4) {
> > printf("FreeBSD i386 detected with PAE option enabled. FreeBSD
> > PAE type\n");
> > printf("kernels does not support loadable modules which use DMA.
> > Please\n");
> > printf("reconfigure your kernel for non-PAE or switch to amd64
> > kernel.\n");
> > return EFAULT;
> > }
> > }
> > <<<
>
> Hmmm, even this isn't really accurate as some folks may choose to enable PAE
> even with < 4GB to get PG_NX functionality.
>
> > afaik there's a sysctl method of checking this per BSD7 (or is it 8?),
> > but what about BSD6? Any hints on how I can runtime detect the above?
>
> Definitely a kern.features.pae sysctl in 7. I don't see anything similar in
> 6.
Read %cr4 and test the bit there.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
iEYEARECAAYFAk3APsoACgkQC3+MBN1Mb4hFawCg0x+eKns4F9qgvH1Rja+R+Gi2
KZgAn0ndc1NnvKZdnycp8UElct80n9bE
=ZARE
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110503174339.GI48734>
