HelenOS sources
This source file includes following definitions.
- cpu_arch_init
- cpu_identify
- cpu_print_report
#include <arch/cpu.h>
#include <cpu.h>
#include <arch.h>
#include <arch/cp0.h>
#include <stdio.h>
struct data_t {
const char *vendor;
const char *model;
};
static struct data_t imp_data[] = {
{ "Invalid", "Invalid" },
{ "MIPS", "R2000" },
{ "MIPS", "R3000" },
{ "MIPS", "R6000" },
{ "MIPS", "R4000/R4400" },
{ "LSI Logic", "R3000" },
{ "MIPS", "R6000A" },
{ "IDT", "3051/3052" },
{ "Invalid", "Invalid" },
{ "MIPS", "R10000/T5" },
{ "MIPS", "R4200" },
{ "Unknown", "Unknown" },
{ "Unknown", "Unknown" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "MIPS", "R8000" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "QED", "R4600" },
{ "Sony", "R3000" },
{ "Toshiba", "R3000" },
{ "NKK", "R3000" },
{ NULL, NULL }
};
static struct data_t imp_data80[] = {
{ "MIPS", "4Kc" },
{ "Invalid", "Invalid" },
{ "Invalid", "Invalid" },
{ "MIPS", "4Km & 4Kp" },
{ NULL, NULL }
};
void cpu_arch_init(void)
{
}
void cpu_identify(void)
{
CPU->arch.rev_num = cp0_prid_read() & 0xff;
CPU->arch.imp_num = (cp0_prid_read() >> 8) & 0xff;
}
void cpu_print_report(cpu_t *m)
{
struct data_t *data;
unsigned int i;
if (m->arch.imp_num & 0x80) {
i = 0;
while (imp_data80[i].vendor)
i++;
if ((m->arch.imp_num & 0x7f) >= i) {
printf("imp=%d\n", m->arch.imp_num);
return;
}
data = &imp_data80[m->arch.imp_num & 0x7f];
} else {
i = 0;
while (imp_data[i].vendor)
i++;
if (m->arch.imp_num >= i) {
printf("imp=%d\n", m->arch.imp_num);
return;
}
data = &imp_data[m->arch.imp_num];
}
printf("cpu%u: %s %s (rev=%d.%d, imp=%d)\n",
m->id, data->vendor, data->model, m->arch.rev_num >> 4,
m->arch.rev_num & 0x0f, m->arch.imp_num);
}
HelenOS homepage, sources at GitHub