I have a code in which, fetching of CPU vendor information (i.e vendor id , vendor name) is done using Intel x86 based inline asm code. Now I want to port this code into MIPS/FreeBSD. So any body can tell me how I can achieve this in FreeBSD/MIPS..
The special device /dev/cpuctl presents interface to the system CPU. It
provides functionality to retrieve CPUID information, read/write machine
specific registers (MSR) and perform CPU firmware updates.
For each CPU present in the system, the special device /dev/cpuctl%d with
the appropriate index will be created. For multicore CPUs such a special
device will be created for each core.
Currently, only i386 and amd64 processors are supported.
according to me there must be a way
That's probably because it uses the x86 CPUID instruction.In FreeBSD I would have looked to the cpuctl(4) device but unfortunately the man page says only i386 and amd64 are supported.
Yep, already did that too.I've just had a quick scan through the MIPS (64bit) instruction set reference and don't see anything at all that looks like it might get CPU information. As a RISC cpu is actually has quite a small instruction set.
Sunny Goel, Perhaps for the benefit of other people finding this thread you could post your C source code for fetching CPU information on a MIPS processor?i know how to do it with c code
If you have working code in C for fetching CPU information on a MIPS processor, why use inline assembler at all? But assuming you have a valid reason, why not just compile your working code and examine the machine instructions that the compiler generates?i am asking that how to do it with inline assembly in freebsd/mips
And also says that the MFC0 instruction can be used to read from registers in coprocessor 0.The Processor ID (PRId) is a read-only, special-purpose register found in the MIPS32 and MIPS64 ISAs that can be queried to identify the MIPS CPU. The Processor ID should be unique for each instruction set or CPU control register change. The PRId is the 15th register in Coprocessor 0.