mfpvr instruction: how to get processor version info from userland?
Nathan Whitehorn
nwhitehorn at freebsd.org
Mon Nov 25 14:07:34 UTC 2013
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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ppc
> To unsubscribe, send any mail to "freebsd-ppc-unsubscribe at 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
More information about the freebsd-ppc
mailing list