// As of now, there isn't a 32 bit thumb version of this instruction.
assert(!machInst.bigThumb);
- tc->syscall();
+ tc->getSystemPtr()->workload->syscall(tc);
// Advance the PC since that won't happen automatically.
PCState pc = tc->pcState();
void
SyscallFault::invokeSE(ThreadContext *tc, const StaticInstPtr &inst)
{
- tc->syscall();
+ tc->getSystemPtr()->workload->syscall(tc);
}
} // namespace RiscvISA
{
switch (trapNum) {
case 0x10: //Linux 32 bit syscall trap
- tc->syscall();
+ tc->getSystemPtr()->workload->syscall(tc);
break;
default:
SparcProcess::handleTrap(trapNum, tc);
switch (trapNum) {
// case 0x10: // Linux 32 bit syscall trap
case 0x6d: // Linux 64 bit syscall trap
- tc->syscall();
+ tc->getSystemPtr()->workload->syscall(tc);
break;
case 0x6e: // Linux 64 bit getcontext trap
getContext(tc);
/////////////////////////////////////////////////////
void wakeup(ThreadID tid) override { }
- // Assume that the normal CPU's call to syscall was successful.
- // The checker's state would have already been updated by the syscall.
- void syscall() override { }
void
handleError()
actualTC->connectMemPorts(tc);
}
- /** Executes a syscall in SE mode. */
- void syscall() override { return actualTC->syscall(); }
-
Status status() const override { return actualTC->status(); }
void
/** @} */
- /**
- * @{
- * @name SysCall Emulation Interfaces
- */
-
- /**
- * Executes a syscall.
- */
- virtual void syscall() = 0;
-
- /** @} */
-
/** Returns a pointer to the ThreadContext. */
virtual ThreadContext *tcBase() const = 0;
return thread.setMiscReg(reg.index(), val);
}
- void syscall() override { thread.syscall(); }
-
ThreadContext *tcBase() const override { return thread.getTC(); }
/* @todo, should make stCondFailures persistent somewhere */
fault->invoke(this->threadContexts[tid], inst);
}
-template <class Impl>
-void
-FullO3CPU<Impl>::syscall(ThreadID tid)
-{
- DPRINTF(O3CPU, "[tid:%i] Executing syscall().\n\n", tid);
-
- DPRINTF(Activity,"Activity: syscall() called.\n");
-
- // Temporarily increase this by one to account for the syscall
- // instruction.
- ++(this->thread[tid]->funcExeInst);
-
- // Execute the actual syscall.
- this->thread[tid]->syscall();
-
- // Decrease funcExeInst by one as the normal commit will handle
- // incrementing it.
- --(this->thread[tid]->funcExeInst);
-}
-
template <class Impl>
void
FullO3CPU<Impl>::serializeThread(CheckpointOut &cp, ThreadID tid) const
void exitThreads();
public:
- /** Executes a syscall.
- * @todo: Determine if this needs to be virtual.
- */
- void syscall(ThreadID tid);
-
/** Starts draining the CPU's pipeline of all instructions in
* order to stop all memory accesses. */
DrainState drain() override;
/** Traps to handle specified fault. */
void trap(const Fault &fault);
- /** Emulates a syscall. */
- void syscall() override;
-
public:
// The register accessor methods provide the index of the
this->cpu->trap(fault, this->threadNumber, this->staticInst);
}
-template <class Impl>
-void
-BaseO3DynInst<Impl>::syscall()
-{
- // HACK: check CPU's nextPC before and after syscall. If it
- // changes, update this instruction's nextPC because the syscall
- // must have changed the nextPC.
- TheISA::PCState curPC = this->cpu->pcState(this->threadNumber);
- this->cpu->syscall(this->threadNumber);
- TheISA::PCState newPC = this->cpu->pcState(this->threadNumber);
- if (!(curPC == newPC)) {
- this->pcState(newPC);
- }
-}
-
#endif//__CPU_O3_DYN_INST_IMPL_HH__
thread->storeCondFailures = sc_failures;
}
- /** Executes a syscall in SE mode. */
- void
- syscall() override
- {
- return cpu->syscall(thread->threadId());
- }
-
/** Reads the funcExeInst counter. */
Counter readFuncExeInst() const override { return thread->funcExeInst; }
/** Returns a pointer to the TC of this thread. */
ThreadContext *getTC() { return tc; }
-
- /** Handles the syscall. */
- void syscall() { process->syscall(tc); }
};
#endif // __CPU_O3_THREAD_STATE_HH__
return thread->readStCondFailures();
}
- /**
- * Executes a syscall specified by the callnum.
- */
- void syscall() override { thread->syscall(); }
-
/** Returns a pointer to the ThreadContext. */
ThreadContext *tcBase() const override { return thread->getTC(); }
return ThreadState::readFuncExeInst();
}
- void syscall() override { process->syscall(this); }
-
RegVal readIntRegFlat(RegIndex idx) const override { return intRegs[idx]; }
void
setIntRegFlat(RegIndex idx, RegVal val) override
// Same with st cond failures.
virtual Counter readFuncExeInst() const = 0;
- virtual void syscall() = 0;
-
// This function exits the thread context in the CPU and returns
// 1 if the CPU has no more active threads (meaning it's OK to exit);
// Used in syscall-emulation mode when a thread calls the exit syscall.
void
SESyscallFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
- tc->syscall();
+ tc->getSystemPtr()->workload->syscall(tc);
// Move the PC forward since that doesn't happen automatically.
TheISA::PCState pc = tc->pcState();
inst->advancePC(pc);
m5Syscall(ThreadContext *tc)
{
DPRINTF(PseudoInst, "PseudoInst::m5Syscall()\n");
- tc->syscall();
+ tc->getSystemPtr()->workload->syscall(tc);
}
void
#include "sim/se_workload.hh"
+#include "cpu/thread_context.hh"
#include "params/SEWorkload.hh"
+#include "sim/process.hh"
SEWorkload::SEWorkload(const Params &p) : Workload(&p), _params(p)
+{}
+
+void
+SEWorkload::syscall(ThreadContext *tc)
{
+ tc->getProcessPtr()->syscall(tc);
}
SEWorkload *
// within it.
panic("No workload symbol table for syscall emulation mode.");
}
+
+ void syscall(ThreadContext *tc) override;
};
#endif // __SIM_SE_WORKLOAD_HH__
virtual const Loader::SymbolTable &symtab(ThreadContext *tc) = 0;
virtual bool insertSymbol(const Loader::Symbol &symbol) = 0;
+ virtual void
+ syscall(ThreadContext *tc)
+ {
+ panic("syscall() not implemented.");
+ }
+
/** @{ */
/**
* Add a function-based event to the given function, to be looked