From owner-freebsd-ppc@FreeBSD.ORG Mon Nov 25 12:48:19 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 5A0B7538 for ; Mon, 25 Nov 2013 12:48:19 +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 BDFB326D2 for ; Mon, 25 Nov 2013 12:48:18 +0000 (UTC) Received: from regency.nsu.ru ([193.124.210.26]) by mx.nsu.ru with esmtp (Exim 4.69) (envelope-from ) id 1Vkva4-0003Mk-RA for powerpc@freebsd.org; Mon, 25 Nov 2013 19:48:05 +0700 Received: from regency.nsu.ru (localhost [127.0.0.1]) by regency.nsu.ru (8.14.2/8.14.2) with ESMTP id rAPCn7Va003001 for ; Mon, 25 Nov 2013 19:49:17 +0700 (NOVT) (envelope-from danfe@regency.nsu.ru) Received: (from danfe@localhost) by regency.nsu.ru (8.14.2/8.14.2/Submit) id rAPCn2bh002987 for powerpc@freebsd.org; Mon, 25 Nov 2013 19:49:02 +0700 (NOVT) (envelope-from danfe) Date: Mon, 25 Nov 2013 19:49:02 +0700 From: Alexey Dokuchaev To: powerpc@freebsd.org Subject: mfpvr instruction: how to get processor version info from userland? Message-ID: <20131125124901.GA87016@regency.nsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i 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 12:48:19 -0000 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