32#include <sys/syscall.h>
39#include <unordered_map>
61 warn(
"Cannot invoke %s on host operating system.", syscall_name);
67 fatal(
"syscall %s (#%d) unimplemented.", desc->
name(), desc->
num());
74 warn(
"ignoring syscall %s(...)", desc->
name());
81 static std::unordered_map<SyscallDesc *, bool> bool_map;
83 bool &warned = bool_map[desc];
85 warn(
"ignoring syscall %s(...)\n"
86 " (further warnings will be suppressed)", desc->
name());
115 *
p->exitGroup =
true;
117 if (
p->childClearTID)
120 bool last_thread =
true;
121 Process *parent =
nullptr, *tg_lead =
nullptr;
124 if (!(walk = sys->
threads[
i]->getProcessPtr()))
133 if (walk->
pid() ==
p->tgid())
146 if (walk->
tgid() ==
p->tgid()) {
159 if (*(
p->exitGroup)) {
175 if (*
p->sigchld && (
p->ppid() != 0) && (walk->
pid() ==
p->ppid()))
191 for (
int i = 0;
i <
p->fds->getSize();
i++) {
193 p->fds->closeFDEntry(
i);
201 if (!
p->vforkContexts.empty()) {
213 int activeContexts = 0;
215 activeContexts +=
system->threads.numRunning();
217 if (activeContexts == 0) {
263 std::shared_ptr<MemState> mem_state =
p->
memState;
264 Addr brk_point = mem_state->getBrkPoint();
268 if (new_brk == 0 || (new_brk == brk_point))
271 mem_state->updateBrkRegion(brk_point, new_brk);
274 mem_state->getBrkPoint());
276 return mem_state->getBrkPoint();
285 return process->pid();
292 return p->
fds->closeFDEntry(tgt_fd);
297 int tgt_fd, uint64_t offs,
int whence)
301 auto ffdp = std::dynamic_pointer_cast<FileFDEntry>((*
p->fds)[tgt_fd]);
304 int sim_fd = ffdp->getSimFD();
306 off_t result = lseek(sim_fd, offs, whence);
308 return (result == (off_t)-1) ? -errno : result;
314 int tgt_fd, uint64_t offset_high, uint32_t offset_low,
315 VPtr<> result_ptr,
int whence)
319 auto ffdp = std::dynamic_pointer_cast<FileFDEntry>((*
p->fds)[tgt_fd]);
322 int sim_fd = ffdp->getSimFD();
324 uint64_t
offset = (offset_high << 32) | offset_low;
326 uint64_t result = lseek(sim_fd,
offset, whence);
329 if (result == (off_t)-1)
332 BufferArg result_buf(result_ptr,
sizeof(result));
333 std::memcpy(result_buf.
bufferPtr(), &result,
sizeof(result));
343 VPtr<> buf_ptr,
int name_len)
353 VPtr<> buf_ptr,
unsigned long size)
360 std::string cwd =
p->tgtCwd;
362 if (cwd.length() >= size) {
366 strncpy((
char *)buf.
bufferPtr(), cwd.c_str(), size);
367 result = cwd.length();
369 if (getcwd((
char *)buf.
bufferPtr(), size)) {
370 result = strlen((
char *)buf.
bufferPtr());
378 return (result == -1) ? -errno : result;
397 int result = unlink(path.c_str());
398 return (result == -1) ? -errno : result;
406 std::string new_path;
415 path =
p->absolutePath(path,
true);
416 new_path =
p->absolutePath(new_path,
true);
418 int result = link(path.c_str(), new_path.c_str());
419 return (result == -1) ? -errno : result;
427 std::string new_path;
436 path =
p->absolutePath(path,
true);
437 new_path =
p->absolutePath(new_path,
true);
439 int result = symlink(path.c_str(), new_path.c_str());
440 return (result == -1) ? -errno : result;
459 auto result = mkdir(path.c_str(),
mode);
460 return (result == -1) ? -errno : result;
468 std::string old_name;
472 std::string new_name;
476 return renameImpl(desc, tc, old_name, new_name);
481 std::string old_name, std::string new_name)
487 new_name =
p->checkPathRedirect(new_name);
489 int64_t result = rename(old_name.c_str(), new_name.c_str());
490 return (result == -1) ? -errno : result;
496 VPtr<> pathname, int64_t length)
508 int result = truncate(path.c_str(), length);
510 int result = truncate64(path.c_str(), length);
512 return (result == -1) ? -errno : result;
517 int tgt_fd, int64_t length)
521 auto ffdp = std::dynamic_pointer_cast<FileFDEntry>((*
p->fds)[tgt_fd]);
524 int sim_fd = ffdp->getSimFD();
527 int result = ftruncate(sim_fd, length);
529 int result = ftruncate64(sim_fd, length);
531 return (result == -1) ? -errno : result;
540 mode_t oldMask = umask(0);
547 VPtr<> pathname, uint32_t owner, uint32_t group)
553 return chownImpl(desc, tc, path, owner, group);
558 std::string path, uint32_t owner, uint32_t group)
563 uid_t hostOwner = owner;
564 gid_t hostGroup = group;
569 int result = chown(path.c_str(), hostOwner, hostGroup);
570 return (result == -1) ? -errno : result;
575 int tgt_fd, uint32_t owner, uint32_t group)
579 auto ffdp = std::dynamic_pointer_cast<FileFDEntry>((*
p->fds)[tgt_fd]);
582 int sim_fd = ffdp->getSimFD();
585 uid_t hostOwner = owner;
586 gid_t hostGroup = group;
588 int result = fchown(sim_fd, hostOwner, hostGroup);
589 return (result == -1) ? -errno : result;
603 auto old_hbfdp = std::dynamic_pointer_cast<HBFDEntry>((*
p->fds)[tgt_fd]);
606 int sim_fd = old_hbfdp->getSimFD();
608 int result = dup(sim_fd);
612 auto new_hbfdp = std::dynamic_pointer_cast<HBFDEntry>(old_hbfdp->clone());
613 new_hbfdp->setSimFD(result);
614 new_hbfdp->setCOE(
false);
615 return p->fds->allocFD(new_hbfdp);
622 auto old_hbp = std::dynamic_pointer_cast<HBFDEntry>((*
p->fds)[old_tgt_fd]);
625 int old_sim_fd = old_hbp->getSimFD();
632 int res_fd = dup2(old_sim_fd, open(
"/dev/null", O_RDONLY));
636 auto new_hbp = std::dynamic_pointer_cast<HBFDEntry>((*
p->fds)[new_tgt_fd]);
638 p->fds->closeFDEntry(new_tgt_fd);
639 new_hbp = std::dynamic_pointer_cast<HBFDEntry>(old_hbp->clone());
640 new_hbp->setSimFD(res_fd);
641 new_hbp->setCOE(
false);
643 return p->fds->allocFD(new_hbp);
652 auto hbfdp = std::dynamic_pointer_cast<HBFDEntry>((*
p->fds)[tgt_fd]);
655 int sim_fd = hbfdp->getSimFD();
657 int coe = hbfdp->getCOE();
661 return coe & FD_CLOEXEC;
664 int arg = varargs.
get<
int>();
665 arg ? hbfdp->setCOE(
true) : hbfdp->setCOE(
false);
677 int arg = varargs.
get<
int>();
678 int rv = fcntl(sim_fd, cmd, arg);
679 return (rv == -1) ? -errno : rv;
683 warn(
"fcntl: unsupported command %d\n", cmd);
693 auto hbfdp = std::dynamic_pointer_cast<HBFDEntry>((*
p->fds)[tgt_fd]);
696 int sim_fd = hbfdp->getSimFD();
700 warn(
"fcntl64(%d, F_GETLK64) not supported, error returned\n", tgt_fd);
705 warn(
"fcntl64(%d, F_SETLK(W)64) not supported, error returned\n",
712 warn(
"fcntl64(%d, %d) passed through to host\n", tgt_fd, cmd);
713 return fcntl(sim_fd, cmd);
734 int sim_fds[2], tgt_fds[2];
736 int pipe_retval = pipe(sim_fds);
737 if (pipe_retval == -1)
741 auto rpfd = std::make_shared<PipeFDEntry>(sim_fds[0], O_WRONLY, rend);
742 tgt_fds[0] =
p->fds->allocFD(rpfd);
743 int sim_fd_rpfd = rpfd->getSimFD();
746 auto wpfd = std::make_shared<PipeFDEntry>(sim_fds[1], O_RDONLY, wend);
747 tgt_fds[1] =
p->fds->allocFD(wpfd);
748 int sim_fd_wpfd = wpfd->getSimFD();
754 rpfd->setPipeReadSource(tgt_fds[1]);
768 BufferArg tgt_handle(tgt_addr,
sizeof(
int[2]));
769 int *buf_ptr = (
int*)tgt_handle.
bufferPtr();
770 buf_ptr[0] = tgt_fds[0];
771 buf_ptr[1] = tgt_fds[1];
777 if ((
flags != O_CLOEXEC) && (
flags != O_NONBLOCK) &&
778 (
flags != (O_CLOEXEC | O_NONBLOCK))) {
786 if (
flags & O_NONBLOCK) {
793 if (fcntl(sim_fd_rpfd, F_SETFL, O_NONBLOCK)) {
796 if (fcntl(sim_fd_wpfd, F_SETFL, O_NONBLOCK)) {
805 if (
flags & O_CLOEXEC) {
818 return process->
pgid();
830 process->
pgid(process->pid());
838 for (
auto *tc: sysh->
threads) {
843 if (walk_ph && walk_ph->
pid() == process->pid())
844 matched_ph = walk_ph;
849 matched_ph->
pgid((pgid == 0) ? matched_ph->
pid() : pgid);
859 return process->
tgid();
866 return process->
pid();
873 return process->
ppid();
880 return process->
uid();
887 return process->
euid();
894 return process->
gid();
901 return process->
egid();
917 std::string path, mode_t
mode)
923 int result = access(path.c_str(),
mode);
924 return (result == -1) ? -errno : result;
940 std::string path, mode_t
mode, dev_t dev)
945 auto result = mknod(path.c_str(),
mode, dev);
946 return (result == -1) ? -errno : result;
962 if (!realpath((
p->tgtCwd +
"/" + path).c_str(), buf))
968 int result = chdir(host_cwd.c_str());
973 p->hostCwd = host_cwd;
994 auto result = rmdir(path.c_str());
995 return (result == -1) ? -errno : result;
998#if defined(SYS_getdents) || defined(SYS_getdents64)
999template<
typename DE,
int SYS_NUM>
1001getdentsImpl(SyscallDesc *desc, ThreadContext *tc,
1004 auto p = tc->getProcessPtr();
1006 auto hbfdp = std::dynamic_pointer_cast<HBFDEntry>((*
p->fds)[tgt_fd]);
1009 int sim_fd = hbfdp->getSimFD();
1011 BufferArg buf_arg(buf_ptr,
count);
1012 auto status = syscall(SYS_NUM, sim_fd, buf_arg.bufferPtr(),
count);
1017 unsigned traversed = 0;
1018 while (traversed <
status) {
1019 DE *buffer = (DE*)((
Addr)buf_arg.bufferPtr() + traversed);
1021 auto host_reclen = buffer->d_reclen;
1028 const ByteOrder
bo = tc->getSystemPtr()->getGuestByteOrder();
1029 buffer->d_ino =
htog(buffer->d_ino,
bo);
1030 buffer->d_off =
htog(buffer->d_off,
bo);
1031 buffer->d_reclen =
htog(buffer->d_reclen,
bo);
1033 traversed += host_reclen;
1036 buf_arg.copyOut(SETranslatingPortProxy(tc));
1041#if defined(SYS_getdents)
1043getdentsFunc(SyscallDesc *desc, ThreadContext *tc,
1046 typedef struct linux_dirent
1048 unsigned long d_ino;
1049 unsigned long d_off;
1050 unsigned short d_reclen;
1054 return getdentsImpl<LinDent, SYS_getdents>(desc, tc,
1055 tgt_fd, buf_ptr,
count);
1059#if defined(SYS_getdents64)
1061getdents64Func(SyscallDesc *desc, ThreadContext *tc,
1064 typedef struct linux_dirent64
1068 unsigned short d_reclen;
1072 return getdentsImpl<LinDent64, SYS_getdents64>(desc, tc,
1073 tgt_fd, buf_ptr,
count);
1082 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1085 int sim_fd = sfdp->getSimFD();
1087 int retval = shutdown(sim_fd, how);
1089 return (retval == -1) ? -errno : retval;
1094 int tgt_fd,
VPtr<> buf_ptr,
int addrlen)
1101 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1104 int sim_fd = sfdp->getSimFD();
1106 int status = ::bind(sim_fd,
1118 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1121 int sim_fd = sfdp->getSimFD();
1123 int status = listen(sim_fd, backlog);
1130 int tgt_fd,
VPtr<> buf_ptr,
int addrlen)
1137 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1140 int sim_fd = sfdp->getSimFD();
1142 int status = connect(sim_fd,
1143 (
struct sockaddr *)
addr.bufferPtr(),
1144 (socklen_t)addrlen);
1156 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1159 int sim_fd = sfdp->getSimFD();
1186 BufferArg msgBuf(msgPtr,
sizeof(
struct msghdr));
1188 struct msghdr *msgHdr = (
struct msghdr *)msgBuf.
bufferPtr();
1195 Addr msg_name_phold = 0;
1196 Addr msg_iov_phold = 0;
1197 Addr iovec_base_phold[msgHdr->msg_iovlen];
1198 Addr msg_control_phold = 0;
1204 if (msgHdr->msg_name) {
1205 msg_name_phold = (
Addr)msgHdr->msg_name;
1206 nameBuf =
new BufferArg(msg_name_phold, msgHdr->msg_namelen);
1208 msgHdr->msg_name = nameBuf->
bufferPtr();
1217 BufferArg *iovecBuf[msgHdr->msg_iovlen];
1218 for (
int i = 0;
i < msgHdr->msg_iovlen;
i++) {
1219 iovec_base_phold[
i] = 0;
1223 if (msgHdr->msg_iov) {
1224 msg_iov_phold = (
Addr)msgHdr->msg_iov;
1225 iovBuf =
new BufferArg(msg_iov_phold, msgHdr->msg_iovlen *
1226 sizeof(
struct iovec));
1228 for (
int i = 0;
i < msgHdr->msg_iovlen;
i++) {
1229 if (((
struct iovec *)iovBuf->
bufferPtr())[
i].iov_base) {
1230 iovec_base_phold[
i] =
1233 ((
struct iovec *)iovBuf->
bufferPtr())[
i].iov_len);
1235 ((
struct iovec *)iovBuf->
bufferPtr())[
i].iov_base =
1236 iovecBuf[
i]->bufferPtr();
1239 msgHdr->msg_iov = (
struct iovec *)iovBuf->
bufferPtr();
1246 if (msgHdr->msg_control) {
1247 msg_control_phold = (
Addr)msgHdr->msg_control;
1248 controlBuf =
new BufferArg(msg_control_phold,
1249 CMSG_ALIGN(msgHdr->msg_controllen));
1250 controlBuf->
copyIn(proxy);
1251 msgHdr->msg_control = controlBuf->
bufferPtr();
1254 ssize_t recvd_size = recvmsg(sim_fd, msgHdr,
flags);
1259 if (msgHdr->msg_name) {
1262 msgHdr->msg_name = (
void *)msg_name_phold;
1265 if (msgHdr->msg_iov) {
1266 for (
int i = 0;
i< msgHdr->msg_iovlen;
i++) {
1267 if (((
struct iovec *)iovBuf->
bufferPtr())[
i].iov_base) {
1270 ((
struct iovec *)iovBuf->
bufferPtr())[
i].iov_base =
1271 (
void *)iovec_base_phold[
i];
1276 msgHdr->msg_iov = (
struct iovec *)msg_iov_phold;
1279 if (msgHdr->msg_control) {
1282 msgHdr->msg_control = (
void *)msg_control_phold;
1296 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1299 int sim_fd = sfdp->getSimFD();
1306 BufferArg msgBuf(msgPtr,
sizeof(
struct msghdr));
1308 struct msghdr msgHdr = *((
struct msghdr *)msgBuf.
bufferPtr());
1314 struct iovec *iovPtr = msgHdr.msg_iov;
1315 BufferArg iovBuf((
Addr)iovPtr,
sizeof(
struct iovec) * msgHdr.msg_iovlen);
1317 struct iovec *iov = (
struct iovec *)iovBuf.
bufferPtr();
1318 msgHdr.msg_iov = iov;
1333 for (
int iovIndex = 0 ; iovIndex < msgHdr.msg_iovlen; iovIndex++) {
1334 Addr basePtr = (
Addr) iov[iovIndex].iov_base;
1335 bufferArray[iovIndex] =
new BufferArg(basePtr, iov[iovIndex].iov_len);
1336 bufferArray[iovIndex]->
copyIn(proxy);
1337 iov[iovIndex].iov_base = bufferArray[iovIndex]->
bufferPtr();
1340 ssize_t sent_size = sendmsg(sim_fd, &msgHdr,
flags);
1341 int local_errno = errno;
1346 for (
int iovIndex = 0 ; iovIndex < msgHdr.msg_iovlen; iovIndex++) {
1356 return (sent_size < 0) ? -local_errno : sent_size;
1361 int tgt_fd,
int level,
int optname,
VPtr<> valPtr,
1369 struct linger linger_val;
1370 struct timeval timeval_val;
1375 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1378 int sim_fd = sfdp->getSimFD();
1380 socklen_t
len =
sizeof(
val);
1407 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1410 int sim_fd = sfdp->getSimFD();
1418 BufferArg lenBuf(lenPtr,
sizeof(socklen_t));
1446 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1449 int sim_fd = sfdp->getSimFD();
1453 BufferArg bufAddrlen(addrlenPtr,
sizeof(
unsigned));
1454 bufAddrlen.
copyIn(proxy);
1457 int retval = getpeername(sim_fd,
1466 return (retval == -1) ? -errno : retval;
1471 int tgt_fd,
int level,
int optname,
VPtr<> valPtr,
1479 auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*
p->fds)[tgt_fd]);
1482 int sim_fd = sfdp->getSimFD();
Declaration and inline definition of ChunkGenerator object.
bool copyIn(const PortProxy &memproxy)
copy data into simulator space (read from target memory)
bool copyOut(const PortProxy &memproxy)
copy data out of simulator space (write to target memory)
BufferArg represents an untyped buffer in target user space that is passed by reference to an (emulat...
void * bufferPtr()
Return a pointer to the internal simulator-space buffer.
static bool readyToExit(Tick delay)
Initiate the exit from the simulation.
FutexMap class holds a map of all futexes used in the system.
int wakeup(Addr addr, uint64_t tgid, int count)
Wakes up at most count waiting threads on a futex.
bool tryReadString(std::string &str, Addr addr) const
Reads the string at guest address addr into the std::string str.
std::shared_ptr< MemState > memState
std::shared_ptr< FDArray > fds
std::string checkPathRedirect(const std::string &filename)
Redirect file path if it matches any keys initialized by system object.
EmulationPageTable * pTable
uint64_t childClearTID
Calls a futex wakeup at the address specified by this pointer when this process exits.
This class provides the wrapper interface for the system call implementations which are defined in th...
This class represents the return value from an emulated system call, including any errno setting.
std::list< BasicSignal > signalList
ByteOrder getGuestByteOrder() const
Get the guest byte order.
static std::vector< System * > systemList
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void activate()=0
Set the status to Active.
virtual System * getSystemPtr()=0
virtual void halt()=0
Set the status to Halted.
@ Halted
Permanently shut down.
@ Halting
Trying to exit and waiting for an event to completely exit.
@ Suspended
Temporarily inactive.
virtual Status status() const =0
virtual Process * getProcessPtr()=0
virtual ContextID contextId() const =0
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
SyscallReturn linkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> new_pathname)
Target link() handler.
SyscallReturn getppidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getppid() handler.
SyscallReturn exitGroupFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
SyscallReturn gettidFunc(SyscallDesc *desc, ThreadContext *tc)
Target gettid() handler.
SyscallReturn recvmsgFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> msgPtr, int flags)
void warnUnsupportedOS(std::string syscall_name)
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
SyscallReturn pipe2Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr, int flags)
Target pipe() handler.
SyscallReturn getpidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpid() handler.
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
SyscallReturn chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target chdir() handler.
SyscallReturn truncate64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, int64_t length)
Target truncate64() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, ThreadContext *tc)
SyscallReturn pipePseudoFunc(SyscallDesc *desc, ThreadContext *tc)
Pseudo Funcs - These functions use a different return convension, returning a second value in a regis...
static void exitFutexWake(ThreadContext *tc, VPtr<> addr, uint64_t tgid)
SyscallReturn chownFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, uint32_t owner, uint32_t group)
Target chown() handler.
SyscallReturn renameImpl(SyscallDesc *desc, ThreadContext *tc, std::string old_name, std::string new_name)
SyscallReturn mknodImpl(SyscallDesc *desc, ThreadContext *tc, std::string path, mode_t mode, dev_t dev)
SyscallReturn renameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> oldpath, VPtr<> newpath)
Target rename() handler.
SyscallReturn mknodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode, dev_t dev)
Target mknod() handler.
SyscallReturn _llseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offset_high, uint32_t offset_low, VPtr<> result_ptr, int whence)
Target _llseek() handler.
SyscallReturn setTidAddressFunc(SyscallDesc *desc, ThreadContext *tc, uint64_t tidPtr)
Target set_tid_address() handler.
SyscallReturn setpgidFunc(SyscallDesc *desc, ThreadContext *tc, int pid, int pgid)
Target setpgid() handler.
SyscallReturn geteuidFunc(SyscallDesc *desc, ThreadContext *tc)
Target geteuid() handler.
SyscallReturn getcwdFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, unsigned long size)
Target getcwd() handler.
SyscallReturn symlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> new_pathname)
Target symlink() handler.
ProxyPtr< T, SETranslatingPortProxy > VPtr
SyscallReturn unlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target unlink() handler.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
SyscallReturn accessImpl(SyscallDesc *desc, ThreadContext *tc, std::string path, mode_t mode)
SyscallReturn chownImpl(SyscallDesc *desc, ThreadContext *tc, std::string path, uint32_t owner, uint32_t group)
SyscallReturn pipeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr)
Target pipe() handler.
SyscallReturn getsockoptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, VPtr<> valPtr, VPtr<> lenPtr)
SyscallReturn fcntl64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd)
Target fcntl64() handler.
SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, ThreadContext *tc)
Like above, but only prints a warning once per syscall desc it's used with.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
SyscallReturn setsockoptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, VPtr<> valPtr, socklen_t len)
SyscallReturn getpagesizeFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpagesize() handler.
SyscallReturn rmdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn getpgrpFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpgrpFunc() handler.
SyscallReturn unlinkImpl(SyscallDesc *desc, ThreadContext *tc, std::string path)
SyscallReturn dupFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
FIXME: The file description is not shared among file descriptors created with dup.
SyscallReturn listenFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int backlog)
SyscallReturn ftruncate64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int64_t length)
Target ftruncate64() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() handler.
SyscallReturn fcntlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd, guest_abi::VarArgs< int > varargs)
Target fcntl() handler.
T htog(T value, ByteOrder guest_byte_order)
SyscallReturn bindFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int addrlen)
SyscallReturn getegidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getegid() handler.
SyscallReturn shutdownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int how)
Target shutdown() handler.
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, VPtr<> addrPtr, VPtr<> lenPtr)
SyscallReturn mkdirImpl(SyscallDesc *desc, ThreadContext *tc, std::string path, mode_t mode)
SyscallReturn getpeernameFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> sockAddrPtr, VPtr<> addrlenPtr)
SyscallReturn lseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
SyscallReturn unimplementedFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we haven't thought about.
SyscallReturn gethostnameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, int name_len)
Target gethostname() handler.
SyscallReturn accessFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target access() handler.
SyscallReturn sendmsgFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> msgPtr, int flags)
SyscallReturn ignoreFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling,...
SyscallReturn rmdirImpl(SyscallDesc *desc, ThreadContext *tc, std::string path)
static SyscallReturn exitImpl(SyscallDesc *desc, ThreadContext *tc, bool group, int status)
SyscallReturn connectFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int addrlen)
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
SyscallReturn dup2Func(SyscallDesc *desc, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd)
Target dup2() handler.
SyscallReturn getgidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getgid() handler.
SyscallReturn closeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
Target close() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, ThreadContext *tc)
Target umask() handler.
Declarations of a non-full system Page Table.
#define DPRINTF_SYSCALL(FLAGEXT, FMT,...)
This macro is intended to help with readability.
This file defines objects used to emulate syscalls from the target application on the host machine.
const std::string & name()