diff options
author | Alexandru Dutu <alexandru.dutu@amd.com> | 2019-04-15 23:36:36 -0400 |
---|---|---|
committer | Alexandru Duțu <alexandru.dutu@amd.com> | 2019-04-22 23:11:31 +0000 |
commit | c5b3db6da28611280c291d9e0540f087cf55a54e (patch) | |
tree | 71506b9c6f2f6b0fc5d4a3361ee2e247cf518805 /src/sim/syscall_emul.hh | |
parent | 382263c6706296fee2548f74fd4b811553106dba (diff) | |
download | gem5-c5b3db6da28611280c291d9e0540f087cf55a54e.tar.xz |
sim-se: Enhance clone for X86KvmCPU
This changeset enables clone to work with X86KvmCPU model, which
will allow running multi-threaded applications at near hardware
speeds. Even though the application is multi-threaded, the KvmCPU
model uses one event queue, therefore, only one hardware thread
will be used, through KVM, to simulate multiple application threads.
Change-Id: I2b2a7b1edb1c56eeb9c4fa0553cd236029cd53f8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18268
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r-- | src/sim/syscall_emul.hh | 20 |
1 files changed, 17 insertions, 3 deletions
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(); |