From owner-freebsd-hackers@FreeBSD.ORG Tue May 3 13:28:41 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 260A2106564A for ; Tue, 3 May 2011 13:28:41 +0000 (UTC) (envelope-from philip-freebsd1@soeberg.net) Received: from pasmtpB.tele.dk (pasmtpb.tele.dk [80.160.77.98]) by mx1.freebsd.org (Postfix) with ESMTP id D78F98FC16 for ; Tue, 3 May 2011 13:28:40 +0000 (UTC) Received: from mail.soeberg.net (0x573f534a.cpe.ge-1-1-0-1109.bynqu1.customer.tele.dk [87.63.83.74]) by pasmtpB.tele.dk (Postfix) with ESMTP id DE9BAE30317 for ; Tue, 3 May 2011 15:10:23 +0200 (CEST) Received: from [10.240.10.87] ([188.120.77.114]) (authenticated user philip@soeberg.net) by mail.soeberg.net (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)) for freebsd-hackers@freebsd.org; Tue, 3 May 2011 15:10:27 +0200 Message-ID: <4DBFFEC2.4010506@soeberg.net> Date: Tue, 03 May 2011 15:10:26 +0200 From: Philip Soeberg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Runtime check for PAE option on BSD 6+ i386 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: philip-freebsd1@soeberg.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2011 13:28:41 -0000 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