Got rid of "inPalMode". Some places are still effectively checking if they are in PAL mode, however.

--HG--
extra : convert_revision : b52d9642efc474eaf97437fa2df879efefa0062b
This commit is contained in:
Gabe Black 2006-11-03 04:25:33 -05:00
parent c8fc116c76
commit 118b9dc1f9
23 changed files with 31 additions and 94 deletions

View file

@ -147,7 +147,7 @@ AlphaISA::zeroRegisters(CPU *cpu)
Fault Fault
SimpleThread::hwrei() SimpleThread::hwrei()
{ {
if (!inPalMode()) if (!(readPC() & 0x3))
return new UnimplementedOpcodeFault; return new UnimplementedOpcodeFault;
setNextPC(readMiscReg(AlphaISA::IPR_EXC_ADDR)); setNextPC(readMiscReg(AlphaISA::IPR_EXC_ADDR));

View file

@ -125,7 +125,7 @@ void AlphaFault::invoke(ThreadContext * tc)
countStat()++; countStat()++;
// exception restart address // exception restart address
if (setRestartAddress() || !tc->inPalMode()) if (setRestartAddress() || !(tc->readPC() & 0x3))
tc->setMiscReg(AlphaISA::IPR_EXC_ADDR, tc->readPC()); tc->setMiscReg(AlphaISA::IPR_EXC_ADDR, tc->readPC());
if (skipFaultingInstruction()) { if (skipFaultingInstruction()) {

View file

@ -88,15 +88,6 @@ namespace AlphaISA
intstatus = 0; intstatus = 0;
} }
bool check_interrupt(int int_num) const {
if (int_num > NumInterruptLevels)
panic("int_num out of bounds\n");
return interrupts[int_num] != 0;
}
bool check_interrupts() const { return intstatus != 0; }
void serialize(std::ostream &os) void serialize(std::ostream &os)
{ {
SERIALIZE_ARRAY(interrupts, NumInterruptLevels); SERIALIZE_ARRAY(interrupts, NumInterruptLevels);
@ -109,6 +100,11 @@ namespace AlphaISA
UNSERIALIZE_SCALAR(intstatus); UNSERIALIZE_SCALAR(intstatus);
} }
bool check_interrupts(ThreadContext * tc) const
{
return (intstatus != 0) && !(tc->readPC() & 0x3);
}
Fault getInterrupt(ThreadContext * tc) Fault getInterrupt(ThreadContext * tc)
{ {
int ipl = 0; int ipl = 0;
@ -163,7 +159,6 @@ namespace AlphaISA
} }
private: private:
uint64_t intr_status() const { return intstatus; }
}; };
} }

View file

@ -89,12 +89,8 @@ class BaseCPU : public MemObject
virtual void clear_interrupts(); virtual void clear_interrupts();
bool checkInterrupts; bool checkInterrupts;
bool check_interrupt(int int_num) const { bool check_interrupts(ThreadContext * tc) const
return interrupts.check_interrupt(int_num); { return interrupts.check_interrupts(tc); }
}
bool check_interrupts() const { return interrupts.check_interrupts(); }
//uint64_t intr_status() const { return interrupts.intr_status(); }
class ProfileEvent : public Event class ProfileEvent : public Event
{ {

View file

@ -327,7 +327,6 @@ class CheckerCPU : public BaseCPU
#if FULL_SYSTEM #if FULL_SYSTEM
Fault hwrei() { return thread->hwrei(); } Fault hwrei() { return thread->hwrei(); }
bool inPalMode() { return thread->inPalMode(); }
void ev5_trap(Fault fault) { fault->invoke(tc); } void ev5_trap(Fault fault) { fault->invoke(tc); }
bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); } bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); }
#else #else

View file

@ -271,9 +271,6 @@ class CheckerThreadContext : public ThreadContext
checkerTC->setStCondFailures(sc_failures); checkerTC->setStCondFailures(sc_failures);
actualTC->setStCondFailures(sc_failures); actualTC->setStCondFailures(sc_failures);
} }
#if FULL_SYSTEM
bool inPalMode() { return actualTC->inPalMode(); }
#endif
// @todo: Fix this! // @todo: Fix this!
bool misspeculating() { return actualTC->misspeculating(); } bool misspeculating() { return actualTC->misspeculating(); }

View file

@ -153,9 +153,6 @@ class AlphaO3CPU : public FullO3CPU<Impl>
void post_interrupt(int int_num, int index); void post_interrupt(int int_num, int index);
/** HW return from error interrupt. */ /** HW return from error interrupt. */
Fault hwrei(unsigned tid); Fault hwrei(unsigned tid);
/** Returns if a specific PC is a PAL mode PC. */
bool inPalMode(uint64_t PC)
{ return AlphaISA::PcPAL(PC); }
bool simPalCheck(int palFunc, unsigned tid); bool simPalCheck(int palFunc, unsigned tid);

