tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to get CPU-Specific Info?



On Jul 19, 2012, at 10:02 AM, Frank Kastenholz wrote:

> Hi
> 
> The project I'm working on uses the (new) P2020 port
> of NetBSD. For various reasons, I'd like to be able to
> read the contents of all the internal configuration/etc
> registers on the processor (some are general PPC/Booke
> regs, some are specific to the 2020).

Most of those registers are privileged.  Some are SPRs,
others are device registers.

> This code does not exist ---I realize I'll have to
> write it. The question I have is whether there is
> a machine-independant framework/scheme for retrieving this sort
> of info into which processor-specific code would
> actually get the info/etc/etc/etc?

We prefer sysctl.  Maybe returning a proplib might make sense
since it's extensible.

> There is /proc/cpuinfo --- but this seems to be
> oriented more towards things like versions/features/
> etc of the actual silicon.  I could add the stuff
> I want to this.  Or I could make a new /proc file
> (eg "/proc/cpucsrs")

The problem with this is that some register reads might
be destructive.


Home | Main Index | Thread Index | Old Index