Exemplo n.º 1
0
void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq)
{
	char cpu_string[80];
	if (!svgfile)
		return;

	max_freq = __max_freq;
	turbo_frequency = __turbo_freq;

	fprintf(svgfile, "<g>\n");

	fprintf(svgfile, "<rect x=\"%4.8f\" width=\"%4.8f\" y=\"%4.1f\" height=\"%4.1f\" class=\"cpu\"/>\n",
		time2pixels(first_time),
		time2pixels(last_time)-time2pixels(first_time),
		cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT);

	sprintf(cpu_string, "CPU %i", (int)cpu);
	fprintf(svgfile, "<text x=\"%4.8f\" y=\"%4.8f\">%s</text>\n",
		10+time2pixels(first_time), cpu2y(cpu) + SLOT_HEIGHT/2, cpu_string);

	fprintf(svgfile, "<text transform=\"translate(%4.8f,%4.8f)\" font-size=\"1.25pt\">%s</text>\n",
		10+time2pixels(first_time), cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - 4, cpu_model());

	fprintf(svgfile, "</g>\n");
}
Exemplo n.º 2
0
void cpu_show_info() {
	char buffer[18];
    
	cpu_model(buffer);
	if (!*buffer) {
        syslog(LOG_ERR, "cpu unknown CPU");
        syslog(LOG_ERR, "cpu device 0x%x", DPORT.OTP_CHIPID);        		
	} else {
        syslog(LOG_INFO, "cpu %s at %d Mhz", buffer, cpu_speed());        		
	}
}
Exemplo n.º 3
0
psim_read_register(psim *system,
                   int which_cpu,
                   void *buf,
                   const char reg[],
                   transfer_mode mode)
{
    register_descriptions description;
    char *cooked_buf;
    cpu *processor;

    /* find our processor */
    if (which_cpu == MAX_NR_PROCESSORS) {
        if (system->last_cpu == system->nr_cpus
                || system->last_cpu == -1)
            which_cpu = 0;
        else
            which_cpu = system->last_cpu;
    }
    ASSERT(which_cpu >= 0 && which_cpu < system->nr_cpus);

    processor = system->processors[which_cpu];

    /* find the register description */
    description = register_description(reg);
    if (description.type == reg_invalid)
        return 0;
    cooked_buf = alloca (description.size);

    /* get the cooked value */
    switch (description.type) {

    case reg_gpr:
        *(gpreg*)cooked_buf = cpu_registers(processor)->gpr[description.index];
        break;

    case reg_spr:
        *(spreg*)cooked_buf = cpu_registers(processor)->spr[description.index];
        break;

    case reg_sr:
        *(sreg*)cooked_buf = cpu_registers(processor)->sr[description.index];
        break;

    case reg_fpr:
        *(fpreg*)cooked_buf = cpu_registers(processor)->fpr[description.index];
        break;

    case reg_pc:
        *(unsigned_word*)cooked_buf = cpu_get_program_counter(processor);
        break;

    case reg_cr:
        *(creg*)cooked_buf = cpu_registers(processor)->cr;
        break;

    case reg_msr:
        *(msreg*)cooked_buf = cpu_registers(processor)->msr;
        break;

    case reg_fpscr:
        *(fpscreg*)cooked_buf = cpu_registers(processor)->fpscr;
        break;

    case reg_insns:
        *(unsigned_word*)cooked_buf = mon_get_number_of_insns(system->monitor,
                                      which_cpu);
        break;

    case reg_stalls:
        if (cpu_model(processor) == NULL)
            error("$stalls only valid if processor unit model enabled (-I)\n");
        *(unsigned_word*)cooked_buf = model_get_number_of_stalls(cpu_model(processor));
        break;

    case reg_cycles:
        if (cpu_model(processor) == NULL)
            error("$cycles only valid if processor unit model enabled (-I)\n");
        *(unsigned_word*)cooked_buf = model_get_number_of_cycles(cpu_model(processor));
        break;

#ifdef WITH_ALTIVEC
    case reg_vr:
        *(vreg*)cooked_buf = cpu_registers(processor)->altivec.vr[description.index];
        break;

    case reg_vscr:
        *(vscreg*)cooked_buf = cpu_registers(processor)->altivec.vscr;
        break;
#endif

#ifdef WITH_E500
    case reg_gprh:
        *(gpreg*)cooked_buf = cpu_registers(processor)->e500.gprh[description.index];
        break;

    case reg_evr:
        *(unsigned64*)cooked_buf = EVR(description.index);
        break;

    case reg_acc:
        *(accreg*)cooked_buf = cpu_registers(processor)->e500.acc;
        break;
#endif

    default:
        printf_filtered("psim_read_register(processor=0x%lx,buf=0x%lx,reg=%s) %s\n",
                        (unsigned long)processor, (unsigned long)buf, reg,
                        "read of this register unimplemented");
        break;

    }

    /* the PSIM internal values are in host order.  To fetch raw data,
       they need to be converted into target order and then returned */
    if (mode == raw_transfer) {
        /* FIXME - assumes that all registers are simple integers */
        switch (description.size) {
        case 1:
            *(unsigned_1*)buf = H2T_1(*(unsigned_1*)cooked_buf);
            break;
        case 2:
            *(unsigned_2*)buf = H2T_2(*(unsigned_2*)cooked_buf);
            break;
        case 4:
            *(unsigned_4*)buf = H2T_4(*(unsigned_4*)cooked_buf);
            break;
        case 8:
            *(unsigned_8*)buf = H2T_8(*(unsigned_8*)cooked_buf);
            break;
#ifdef WITH_ALTIVEC
        case 16:
            if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
            {
                union {
                    vreg v;
                    unsigned_8 d[2];
                } h, t;
                memcpy(&h.v/*dest*/, cooked_buf/*src*/, description.size);
                {
                    _SWAP_8(t.d[0] =, h.d[1]);
                }
                {
                    _SWAP_8(t.d[1] =, h.d[0]);
                }
                memcpy(buf/*dest*/, &t/*src*/, description.size);
                break;
            }
            else
                memcpy(buf/*dest*/, cooked_buf/*src*/, description.size);
            break;
#endif
        }
    }