View file

@ -278,11 +278,12 @@ AlphaO3CPU<Impl>::processInterrupts()
// Check if there are any outstanding interrupts // Check if there are any outstanding interrupts
//Handle the interrupts //Handle the interrupts
this->checkInterrupts = false;
Fault interrupt = this->interrupts.getInterrupt(this->tcBase(0)); Fault interrupt = this->interrupts.getInterrupt(this->tcBase(0));
if (interrupt != NoFault) if (interrupt != NoFault) {
this->checkInterrupts = false;
this->trap(interrupt, 0); this->trap(interrupt, 0);
}
} }
#endif // FULL_SYSTEM #endif // FULL_SYSTEM

View file

@ -126,8 +126,6 @@ class AlphaDynInst : public BaseDynInst<Impl>
#if FULL_SYSTEM #if FULL_SYSTEM
/** Calls hardware return from error interrupt. */ /** Calls hardware return from error interrupt. */
Fault hwrei(); Fault hwrei();
/** Checks if system is in PAL mode. */
bool inPalMode();
/** Traps to handle specified fault. */ /** Traps to handle specified fault. */
void trap(Fault fault); void trap(Fault fault);
bool simPalCheck(int palFunc); bool simPalCheck(int palFunc);

View file

@ -113,7 +113,7 @@ Fault
AlphaDynInst<Impl>::hwrei() AlphaDynInst<Impl>::hwrei()
{ {
// Can only do a hwrei when in pal mode. // Can only do a hwrei when in pal mode.
if (!this->cpu->inPalMode(this->readPC())) if (!(this->readPC() & 0x3))
return new AlphaISA::UnimplementedOpcodeFault; return new AlphaISA::UnimplementedOpcodeFault;
// Set the next PC based on the value of the EXC_ADDR IPR. // Set the next PC based on the value of the EXC_ADDR IPR.
@ -127,13 +127,6 @@ AlphaDynInst<Impl>::hwrei()
return NoFault; return NoFault;
} }
template <class Impl>
bool
AlphaDynInst<Impl>::inPalMode()
{
return this->cpu->inPalMode(this->PC);
}
template <class Impl> template <class Impl>
void void
AlphaDynInst<Impl>::trap(Fault fault) AlphaDynInst<Impl>::trap(Fault fault)

View file

@ -47,11 +47,6 @@ class AlphaTC : public O3ThreadContext<Impl>
{ {
return this->thread->quiesceEvent; return this->thread->quiesceEvent;
} }
/** Returns if the thread is currently in PAL mode, based on
* the PC's value. */
virtual bool inPalMode()
{ return TheISA::PcPAL(this->cpu->readPC(this->thread->readTid())); }
#endif #endif
virtual uint64_t readNextNPC() virtual uint64_t readNextNPC()

View file

