371c371
< Addr threadPC = thread->readPC();
---
> Addr instAddr = thread->instAddr();
374,380c374
< #if ISA_HAS_DELAY_SLOT
< DPRINTF(Fetch,"Fetch: PC:%08p NPC:%08p NNPC:%08p\n",threadPC,
< thread->readNextPC(),thread->readNextNPC());
< #else
< DPRINTF(Fetch,"Fetch: PC:%08p NPC:%08p\n",threadPC,
< thread->readNextPC());
< #endif
---
> DPRINTF(Fetch, "Fetch: PC:%08p\n", instAddr);
382,383c376,377
< Addr fetchPC = (threadPC & PCMask) + fetchOffset;
< req->setVirt(0, fetchPC, sizeof(MachInst), Request::INST_FETCH, threadPC);
---
> Addr fetchPC = (instAddr & PCMask) + fetchOffset;
> req->setVirt(0, fetchPC, sizeof(MachInst), Request::INST_FETCH, instAddr);
402c396
< MicroPC upc = thread->readMicroPC();
---
> TheISA::PCState pcState = thread->pcState();
404c398
< if (isRomMicroPC(upc)) {
---
> if (isRomMicroPC(pcState.microPC())) {
406c400,401
< curStaticInst = microcodeRom.fetchMicroop(upc, curMacroStaticInst);
---
> curStaticInst = microcodeRom.fetchMicroop(pcState.microPC(),
> curMacroStaticInst);
415c410
< Addr fetchPC = (thread->readPC() & PCMask) + fetchOffset;
---
> Addr fetchPC = (pcState.instAddr() & PCMask) + fetchOffset;
417c412
< predecoder.moreBytes(thread->readPC(), fetchPC, inst);
---
> predecoder.moreBytes(pcState, fetchPC, inst);
424,426d418
< #if THE_ISA == X86_ISA || THE_ISA == ARM_ISA
< thread->setNextPC(thread->readPC() + predecoder.getInstSize());
< #endif // X86_ISA
428,429c420,422
< instPtr = StaticInst::decode(predecoder.getExtMachInst(),
< thread->readPC());
---
> ExtMachInst machInst = predecoder.getExtMachInst(pcState);
> thread->pcState(pcState);
> instPtr = StaticInst::decode(machInst, pcState.instAddr());
439c432
< curStaticInst = curMacroStaticInst->fetchMicroop(upc);
---
> curStaticInst = curMacroStaticInst->fetchMicroop(pcState.microPC());
445c438
< curStaticInst = curMacroStaticInst->fetchMicroop(upc);
---
> curStaticInst = curMacroStaticInst->fetchMicroop(pcState.microPC());
453,454c446
< curStaticInst, thread->readPC(),
< curMacroStaticInst, thread->readMicroPC());
---
> curStaticInst, thread->pcState(), curMacroStaticInst);
464a457,460
> assert(curStaticInst);
>
> TheISA::PCState pc = tc->pcState();
> Addr instAddr = pc.instAddr();
466c462
< if (thread->profile && curStaticInst) {
---
> if (thread->profile) {
468c464
< thread->profilePC = usermode ? 1 : thread->readPC();
---
> thread->profilePC = usermode ? 1 : instAddr;
485c481
< CPA::cpa()->swAutoBegin(tc, thread->readNextPC());
---
> CPA::cpa()->swAutoBegin(tc, pc.nextInstAddr());
488c484
< traceFunctions(thread->readPC());
---
> traceFunctions(instAddr);
508,517c504,509
< //If we're at the last micro op for this instruction
< if (curStaticInst && curStaticInst->isLastMicroop()) {
< //We should be working with a macro op or be in the ROM
< assert(curMacroStaticInst ||
< isRomMicroPC(thread->readMicroPC()));
< //Close out this macro op, and clean up the
< //microcode state
< curMacroStaticInst = StaticInst::nullStaticInstPtr;
< thread->setMicroPC(normalMicroPC(0));
< thread->setNextMicroPC(normalMicroPC(1));
---
> if (curStaticInst) {
> if (curStaticInst->isLastMicroop())
> curMacroStaticInst = StaticInst::nullStaticInstPtr;
> TheISA::PCState pcState = thread->pcState();
> TheISA::advancePC(pcState, curStaticInst);
> thread->pcState(pcState);
519,532d510
< //If we're still in a macro op
< if (curMacroStaticInst || isRomMicroPC(thread->readMicroPC())) {
< //Advance the micro pc
< thread->setMicroPC(thread->readNextMicroPC());
< //Advance the "next" micro pc. Note that there are no delay
< //slots, and micro ops are "word" addressed.
< thread->setNextMicroPC(thread->readNextMicroPC() + 1);
< } else {
< // go to the next instruction
< thread->setPC(thread->readNextPC());
< thread->setNextPC(thread->readNextNPC());
< thread->setNextNPC(thread->readNextNPC() + sizeof(MachInst));
< assert(thread->readNextPC() != thread->readNextNPC());
< }