Date: Mon, 25 Nov 2013 08:26:33 -0600 From: Nathan Whitehorn <nwhitehorn@freebsd.org> To: Alexey Dokuchaev <danfe@nsu.ru> Cc: powerpc@freebsd.org Subject: Re: mfpvr instruction: how to get processor version info from userland? Message-ID: <52935E19.5070404@freebsd.org> In-Reply-To: <20131125142618.GA79428@regency.nsu.ru> References: <20131125124901.GA87016@regency.nsu.ru> <5293599C.8080401@freebsd.org> <20131125142618.GA79428@regency.nsu.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52935E19.5070404>