From owner-freebsd-ppc@FreeBSD.ORG Mon Nov 25 14:26:37 2013 Return-Path: Delivered-To: powerpc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC6DB477 for ; Mon, 25 Nov 2013 14:26:37 +0000 (UTC) Received: from smtpauth2.wiscmail.wisc.edu (wmauth2.doit.wisc.edu [144.92.197.222]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B08F52D52 for ; Mon, 25 Nov 2013 14:26:37 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MWT00700OHVX500@smtpauth2.wiscmail.wisc.edu> for powerpc@freebsd.org; Mon, 25 Nov 2013 08:26:35 -0600 (CST) X-Spam-PmxInfo: Server=avs-2, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.11.25.141514, SenderIP=0.0.0.0 X-Spam-Report: AuthenticatedSender=yes, SenderIP=0.0.0.0 Received: from comporellon.tachypleus.net (adsl-76-208-69-44.dsl.mdsnwi.sbcglobal.net [76.208.69.44]) by smtpauth2.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MWT004WBPGADP10@smtpauth2.wiscmail.wisc.edu>; Mon, 25 Nov 2013 08:26:35 -0600 (CST) Message-id: <52935E19.5070404@freebsd.org> Date: Mon, 25 Nov 2013 08:26:33 -0600 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 To: Alexey Dokuchaev Subject: Re: mfpvr instruction: how to get processor version info from userland? References: <20131125124901.GA87016@regency.nsu.ru> <5293599C.8080401@freebsd.org> <20131125142618.GA79428@regency.nsu.ru> In-reply-to: <20131125142618.GA79428@regency.nsu.ru> Cc: powerpc@freebsd.org X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Nov 2013 14:26:37 -0000 On 11/25/13 08:26, Alexey Dokuchaev wrote: > On Mon, Nov 25, 2013 at 08:07:24AM -0600, Nathan Whitehorn wrote: >>> it seems that mfpvr should do the job, but it can only be called from >>> kernel. Linux emulates it so user-space can have access to the info; but >>> in FreeBSD, its prototype is hidden under #ifdef _KERNEL :( >>> >>> i haven't yet made my way through this code, but have a quick question: is >>> there a way to obtain mfpvr() value from userland (thru kernel catching >>> the trap that the processor raises when a non-privileged program tries to >>> execute it), or i have to write my own kld for that? i also wonder why it >>> was made privileged in the first place... thanks, >> You can use it fine from userland -- just copy the mfpvr() definition >> our of the header file. The architecture makes it privileged for various >> reasons (VM mobility for instance), but we emulate it. > OK, i see. Would it more sense to open it to userland (in header file) > in this case? Or there are reasons it's hidden behind #ifdef _KERNEL? > > ./danfe The whole header file is meant for kernel-only. Moving this around might make some sense. -Nathan