syscall_emul.hh (11908:2fd0307d03e9) | syscall_emul.hh (11910:b33a207489a2) |
---|---|
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 --- 1959 unchanged lines hidden (view full) --- 1968 typename OS::time_t t = sec; 1969 t = TheISA::htog(t); 1970 SETranslatingPortProxy &p = tc->getMemProxy(); 1971 p.writeBlob(taddr, (uint8_t*)&t, (int)sizeof(typename OS::time_t)); 1972 } 1973 return sec; 1974} 1975 | 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 --- 1959 unchanged lines hidden (view full) --- 1968 typename OS::time_t t = sec; 1969 t = TheISA::htog(t); 1970 SETranslatingPortProxy &p = tc->getMemProxy(); 1971 p.writeBlob(taddr, (uint8_t*)&t, (int)sizeof(typename OS::time_t)); 1972 } 1973 return sec; 1974} 1975 |
1976template <class OS> 1977SyscallReturn 1978tgkillFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) 1979{ 1980 int index = 0; 1981 int tgid = process->getSyscallArg(tc, index); 1982 int tid = process->getSyscallArg(tc, index); 1983 int sig = process->getSyscallArg(tc, index); |
|
1976 | 1984 |
1985 /** 1986 * This system call is intended to allow killing a specific thread 1987 * within an arbitrary thread group if sanctioned with permission checks. 1988 * It's usually true that threads share the termination signal as pointed 1989 * out by the pthread_kill man page and this seems to be the intended 1990 * usage. Due to this being an emulated environment, assume the following: 1991 * Threads are allowed to call tgkill because the EUID for all threads 1992 * should be the same. There is no signal handling mechanism for kernel 1993 * registration of signal handlers since signals are poorly supported in 1994 * emulation mode. Since signal handlers cannot be registered, all 1995 * threads within in a thread group must share the termination signal. 1996 * We never exhaust PIDs so there's no chance of finding the wrong one 1997 * due to PID rollover. 1998 */ 1999 2000 System *sys = tc->getSystemPtr(); 2001 Process *tgt_proc = nullptr; 2002 for (int i = 0; i < sys->numContexts(); i++) { 2003 Process *temp = sys->threadContexts[i]->getProcessPtr(); 2004 if (temp->pid() == tid) { 2005 tgt_proc = temp; 2006 break; 2007 } 2008 } 2009 2010 if (sig != 0 || sig != OS::TGT_SIGABRT) 2011 return -EINVAL; 2012 2013 if (tgt_proc == nullptr) 2014 return -ESRCH; 2015 2016 if (tgid != -1 && tgt_proc->tgid() != tgid) 2017 return -ESRCH; 2018 2019 if (sig == OS::TGT_SIGABRT) 2020 exitGroupFunc(desc, 252, process, tc); 2021 2022 return 0; 2023} 2024 2025 |
|
1977#endif // __SIM_SYSCALL_EMUL_HH__ | 2026#endif // __SIM_SYSCALL_EMUL_HH__ |