arch-power: Add clone support

This adds support for the clone() system call using
which multiple cpus can be utilized in SE mode. For
this change, it should be noted that Linux on Power
uses the CLONE_BACKWARDS argument order.

Change-Id: Iac91a7d110d9f7a133b8e102ac113f48a431a0d6
Signed-off-by: Kevin Joe <0keik0de@gmail.com>
Signed-off-by: Chetan Agarwal <chetanag35@gmail.com>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47579
Reviewed-by: Boris Shingarov <shingarov@labware.com>
Maintainer: Boris Shingarov <shingarov@labware.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Sandipan Das
2021-07-05 12:46:16 +05:30
parent 80becc6684
commit 711f7a3009
3 changed files with 20 additions and 1 deletions

View File

@@ -32,6 +32,9 @@
#include <map>
#include "arch/power/isa.hh"
#include "arch/power/regs/int.hh"
#include "cpu/thread_context.hh"
#include "kern/linux/linux.hh"
namespace gem5
@@ -214,6 +217,21 @@ class PowerLinux : public Linux
return false;
}
}
static void
archClone(uint64_t flags,
Process *pp, Process *cp,
ThreadContext *ptc, ThreadContext *ctc,
uint64_t stack, uint64_t tls)
{
ctc->getIsaPtr()->copyRegsFrom(ptc);
if (flags & TGT_CLONE_SETTLS)
ctc->setIntReg(PowerISA::ThreadPointerReg, tls);
if (stack)
ctc->setIntReg(PowerISA::StackPointerReg, stack);
}
};
} // namespace gem5

View File

@@ -227,7 +227,7 @@ SyscallDescTable<PowerISA::SEWorkload::SyscallABI> EmuLinux::syscallDescs = {
{ 117, "ipc" },
{ 118, "fsync" },
{ 119, "sigreturn" },
{ 120, "clone" },
{ 120, "clone", cloneBackwardsFunc<PowerLinux> },
{ 121, "setdomainname" },
{ 122, "uname", unameFunc },
{ 123, "modify_ldt" },

View File

@@ -55,6 +55,7 @@ const int ArgumentReg4 = 7;
const int ArgumentReg5 = 8;
const int StackPointerReg = 1;
const int TOCPointerReg = 2;
const int ThreadPointerReg = 13;
enum MiscIntRegNums
{