sim-se: Refactor clone to avoid most ifdefs
Some parts of clone are architecture dependent. In some cases, we are able to use architecture-specific helper functions or register aliases. However, there is still some architecture-specific that is protected by ifdefs in the common clone implementation. Move these architecture-specific bits to the architecture-specific OS class instead to avoid these ifdefs and make the code a bit more readable. Change-Id: Ia0903d738d0ba890863bddfa77e3b717db7f45de Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Cc: Giacomo Travaglini <giacomo.travaglini@arm.com> Cc: Javier Setoain <javier.setoain@arm.com> Cc: Brandon Potter <Brandon.Potter@amd.com> Reviewed-on: https://gem5-review.googlesource.com/c/15435 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#ifndef __ARCH_RISCV_LINUX_LINUX_HH__
|
||||
#define __ARCH_RISCV_LINUX_LINUX_HH__
|
||||
|
||||
#include "arch/riscv/utility.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
|
||||
class RiscvLinux : public Linux
|
||||
@@ -187,6 +188,17 @@ class RiscvLinux : public Linux
|
||||
uint64_t freehigh;
|
||||
uint32_t mem_unit;
|
||||
} tgt_sysinfo;
|
||||
|
||||
static void
|
||||
archClone(uint64_t flags,
|
||||
Process *pp, Process *cp,
|
||||
ThreadContext *ptc, ThreadContext *ctc,
|
||||
uint64_t stack, uint64_t tls)
|
||||
{
|
||||
RiscvISA::copyRegs(ptc, ctc);
|
||||
if (stack)
|
||||
ctc->setIntReg(RiscvISA::StackPointerReg, stack);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user