From owner-freebsd-ppc@FreeBSD.ORG Mon Nov 25 14:25:32 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 3884E3A4; Mon, 25 Nov 2013 14:25:32 +0000 (UTC) Received: from mx.nsu.ru (mx.nsu.ru [84.237.50.39]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9D1842D33; Mon, 25 Nov 2013 14:25:31 +0000 (UTC) Received: from regency.nsu.ru ([193.124.210.26]) by mx.nsu.ru with esmtp (Exim 4.69) (envelope-from ) id 1Vkx6C-0005Ji-Dt; Mon, 25 Nov 2013 21:25:21 +0700 Received: from regency.nsu.ru (localhost [127.0.0.1]) by regency.nsu.ru (8.14.2/8.14.2) with ESMTP id rAPEQNtl019423; Mon, 25 Nov 2013 21:26:33 +0700 (NOVT) (envelope-from danfe@regency.nsu.ru) Received: (from danfe@localhost) by regency.nsu.ru (8.14.2/8.14.2/Submit) id rAPEQIJU019418; Mon, 25 Nov 2013 21:26:18 +0700 (NOVT) (envelope-from danfe) Date: Mon, 25 Nov 2013 21:26:18 +0700 From: Alexey Dokuchaev To: Nathan Whitehorn Subject: Re: mfpvr instruction: how to get processor version info from userland? Message-ID: <20131125142618.GA79428@regency.nsu.ru> References: <20131125124901.GA87016@regency.nsu.ru> <5293599C.8080401@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5293599C.8080401@freebsd.org> User-Agent: Mutt/1.4.2.1i 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:25:32 -0000 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