40 #include "debug/SyscallVerbose.hh" 58 load(ProcessParams *params,
ObjectFile *obj_file)
override 66 warn(
"Unknown operating system; assuming Linux.");
77 MipsLinuxObjectFileLoader loader;
89 strcpy(
name->sysname,
"Linux");
90 strcpy(
name->nodename,
"sim.gem5.org");
91 strcpy(
name->release, process->release.c_str());
92 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
93 strcpy(
name->machine,
"mips");
107 unsigned op = process->getSyscallArg(tc, index);
108 unsigned bufPtr = process->getSyscallArg(tc, index);
122 cerr <<
"sys_getsysinfo: unknown op " << op << endl;
136 unsigned op = process->getSyscallArg(tc, index);
137 Addr bufPtr = process->getSyscallArg(tc, index);
148 DPRINTFR(SyscallVerbose,
"sys_setsysinfo(SSI_IEEE_FP_CONTROL): " 149 " setting FPCR to 0x%x\n",
letoh(*(uint64_t*)fpcr));
153 cerr <<
"sys_setsysinfo: unknown op " << op << endl;
166 Addr addr = process->getSyscallArg(tc, index);
175 {
"read", readFunc<MipsLinux> },
176 {
"write", writeFunc<MipsLinux> },
177 {
"open", openFunc<MipsLinux> },
187 {
"chmod", chmodFunc<MipsLinux> },
226 {
"ioctl", ioctlFunc<MipsLinux> },
249 {
"getrusage", getrusageFunc<MipsLinux> },
262 {
"mmap", mmapFunc<MipsLinux> },
266 {
"fchmod", fchmodFunc<MipsLinux> },
278 {
"stat", statFunc<MipsLinux> },
280 {
"fstat", fstatFunc<MipsLinux> },
288 {
"sysinfo", sysinfoFunc<MipsLinux> },
302 {
"get_kernel_syms" },
318 {
"writev", writevFunc<MipsLinux> },
330 {
"sched_setparam" },
331 {
"sched_getparam" },
332 {
"sched_setscheduler" },
333 {
"sched_getscheduler" },
335 {
"sched_get_prioritymax" },
336 {
"sched_get_priority_min" },
337 {
"sched_rr_get_interval" },
339 {
"mremap", mremapFunc<MipsLinux> },
367 {
"rt_sigprocmask" },
369 {
"rt_sigtimedwait" },
386 {
"lstat64", lstat64Func<MipsLinux> },
387 {
"fstat64", fstat64Func<MipsLinux> },
411 {
"sched_setaffinity" },
412 {
"sched_getaffinity" },
419 {
"lookup_dcookie" },
423 {
"remap_file_pages" },
424 {
"set_tid_address" },
425 {
"restart_syscall" },
432 {
"timer_getoverrun" },
437 {
"clock_nanosleep" },
446 {
"mq_timedreceive" },
457 {
"inotify_add_watch" },
458 {
"inotify_rm_watch" },
477 {
"sync_file_range" },
481 {
"set_robust_list" },
482 {
"get_robust_list" },
497 Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(
SyscallDesc))
504 int m5_sys_idx = callnum - 4000;
const std::string & name()
SyscallReturn geteuidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target geteuid() handler.
SyscallReturn ignoreFunc(SyscallDesc *desc, int callnum, 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.
SyscallReturn getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr buf_ptr, unsigned long size)
Target getcwd() handler.
virtual RegVal readIntReg(RegIndex reg_idx) const =0
A process with emulated Mips/Linux syscalls.
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
bool copyIn(PortProxy &memproxy)
copy data into simulator space (read from target memory)
virtual PortProxy & getVirtProxy()=0
virtual Process * getProcessPtr()=0
SyscallReturn fcntlFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target fcntl() handler.
Overload hash function for BasicBlockRange type.
void doSyscall(int64_t callnum, ThreadContext *tc, Fault *fault)
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
ThreadContext is the external interface to all thread state for anything outside of the CPU...
static SyscallReturn sys_getsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target sys_getsysyinfo() handler.
SyscallReturn closeFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd)
Target close() handler.
SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr buf_ptr, int name_len)
Target gethostname() handler.
SyscallReturn getegidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getegid() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target umask() handler.
SyscallReturn munmapFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target munmap() handler.
static SyscallReturn sys_setsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target sys_setsysinfo() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
SyscallReturn unlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname)
Target unlink() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() handler.
SyscallReturn mkdirFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, mode_t mode)
Target mkdir() handler.
static SyscallReturn setThreadAreaFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, Addr buf_ptr, size_t bufsiz)
Target readlink() handler.
SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, off_t length)
Target ftruncate() handler.
void syscall(ThreadContext *tc, Fault *fault) override
SyscallReturn brkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr new_brk)
Target brk() handler: set brk address.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
SyscallReturn getgidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getgid() handler.
SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target getpagesize() handler.
This class provides the wrapper interface for the system call implementations which are defined in th...
SyscallReturn truncateFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, off_t length)
Target truncate() handler.
SyscallReturn fcntl64Func(SyscallDesc *desc, int num, ThreadContext *tc)
Target fcntl64() handler.
SyscallReturn lseekFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
static SyscallReturn unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target uname() handler.
This file defines objects used to emulate syscalls from the target application on the host machine...
static SyscallDescABI< DefaultSyscallABI > syscallDescs[]
Array of syscall descriptors, indexed by call number.
bool copyOut(PortProxy &memproxy)
copy data out of simulator space (write to target memory)
SyscallReturn chownFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, uint32_t owner, uint32_t group)
Target chown() handler.
const int Num_Syscall_Descs
SyscallReturn pipePseudoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Pseudo Funcs - These functions use a different return convension, returning a second value in a regis...
SyscallDesc * getDesc(int callnum) override
This class represents the return value from an emulated system call, including any errno setting...
Each instance of a Loader subclass will have a chance to try to load an object file when tryLoaders i...
MipsLinuxProcess(ProcessParams *params, ObjectFile *objFile)
Constructor.
std::shared_ptr< FaultBase > Fault
SyscallReturn getpidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getpid() handler.
SyscallReturn exitFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int status)
Target exit() handler: terminate current context.