summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc1
-rw-r--r--src/sim/process.hh8
-rw-r--r--src/sim/syscall_emul.hh20
3 files changed, 24 insertions, 5 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index c4dd64107..5cec2958e 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -106,6 +106,7 @@ Process::Process(ProcessParams *params, EmulationPageTable *pTable,
: SimObject(params), system(params->system),
useArchPT(params->useArchPT),
kvmInSE(params->kvmInSE),
+ useForClone(false),
pTable(pTable),
initVirtMem(system->getSystemPort(), this,
SETranslatingPortProxy::Always),
diff --git a/src/sim/process.hh b/src/sim/process.hh
index c690e825e..a1ca84bf5 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -172,8 +172,12 @@ class Process : public SimObject
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;
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 0378bd770..87c16c489 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1551,6 +1551,8 @@ cloneFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
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;
@@ -1566,6 +1568,10 @@ cloneFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
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);
@@ -1599,9 +1605,17 @@ cloneFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
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();