Exemplo n.º 1
0
void StateWidget::sync()
{
    QString s;
    auto& cpu = machine().cpu();

    if (cpu.x32()) {
        DO_LABEL_N(EBX, EBX, "ebx", "%08x");
        DO_LABEL_N(EAX, EAX, "eax", "%08x");
        DO_LABEL_N(ECX, ECX, "ecx", "%08x");
        DO_LABEL_N(EDX, EDX, "edx", "%08x");
        DO_LABEL_N(EBP, EBP, "ebp", "%08x");
        DO_LABEL_N(ESP, ESP, "esp", "%08x");
        DO_LABEL_N(ESI, ESI, "esi", "%08x");
        DO_LABEL_N(EDI, EDI, "edi", "%08x");
        d->ui.lblPC->setText(s.sprintf("%04X:%08X", cpu.getBaseCS(), cpu.currentBaseInstructionPointer()));
    } else {
        DO_LABEL_N(EBX, BX, "bx", "%04x");
        DO_LABEL_N(EAX, AX, "ax", "%04x");
        DO_LABEL_N(ECX, CX, "cx", "%04x");
        DO_LABEL_N(EDX, DX, "dx", "%04x");
        DO_LABEL_N(EBP, BP, "bp", "%04x");
        DO_LABEL_N(ESP, SP, "sp", "%04x");
        DO_LABEL_N(ESI, SI, "si", "%04x");
        DO_LABEL_N(EDI, DI, "di", "%04x");
        d->ui.lblPC->setText(s.sprintf("%04X:%04X", cpu.getBaseCS(), cpu.getBaseIP()));
    }
    DO_LABEL(CS, "%04x");
    DO_LABEL(DS, "%04x");
    DO_LABEL(ES, "%04x");
    DO_LABEL(SS, "%04x");
    DO_LABEL(FS, "%04x");
    DO_LABEL(GS, "%04x");
    DO_LABEL(CR0, "%08x");
    DO_LABEL(CR3, "%08x");

#define DO_FLAG(getterName, name) flagString += QString("<font color='%1'>%2</font> ").arg(cpu.get ## getterName() ? "black" : "#ccc").arg(name);

    QString flagString;
    DO_FLAG(OF, "of");
    DO_FLAG(SF, "sf");
    DO_FLAG(ZF, "zf");
    DO_FLAG(AF, "af");
    DO_FLAG(PF, "pf");
    DO_FLAG(CF, "cf");
    DO_FLAG(IF, "if");
    DO_FLAG(TF, "tf");
    DO_FLAG(NT, "nt");

    d->ui.lblFlags->setText(flagString);

    d->ui.lblSizes->setText(QString("a%1o%2x%3s%4").arg(cpu.a16() ? 16 : 32).arg(cpu.o16() ? 16 : 32).arg(cpu.x16() ? 16 : 32).arg(cpu.s16() ? 16 : 32));

    auto cpuCycles = cpu.cycle();
    auto cycles = cpuCycles - d->cycleCount;
    double elapsed = d->cycleTimer.elapsed() / 1000.0;
    double ips = cycles / elapsed;
    d->ui.lblIPS->setText(QString("%1").arg((QWORD)ips));
    d->cycleCount = cpuCycles;
    d->cycleTimer.start();
}
Exemplo n.º 2
0
static int proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset,
		int length, int inout)
{
	struct us_data *us = host_to_us(host);
	char *pos = buffer;
	const char *string;

	/* if someone is sending us data, just throw it away */
	if (inout)
		return length;

	/* print the controller name */
	SPRINTF("   Host scsi%d: usb-storage\n", host->host_no);

	/* print product, vendor, and serial number strings */
	if (us->pusb_dev->manufacturer)
		string = us->pusb_dev->manufacturer;
	else if (us->unusual_dev->vendorName)
		string = us->unusual_dev->vendorName;
	else
		string = "Unknown";
	SPRINTF("       Vendor: %s\n", string);
	if (us->pusb_dev->product)
		string = us->pusb_dev->product;
	else if (us->unusual_dev->productName)
		string = us->unusual_dev->productName;
	else
		string = "Unknown";
	SPRINTF("      Product: %s\n", string);
	if (us->pusb_dev->serial)
		string = us->pusb_dev->serial;
	else
		string = "None";
	SPRINTF("Serial Number: %s\n", string);

	/* show the protocol and transport */
	SPRINTF("     Protocol: %s\n", us->protocol_name);
	SPRINTF("    Transport: %s\n", us->transport_name);

	/* show the device flags */
	if (pos < buffer + length) {
		pos += sprintf(pos, "       Quirks:");

		DO_FLAG(SINGLE_LUN);
		DO_FLAG(SCM_MULT_TARG);
		DO_FLAG(FIX_INQUIRY);
		DO_FLAG(FIX_CAPACITY);

		*(pos++) = '\n';
	}

	/*
	 * Calculate start of next buffer, and return value.
	 */
	*start = buffer + offset;

	if ((pos - buffer) < offset)
		return (0);
	else if ((pos - buffer - offset) < length)
		return (pos - buffer - offset);
	else
		return (length);
}