syscall_emul.hh (13535:14b3f5a55d38) syscall_emul.hh (13536:77e19417e723)
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * Copyright (c) 2015 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 1265 unchanged lines hidden (view full) ---

1274 Addr ptidPtr = p->getSyscallArg(tc, index);
1275
1276#if THE_ISA == RISCV_ISA or THE_ISA == ARM_ISA
1277 /**
1278 * Linux sets CLONE_BACKWARDS flag for RISC-V and Arm.
1279 * The flag defines the list of clone() arguments in the following
1280 * order: flags -> newStack -> ptidPtr -> tlsPtr -> ctidPtr
1281 */
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * Copyright (c) 2015 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 1265 unchanged lines hidden (view full) ---

1274 Addr ptidPtr = p->getSyscallArg(tc, index);
1275
1276#if THE_ISA == RISCV_ISA or THE_ISA == ARM_ISA
1277 /**
1278 * Linux sets CLONE_BACKWARDS flag for RISC-V and Arm.
1279 * The flag defines the list of clone() arguments in the following
1280 * order: flags -> newStack -> ptidPtr -> tlsPtr -> ctidPtr
1281 */
1282 Addr tlsPtr M5_VAR_USED = p->getSyscallArg(tc, index);
1282 Addr tlsPtr = p->getSyscallArg(tc, index);
1283 Addr ctidPtr = p->getSyscallArg(tc, index);
1284#else
1285 Addr ctidPtr = p->getSyscallArg(tc, index);
1283 Addr ctidPtr = p->getSyscallArg(tc, index);
1284#else
1285 Addr ctidPtr = p->getSyscallArg(tc, index);
1286 Addr tlsPtr M5_VAR_USED = p->getSyscallArg(tc, index);
1286 Addr tlsPtr = p->getSyscallArg(tc, index);
1287#endif
1288
1289 if (((flags & OS::TGT_CLONE_SIGHAND)&& !(flags & OS::TGT_CLONE_VM)) ||
1290 ((flags & OS::TGT_CLONE_THREAD) && !(flags & OS::TGT_CLONE_SIGHAND)) ||
1291 ((flags & OS::TGT_CLONE_FS) && (flags & OS::TGT_CLONE_NEWNS)) ||
1292 ((flags & OS::TGT_CLONE_NEWIPC) && (flags & OS::TGT_CLONE_SYSVSEM)) ||
1293 ((flags & OS::TGT_CLONE_NEWPID) && (flags & OS::TGT_CLONE_THREAD)) ||
1294 ((flags & OS::TGT_CLONE_VM) && !(newStack)))

--- 65 unchanged lines hidden (view full) ---

1360 ctidBuf.copyOut(ctc->getMemProxy());
1361 }
1362
1363 if (flags & OS::TGT_CLONE_CHILD_CLEARTID)
1364 cp->childClearTID = (uint64_t)ctidPtr;
1365
1366 ctc->clearArchRegs();
1367
1287#endif
1288
1289 if (((flags & OS::TGT_CLONE_SIGHAND)&& !(flags & OS::TGT_CLONE_VM)) ||
1290 ((flags & OS::TGT_CLONE_THREAD) && !(flags & OS::TGT_CLONE_SIGHAND)) ||
1291 ((flags & OS::TGT_CLONE_FS) && (flags & OS::TGT_CLONE_NEWNS)) ||
1292 ((flags & OS::TGT_CLONE_NEWIPC) && (flags & OS::TGT_CLONE_SYSVSEM)) ||
1293 ((flags & OS::TGT_CLONE_NEWPID) && (flags & OS::TGT_CLONE_THREAD)) ||
1294 ((flags & OS::TGT_CLONE_VM) && !(newStack)))

--- 65 unchanged lines hidden (view full) ---

1360 ctidBuf.copyOut(ctc->getMemProxy());
1361 }
1362
1363 if (flags & OS::TGT_CLONE_CHILD_CLEARTID)
1364 cp->childClearTID = (uint64_t)ctidPtr;
1365
1366 ctc->clearArchRegs();
1367
1368#if THE_ISA == ALPHA_ISA
1369 TheISA::copyMiscRegs(tc, ctc);
1370#elif THE_ISA == SPARC_ISA
1371 TheISA::copyRegs(tc, ctc);
1372 ctc->setIntReg(TheISA::NumIntArchRegs + 6, 0);
1373 ctc->setIntReg(TheISA::NumIntArchRegs + 4, 0);
1374 ctc->setIntReg(TheISA::NumIntArchRegs + 3, TheISA::NWindows - 2);
1375 ctc->setIntReg(TheISA::NumIntArchRegs + 5, TheISA::NWindows);
1376 ctc->setMiscReg(TheISA::MISCREG_CWP, 0);
1377 ctc->setIntReg(TheISA::NumIntArchRegs + 7, 0);
1378 ctc->setMiscRegNoEffect(TheISA::MISCREG_TL, 0);
1379 ctc->setMiscReg(TheISA::MISCREG_ASI, TheISA::ASI_PRIMARY);
1380 for (int y = 8; y < 32; y++)
1381 ctc->setIntReg(y, tc->readIntReg(y));
1382#elif THE_ISA == ARM_ISA or THE_ISA == X86_ISA or THE_ISA == RISCV_ISA
1383 TheISA::copyRegs(tc, ctc);
1384#endif
1368 OS::archClone(flags, p, cp, tc, ctc, newStack, tlsPtr);
1385
1369
1386#if THE_ISA == X86_ISA
1387 if (flags & OS::TGT_CLONE_SETTLS) {
1388 ctc->setMiscRegNoEffect(TheISA::MISCREG_FS_BASE, tlsPtr);
1389 ctc->setMiscRegNoEffect(TheISA::MISCREG_FS_EFF_BASE, tlsPtr);
1390 }
1391#endif
1392
1393 if (newStack)
1394 ctc->setIntReg(TheISA::StackPointerReg, newStack);
1395
1396 cp->setSyscallReturn(ctc, 0);
1397
1398#if THE_ISA == ALPHA_ISA
1399 ctc->setIntReg(TheISA::SyscallSuccessReg, 0);
1400#elif THE_ISA == SPARC_ISA
1401 tc->setIntReg(TheISA::SyscallPseudoReturnReg, 0);
1402 ctc->setIntReg(TheISA::SyscallPseudoReturnReg, 1);
1403#endif

--- 701 unchanged lines hidden ---
1370 cp->setSyscallReturn(ctc, 0);
1371
1372#if THE_ISA == ALPHA_ISA
1373 ctc->setIntReg(TheISA::SyscallSuccessReg, 0);
1374#elif THE_ISA == SPARC_ISA
1375 tc->setIntReg(TheISA::SyscallPseudoReturnReg, 0);
1376 ctc->setIntReg(TheISA::SyscallPseudoReturnReg, 1);
1377#endif

--- 701 unchanged lines hidden ---