Subject: Re: spr register
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Allen Briggs <briggs@wasabisystems.com>
List: port-powerpc
Date: 11/16/2002 15:20:14
On Sat, Nov 16, 2002 at 10:05:58PM +0100, Emmanuel Dreyfus wrote:
> In one special purpose register, there is the type of the CPU stored. I
> need it for COMPAT_MACH. Is there a place accessible in C where we store
> it? If not, what assembly would I need to get the value?

Which CPU?  ;-)

It might make sense to stick this in the cpu_info structure, but I don't
think it's actually saved anywhere right now.  To get it for the
currently-running CPU, you can use the following code.  The values here
correspond to the definitions in spr.h.

	u_int pvr, vers;

        __asm __volatile ("mfpvr %0" : "=r"(pvr));
        vers = (pvr >> 16) & 0xffff;

-allen

-- 
 Allen Briggs                     briggs@wasabisystems.com
 http://www.wasabisystems.com/    Quality NetBSD CDs, Sales, Support, Service
NetBSD development for Alpha, ARM, M68K, MIPS, PowerPC, SuperH, XScale, etc...