From owner-freebsd-ppc@FreeBSD.ORG Mon Nov 25 14:07:34 2013 Return-Path: Delivered-To: powerpc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDF5AB6D for ; Mon, 25 Nov 2013 14:07:34 +0000 (UTC) Received: from smtpauth3.wiscmail.wisc.edu (wmauth3.doit.wisc.edu [144.92.197.226]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A23562BD5 for ; Mon, 25 Nov 2013 14:07:34 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) id <0MWT00K00OK6LO00@smtpauth3.wiscmail.wisc.edu> for powerpc@freebsd.org; Mon, 25 Nov 2013 08:07:26 -0600 (CST) X-Spam-PmxInfo: Server=avs-3, Version=6.0.3.2322014, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.11.25.140016, 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 smtpauth3.wiscmail.wisc.edu (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTPSA id <0MWT006PHOKDHS10@smtpauth3.wiscmail.wisc.edu>; Mon, 25 Nov 2013 08:07:25 -0600 (CST) Message-id: <5293599C.8080401@freebsd.org> Date: Mon, 25 Nov 2013 08:07:24 -0600 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 To: Alexey Dokuchaev , powerpc@freebsd.org Subject: Re: mfpvr instruction: how to get processor version info from userland? References: <20131125124901.GA87016@regency.nsu.ru> In-reply-to: <20131125124901.GA87016@regency.nsu.ru> 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:07:34 -0000 On 11/25/13 06:49, Alexey Dokuchaev wrote: > hi there, > > i might soon have a chance to play with powerpc, so i'm wondering about > few things about the arch and cpu; particularly, i'm wondering if there > is something like cpuid instruction for intel. > > 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 :( > > grep'ing -R mfpvr /sys/powerpc shows an interesting line in > /sys/powerpc/aim/trap.c: > > frame->fixreg[reg] = mfpvr(); > > 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, > > ./danfe > _______________________________________________ > freebsd-ppc@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ppc > To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@freebsd.org" 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. -Nathan