syscall: Resolve conflicts between m5threads and Gabe's recent SE changes.
This commit is contained in:
parent
b0e9654f86
commit
52b6764f31
9 changed files with 13 additions and 14 deletions
|
@ -155,6 +155,7 @@ const int FramePointerReg = 15;
|
|||
const int SyscallNumReg = 0;
|
||||
const int FirstArgumentReg = 16;
|
||||
const int SyscallPseudoReturnReg = 20;
|
||||
const int SyscallSuccessReg = 19;
|
||||
|
||||
const int LogVMPageSize = 13; // 8K bytes
|
||||
const int VMPageSize = (1 << LogVMPageSize);
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
using namespace AlphaISA;
|
||||
using namespace std;
|
||||
|
||||
static const int SyscallSuccessReg = 19;
|
||||
|
||||
AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams *params,
|
||||
ObjectFile *objFile)
|
||||
: LiveProcess(params, objFile)
|
||||
|
|
|
@ -188,6 +188,10 @@ namespace MipsISA
|
|||
// semantically meaningful register indices
|
||||
const int ZeroReg = 0;
|
||||
const int AssemblerReg = 1;
|
||||
const int SyscallSuccessReg = 7;
|
||||
const int FirstArgumentReg = 4;
|
||||
const int ReturnValueReg = 2;
|
||||
|
||||
const int KernelReg0 = 26;
|
||||
const int KernelReg1 = 27;
|
||||
const int GlobalPointerReg = 28;
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
using namespace std;
|
||||
using namespace MipsISA;
|
||||
|
||||
static const int SyscallSuccessReg = 7;
|
||||
static const int FirstArgumentReg = 4;
|
||||
static const int ReturnValueReg = 2;
|
||||
|
||||
MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
|
||||
ObjectFile *objFile)
|
||||
: LiveProcess(params, objFile)
|
||||
|
|
|
@ -69,6 +69,7 @@ namespace SparcISA
|
|||
const int ZeroReg = 0; // architecturally meaningful
|
||||
// the rest of these depend on the ABI
|
||||
const int ReturnAddressReg = 31; // post call, precall is 15
|
||||
const int ReturnValueReg = 8; // Post return, 24 is pre-return.
|
||||
const int StackPointerReg = 14;
|
||||
const int FramePointerReg = 30;
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ using namespace std;
|
|||
using namespace SparcISA;
|
||||
|
||||
static const int FirstArgumentReg = 8;
|
||||
static const int ReturnValueReg = 8;
|
||||
|
||||
|
||||
SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params,
|
||||
|
|
|
@ -106,6 +106,7 @@ namespace X86ISA
|
|||
const int StackPointerReg = INTREG_RSP;
|
||||
//X86 doesn't seem to have a link register
|
||||
const int ReturnAddressReg = 0;
|
||||
const int ReturnValueReg = INTREG_RAX;
|
||||
const int FramePointerReg = INTREG_RBP;
|
||||
|
||||
// Some OS syscalls use a second register (rdx) to return a second
|
||||
|
|
|
@ -104,7 +104,6 @@
|
|||
using namespace std;
|
||||
using namespace X86ISA;
|
||||
|
||||
static const int ReturnValueReg = INTREG_RAX;
|
||||
static const int ArgumentReg[] = {
|
||||
INTREG_RDI,
|
||||
INTREG_RSI,
|
||||
|
|
|
@ -659,12 +659,12 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
ThreadContext *tc)
|
||||
{
|
||||
DPRINTF(SyscallVerbose, "In sys_clone:\n");
|
||||
DPRINTF(SyscallVerbose, " Flags=%llx\n", tc->getSyscallArg(0));
|
||||
DPRINTF(SyscallVerbose, " Child stack=%llx\n", tc->getSyscallArg(1));
|
||||
DPRINTF(SyscallVerbose, " Flags=%llx\n", process->getSyscallArg(tc, 0));
|
||||
DPRINTF(SyscallVerbose, " Child stack=%llx\n", process->getSyscallArg(tc, 1));
|
||||
|
||||
|
||||
if (tc->getSyscallArg(0) != 0x10f00) {
|
||||
warn("This sys_clone implementation assumes flags CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD (0x10f00), and may not work correctly with given flags 0x%llx\n", tc->getSyscallArg(0));
|
||||
if (process->getSyscallArg(tc, 0) != 0x10f00) {
|
||||
warn("This sys_clone implementation assumes flags CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD (0x10f00), and may not work correctly with given flags 0x%llx\n", process->getSyscallArg(tc, 0));
|
||||
}
|
||||
|
||||
ThreadContext* ctc; //child thread context
|
||||
|
@ -697,14 +697,14 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
|
|||
#endif
|
||||
|
||||
//Set up stack register
|
||||
ctc->setIntReg(TheISA::StackPointerReg, tc->getSyscallArg(1));
|
||||
ctc->setIntReg(TheISA::StackPointerReg, process->getSyscallArg(tc, 1));
|
||||
|
||||
//Set up syscall return values in parent and child
|
||||
ctc->setIntReg(ReturnValueReg, 0); //return value, child
|
||||
|
||||
//Alpha needs SyscallSuccessReg=0 in child
|
||||
#if THE_ISA == ALPHA_ISA
|
||||
ctc->setIntReg(SyscallSuccessReg, 0);
|
||||
ctc->setIntReg(TheISA::SyscallSuccessReg, 0);
|
||||
#endif
|
||||
|
||||
//In SPARC/Linux, clone returns 0 on pseudo-return register if parent, non-zero if child
|
||||
|
|
Loading…
Reference in a new issue