Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/23199 )

Change subject: sim: Remove special KVM handling of the return from clone.
......................................................................

sim: Remove special KVM handling of the return from clone.

When the new thread context ctc is created, it should have a copy of
all the state in the original tc, including the original PC. This code
used to specially handle the KVM case by explicitly making this new
context return from the system call immediately by jumping right to
RCX which (assuming a particular instruction was used) is where user
mode should resume.

The first problem with this approach as far as I can tell is that the
CPU will still be in CPL0, ie supervisor mode, and will not have been
forced back into CPL3, ie user mode. This may not have any immediately
visible effect, but may down the line.

Second, this seems unnecessary. The non-special case code will advance
the PC beyond the instruction which triggered the system call. Then
once the new thread starts executing again, it will execute sysret and
return to rcx naturally, just like the original thread will.

Change-Id: I0d97f66e64ce39b13d6700dcf3d7da88d6fe0048
---
M src/sim/syscall_emul.hh
1 file changed, 3 insertions(+), 11 deletions(-)



diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 3480463..8216a7b 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1556,17 +1556,9 @@
     ctc->setIntReg(TheISA::SyscallPseudoReturnReg, 1);
 #endif

-    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);
-    }
+    TheISA::PCState cpc = tc->pcState();
+    cpc.advance();
+    ctc->pcState(cpc);
     ctc->activate();

     return cp->pid();

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23199
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I0d97f66e64ce39b13d6700dcf3d7da88d6fe0048
Gerrit-Change-Number: 23199
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to