cpu.cc (2689:dbf969c18a65) cpu.cc (2690:f4337c0d9e6f)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 67 unchanged lines hidden (view full) ---

76
77 changedPC = willChangePC = changedNextPC = false;
78
79 exitOnError = p->exitOnError;
80#if FULL_SYSTEM
81 itb = p->itb;
82 dtb = p->dtb;
83 systemPtr = NULL;
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 67 unchanged lines hidden (view full) ---

76
77 changedPC = willChangePC = changedNextPC = false;
78
79 exitOnError = p->exitOnError;
80#if FULL_SYSTEM
81 itb = p->itb;
82 dtb = p->dtb;
83 systemPtr = NULL;
84 memPtr = NULL;
85#else
86 process = p->process;
87#endif
88}
89
90CheckerCPU::~CheckerCPU()
91{
92}
93
94void
95CheckerCPU::setMemory(MemObject *mem)
96{
84#else
85 process = p->process;
86#endif
87}
88
89CheckerCPU::~CheckerCPU()
90{
91}
92
93void
94CheckerCPU::setMemory(MemObject *mem)
95{
97 memPtr = mem;
98#if !FULL_SYSTEM
96#if !FULL_SYSTEM
97 memPtr = mem;
99 thread = new SimpleThread(this, /* thread_num */ 0, process,
100 /* asid */ 0, mem);
101
102 thread->setStatus(ThreadContext::Suspended);
103 tc = thread->getTC();
104 threadContexts.push_back(tc);
98 thread = new SimpleThread(this, /* thread_num */ 0, process,
99 /* asid */ 0, mem);
100
101 thread->setStatus(ThreadContext::Suspended);
102 tc = thread->getTC();
103 threadContexts.push_back(tc);
105#else
106 if (systemPtr) {
107 thread = new SimpleThread(this, 0, systemPtr, itb, dtb, memPtr, false);
108
109 thread->setStatus(ThreadContext::Suspended);
110 tc = thread->getTC();
111 threadContexts.push_back(tc);
112 delete thread->kernelStats;
113 thread->kernelStats = NULL;
114 }
115#endif
116}
117
104#endif
105}
106
118#if FULL_SYSTEM
119void
120CheckerCPU::setSystem(System *system)
121{
107void
108CheckerCPU::setSystem(System *system)
109{
110#if FULL_SYSTEM
122 systemPtr = system;
123
111 systemPtr = system;
112
124 if (memPtr) {
125 thread = new SimpleThread(this, 0, systemPtr, itb, dtb, memPtr, false);
113 thread = new SimpleThread(this, 0, systemPtr, itb, dtb, false);
126
114
127 thread->setStatus(ThreadContext::Suspended);
128 tc = thread->getTC();
129 threadContexts.push_back(tc);
130 delete thread->kernelStats;
131 thread->kernelStats = NULL;
132 }
133}
115 thread->setStatus(ThreadContext::Suspended);
116 tc = thread->getTC();
117 threadContexts.push_back(tc);
118 delete thread->kernelStats;
119 thread->kernelStats = NULL;
134#endif
120#endif
121}
135
136void
137CheckerCPU::setIcachePort(Port *icache_port)
138{
139 icachePort = icache_port;
140}
141
142void

--- 202 unchanged lines hidden (view full) ---

345 return write((uint32_t)data, addr, flags, res);
346}
347
348
349#if FULL_SYSTEM
350Addr
351CheckerCPU::dbg_vtophys(Addr addr)
352{
122
123void
124CheckerCPU::setIcachePort(Port *icache_port)
125{
126 icachePort = icache_port;
127}
128
129void

--- 202 unchanged lines hidden (view full) ---

332 return write((uint32_t)data, addr, flags, res);
333}
334
335
336#if FULL_SYSTEM
337Addr
338CheckerCPU::dbg_vtophys(Addr addr)
339{
353 return vtophys(xcProxy, addr);
340 return vtophys(tc, addr);
354}
355#endif // FULL_SYSTEM
356
357bool
358CheckerCPU::translateInstReq(Request *req)
359{
360#if FULL_SYSTEM
361 return (thread->translateInstReq(req) == NoFault);

--- 234 unchanged lines hidden (view full) ---

596
597 if (curStaticInst->isLoad()) {
598 ++numLoad;
599 }
600 }
601
602 if (fault != NoFault) {
603#if FULL_SYSTEM
341}
342#endif // FULL_SYSTEM
343
344bool
345CheckerCPU::translateInstReq(Request *req)
346{
347#if FULL_SYSTEM
348 return (thread->translateInstReq(req) == NoFault);

--- 234 unchanged lines hidden (view full) ---

583
584 if (curStaticInst->isLoad()) {
585 ++numLoad;
586 }
587 }
588
589 if (fault != NoFault) {
590#if FULL_SYSTEM
604 fault->invoke(xcProxy);
591 fault->invoke(tc);
605 willChangePC = true;
606 newPC = thread->readPC();
607 DPRINTF(Checker, "Fault, PC is now %#x\n", newPC);
608#else // !FULL_SYSTEM
609 fatal("fault (%d) detected @ PC 0x%08p", fault, thread->readPC());
610#endif // FULL_SYSTEM
611 } else {
612#if THE_ISA != MIPS_ISA

--- 12 unchanged lines hidden (view full) ---

625#if FULL_SYSTEM
626 // @todo: Determine if these should happen only if the
627 // instruction hasn't faulted. In the SimpleCPU case this may
628 // not be true, but in the O3 or Ozone case this may be true.
629 Addr oldpc;
630 int count = 0;
631 do {
632 oldpc = thread->readPC();
592 willChangePC = true;
593 newPC = thread->readPC();
594 DPRINTF(Checker, "Fault, PC is now %#x\n", newPC);
595#else // !FULL_SYSTEM
596 fatal("fault (%d) detected @ PC 0x%08p", fault, thread->readPC());
597#endif // FULL_SYSTEM
598 } else {
599#if THE_ISA != MIPS_ISA

--- 12 unchanged lines hidden (view full) ---

612#if FULL_SYSTEM
613 // @todo: Determine if these should happen only if the
614 // instruction hasn't faulted. In the SimpleCPU case this may
615 // not be true, but in the O3 or Ozone case this may be true.
616 Addr oldpc;
617 int count = 0;
618 do {
619 oldpc = thread->readPC();
633 system->pcEventQueue.service(xcProxy);
620 system->pcEventQueue.service(tc);
634 count++;
635 } while (oldpc != thread->readPC());
636 if (count > 1) {
637 willChangePC = true;
638 newPC = thread->readPC();
639 DPRINTF(Checker, "PC Event, PC is now %#x\n", newPC);
640 }
641#endif

--- 156 unchanged lines hidden ---
621 count++;
622 } while (oldpc != thread->readPC());
623 if (count > 1) {
624 willChangePC = true;
625 newPC = thread->readPC();
626 DPRINTF(Checker, "PC Event, PC is now %#x\n", newPC);
627 }
628#endif

--- 156 unchanged lines hidden ---