gem5
v20.1.0.0
|
#include <sys/mount.h>
#include <fcntl.h>
#include <net/if.h>
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <cerrno>
#include <memory>
#include <string>
#include "arch/generic/tlb.hh"
#include "arch/utility.hh"
#include "base/intmath.hh"
#include "base/loader/object_file.hh"
#include "base/logging.hh"
#include "base/trace.hh"
#include "base/types.hh"
#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
#include "kern/linux/linux.hh"
#include "mem/page_table.hh"
#include "params/Process.hh"
#include "sim/emul_driver.hh"
#include "sim/futex_map.hh"
#include "sim/guest_abi.hh"
#include "sim/process.hh"
#include "sim/proxy_ptr.hh"
#include "sim/syscall_debug_macros.hh"
#include "sim/syscall_desc.hh"
#include "sim/syscall_emul_buf.hh"
#include "sim/syscall_return.hh"
Go to the source code of this file.
Macros | |
#define | NO_STAT64 0 |
Typedefs | |
typedef struct statfs | hst_statfs |
typedef struct stat | hst_stat |
typedef struct stat64 | hst_stat64 |
Functions | |
void | warnUnsupportedOS (std::string syscall_name) |
SyscallReturn | unimplementedFunc (SyscallDesc *desc, ThreadContext *tc) |
Handler for unimplemented syscalls that we haven't thought about. More... | |
SyscallReturn | ignoreFunc (SyscallDesc *desc, ThreadContext *tc) |
Handler for unimplemented syscalls that we never intend to implement (signal handling, etc.) and should not affect the correct behavior of the program. More... | |
SyscallReturn | ignoreWarnOnceFunc (SyscallDesc *desc, ThreadContext *tc) |
Like above, but only prints a warning once per syscall desc it's used with. More... | |
SyscallReturn | fallocateFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int mode, off_t offset, off_t len) |
SyscallReturn | exitFunc (SyscallDesc *desc, ThreadContext *tc, int status) |
Target exit() handler: terminate current context. More... | |
SyscallReturn | exitGroupFunc (SyscallDesc *desc, ThreadContext *tc, int status) |
Target exit_group() handler: terminate simulation. (exit all threads) More... | |
SyscallReturn | setTidAddressFunc (SyscallDesc *desc, ThreadContext *tc, uint64_t tidPtr) |
Target set_tid_address() handler. More... | |
SyscallReturn | getpagesizeFunc (SyscallDesc *desc, ThreadContext *tc) |
Target getpagesize() handler. More... | |
SyscallReturn | brkFunc (SyscallDesc *desc, ThreadContext *tc, Addr new_brk) |
Target brk() handler: set brk address. More... | |
SyscallReturn | closeFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd) |
Target close() handler. More... | |
SyscallReturn | lseekFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence) |
Target lseek() handler. More... | |
SyscallReturn | _llseekFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offset_high, uint32_t offset_low, Addr result_ptr, int whence) |
Target _llseek() handler. More... | |
SyscallReturn | munmapFunc (SyscallDesc *desc, ThreadContext *tc, Addr start, size_t length) |
Target munmap() handler. More... | |
SyscallReturn | shutdownFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int how) |
Target shutdown() handler. More... | |
SyscallReturn | gethostnameFunc (SyscallDesc *desc, ThreadContext *tc, Addr buf_ptr, int name_len) |
Target gethostname() handler. More... | |
SyscallReturn | getcwdFunc (SyscallDesc *desc, ThreadContext *tc, Addr buf_ptr, unsigned long size) |
Target getcwd() handler. More... | |
SyscallReturn | readlinkFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, Addr buf, size_t bufsiz) |
Target readlink() handler. More... | |
SyscallReturn | unlinkFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname) |
Target unlink() handler. More... | |
SyscallReturn | linkFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, Addr new_pathname) |
Target link() handler. More... | |
SyscallReturn | symlinkFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, Addr new_pathname) |
Target symlink() handler. More... | |
SyscallReturn | mkdirFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, mode_t mode) |
Target mkdir() handler. More... | |
SyscallReturn | mknodFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, mode_t mode, dev_t dev) |
Target mknod() handler. More... | |
SyscallReturn | chdirFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname) |
Target chdir() handler. More... | |
SyscallReturn | rmdirFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname) |
SyscallReturn | renameFunc (SyscallDesc *desc, ThreadContext *tc, Addr oldpath, Addr newpath) |
Target rename() handler. More... | |
SyscallReturn | truncateFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, off_t length) |
Target truncate() handler. More... | |
SyscallReturn | ftruncateFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, off_t length) |
Target ftruncate() handler. More... | |
SyscallReturn | truncate64Func (SyscallDesc *desc, ThreadContext *tc, Addr pathname, int64_t length) |
Target truncate64() handler. More... | |
SyscallReturn | ftruncate64Func (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int64_t length) |
Target ftruncate64() handler. More... | |
SyscallReturn | umaskFunc (SyscallDesc *desc, ThreadContext *tc) |
Target umask() handler. More... | |
SyscallReturn | gettidFunc (SyscallDesc *desc, ThreadContext *tc) |
Target gettid() handler. More... | |
SyscallReturn | chownFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, uint32_t owner, uint32_t group) |
Target chown() handler. More... | |
SyscallReturn | getpgrpFunc (SyscallDesc *desc, ThreadContext *tc) |
Target getpgrpFunc() handler. More... | |
SyscallReturn | setpgidFunc (SyscallDesc *desc, ThreadContext *tc, int pid, int pgid) |
Target setpgid() handler. More... | |
SyscallReturn | fchownFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group) |
Target fchown() handler. More... | |
SyscallReturn | dupFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd) |
Target dup() handler. More... | |
SyscallReturn | dup2Func (SyscallDesc *desc, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd) |
Target dup2() handler. More... | |
SyscallReturn | fcntlFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd, GuestABI::VarArgs< int > varargs) |
Target fcntl() handler. More... | |
SyscallReturn | fcntl64Func (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd) |
Target fcntl64() handler. More... | |
SyscallReturn | pipeFunc (SyscallDesc *desc, ThreadContext *tc, Addr tgt_addr) |
Target pipe() handler. More... | |
SyscallReturn | pipe2Func (SyscallDesc *desc, ThreadContext *tc, Addr tgt_addr, int flags) |
Target pipe() handler. More... | |
SyscallReturn | getpidFunc (SyscallDesc *desc, ThreadContext *tc) |
Target getpid() handler. More... | |
SyscallReturn | getpeernameFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr sockAddrPtr, Addr addrlenPtr) |
SyscallReturn | bindFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr buf_ptr, int addrlen) |
SyscallReturn | listenFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int backlog) |
SyscallReturn | connectFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr buf_ptr, int addrlen) |
SyscallReturn | sendtoFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr bufrPtr, size_t bufrLen, int flags, Addr addrPtr, socklen_t addrLen) |
SyscallReturn | recvfromFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr bufrPtr, size_t bufrLen, int flags, Addr addrPtr, Addr addrlenPtr) |
SyscallReturn | recvmsgFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr msgPtr, int flags) |
SyscallReturn | sendmsgFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr msgPtr, int flags) |
SyscallReturn | getuidFunc (SyscallDesc *desc, ThreadContext *tc) |
SyscallReturn | getgidFunc (SyscallDesc *desc, ThreadContext *tc) |
Target getgid() handler. More... | |
SyscallReturn | getppidFunc (SyscallDesc *desc, ThreadContext *tc) |
Target getppid() handler. More... | |
SyscallReturn | geteuidFunc (SyscallDesc *desc, ThreadContext *tc) |
Target geteuid() handler. More... | |
SyscallReturn | getegidFunc (SyscallDesc *desc, ThreadContext *tc) |
Target getegid() handler. More... | |
SyscallReturn | accessFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, mode_t mode) |
Target access() handler. More... | |
SyscallReturn | getsockoptFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, Addr valPtr, Addr lenPtr) |
SyscallReturn | setsockoptFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, Addr valPtr, socklen_t len) |
SyscallReturn | getcpuFunc (SyscallDesc *desc, ThreadContext *tc, VPtr< uint32_t > cpu, VPtr< uint32_t > node, VPtr< uint32_t > tcache) |
SyscallReturn | getsocknameFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr addrPtr, Addr lenPtr) |
template<class OS > | |
SyscallReturn | futexFunc (SyscallDesc *desc, ThreadContext *tc, Addr uaddr, int op, int val, int timeout, Addr uaddr2, int val3) |
Futex system call Implemented by Daniel Sanchez Used by printf's in multi-threaded apps. More... | |
SyscallReturn | pipePseudoFunc (SyscallDesc *desc, ThreadContext *tc) |
Pseudo Funcs - These functions use a different return convension, returning a second value in a register other than the normal return register. More... | |
template<class T1 , class T2 > | |
void | getElapsedTimeMicro (T1 &sec, T2 &usec) |
Helper function to convert current elapsed time to seconds and microseconds. More... | |
template<class T1 , class T2 > | |
void | getElapsedTimeNano (T1 &sec, T2 &nsec) |
Helper function to convert current elapsed time to seconds and nanoseconds. More... | |
template<typename OS , typename TgtStatPtr , typename HostStatPtr > | |
void | copyOutStatBuf (TgtStatPtr tgt, HostStatPtr host, bool fakeTTY=false) |
template<typename OS , typename TgtStatPtr , typename HostStatPtr > | |
void | copyOutStat64Buf (TgtStatPtr tgt, HostStatPtr host, bool fakeTTY=false) |
template<class OS , typename TgtStatPtr , typename HostStatPtr > | |
void | copyOutStatfsBuf (TgtStatPtr tgt, HostStatPtr host) |
template<class OS > | |
SyscallReturn | ioctlFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, unsigned req, Addr addr) |
Target ioctl() handler. More... | |
template<class OS > | |
SyscallReturn | openatFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_dirfd, Addr pathname, int tgt_flags, int mode) |
Target open() handler. More... | |
template<class OS > | |
SyscallReturn | openFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, int tgt_flags, int mode) |
Target open() handler. More... | |
template<class OS > | |
SyscallReturn | unlinkatFunc (SyscallDesc *desc, ThreadContext *tc, int dirfd, Addr pathname) |
Target unlinkat() handler. More... | |
template<class OS > | |
SyscallReturn | faccessatFunc (SyscallDesc *desc, ThreadContext *tc, int dirfd, Addr pathname, int mode) |
Target facessat() handler. More... | |
template<class OS > | |
SyscallReturn | readlinkatFunc (SyscallDesc *desc, ThreadContext *tc, int dirfd, Addr pathname, Addr buf, size_t bufsiz) |
Target readlinkat() handler. More... | |
template<class OS > | |
SyscallReturn | renameatFunc (SyscallDesc *desc, ThreadContext *tc, int olddirfd, Addr oldpath, int newdirfd, Addr newpath) |
Target renameat() handler. More... | |
template<class OS > | |
SyscallReturn | sysinfoFunc (SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::tgt_sysinfo > sysinfo) |
Target sysinfo() handler. More... | |
template<class OS > | |
SyscallReturn | chmodFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, mode_t mode) |
Target chmod() handler. More... | |
template<class OS > | |
SyscallReturn | pollFunc (SyscallDesc *desc, ThreadContext *tc, Addr fdsPtr, int nfds, int tmout) |
template<class OS > | |
SyscallReturn | fchmodFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t mode) |
Target fchmod() handler. More... | |
template<class OS > | |
SyscallReturn | mremapFunc (SyscallDesc *desc, ThreadContext *tc, Addr start, uint64_t old_length, uint64_t new_length, uint64_t flags, GuestABI::VarArgs< uint64_t > varargs) |
Target mremap() handler. More... | |
template<class OS > | |
SyscallReturn | statFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, VPtr< typename OS::tgt_stat > tgt_stat) |
Target stat() handler. More... | |
template<class OS > | |
SyscallReturn | stat64Func (SyscallDesc *desc, ThreadContext *tc, Addr pathname, VPtr< typename OS::tgt_stat64 > tgt_stat) |
Target stat64() handler. More... | |
template<class OS > | |
SyscallReturn | fstatat64Func (SyscallDesc *desc, ThreadContext *tc, int dirfd, Addr pathname, VPtr< typename OS::tgt_stat64 > tgt_stat) |
Target fstatat64() handler. More... | |
template<class OS > | |
SyscallReturn | fstat64Func (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat64 > tgt_stat) |
Target fstat64() handler. More... | |
template<class OS > | |
SyscallReturn | lstatFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, VPtr< typename OS::tgt_stat > tgt_stat) |
Target lstat() handler. More... | |
template<class OS > | |
SyscallReturn | lstat64Func (SyscallDesc *desc, ThreadContext *tc, Addr pathname, VPtr< typename OS::tgt_stat64 > tgt_stat) |
Target lstat64() handler. More... | |
template<class OS > | |
SyscallReturn | fstatFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat > tgt_stat) |
Target fstat() handler. More... | |
template<class OS > | |
SyscallReturn | statfsFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, VPtr< typename OS::tgt_statfs > tgt_stat) |
Target statfs() handler. More... | |
template<class OS > | |
SyscallReturn | cloneFunc (SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack, Addr ptidPtr, Addr ctidPtr, Addr tlsPtr) |
template<class OS > | |
SyscallReturn | cloneBackwardsFunc (SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack, Addr ptidPtr, Addr tlsPtr, Addr ctidPtr) |
template<class OS > | |
SyscallReturn | fstatfsFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_statfs > tgt_stat) |
Target fstatfs() handler. More... | |
template<class OS > | |
SyscallReturn | readvFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t tiov_base, size_t count) |
Target readv() handler. More... | |
template<class OS > | |
SyscallReturn | writevFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t tiov_base, size_t count) |
Target writev() handler. More... | |
template<class OS > | |
SyscallReturn | mmapFunc (SyscallDesc *desc, ThreadContext *tc, Addr start, typename OS::size_t length, int prot, int tgt_flags, int tgt_fd, typename OS::off_t offset) |
Target mmap() handler. More... | |
template<class OS > | |
SyscallReturn | pread64Func (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr bufPtr, int nbytes, int offset) |
template<class OS > | |
SyscallReturn | pwrite64Func (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr bufPtr, int nbytes, int offset) |
template<class OS > | |
SyscallReturn | mmap2Func (SyscallDesc *desc, ThreadContext *tc, Addr start, typename OS::size_t length, int prot, int tgt_flags, int tgt_fd, typename OS::off_t offset) |
Target mmap2() handler. More... | |
template<class OS > | |
SyscallReturn | getrlimitFunc (SyscallDesc *desc, ThreadContext *tc, unsigned resource, VPtr< typename OS::rlimit > rlp) |
Target getrlimit() handler. More... | |
template<class OS > | |
SyscallReturn | prlimitFunc (SyscallDesc *desc, ThreadContext *tc, int pid, int resource, Addr n, VPtr< typename OS::rlimit > rlp) |
template<class OS > | |
SyscallReturn | clock_gettimeFunc (SyscallDesc *desc, ThreadContext *tc, int clk_id, VPtr< typename OS::timespec > tp) |
Target clock_gettime() function. More... | |
template<class OS > | |
SyscallReturn | clock_getresFunc (SyscallDesc *desc, ThreadContext *tc, int clk_id, VPtr< typename OS::timespec > tp) |
Target clock_getres() function. More... | |
template<class OS > | |
SyscallReturn | gettimeofdayFunc (SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::timeval > tp, Addr tz_ptr) |
Target gettimeofday() handler. More... | |
template<class OS > | |
SyscallReturn | utimesFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, VPtr< typename OS::timeval[2]> tp) |
Target utimes() handler. More... | |
template<class OS > | |
SyscallReturn | execveFunc (SyscallDesc *desc, ThreadContext *tc, Addr pathname, Addr argv_mem_loc, Addr envp_mem_loc) |
template<class OS > | |
SyscallReturn | getrusageFunc (SyscallDesc *desc, ThreadContext *tc, int who, VPtr< typename OS::rusage > rup) |
Target getrusage() function. More... | |
template<class OS > | |
SyscallReturn | timesFunc (SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::tms > bufp) |
Target times() function. More... | |
template<class OS > | |
SyscallReturn | timeFunc (SyscallDesc *desc, ThreadContext *tc, Addr taddr) |
Target time() function. More... | |
template<class OS > | |
SyscallReturn | tgkillFunc (SyscallDesc *desc, ThreadContext *tc, int tgid, int tid, int sig) |
template<class OS > | |
SyscallReturn | socketFunc (SyscallDesc *desc, ThreadContext *tc, int domain, int type, int prot) |
template<class OS > | |
SyscallReturn | socketpairFunc (SyscallDesc *desc, ThreadContext *tc, int domain, int type, int prot, Addr svPtr) |
template<class OS > | |
SyscallReturn | selectFunc (SyscallDesc *desc, ThreadContext *tc, int nfds, VPtr< typename OS::fd_set > readfds, VPtr< typename OS::fd_set > writefds, VPtr< typename OS::fd_set > errorfds, VPtr< typename OS::timeval > timeout) |
template<class OS > | |
SyscallReturn | readFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr buf_ptr, int nbytes) |
template<class OS > | |
SyscallReturn | writeFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr buf_ptr, int nbytes) |
template<class OS > | |
SyscallReturn | wait4Func (SyscallDesc *desc, ThreadContext *tc, pid_t pid, Addr statPtr, int options, Addr rusagePtr) |
template<class OS > | |
SyscallReturn | acceptFunc (SyscallDesc *desc, ThreadContext *tc, int tgt_fd, Addr addrPtr, Addr lenPtr) |
template<class OS > | |
SyscallReturn | eventfdFunc (SyscallDesc *desc, ThreadContext *tc, unsigned initval, int in_flags) |
Target eventfd() function. More... | |
Variables | |
const unsigned | seconds_since_epoch = 1000 * 1000 * 1000 |
Approximate seconds since the epoch (1/1/1970). More... | |
This file defines objects used to emulate syscalls from the target application on the host machine.
Definition in file syscall_emul.hh.
#define NO_STAT64 0 |
Definition at line 50 of file syscall_emul.hh.
typedef struct stat hst_stat |
Definition at line 551 of file syscall_emul.hh.
typedef struct stat64 hst_stat64 |
Definition at line 552 of file syscall_emul.hh.
typedef struct statfs hst_statfs |
Definition at line 546 of file syscall_emul.hh.
SyscallReturn _llseekFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
uint64_t | offset_high, | ||
uint32_t | offset_low, | ||
Addr | result_ptr, | ||
int | whence | ||
) |
Target _llseek() handler.
Definition at line 304 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), System::getGuestByteOrder(), ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ThreadContext::getVirtProxy(), htog(), ArmISA::offset, and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32().
SyscallReturn acceptFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | addrPtr, | ||
Addr | lenPtr | ||
) |
We poll the socket file descriptor first to guarantee that we do not block on our accept call. The socket can be opened without the non-blocking flag (it blocks). This will cause deadlocks between communicating processes.
Definition at line 2514 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, SyscallReturn::retry(), and ArmISA::sa.
SyscallReturn accessFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
mode_t | mode | ||
) |
Target access() handler.
Definition at line 999 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::mode, MipsISA::p, and PortProxy::tryReadString().
Referenced by faccessatFunc(), SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn bindFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | buf_ptr, | ||
int | addrlen | ||
) |
Definition at line 1163 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and ArmISA::status.
SyscallReturn brkFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | new_brk | ||
) |
Target brk() handler: set brk address.
Definition at line 249 of file syscall_emul.cc.
References DPRINTF_SYSCALL, ThreadContext::getProcessPtr(), and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn chdirFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname | ||
) |
Target chdir() handler.
Definition at line 1030 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, startswith(), and PortProxy::tryReadString().
SyscallReturn chmodFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
mode_t | mode | ||
) |
Target chmod() handler.
Definition at line 973 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::mode, and PortProxy::tryReadString().
SyscallReturn chownFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
uint32_t | owner, | ||
uint32_t | group | ||
) |
Target chown() handler.
Definition at line 625 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and PortProxy::tryReadString().
Referenced by SyscallTable32::SyscallTable32().
SyscallReturn clock_getresFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | clk_id, | ||
VPtr< typename OS::timespec > | tp | ||
) |
Target clock_getres() function.
Definition at line 1910 of file syscall_emul.hh.
SyscallReturn clock_gettimeFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | clk_id, | ||
VPtr< typename OS::timespec > | tp | ||
) |
Target clock_gettime() function.
Definition at line 1896 of file syscall_emul.hh.
References ArmISA::byteOrder(), getElapsedTimeNano(), htog(), and seconds_since_epoch.
SyscallReturn cloneBackwardsFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
RegVal | flags, | ||
RegVal | newStack, | ||
Addr | ptidPtr, | ||
Addr | tlsPtr, | ||
Addr | ctidPtr | ||
) |
Definition at line 1525 of file syscall_emul.hh.
SyscallReturn cloneFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
RegVal | flags, | ||
RegVal | newStack, | ||
Addr | ptidPtr, | ||
Addr | ctidPtr, | ||
Addr | tlsPtr | ||
) |
Note that ProcessParams is generated by swig and there are no other examples of how to create anything but this default constructor. The fields are manually initialized instead of passing parameters to the constructor.
Definition at line 1410 of file syscall_emul.hh.
References ThreadContext::activate(), BufferArg::bufferPtr(), ThreadContext::clearArchRegs(), ThreadContext::contextId(), BaseBufferArg::copyOut(), ThreadContext::cpuId(), DPRINTF_SYSCALL, fatal, System::Threads::findFree(), ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ThreadContext::getVirtProxy(), System::maxPID, MipsISA::p, ThreadContext::pcState(), SyscallDesc::returnInto(), Process::revokeThreadContext(), ThreadContext::setIntReg(), ThreadContext::setProcessPtr(), ArmISA::SyscallPseudoReturnReg, ThreadContext::threadId(), and System::threads.
SyscallReturn closeFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd | ||
) |
Target close() handler.
Definition at line 280 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn connectFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | buf_ptr, | ||
int | addrlen | ||
) |
Definition at line 1199 of file syscall_emul.cc.
References addr, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and ArmISA::status.
void copyOutStat64Buf | ( | TgtStatPtr | tgt, |
HostStatPtr | host, | ||
bool | fakeTTY = false |
||
) |
Definition at line 610 of file syscall_emul.hh.
References PowerISA::bo, ArmISA::byteOrder(), and htog().
void copyOutStatBuf | ( | TgtStatPtr | tgt, |
HostStatPtr | host, | ||
bool | fakeTTY = false |
||
) |
Definition at line 561 of file syscall_emul.hh.
References PowerISA::bo, ArmISA::byteOrder(), and htog().
void copyOutStatfsBuf | ( | TgtStatPtr | tgt, |
HostStatPtr | host | ||
) |
Definition at line 632 of file syscall_emul.hh.
References PowerISA::bo, ArmISA::byteOrder(), and htog().
SyscallReturn dup2Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | old_tgt_fd, | ||
int | new_tgt_fd | ||
) |
Target dup2() handler.
We need a valid host file descriptor number to be able to pass into the second parameter for dup2 (newfd), but we don't know what the viable numbers are; we execute the open call to retrieve one.
Definition at line 691 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and MipsISA::p.
SyscallReturn dupFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd | ||
) |
Target dup() handler.
Target dup() handler.
Really, it's difficult to maintain fields like file offset or flags since an update to such a field won't be reflected in the metadata for the fd entries that we maintain for checkpoint restoration.
Definition at line 671 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn eventfdFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
unsigned | initval, | ||
int | in_flags | ||
) |
Target eventfd() function.
Definition at line 2581 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), MipsISA::p, and warnUnsupportedOS().
SyscallReturn execveFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
Addr | argv_mem_loc, | ||
Addr | envp_mem_loc | ||
) |
Note that ProcessParams is generated by swig and there are no other examples of how to create anything but this default constructor. The fields are manually initialized instead of passing parameters to the constructor.
Prevent process object creation with identical PIDs (which will trip a fatal check in Process constructor). The execve call is supposed to take over the currently executing process' identity but replace whatever it is doing with a new process image. Instead of hijacking the process object in the simulator, we create a new process object and bind to the previous process' thread below (hijacking the thread).
Work through the file descriptor array and close any files marked close-on-exec.
Definition at line 1966 of file syscall_emul.hh.
References ThreadContext::activate(), Process::assignThreadContext(), ArmISA::b, ThreadContext::clearArchRegs(), ThreadContext::contextId(), Process::fds, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::i, sc_dt::inc(), Process::initState(), MipsISA::p, ThreadContext::pcState(), ThreadContext::setNPC(), ThreadContext::setProcessPtr(), Process::sigchld, and PortProxy::tryReadString().
SyscallReturn exitFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | status | ||
) |
Target exit() handler: terminate current context.
Definition at line 230 of file syscall_emul.cc.
References exitImpl(), and ArmISA::status.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn exitGroupFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | status | ||
) |
Target exit_group() handler: terminate simulation. (exit all threads)
Definition at line 236 of file syscall_emul.cc.
References exitImpl(), and ArmISA::status.
Referenced by SyscallTable32::SyscallTable32(), SyscallTable64::SyscallTable64(), and tgkillFunc().
SyscallReturn faccessatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | dirfd, | ||
Addr | pathname, | ||
int | mode | ||
) |
Target facessat() handler.
Definition at line 921 of file syscall_emul.hh.
References accessFunc(), ArmISA::mode, and warn.
SyscallReturn fallocateFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | mode, | ||
off_t | offset, | ||
off_t | len | ||
) |
Definition at line 977 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ArmISA::len, ArmISA::mode, ArmISA::offset, MipsISA::p, and warnUnsupportedOS().
SyscallReturn fchmodFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
uint32_t | mode | ||
) |
Target fchmod() handler.
Definition at line 1073 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), ArmISA::mode, and MipsISA::p.
SyscallReturn fchownFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
uint32_t | owner, | ||
uint32_t | group | ||
) |
Target fchown() handler.
Definition at line 646 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and MipsISA::p.
SyscallReturn fcntl64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | cmd | ||
) |
Target fcntl64() handler.
Definition at line 761 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), MipsISA::p, and warn.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn fcntlFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | cmd, | ||
GuestABI::VarArgs< int > | varargs | ||
) |
Target fcntl() handler.
Definition at line 719 of file syscall_emul.cc.
References GuestABI::VarArgs< Types >::get(), ThreadContext::getProcessPtr(), MipsISA::p, and warn.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn fstat64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
VPtr< typename OS::tgt_stat64 > | tgt_stat | ||
) |
Target fstat64() handler.
Definition at line 1268 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), and MipsISA::p.
SyscallReturn fstatat64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | dirfd, | ||
Addr | pathname, | ||
VPtr< typename OS::tgt_stat64 > | tgt_stat | ||
) |
Target fstatat64() handler.
Definition at line 1234 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), PortProxy::tryReadString(), and warn.
SyscallReturn fstatfsFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
VPtr< typename OS::tgt_statfs > | tgt_stat | ||
) |
Target fstatfs() handler.
Definition at line 1534 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), and MipsISA::p.
SyscallReturn fstatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
VPtr< typename OS::tgt_stat > | tgt_stat | ||
) |
Target fstat() handler.
Definition at line 1355 of file syscall_emul.hh.
References DPRINTF_SYSCALL, ThreadContext::getProcessPtr(), and MipsISA::p.
SyscallReturn ftruncate64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int64_t | length | ||
) |
Target ftruncate64() handler.
Definition at line 595 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), length, and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn ftruncateFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
off_t | length | ||
) |
Target ftruncate() handler.
Definition at line 560 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), length, and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn futexFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | uaddr, | ||
int | op, | ||
int | val, | ||
int | timeout, | ||
Addr | uaddr2, | ||
int | val3 | ||
) |
Futex system call Implemented by Daniel Sanchez Used by printf's in multi-threaded apps.
Definition at line 372 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), System::futexMap, ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ThreadContext::getVirtProxy(), X86ISA::op, FutexMap::requeue(), FutexMap::suspend(), FutexMap::suspend_bitset(), X86ISA::val, FutexMap::wakeup(), FutexMap::wakeup_bitset(), and warn.
SyscallReturn getcpuFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
VPtr< uint32_t > | cpu, | ||
VPtr< uint32_t > | node, | ||
VPtr< uint32_t > | tcache | ||
) |
Definition at line 1639 of file syscall_emul.cc.
References ThreadContext::contextId(), System::getGuestByteOrder(), ThreadContext::getSystemPtr(), and htog().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn getcwdFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | buf_ptr, | ||
unsigned long | size | ||
) |
Target getcwd() handler.
Definition at line 364 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn getegidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target getegid() handler.
Definition at line 970 of file syscall_emul.cc.
References Process::egid(), and ThreadContext::getProcessPtr().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
void getElapsedTimeMicro | ( | T1 & | sec, |
T2 & | usec | ||
) |
Helper function to convert current elapsed time to seconds and microseconds.
Definition at line 517 of file syscall_emul.hh.
References curTick(), and SimClock::Int::us.
Referenced by getrusageFunc(), gettimeofdayFunc(), and timeFunc().
void getElapsedTimeNano | ( | T1 & | sec, |
T2 & | nsec | ||
) |
Helper function to convert current elapsed time to seconds and nanoseconds.
Definition at line 530 of file syscall_emul.hh.
References curTick(), and SimClock::Int::ns.
Referenced by clock_gettimeFunc().
SyscallReturn geteuidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target geteuid() handler.
Definition at line 956 of file syscall_emul.cc.
References Process::euid(), and ThreadContext::getProcessPtr().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn getgidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target getgid() handler.
Definition at line 963 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and Process::gid().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn gethostnameFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | buf_ptr, | ||
int | name_len | ||
) |
Target gethostname() handler.
Definition at line 354 of file syscall_emul.cc.
References ThreadContext::getVirtProxy(), hostname, and name().
SyscallReturn getpagesizeFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target getpagesize() handler.
Definition at line 242 of file syscall_emul.cc.
References System::getPageBytes(), and ThreadContext::getSystemPtr().
SyscallReturn getpeernameFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | sockAddrPtr, | ||
Addr | addrlenPtr | ||
) |
Definition at line 1592 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and MipsISA::p.
SyscallReturn getpgrpFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target getpgrpFunc() handler.
Definition at line 887 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and Process::pgid().
SyscallReturn getpidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target getpid() handler.
Definition at line 928 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and Process::tgid().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn getppidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target getppid() handler.
Definition at line 942 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and Process::ppid().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn getrlimitFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
unsigned | resource, | ||
VPtr< typename OS::rlimit > | rlp | ||
) |
Target getrlimit() handler.
Definition at line 1824 of file syscall_emul.hh.
References PowerISA::bo, ArmISA::byteOrder(), ThreadContext::getSystemPtr(), htog(), System::Threads::size(), System::threads, and warn.
SyscallReturn getrusageFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | who, | ||
VPtr< typename OS::rusage > | rup | ||
) |
Target getrusage() function.
Definition at line 2055 of file syscall_emul.hh.
References ArmISA::byteOrder(), getElapsedTimeMicro(), htog(), and warn.
SyscallReturn getsocknameFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | addrPtr, | ||
Addr | lenPtr | ||
) |
Definition at line 1555 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::len, MipsISA::p, ArmISA::sa, and ArmISA::status.
SyscallReturn getsockoptFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | level, | ||
int | optname, | ||
Addr | valPtr, | ||
Addr | lenPtr | ||
) |
Definition at line 1517 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::len, X86ISA::level, MipsISA::p, ArmISA::status, and X86ISA::val.
SyscallReturn gettidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target gettid() handler.
Definition at line 935 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and Process::pid().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn gettimeofdayFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
VPtr< typename OS::timeval > | tp, | ||
Addr | tz_ptr | ||
) |
Target gettimeofday() handler.
Definition at line 1923 of file syscall_emul.hh.
References ArmISA::byteOrder(), getElapsedTimeMicro(), htog(), and seconds_since_epoch.
SyscallReturn getuidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Definition at line 949 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and Process::uid().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn ignoreFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Handler for unimplemented syscalls that we never intend to implement (signal handling, etc.) and should not affect the correct behavior of the program.
Prints a warning. Return success to the target program.
Definition at line 73 of file syscall_emul.cc.
References SyscallDesc::name(), and warn.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn ignoreWarnOnceFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Like above, but only prints a warning once per syscall desc it's used with.
Definition at line 80 of file syscall_emul.cc.
References SyscallDesc::name(), and warn.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn ioctlFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
unsigned | req, | ||
Addr | addr | ||
) |
Target ioctl() handler.
For the most part, programs call ioctl() only to find out if their stdout is a tty, to determine whether to do line or block buffering. We always claim that output fds are not TTYs to provide repeatable results.
For lack of a better return code, return ENOTTY. Ideally, we should return something better here, but at least we issue the warning.
Definition at line 676 of file syscall_emul.hh.
References addr, BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), DPRINTF_SYSCALL, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), EmulatedDriver::ioctl(), MipsISA::p, ThreadContext::pcState(), ArmISA::status, and warn.
SyscallReturn linkFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
Addr | new_pathname | ||
) |
Target link() handler.
Definition at line 467 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and MipsISA::p.
SyscallReturn listenFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | backlog | ||
) |
Definition at line 1184 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), MipsISA::p, and ArmISA::status.
SyscallReturn lseekFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
uint64_t | offs, | ||
int | whence | ||
) |
Target lseek() handler.
Definition at line 287 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and MipsISA::p.
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn lstat64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
VPtr< typename OS::tgt_stat64 > | tgt_stat | ||
) |
Target lstat64() handler.
Definition at line 1324 of file syscall_emul.hh.
References Process::checkPathRedirect(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and PortProxy::tryReadString().
SyscallReturn lstatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
VPtr< typename OS::tgt_stat > | tgt_stat | ||
) |
Target lstat() handler.
Definition at line 1298 of file syscall_emul.hh.
References Process::checkPathRedirect(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and PortProxy::tryReadString().
SyscallReturn mkdirFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
mode_t | mode | ||
) |
Target mkdir() handler.
Definition at line 509 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::mode, MipsISA::p, and PortProxy::tryReadString().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn mknodFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
mode_t | mode, | ||
dev_t | dev | ||
) |
Target mknod() handler.
Definition at line 1015 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::mode, MipsISA::p, and PortProxy::tryReadString().
SyscallReturn mmap2Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | start, | ||
typename OS::size_t | length, | ||
int | prot, | ||
int | tgt_flags, | ||
int | tgt_fd, | ||
typename OS::off_t | offset | ||
) |
Target mmap2() handler.
Definition at line 1813 of file syscall_emul.hh.
References System::getPageBytes(), ThreadContext::getSystemPtr(), length, ArmISA::offset, and X86ISA::prot.
SyscallReturn mmapFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | start, | ||
typename OS::size_t | length, | ||
int | prot, | ||
int | tgt_flags, | ||
int | tgt_fd, | ||
typename OS::off_t | offset | ||
) |
Target mmap() handler.
Maintain the symbol table for dynamic executables. The loader will call mmap to map the images into its address space and we intercept that here. We can verify that we are executing inside the loader by checking the program counter value. XXX: with multiprogrammed workloads or multi-node configurations, this will not work since there is a single global symbol table.
Not TGT_MAP_FIXED means we can start wherever we want.
If the application provides us with a hint, we should make some small amount of effort to accomodate it. Basically, we check if every single VA within the requested range is unused. If it is, we give the application the range. If not, we fall back to extending the global mmap region.
Extend global mmap region to give us some room for the app.
We only allow mappings to overwrite existing mappings if TGT_MAP_FIXED is set. Otherwise it shouldn't be a problem because we ignore the start hint if TGT_MAP_FIXED is not set.
We might already have some old VMAs mapped to this region, so make sure to clear em out!
Figure out a human-readable name for the mapping.
Setup the correct VMA for this region. The physical pages will be mapped lazily.
Definition at line 1629 of file syscall_emul.hh.
References Loader::createObjectFile(), Loader::debugSymbolTable, DPRINTF_SYSCALL, System::getPageBytes(), ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), Loader::SymbolTable::insert(), length, EmulatedDriver::mmap(), ArmISA::offset, MipsISA::p, ThreadContext::pcState(), X86ISA::prot, roundUp(), and warn_once.
SyscallReturn mremapFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | start, | ||
uint64_t | old_length, | ||
uint64_t | new_length, | ||
uint64_t | flags, | ||
GuestABI::VarArgs< uint64_t > | varargs | ||
) |
Target mremap() handler.
Definition at line 1092 of file syscall_emul.hh.
References GuestABI::VarArgs< Types >::get(), System::getPageBytes(), ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), MipsISA::p, roundUp(), and warn.
SyscallReturn munmapFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | start, | ||
size_t | length | ||
) |
Target munmap() handler.
Definition at line 331 of file syscall_emul.cc.
References System::getPageBytes(), ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), length, MipsISA::p, and roundUp().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn openatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_dirfd, | ||
Addr | pathname, | ||
int | tgt_flags, | ||
int | mode | ||
) |
Target open() handler.
Retrieve the simulated process' memory proxy and then read in the path string from that memory space into the host's working memory space.
Translate target flags into host flags. Flags exist which are not ported between architectures which can cause check failures.
If the simulated process called open or openat with AT_FDCWD specified, take the current working directory value which was passed into the process class as a Python parameter and append the current path to create a full path. Otherwise, openat with a valid target directory file descriptor has been called. If the path option, which was passed in as a parameter, is not absolute, retrieve the directory file descriptor's path and prepend it to the path passed in as a parameter. In every case, we should have a full path (which is relevant to the host) to work with after this block has been passed.
Since this is an emulated environment, we create pseudo file descriptors for device requests that have been registered with the process class through Python; this allows us to create a file descriptor for subsequent ioctl or mmap calls.
Fall through here for pass through to host devices, such as /dev/zero
We make several attempts resolve a call to open.
1) Resolve any path redirection before hand. This will set the path up with variable 'redir_path' which may contain a modified path or the original path value. This should already be done in prior code. 2) Try to handle the access using 'special_paths'. Some special_paths and files cannot be called on the host and need to be handled as special cases inside the simulator. These special_paths are handled by C++ routines to provide output back to userspace. 3) If the full path that was created above does not match any of the special cases, pass it through to the open call on the HOST to let the host open the file on our behalf. Again, the openImpl tries to USE_THE_HOST_FILESYSTEM_OPEN (with a possible redirection to the faux-filesystem files). The faux-filesystem is dynamically created during simulator configuration using Python functions. 4) If the host cannot open the file, the open attempt failed in "3)". Return the host's error code back through the system call to the simulated process. If running a debug trace, also notify the user that the open call failed.
Any success will set sim_fd to something other than -1 and skip the next conditions effectively bypassing them.
The file was opened successfully and needs to be recorded in the process' file descriptor array so that it can be retrieved later. The target file descriptor that is chosen will be the lowest unused file descriptor. Return the indirect target file descriptor back to the simulated process to act as a handle for the opened file.
Definition at line 751 of file syscall_emul.hh.
References DPRINTF_SYSCALL, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::i, ArmISA::mode, SyscallDesc::name(), EmulatedDriver::open(), MipsISA::p, startswith(), PortProxy::tryReadString(), and warn.
SyscallReturn openFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
int | tgt_flags, | ||
int | mode | ||
) |
SyscallReturn pipe2Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | tgt_addr, | ||
int | flags | ||
) |
Target pipe() handler.
Now patch the read object to record the target file descriptor chosen as the write end of the pipe.
On some architectures, it's possible to use more than one register for a return value. In those cases, pipe returns its values rather than write them into a buffer.
Copy the target file descriptors into buffer space and then copy the buffer space back into the target address space.
Definition at line 802 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and MipsISA::p.
Referenced by pipeFunc(), and pipePseudoFunc().
SyscallReturn pipeFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | tgt_addr | ||
) |
SyscallReturn pipePseudoFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Pseudo Funcs - These functions use a different return convension, returning a second value in a register other than the normal return register.
Definition at line 790 of file syscall_emul.cc.
References pipe2Func().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn pollFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | fdsPtr, | ||
int | nfds, | ||
int | tmout | ||
) |
Record the target file descriptors in a local variable. We need to replace them with host file descriptors but we need a temporary copy for later. Afterwards, replace each target file descriptor in the poll_fd array with its host_fd.
We cannot allow an infinite poll to occur or it will inevitably cause a deadlock in the gem5 simulator with clone. We must pass in tmout with a non-negative value, however it also makes no sense to poll on the underlying host for any other time than tmout a zero timeout.
If blocking indefinitely, check the signal list to see if a signal would break the poll out of the retry cycle and try to return the signal interrupt instead.
Replace each host_fd in the returned poll_fd array with its original target file descriptor.
Copy out the pollfd struct because the host may have updated fields in the structure.
Definition at line 999 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), ArmISA::fd, ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ThreadContext::getVirtProxy(), MipsISA::index, MipsISA::p, SyscallReturn::retry(), System::signalList, and ArmISA::status.
SyscallReturn pread64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | bufPtr, | ||
int | nbytes, | ||
int | offset | ||
) |
Definition at line 1771 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::offset, and MipsISA::p.
SyscallReturn prlimitFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | pid, | ||
int | resource, | ||
Addr | n, | ||
VPtr< typename OS::rlimit > | rlp | ||
) |
Definition at line 1860 of file syscall_emul.hh.
References PowerISA::bo, ArmISA::byteOrder(), htog(), ArmISA::n, and warn.
SyscallReturn pwrite64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | bufPtr, | ||
int | nbytes, | ||
int | offset | ||
) |
Definition at line 1792 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::offset, and MipsISA::p.
SyscallReturn readFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | buf_ptr, | ||
int | nbytes | ||
) |
Definition at line 2389 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and SyscallReturn::retry().
SyscallReturn readlinkatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | dirfd, | ||
Addr | pathname, | ||
Addr | buf, | ||
size_t | bufsiz | ||
) |
Target readlinkat() handler.
Definition at line 932 of file syscall_emul.hh.
References readlinkFunc(), and warn.
SyscallReturn readlinkFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
Addr | buf, | ||
size_t | bufsiz | ||
) |
Target readlink() handler.
Definition at line 394 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), fatal, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, PortProxy::tryReadString(), and warn_once.
Referenced by readlinkatFunc(), SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn readvFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
uint64_t | tiov_base, | ||
size_t | count | ||
) |
Target readv() handler.
Definition at line 1558 of file syscall_emul.hh.
References ArmISA::byteOrder(), X86ISA::count, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), gtoh(), htog(), ArmISA::i, MipsISA::p, PortProxy::readBlob(), and PortProxy::writeBlob().
SyscallReturn recvfromFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | bufrPtr, | ||
size_t | bufrLen, | ||
int | flags, | ||
Addr | addrPtr, | ||
Addr | addrlenPtr | ||
) |
Definition at line 1220 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and ArmISA::sa.
SyscallReturn recvmsgFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | msgPtr, | ||
int | flags | ||
) |
struct msghdr { void *msg_name; // optional address socklen_t msg_namelen; // size of address struct iovec *msg_iov; // iovec array size_t msg_iovlen; // number entries in msg_iov i // entries correspond to buffer void *msg_control; // ancillary data size_t msg_controllen; // ancillary data buffer len int msg_flags; // flags on received message };
struct iovec { void *iov_base; // starting address size_t iov_len; // number of bytes to transfer };
The plan with this system call is to replace all of the pointers in the structure and the substructure with BufferArg class pointers. We will copy every field from the structures into our BufferArg classes.
We will use these address place holders to retain the pointers which we are going to replace with our own buffers in our simulator address space.
Record msg_name pointer then replace with buffer pointer.
Record msg_iov pointer then replace with buffer pointer. Also, setup an array of buffer pointers for the iovec structs record and replace their pointers with buffer pointers.
Record msg_control pointer then replace with buffer pointer.
Definition at line 1312 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), BaseBufferArg::copyOut(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::i, and MipsISA::p.
SyscallReturn renameatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | olddirfd, | ||
Addr | oldpath, | ||
int | newdirfd, | ||
Addr | newpath | ||
) |
Target renameat() handler.
Definition at line 943 of file syscall_emul.hh.
References renameFunc(), and warn.
SyscallReturn renameFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | oldpath, | ||
Addr | newpath | ||
) |
Target rename() handler.
Definition at line 523 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and PortProxy::tryReadString().
Referenced by renameatFunc(), SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn rmdirFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname | ||
) |
Definition at line 1057 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and PortProxy::tryReadString().
SyscallReturn selectFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | nfds, | ||
VPtr< typename OS::fd_set > | readfds, | ||
VPtr< typename OS::fd_set > | writefds, | ||
VPtr< typename OS::fd_set > | errorfds, | ||
VPtr< typename OS::timeval > | timeout | ||
) |
Host fields. Notice that these use the definitions from the system headers instead of the gem5 headers and libraries. If the host and target have different header file definitions, this will not work.
We need to translate the target file descriptor set into a host file descriptor set. This involves both our internal process fd array and the fd_set defined in Linux header files. The nfds field also needs to be updated as it will be only target specific after retrieving it from the target; the nfds value is expected to be the highest file descriptor that needs to be checked, so we need to extend it out for nfds_h when we do the update.
By this point, we know that we are looking at a valid file descriptor set on the target. We need to check if the target file descriptor value passed in as iter is part of the set.
We know that the target file descriptor belongs to the set, but we do not yet know if the file descriptor is valid or that we have a host mapping. Check that now.
Add the sim_fd to tgt_fd translation into trans_map for use later when we need to zero the target fd_set structures and then update them with hits returned from the host select call.
We know that the host file descriptor exists so now we check if we need to update the max count for nfds_h before passing the duplicated structure into the host.
Add the host file descriptor to the set that we are going to pass into the host.
It might be possible to decrement the timeval based on some derivation of wall clock determined from elapsed simulator ticks but that seems like overkill. Rather, we just set the timeval with zero timeout. (There is no reason to block during the simulation as it only decreases simulator performance.)
If the timeval pointer is null, setup a new timeval structure to pass into the host select call. Unfortunately, we will need to manually check the return value and throw a retry fault if the return value is zero. Allowing the system call to block will likely deadlock the event queue.
If blocking indefinitely, check the signal list to see if a signal would break the poll out of the retry cycle and try to return the signal interrupt instead.
We need to translate the host file descriptor set into a target file descriptor set. This involves both our internal process fd array and the fd_set defined in header files.
Definition at line 2222 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ArmISA::i, MipsISA::p, SyscallReturn::retry(), and System::signalList.
SyscallReturn sendmsgFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | msgPtr, | ||
int | flags | ||
) |
Reserve buffer space.
Assuming msgHdr.msg_iovlen >= 1, then there is no point calling recvmsg without a buffer.
Cannot instantiate buffers till inside the loop. Create array to hold buffer addresses, to be used during copyIn of send data.
Iterate through the iovec structures: Get the base buffer addreses, reserve iov_len amount of space for each. Put the buf address into the bufferArray for later retrieval.
Free dynamically allocated memory.
Malloced above.
Definition at line 1450 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and MipsISA::p.
SyscallReturn sendtoFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | bufrPtr, | ||
size_t | bufrLen, | ||
int | flags, | ||
Addr | addrPtr, | ||
socklen_t | addrLen | ||
) |
Definition at line 1280 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and ArmISA::sa.
SyscallReturn setpgidFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | pid, | ||
int | pgid | ||
) |
Target setpgid() handler.
Definition at line 894 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ThreadContext::Halted, Process::pgid(), Process::pid(), ThreadContext::status(), and System::threads.
SyscallReturn setsockoptFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | level, | ||
int | optname, | ||
Addr | valPtr, | ||
socklen_t | len | ||
) |
Definition at line 1619 of file syscall_emul.cc.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), ArmISA::len, X86ISA::level, MipsISA::p, and ArmISA::status.
SyscallReturn setTidAddressFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
uint64_t | tidPtr | ||
) |
Target set_tid_address() handler.
Definition at line 271 of file syscall_emul.cc.
References Process::childClearTID, and ThreadContext::getProcessPtr().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn shutdownFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
int | how | ||
) |
Target shutdown() handler.
Definition at line 1148 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), and MipsISA::p.
SyscallReturn socketFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | domain, | ||
int | type, | ||
int | prot | ||
) |
Definition at line 2182 of file syscall_emul.hh.
References ArmISA::domain, ThreadContext::getProcessPtr(), MipsISA::p, X86ISA::prot, and type.
SyscallReturn socketpairFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | domain, | ||
int | type, | ||
int | prot, | ||
Addr | svPtr | ||
) |
Definition at line 2199 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), ArmISA::domain, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, X86ISA::prot, ArmISA::status, and type.
SyscallReturn stat64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
VPtr< typename OS::tgt_stat64 > | tgt_stat | ||
) |
Target stat64() handler.
Definition at line 1202 of file syscall_emul.hh.
References Process::checkPathRedirect(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and PortProxy::tryReadString().
SyscallReturn statfsFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
VPtr< typename OS::tgt_statfs > | tgt_stat | ||
) |
Target statfs() handler.
Definition at line 1381 of file syscall_emul.hh.
References Process::checkPathRedirect(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), PortProxy::tryReadString(), and warnUnsupportedOS().
SyscallReturn statFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
VPtr< typename OS::tgt_stat > | tgt_stat | ||
) |
Target stat() handler.
Definition at line 1175 of file syscall_emul.hh.
References Process::checkPathRedirect(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and PortProxy::tryReadString().
SyscallReturn symlinkFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
Addr | new_pathname | ||
) |
Target symlink() handler.
Definition at line 488 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), and MipsISA::p.
SyscallReturn sysinfoFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
VPtr< typename OS::tgt_sysinfo > | sysinfo | ||
) |
Target sysinfo() handler.
Definition at line 958 of file syscall_emul.hh.
References ThreadContext::getProcessPtr(), and seconds_since_epoch.
SyscallReturn tgkillFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgid, | ||
int | tid, | ||
int | sig | ||
) |
This system call is intended to allow killing a specific thread within an arbitrary thread group if sanctioned with permission checks. It's usually true that threads share the termination signal as pointed out by the pthread_kill man page and this seems to be the intended usage. Due to this being an emulated environment, assume the following: Threads are allowed to call tgkill because the EUID for all threads should be the same. There is no signal handling mechanism for kernel registration of signal handlers since signals are poorly supported in emulation mode. Since signal handlers cannot be registered, all threads within in a thread group must share the termination signal. We never exhaust PIDs so there's no chance of finding the wrong one due to PID rollover.
Definition at line 2138 of file syscall_emul.hh.
References exitGroupFunc(), ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), Process::pid(), Process::tgid(), and System::threads.
SyscallReturn timeFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | taddr | ||
) |
Target time() function.
Definition at line 2121 of file syscall_emul.hh.
References ArmISA::byteOrder(), getElapsedTimeMicro(), ThreadContext::getVirtProxy(), htog(), MipsISA::p, seconds_since_epoch, and ArmISA::t.
SyscallReturn timesFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
VPtr< typename OS::tms > | bufp | ||
) |
Target times() function.
Definition at line 2102 of file syscall_emul.hh.
References ArmISA::byteOrder(), curTick(), htog(), and SimClock::Int::s.
SyscallReturn truncate64Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
int64_t | length | ||
) |
Target truncate64() handler.
Definition at line 574 of file syscall_emul.cc.
References Process::checkPathRedirect(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), length, and PortProxy::tryReadString().
SyscallReturn truncateFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
off_t | length | ||
) |
Target truncate() handler.
Definition at line 544 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), length, MipsISA::p, and PortProxy::tryReadString().
Referenced by SyscallTable32::SyscallTable32(), and SyscallTable64::SyscallTable64().
SyscallReturn umaskFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Target umask() handler.
Definition at line 614 of file syscall_emul.cc.
Referenced by SyscallTable32::SyscallTable32().
SyscallReturn unimplementedFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc | ||
) |
Handler for unimplemented syscalls that we haven't thought about.
Definition at line 66 of file syscall_emul.cc.
References fatal, SyscallDesc::name(), and SyscallDesc::num().
SyscallReturn unlinkatFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | dirfd, | ||
Addr | pathname | ||
) |
Target unlinkat() handler.
Definition at line 910 of file syscall_emul.hh.
References unlinkFunc(), and warn.
SyscallReturn unlinkFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname | ||
) |
Target unlink() handler.
Definition at line 452 of file syscall_emul.cc.
References ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and PortProxy::tryReadString().
Referenced by SyscallTable32::SyscallTable32(), SyscallTable64::SyscallTable64(), and unlinkatFunc().
SyscallReturn utimesFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
Addr | pathname, | ||
VPtr< typename OS::timeval[2]> | tp | ||
) |
Target utimes() handler.
Definition at line 1938 of file syscall_emul.hh.
References ArmISA::byteOrder(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), gtoh(), ArmISA::i, and PortProxy::tryReadString().
SyscallReturn wait4Func | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
pid_t | pid, | ||
Addr | statPtr, | ||
int | options, | ||
Addr | rusagePtr | ||
) |
Currently, wait4 is only implemented so that it will wait for children exit conditions which are denoted by a SIGCHLD signals posted into the system signal list. We return no additional information via any of the parameters supplied to wait4. If nothing is found in the system signal list, we will wait indefinitely for SIGCHLD to post by retrying the call.
Definition at line 2456 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyOut(), DPRINTF_SYSCALL, ThreadContext::getProcessPtr(), ThreadContext::getSystemPtr(), ThreadContext::getVirtProxy(), MipsISA::p, SyscallReturn::retry(), and System::signalList.
void warnUnsupportedOS | ( | std::string | syscall_name | ) |
Definition at line 60 of file syscall_emul.cc.
References warn.
Referenced by eventfdFunc(), fallocateFunc(), and statfsFunc().
SyscallReturn writeFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
Addr | buf_ptr, | ||
int | nbytes | ||
) |
We don't want to poll on /dev/random. The kernel will not enable the file descriptor for writing unless the entropy in the system falls below write_wakeup_threshold. This is not guaranteed to happen depending on host settings.
Definition at line 2417 of file syscall_emul.hh.
References BufferArg::bufferPtr(), BaseBufferArg::copyIn(), ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), MipsISA::p, and SyscallReturn::retry().
SyscallReturn writevFunc | ( | SyscallDesc * | desc, |
ThreadContext * | tc, | ||
int | tgt_fd, | ||
uint64_t | tiov_base, | ||
size_t | count | ||
) |
Target writev() handler.
Definition at line 1595 of file syscall_emul.hh.
References ArmISA::byteOrder(), X86ISA::count, ThreadContext::getProcessPtr(), ThreadContext::getVirtProxy(), gtoh(), ArmISA::i, MipsISA::p, and PortProxy::readBlob().
const unsigned seconds_since_epoch = 1000 * 1000 * 1000 |
Approximate seconds since the epoch (1/1/1970).
About a billion, by my reckoning. We want to keep this a constant (not use the real-world time) to keep simulations repeatable.
Definition at line 511 of file syscall_emul.hh.
Referenced by clock_gettimeFunc(), gettimeofdayFunc(), sysinfoFunc(), and timeFunc().