Runtime check for PAE option on BSD 6+ i386

Philip Soeberg philip-freebsd1 at soeberg.net
Tue May 3 13:28:41 UTC 2011


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;
     }
   }
<<<

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?

Thanx,
Phil



More information about the freebsd-hackers mailing list