diff options
author | Brandon Potter <brandon.potter@amd.com> | 2017-02-27 14:10:15 -0500 |
---|---|---|
committer | Brandon Potter <brandon.potter@amd.com> | 2017-02-27 14:10:15 -0500 |
commit | 2367198921765848a4f5b3d020a7cc5776209f80 (patch) | |
tree | 00cff9357d9e5f2bec277cf937e8a73944ce1c98 /src/arch/alpha/process.cc | |
parent | 073cb266079edddec64ea8cd5169dd2cbef8f812 (diff) | |
download | gem5-2367198921765848a4f5b3d020a7cc5776209f80.tar.xz |
syscall_emul: [PATCH 15/22] add clone/execve for threading and multiprocess simulations
Modifies the clone system call and adds execve system call. Requires allowing
processes to steal thread contexts from other processes in the same system
object and the ability to detach pieces of process state (such as MemState)
to allow dynamic sharing.
Diffstat (limited to 'src/arch/alpha/process.cc')
-rw-r--r-- | src/arch/alpha/process.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index 582dbb57d..64d0b54a9 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -50,19 +50,20 @@ using namespace std; AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) : Process(params, objFile) { - brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); - brk_point = roundUp(brk_point, PageBytes); + memState->brkPoint = objFile->dataBase() + objFile->dataSize() + + objFile->bssSize(); + memState->brkPoint = roundUp(memState->brkPoint, PageBytes); // Set up stack. On Alpha, stack goes below text section. This // code should get moved to some architecture-specific spot. - stack_base = objFile->textBase() - (409600+4096); + memState->stackBase = objFile->textBase() - (409600+4096); // Set up region for mmaps. Tru64 seems to start just above 0 and // grow up from there. - mmap_end = 0x10000; + memState->mmapEnd = 0x10000; // Set pointer for next thread stack. Reserve 8M for main stack. - next_thread_stack_base = stack_base - (8 * 1024 * 1024); + memState->nextThreadStackBase = memState->stackBase - (8 * 1024 * 1024); } @@ -130,15 +131,15 @@ AlphaProcess::argsInit(int intSize, int pageSize) space_needed = 32*1024; // set bottom of stack - stack_min = stack_base - space_needed; + memState->stackMin = memState->stackBase - space_needed; // align it - stack_min = roundDown(stack_min, pageSize); - stack_size = stack_base - stack_min; + memState->stackMin = roundDown(memState->stackMin, pageSize); + memState->stackSize = memState->stackBase - memState->stackMin; // map memory - allocateMem(stack_min, roundUp(stack_size, pageSize)); + allocateMem(memState->stackMin, roundUp(memState->stackSize, pageSize)); // map out initial stack contents - Addr argv_array_base = stack_min + intSize; // room for argc + Addr argv_array_base = memState->stackMin + intSize; // room for argc Addr envp_array_base = argv_array_base + argv_array_size; Addr auxv_array_base = envp_array_base + envp_array_size; Addr arg_data_base = auxv_array_base + auxv_array_size; @@ -153,7 +154,7 @@ AlphaProcess::argsInit(int intSize, int pageSize) else panic("Unknown int size"); - initVirtMem.writeBlob(stack_min, (uint8_t*)&argc, intSize); + initVirtMem.writeBlob(memState->stackMin, (uint8_t*)&argc, intSize); copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); @@ -170,7 +171,7 @@ AlphaProcess::argsInit(int intSize, int pageSize) setSyscallArg(tc, 0, argc); setSyscallArg(tc, 1, argv_array_base); - tc->setIntReg(StackPointerReg, stack_min); + tc->setIntReg(StackPointerReg, memState->stackMin); tc->pcState(getStartPC()); } |