SyscallDesc *_syscallDescs, int _numSyscallDescs)
: X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
{
+ if (kvmInSE)
+ panic("KVM CPU model does not support 32 bit processes");
+
_gdtStart = ULL(0xffffd000);
_gdtSize = PageBytes;
{
X86Process::initState();
+ if (useForClone)
+ return;
+
argsInit(PageBytes);
// Set up the vsyscall page for this process.
void
initState(ThreadContext* tc) override
{
+ if (shared)
+ return;
+
_basePtr = prepTopTable<EntryTypes...>(system, pageSize);
}
EmulationPageTable(
const std::string &__name, uint64_t _pid, Addr _pageSize) :
pageSize(_pageSize), offsetMask(mask(floorLog2(_pageSize))),
- _pid(_pid), _name(__name)
+ _pid(_pid), _name(__name), shared(false)
{
assert(isPowerOf2(pageSize));
}
ReadOnly = 8,
};
+ // flag which marks the page table as shared among software threads
+ bool shared;
+
virtual void initState(ThreadContext* tc) {};
// for DPRINTF compatibility
: SimObject(params), system(params->system),
useArchPT(params->useArchPT),
kvmInSE(params->kvmInSE),
+ useForClone(false),
pTable(pTable),
initVirtMem(system->getSystemPort(), this,
SETranslatingPortProxy::Always),
Stats::Scalar numSyscalls; // track how many system calls are executed
- bool useArchPT; // flag for using architecture specific page table
- bool kvmInSE; // running KVM requires special initialization
+ // flag for using architecture specific page table
+ bool useArchPT;
+ // running KVM requires special initialization
+ bool kvmInSE;
+ // flag for using the process as a thread which shares page tables
+ bool useForClone;
EmulationPageTable *pTable;
pp->pid = temp_pid;
pp->ppid = (flags & OS::TGT_CLONE_THREAD) ? p->ppid() : p->pid();
+ pp->useArchPT = p->useArchPT;
+ pp->kvmInSE = p->kvmInSE;
Process *cp = pp->create();
delete pp;
ptidBuf.copyOut(tc->getMemProxy());
}
+ if (flags & OS::TGT_CLONE_THREAD) {
+ cp->pTable->shared = true;
+ cp->useForClone = true;
+ }
cp->initState();
p->clone(tc, ctc, cp, flags);
ctc->setIntReg(TheISA::SyscallPseudoReturnReg, 1);
#endif
- TheISA::PCState cpc = tc->pcState();
- cpc.advance();
- ctc->pcState(cpc);
+ if (p->kvmInSE) {
+#if THE_ISA == X86_ISA
+ ctc->pcState(tc->readIntReg(TheISA::INTREG_RCX));
+#else
+ panic("KVM CPU model is not supported for this ISA");
+#endif
+ } else {
+ TheISA::PCState cpc = tc->pcState();
+ cpc.advance();
+ ctc->pcState(cpc);
+ }
ctc->activate();
return cp->pid();