--- trunk/src/devices/dev_mp.c 2007/10/08 16:18:19 8 +++ trunk/src/devices/dev_mp.c 2007/10/08 16:19:23 20 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: dev_mp.c,v 1.27 2005/06/11 20:51:41 debug Exp $ + * $Id: dev_mp.c,v 1.30 2005/11/13 00:14:09 debug Exp $ * * This is a fake multiprocessor (MP) device. It can be useful for * theoretical experiments, but probably bares no resemblance to any @@ -70,7 +70,8 @@ int i, which_cpu; uint64_t idata = 0, odata = 0; - idata = memory_readmax64(cpu, data, len); + if (writeflag == MEM_WRITE) + idata = memory_readmax64(cpu, data, len); /* * NOTE: It is up to the user of this device to read or write @@ -221,6 +222,15 @@ cpu_interrupt_ack(d->cpus[cpu->cpu_id], MIPS_IPI_INT); break; + case DEV_MP_NCYCLES: + /* + * Return approximately the number of cycles executed + * in this machine. (This value is not updated for each + * instruction.) + */ + odata = cpu->machine->ncycles; + break; + default: fatal("[ dev_mp: unimplemented relative addr 0x%x ]\n", relative_addr); @@ -262,7 +272,7 @@ memset(d->ipi, 0, sizeof(int *) * n); memory_device_register(devinit->machine->memory, devinit->name, - devinit->addr, DEV_MP_LENGTH, dev_mp_access, d, MEM_DEFAULT, NULL); + devinit->addr, DEV_MP_LENGTH, dev_mp_access, d, DM_DEFAULT, NULL); return 1; }