@ -638,8 +638,7 @@ DefaultCommit<Impl>::commit()
// and no other traps or external squashes are currently pending. // and no other traps or external squashes are currently pending.
// @todo: Allow other threads to handle interrupts. // @todo: Allow other threads to handle interrupts.
if (cpu->checkInterrupts && if (cpu->checkInterrupts &&
cpu->check_interrupts() && cpu->check_interrupts(cpu->tcBase(0)) &&
!cpu->inPalMode(readPC()) &&
!trapSquash[0] && !trapSquash[0] &&
!tcSquash[0]) { !tcSquash[0]) {
// Tell fetch that there is an interrupt pending. This will // Tell fetch that there is an interrupt pending. This will

View file

@ -559,14 +559,9 @@ DefaultFetch<Impl>::fetchCacheLine(Addr fetch_PC, Fault &ret_fault, unsigned tid
{ {
Fault fault = NoFault; Fault fault = NoFault;
#if FULL_SYSTEM //AlphaDep
// Flag to say whether or not address is physical addr. if (cacheBlocked || isSwitchedOut() ||
unsigned flags = cpu->inPalMode(fetch_PC) ? PHYSICAL : 0; (interruptPending && (fetch_PC & 0x3))) {
#else
unsigned flags = 0;
#endif // FULL_SYSTEM
if (cacheBlocked || isSwitchedOut() || (interruptPending && flags == 0)) {
// Hold off fetch from getting new instructions when: // Hold off fetch from getting new instructions when:
// Cache is blocked, or // Cache is blocked, or
// while an interrupt is pending and we're not in PAL mode, or // while an interrupt is pending and we're not in PAL mode, or
@ -585,7 +580,7 @@ DefaultFetch<Impl>::fetchCacheLine(Addr fetch_PC, Fault &ret_fault, unsigned tid
// Setup the memReq to do a read of the first instruction's address. // Setup the memReq to do a read of the first instruction's address.
// Set the appropriate read size and flags as well. // Set the appropriate read size and flags as well.
// Build request here. // Build request here.
RequestPtr mem_req = new Request(tid, fetch_PC, cacheBlkSize, flags, RequestPtr mem_req = new Request(tid, fetch_PC, cacheBlkSize, 0,
fetch_PC, cpu->readCpuId(), tid); fetch_PC, cpu->readCpuId(), tid);
memReq[tid] = mem_req; memReq[tid] = mem_req;

View file

@ -239,10 +239,6 @@ class OzoneCPU : public BaseCPU
void setStCondFailures(unsigned sc_failures) void setStCondFailures(unsigned sc_failures)
{ thread->storeCondFailures = sc_failures; } { thread->storeCondFailures = sc_failures; }
#if FULL_SYSTEM
bool inPalMode() { return cpu->inPalMode(); }
#endif
bool misspeculating() { return false; } bool misspeculating() { return false; }
#if !FULL_SYSTEM #if !FULL_SYSTEM
@ -584,8 +580,6 @@ class OzoneCPU : public BaseCPU
#if FULL_SYSTEM #if FULL_SYSTEM
Fault hwrei(); Fault hwrei();
bool inPalMode() { return AlphaISA::PcPAL(thread.PC); }
bool inPalMode(Addr pc) { return AlphaISA::PcPAL(pc); }
bool simPalCheck(int palFunc); bool simPalCheck(int palFunc);
void processInterrupts(); void processInterrupts();
#else #else

View file

@ -238,7 +238,6 @@ class OzoneDynInst : public BaseDynInst<Impl>
#if FULL_SYSTEM #if FULL_SYSTEM
Fault hwrei(); Fault hwrei();
bool inPalMode();
void trap(Fault fault); void trap(Fault fault);
bool simPalCheck(int palFunc); bool simPalCheck(int palFunc);
#else #else

View file

@ -249,7 +249,7 @@ template <class Impl>
Fault Fault
OzoneDynInst<Impl>::hwrei() OzoneDynInst<Impl>::hwrei()
{ {
if (!this->cpu->inPalMode(this->readPC())) if (!(this->readPC() & 0x3))
return new AlphaISA::UnimplementedOpcodeFault; return new AlphaISA::UnimplementedOpcodeFault;
this->setNextPC(this->thread->readMiscReg(AlphaISA::IPR_EXC_ADDR)); this->setNextPC(this->thread->readMiscReg(AlphaISA::IPR_EXC_ADDR));
@ -260,13 +260,6 @@ OzoneDynInst<Impl>::hwrei()
return NoFault; return NoFault;
} }
template <class Impl>
bool
OzoneDynInst<Impl>::inPalMode()
{
return this->cpu->inPalMode();
}
template <class Impl> template <class Impl>
void void
OzoneDynInst<Impl>::trap(Fault fault) OzoneDynInst<Impl>::trap(Fault fault)

View file

@ -462,15 +462,10 @@ Fault
FrontEnd<Impl>::fetchCacheLine() FrontEnd<Impl>::fetchCacheLine()
{ {
// Read a cache line, based on the current PC. // Read a cache line, based on the current PC.
#if FULL_SYSTEM
// Flag to say whether or not address is physical addr.
unsigned flags = cpu->inPalMode(PC) ? PHYSICAL : 0;
#else
unsigned flags = 0;
#endif // FULL_SYSTEM
Fault fault = NoFault; Fault fault = NoFault;
if (interruptPending && flags == 0) { //AlphaDep
if (interruptPending && (PC & 0x3)) {
return fault; return fault;
} }

View file

@ -152,11 +152,11 @@ InorderBackEnd<Impl>::tick()
#if FULL_SYSTEM #if FULL_SYSTEM
if (interruptBlocked || if (interruptBlocked ||
(cpu->checkInterrupts && (cpu->checkInterrupts &&
cpu->check_interrupts() && cpu->check_interrupts(tc))) {
!cpu->inPalMode())) {
if (!robEmpty()) { if (!robEmpty()) {
interruptBlocked = true; interruptBlocked = true;
} else if (robEmpty() && cpu->inPalMode()) { //AlphaDep
} else if (robEmpty() && (PC & 0x3)) {
// Will need to let the front end continue a bit until // Will need to let the front end continue a bit until
// we're out of pal mode. Hopefully we never get into an // we're out of pal mode. Hopefully we never get into an
// infinite loop... // infinite loop...

View file

@ -526,8 +526,7 @@ void
LWBackEnd<Impl>::checkInterrupts() LWBackEnd<Impl>::checkInterrupts()
{ {
if (cpu->checkInterrupts && if (cpu->checkInterrupts &&
cpu->check_interrupts() && cpu->check_interrupts(tc) &&
!cpu->inPalMode(thread->readPC()) &&
!trapSquash && !trapSquash &&
!tcSquash) { !tcSquash) {
frontEnd->interruptPending = true; frontEnd->interruptPending = true;

View file

@ -311,11 +311,11 @@ void
BaseSimpleCPU::checkForInterrupts() BaseSimpleCPU::checkForInterrupts()
{ {
#if FULL_SYSTEM #if FULL_SYSTEM
if (checkInterrupts && check_interrupts() && !thread->inPalMode()) { if (checkInterrupts && check_interrupts(tc)) {
checkInterrupts = false;
Fault interrupt = interrupts.getInterrupt(tc); Fault interrupt = interrupts.getInterrupt(tc);
if (interrupt != NoFault) { if (interrupt != NoFault) {
checkInterrupts = false;
interrupt->invoke(tc); interrupt->invoke(tc);
} }
} }
@ -371,6 +371,10 @@ BaseSimpleCPU::preExecute()
StaticInstPtr instPtr = StaticInst::decode(makeExtMI(inst, thread->readPC())); StaticInstPtr instPtr = StaticInst::decode(makeExtMI(inst, thread->readPC()));
#elif THE_ISA == SPARC_ISA #elif THE_ISA == SPARC_ISA
StaticInstPtr instPtr = StaticInst::decode(makeExtMI(inst, thread->getTC())); StaticInstPtr instPtr = StaticInst::decode(makeExtMI(inst, thread->getTC()));
#elif THE_ISA == MIPS_ISA
//Mips doesn't do anything in it's MakeExtMI function right now,
//so it won't be called.
StaticInstPtr instPtr = StaticInst::decode(inst);
#endif #endif
if (instPtr->isMacroOp()) { if (instPtr->isMacroOp()) {
curMacroStaticInst = instPtr; curMacroStaticInst = instPtr;

View file

@ -302,7 +302,6 @@ class BaseSimpleCPU : public BaseCPU
#if FULL_SYSTEM #if FULL_SYSTEM
Fault hwrei() { return thread->hwrei(); } Fault hwrei() { return thread->hwrei(); }
bool inPalMode() { return thread->inPalMode(); }
void ev5_trap(Fault fault) { fault->invoke(tc); } void ev5_trap(Fault fault) { fault->invoke(tc); }
bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); } bool simPalCheck(int palFunc) { return thread->simPalCheck(palFunc); }
#else #else

View file

@ -440,10 +440,6 @@ class SimpleThread : public ThreadState
void setStCondFailures(unsigned sc_failures) void setStCondFailures(unsigned sc_failures)
{ storeCondFailures = sc_failures; } { storeCondFailures = sc_failures; }
#if FULL_SYSTEM
bool inPalMode() { return AlphaISA::PcPAL(regs.readPC()); }
#endif
#if !FULL_SYSTEM #if !FULL_SYSTEM
TheISA::IntReg getSyscallArg(int i) TheISA::IntReg getSyscallArg(int i)
{ {

View file

@ -236,10 +236,6 @@ class ThreadContext
virtual void setStCondFailures(unsigned sc_failures) = 0; virtual void setStCondFailures(unsigned sc_failures) = 0;
#if FULL_SYSTEM
virtual bool inPalMode() = 0;
#endif
// Only really makes sense for old CPU model. Still could be useful though. // Only really makes sense for old CPU model. Still could be useful though.
virtual bool misspeculating() = 0; virtual bool misspeculating() = 0;
@ -424,9 +420,6 @@ class ProxyThreadContext : public ThreadContext
void setStCondFailures(unsigned sc_failures) void setStCondFailures(unsigned sc_failures)
{ actualTC->setStCondFailures(sc_failures); } { actualTC->setStCondFailures(sc_failures); }
#if FULL_SYSTEM
bool inPalMode() { return actualTC->inPalMode(); }
#endif
// @todo: Fix this! // @todo: Fix this!
bool misspeculating() { return actualTC->misspeculating(); } bool misspeculating() { return actualTC->misspeculating(); }