process.cc revision 14024
1/* 2 * Copyright (c) 2005 The Regents of The University of Michigan 3 * Copyright (c) 2007 MIPS Technologies, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * Authors: Gabe Black 30 * Korey Sewell 31 */ 32 33#include "arch/mips/linux/process.hh" 34 35#include "arch/mips/isa_traits.hh" 36#include "arch/mips/linux/linux.hh" 37#include "base/loader/object_file.hh" 38#include "base/trace.hh" 39#include "cpu/thread_context.hh" 40#include "debug/SyscallVerbose.hh" 41#include "kern/linux/linux.hh" 42#include "sim/eventq.hh" 43#include "sim/process.hh" 44#include "sim/syscall_desc.hh" 45#include "sim/syscall_emul.hh" 46#include "sim/system.hh" 47 48using namespace std; 49using namespace MipsISA; 50 51namespace 52{ 53 54class MipsLinuxObjectFileLoader : public ObjectFile::Loader 55{ 56 public: 57 Process * 58 load(ProcessParams *params, ObjectFile *obj_file) override 59 { 60 if (obj_file->getArch() != ObjectFile::Mips) 61 return nullptr; 62 63 auto opsys = obj_file->getOpSys(); 64 65 if (opsys == ObjectFile::UnknownOpSys) { 66 warn("Unknown operating system; assuming Linux."); 67 opsys = ObjectFile::Linux; 68 } 69 70 if (opsys != ObjectFile::Linux) 71 return nullptr; 72 73 return new MipsLinuxProcess(params, obj_file); 74 } 75}; 76 77MipsLinuxObjectFileLoader loader; 78 79} // anonymous namespace 80 81/// Target uname() handler. 82static SyscallReturn 83unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) 84{ 85 int index = 0; 86 auto process = tc->getProcessPtr(); 87 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); 88 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"); 94 95 name.copyOut(tc->getVirtProxy()); 96 return 0; 97} 98 99/// Target sys_getsysyinfo() handler. Even though this call is 100/// borrowed from Tru64, the subcases that get used appear to be 101/// different in practice from those used by Tru64 processes. 102static SyscallReturn 103sys_getsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) 104{ 105 int index = 0; 106 auto process = tc->getProcessPtr(); 107 unsigned op = process->getSyscallArg(tc, index); 108 unsigned bufPtr = process->getSyscallArg(tc, index); 109 // unsigned nbytes = process->getSyscallArg(tc, index); 110 111 switch (op) { 112 case 45: 113 { 114 // GSI_IEEE_FP_CONTROL 115 TypedBufferArg<uint64_t> fpcr(bufPtr); 116 // I don't think this exactly matches the HW FPCR 117 *fpcr = 0; 118 fpcr.copyOut(tc->getVirtProxy()); 119 return 0; 120 } 121 default: 122 cerr << "sys_getsysinfo: unknown op " << op << endl; 123 abort(); 124 break; 125 } 126 127 return 1; 128} 129 130/// Target sys_setsysinfo() handler. 131static SyscallReturn 132sys_setsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) 133{ 134 int index = 0; 135 auto process = tc->getProcessPtr(); 136 unsigned op = process->getSyscallArg(tc, index); 137 Addr bufPtr = process->getSyscallArg(tc, index); 138 // unsigned nbytes = process->getSyscallArg(tc, index); 139 140 switch (op) { 141 142 case 14: 143 { 144 // SSI_IEEE_FP_CONTROL 145 TypedBufferArg<uint64_t> fpcr(bufPtr); 146 // I don't think this exactly matches the HW FPCR 147 fpcr.copyIn(tc->getVirtProxy()); 148 DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): " 149 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr)); 150 return 0; 151 } 152 default: 153 cerr << "sys_setsysinfo: unknown op " << op << endl; 154 abort(); 155 break; 156 } 157 158 return 1; 159} 160 161static SyscallReturn 162setThreadAreaFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) 163{ 164 int index = 0; 165 auto process = tc->getProcessPtr(); 166 Addr addr = process->getSyscallArg(tc, index); 167 tc->setMiscRegNoEffect(MISCREG_TP_VALUE, addr); 168 return 0; 169} 170 171SyscallDesc MipsLinuxProcess::syscallDescs[] = { 172 /* 0 */ SyscallDesc("syscall", unimplementedFunc), 173 /* 1 */ SyscallDesc("exit", exitFunc), 174 /* 2 */ SyscallDesc("fork", unimplementedFunc), 175 /* 3 */ SyscallDesc("read", readFunc<MipsLinux>), 176 /* 4 */ SyscallDesc("write", writeFunc<MipsLinux>), 177 /* 5 */ SyscallDesc("open", openFunc<MipsLinux>), 178 /* 6 */ SyscallDesc("close", closeFunc), 179 /* 7 */ SyscallDesc("waitpid", unimplementedFunc), 180 /* 8 */ SyscallDesc("creat", unimplementedFunc), 181 /* 9 */ SyscallDesc("link", unimplementedFunc), 182 /* 10 */ SyscallDesc("unlink", unlinkFunc), 183 /* 11 */ SyscallDesc("execve", unimplementedFunc), 184 /* 12 */ SyscallDesc("chdir", unimplementedFunc), 185 /* 13 */ SyscallDesc("time", unimplementedFunc), 186 /* 14 */ SyscallDesc("mknod", unimplementedFunc), 187 /* 15 */ SyscallDesc("chmod", chmodFunc<MipsLinux>), 188 /* 16 */ SyscallDesc("lchown", chownFunc), 189 /* 17 */ SyscallDesc("break", brkFunc), 190 /* 18 */ SyscallDesc("unused#18", unimplementedFunc), 191 /* 19 */ SyscallDesc("lseek", lseekFunc), 192 /* 20 */ SyscallDesc("getpid", getpidFunc), 193 /* 21 */ SyscallDesc("mount", unimplementedFunc), 194 /* 22 */ SyscallDesc("umount", unimplementedFunc), 195 /* 23 */ SyscallDesc("setuid", setuidFunc), 196 /* 24 */ SyscallDesc("getuid", getuidFunc), 197 /* 25 */ SyscallDesc("stime", unimplementedFunc), 198 /* 26 */ SyscallDesc("ptrace", unimplementedFunc), 199 /* 27 */ SyscallDesc("alarm", unimplementedFunc), 200 /* 28 */ SyscallDesc("unused#28", unimplementedFunc), 201 /* 29 */ SyscallDesc("pause", unimplementedFunc), 202 /* 30 */ SyscallDesc("utime", unimplementedFunc), 203 /* 31 */ SyscallDesc("stty", unimplementedFunc), 204 /* 32 */ SyscallDesc("gtty", unimplementedFunc), 205 /* 33 */ SyscallDesc("access", unimplementedFunc), 206 /* 34 */ SyscallDesc("nice", unimplementedFunc), 207 /* 35 */ SyscallDesc("ftime", unimplementedFunc), 208 /* 36 */ SyscallDesc("sync", unimplementedFunc), 209 /* 37 */ SyscallDesc("kill", unimplementedFunc), 210 /* 38 */ SyscallDesc("rename", unimplementedFunc), 211 /* 39 */ SyscallDesc("mkdir", mkdirFunc), 212 /* 40 */ SyscallDesc("rmdir", unimplementedFunc), 213 /* 41 */ SyscallDesc("dup", unimplementedFunc), 214 /* 42 */ SyscallDesc("pipe", pipePseudoFunc), 215 /* 43 */ SyscallDesc("times", unimplementedFunc), 216 /* 44 */ SyscallDesc("prof", unimplementedFunc), 217 /* 45 */ SyscallDesc("brk", brkFunc), 218 /* 46 */ SyscallDesc("setgid", unimplementedFunc), 219 /* 47 */ SyscallDesc("getgid", getgidFunc), 220 /* 48 */ SyscallDesc("signal", ignoreFunc), 221 /* 49 */ SyscallDesc("geteuid", geteuidFunc), 222 /* 50 */ SyscallDesc("getegid", getegidFunc), 223 /* 51 */ SyscallDesc("acct", unimplementedFunc), 224 /* 52 */ SyscallDesc("umount2", unimplementedFunc), 225 /* 53 */ SyscallDesc("lock", unimplementedFunc), 226 /* 54 */ SyscallDesc("ioctl", ioctlFunc<MipsLinux>), 227 /* 55 */ SyscallDesc("fcntl", fcntlFunc), 228 /* 56 */ SyscallDesc("mpx", unimplementedFunc), 229 /* 57 */ SyscallDesc("setpgid", unimplementedFunc), 230 /* 58 */ SyscallDesc("ulimit", unimplementedFunc), 231 /* 59 */ SyscallDesc("unused#59", unimplementedFunc), 232 /* 60 */ SyscallDesc("umask", umaskFunc), 233 /* 61 */ SyscallDesc("chroot", unimplementedFunc), 234 /* 62 */ SyscallDesc("ustat", unimplementedFunc), 235 /* 63 */ SyscallDesc("dup2", unimplementedFunc), 236 /* 64 */ SyscallDesc("getppid", getpagesizeFunc), 237 /* 65 */ SyscallDesc("getpgrp", unimplementedFunc), 238 /* 66 */ SyscallDesc("setsid", unimplementedFunc), 239 /* 67 */ SyscallDesc("sigaction",unimplementedFunc), 240 /* 68 */ SyscallDesc("sgetmask", unimplementedFunc), 241 /* 69 */ SyscallDesc("ssetmask", unimplementedFunc), 242 /* 70 */ SyscallDesc("setreuid", unimplementedFunc), 243 /* 71 */ SyscallDesc("setregid", unimplementedFunc), 244 /* 72 */ SyscallDesc("sigsuspend", unimplementedFunc), 245 /* 73 */ SyscallDesc("sigpending", unimplementedFunc), 246 /* 74 */ SyscallDesc("sethostname", ignoreFunc), 247 /* 75 */ SyscallDesc("setrlimit", unimplementedFunc), 248 /* 76 */ SyscallDesc("getrlimit", unimplementedFunc), 249 /* 77 */ SyscallDesc("getrusage", getrusageFunc<MipsLinux>), 250 /* 78 */ SyscallDesc("gettimeofday", unimplementedFunc), 251 /* 79 */ SyscallDesc("settimeofday", unimplementedFunc), 252 /* 80 */ SyscallDesc("getgroups", unimplementedFunc), 253 /* 81 */ SyscallDesc("setgroups", unimplementedFunc), 254 /* 82 */ SyscallDesc("reserved#82", unimplementedFunc), 255 /* 83 */ SyscallDesc("symlink", unimplementedFunc), 256 /* 84 */ SyscallDesc("unused#84", unimplementedFunc), 257 /* 85 */ SyscallDesc("readlink", readlinkFunc), 258 /* 86 */ SyscallDesc("uselib", unimplementedFunc), 259 /* 87 */ SyscallDesc("swapon", gethostnameFunc), 260 /* 88 */ SyscallDesc("reboot", unimplementedFunc), 261 /* 89 */ SyscallDesc("readdir", unimplementedFunc), 262 /* 90 */ SyscallDesc("mmap", mmapFunc<MipsLinux>), 263 /* 91 */ SyscallDesc("munmap",munmapFunc), 264 /* 92 */ SyscallDesc("truncate", truncateFunc), 265 /* 93 */ SyscallDesc("ftruncate", ftruncateFunc), 266 /* 94 */ SyscallDesc("fchmod", fchmodFunc<MipsLinux>), 267 /* 95 */ SyscallDesc("fchown", fchownFunc), 268 /* 96 */ SyscallDesc("getpriority", unimplementedFunc), 269 /* 97 */ SyscallDesc("setpriority", unimplementedFunc), 270 /* 98 */ SyscallDesc("profil", unimplementedFunc), 271 /* 99 */ SyscallDesc("statfs", unimplementedFunc), 272 /* 100 */ SyscallDesc("fstatfs", unimplementedFunc), 273 /* 101 */ SyscallDesc("ioperm", unimplementedFunc), 274 /* 102 */ SyscallDesc("socketcall", unimplementedFunc), 275 /* 103 */ SyscallDesc("syslog", unimplementedFunc), 276 /* 104 */ SyscallDesc("setitimer", unimplementedFunc), 277 /* 105 */ SyscallDesc("getitimer", unimplementedFunc), 278 /* 106 */ SyscallDesc("stat", statFunc<MipsLinux>), 279 /* 107 */ SyscallDesc("lstat", unimplementedFunc), 280 /* 108 */ SyscallDesc("fstat", fstatFunc<MipsLinux>), 281 /* 109 */ SyscallDesc("unused#109", unimplementedFunc), 282 /* 110 */ SyscallDesc("iopl", unimplementedFunc), 283 /* 111 */ SyscallDesc("vhangup", unimplementedFunc), 284 /* 112 */ SyscallDesc("idle", ignoreFunc), 285 /* 113 */ SyscallDesc("vm86", unimplementedFunc), 286 /* 114 */ SyscallDesc("wait4", unimplementedFunc), 287 /* 115 */ SyscallDesc("swapoff", unimplementedFunc), 288 /* 116 */ SyscallDesc("sysinfo", sysinfoFunc<MipsLinux>), 289 /* 117 */ SyscallDesc("ipc", unimplementedFunc), 290 /* 118 */ SyscallDesc("fsync", unimplementedFunc), 291 /* 119 */ SyscallDesc("sigreturn", unimplementedFunc), 292 /* 120 */ SyscallDesc("clone", unimplementedFunc), 293 /* 121 */ SyscallDesc("setdomainname", unimplementedFunc), 294 /* 122 */ SyscallDesc("uname", unameFunc), 295 /* 123 */ SyscallDesc("modify_ldt", unimplementedFunc), 296 /* 124 */ SyscallDesc("adjtimex", unimplementedFunc), 297 /* 125 */ SyscallDesc("mprotect", ignoreFunc), 298 /* 126 */ SyscallDesc("sigprocmask", unimplementedFunc), 299 /* 127 */ SyscallDesc("create_module", unimplementedFunc), 300 /* 128 */ SyscallDesc("init_module", unimplementedFunc), 301 /* 129 */ SyscallDesc("delete_module", unimplementedFunc), 302 /* 130 */ SyscallDesc("get_kernel_syms", unimplementedFunc), 303 /* 131 */ SyscallDesc("quotactl", unimplementedFunc), 304 /* 132 */ SyscallDesc("getpgid", unimplementedFunc), 305 /* 133 */ SyscallDesc("fchdir", unimplementedFunc), 306 /* 134 */ SyscallDesc("bdflush", unimplementedFunc), 307 /* 135 */ SyscallDesc("sysfs", unimplementedFunc), 308 /* 136 */ SyscallDesc("personality", unimplementedFunc), 309 /* 137 */ SyscallDesc("afs_syscall", unimplementedFunc), 310 /* 138 */ SyscallDesc("setfsuid", unimplementedFunc), 311 /* 139 */ SyscallDesc("setfsgid", unimplementedFunc), 312 /* 140 */ SyscallDesc("llseek", unimplementedFunc), 313 /* 141 */ SyscallDesc("getdents", unimplementedFunc), 314 /* 142 */ SyscallDesc("newselect", unimplementedFunc), 315 /* 143 */ SyscallDesc("flock", unimplementedFunc), 316 /* 144 */ SyscallDesc("msync", unimplementedFunc), 317 /* 145 */ SyscallDesc("readv", unimplementedFunc), 318 /* 146 */ SyscallDesc("writev", writevFunc<MipsLinux>), 319 /* 147 */ SyscallDesc("cacheflush", unimplementedFunc), 320 /* 148 */ SyscallDesc("cachectl", unimplementedFunc), 321 /* 149 */ SyscallDesc("sysmips", unimplementedFunc), 322 /* 150 */ SyscallDesc("unused#150", unimplementedFunc), 323 /* 151 */ SyscallDesc("getsid", unimplementedFunc), 324 /* 152 */ SyscallDesc("fdatasync", unimplementedFunc), 325 /* 153 */ SyscallDesc("sysctl", ignoreFunc), 326 /* 154 */ SyscallDesc("mlock", unimplementedFunc), 327 /* 155 */ SyscallDesc("munlock", unimplementedFunc), 328 /* 156 */ SyscallDesc("mlockall", unimplementedFunc), 329 /* 157 */ SyscallDesc("munlockall", unimplementedFunc), 330 /* 158 */ SyscallDesc("sched_setparam", unimplementedFunc), 331 /* 159 */ SyscallDesc("sched_getparam", unimplementedFunc), 332 /* 160 */ SyscallDesc("sched_setscheduler", unimplementedFunc), 333 /* 161 */ SyscallDesc("sched_getscheduler", unimplementedFunc), 334 /* 162 */ SyscallDesc("sched_yield", unimplementedFunc), 335 /* 163 */ SyscallDesc("sched_get_prioritymax", unimplementedFunc), 336 /* 164 */ SyscallDesc("sched_get_priority_min", unimplementedFunc), 337 /* 165 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc), 338 /* 166 */ SyscallDesc("nanosleep", unimplementedFunc), 339 /* 167 */ SyscallDesc("mremap", mremapFunc<MipsLinux>), 340 /* 168 */ SyscallDesc("accept", unimplementedFunc), 341 /* 169 */ SyscallDesc("bind", unimplementedFunc), 342 /* 170 */ SyscallDesc("connect", unimplementedFunc), 343 /* 171 */ SyscallDesc("getpeername", unimplementedFunc), 344 /* 172 */ SyscallDesc("getsockname", unimplementedFunc), 345 /* 173 */ SyscallDesc("getsockopt", unimplementedFunc), 346 /* 174 */ SyscallDesc("listen", unimplementedFunc), 347 /* 175 */ SyscallDesc("recv", unimplementedFunc), 348 /* 176 */ SyscallDesc("recvmsg", unimplementedFunc), 349 /* 177 */ SyscallDesc("send", unimplementedFunc), 350 /* 178 */ SyscallDesc("sendmsg", ignoreFunc), 351 /* 179 */ SyscallDesc("sendto", unimplementedFunc), 352 /* 180 */ SyscallDesc("setsockopt", unimplementedFunc), 353 /* 181 */ SyscallDesc("shutdown", unimplementedFunc), 354 /* 182 */ SyscallDesc("unknown #182", unimplementedFunc), 355 /* 183 */ SyscallDesc("socket", ignoreFunc), 356 /* 184 */ SyscallDesc("socketpair", unimplementedFunc), 357 /* 185 */ SyscallDesc("setresuid", unimplementedFunc), 358 /* 186 */ SyscallDesc("getresuid", unimplementedFunc), 359 /* 187 */ SyscallDesc("query_module", unimplementedFunc), 360 /* 188 */ SyscallDesc("poll", unimplementedFunc), 361 /* 189 */ SyscallDesc("nfsservctl", unimplementedFunc), 362 /* 190 */ SyscallDesc("setresgid", unimplementedFunc), 363 /* 191 */ SyscallDesc("getresgid", unimplementedFunc), 364 /* 192 */ SyscallDesc("prctl", unimplementedFunc), 365 /* 193 */ SyscallDesc("rt_sigreturn", unimplementedFunc), 366 /* 194 */ SyscallDesc("rt_sigaction", unimplementedFunc), 367 /* 195 */ SyscallDesc("rt_sigprocmask", unimplementedFunc), 368 /* 196 */ SyscallDesc("rt_sigpending", unimplementedFunc), 369 /* 197 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc), 370 /* 198 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc), 371 /* 199 */ SyscallDesc("rt_sigsuspend", unimplementedFunc), 372 /* 200 */ SyscallDesc("pread64", unimplementedFunc), 373 /* 201 */ SyscallDesc("pwrite64", unimplementedFunc), 374 /* 202 */ SyscallDesc("chown", unimplementedFunc), 375 /* 203 */ SyscallDesc("getcwd", getcwdFunc), 376 /* 204 */ SyscallDesc("capget", unimplementedFunc), 377 /* 205 */ SyscallDesc("capset", unimplementedFunc), 378 /* 206 */ SyscallDesc("sigalstack", unimplementedFunc), 379 /* 207 */ SyscallDesc("sendfile", unimplementedFunc), 380 /* 208 */ SyscallDesc("getpmsg", unimplementedFunc), 381 /* 209 */ SyscallDesc("putpmsg", unimplementedFunc), 382 /* 210 */ SyscallDesc("mmap2", unimplementedFunc), 383 /* 211 */ SyscallDesc("truncate64", unimplementedFunc), 384 /* 212 */ SyscallDesc("ftruncate64", unimplementedFunc), 385 /* 213 */ SyscallDesc("stat64", unimplementedFunc), 386 /* 214 */ SyscallDesc("lstat64", lstat64Func<MipsLinux>), 387 /* 215 */ SyscallDesc("fstat64", fstat64Func<MipsLinux>), 388 /* 216 */ SyscallDesc("pivot_root", unimplementedFunc), 389 /* 217 */ SyscallDesc("mincore", unimplementedFunc), 390 /* 218 */ SyscallDesc("madvise", unimplementedFunc), 391 /* 219 */ SyscallDesc("getdents64", unimplementedFunc), 392 /* 220 */ SyscallDesc("fcntl64", fcntl64Func), 393 /* 221 */ SyscallDesc("reserved#221", unimplementedFunc), 394 /* 222 */ SyscallDesc("gettid", unimplementedFunc), 395 /* 223 */ SyscallDesc("readahead", unimplementedFunc), 396 /* 224 */ SyscallDesc("setxattr", unimplementedFunc), 397 /* 225 */ SyscallDesc("lsetxattr", unimplementedFunc), 398 /* 226 */ SyscallDesc("fsetxattr", unimplementedFunc), 399 /* 227 */ SyscallDesc("getxattr", unimplementedFunc), 400 /* 228 */ SyscallDesc("lgetxattr", unimplementedFunc), 401 /* 229 */ SyscallDesc("fgetxattr", unimplementedFunc), 402 /* 230 */ SyscallDesc("listxattr", unimplementedFunc), 403 /* 231 */ SyscallDesc("llistxattr", unimplementedFunc), 404 /* 232 */ SyscallDesc("flistxattr", unimplementedFunc), 405 /* 233 */ SyscallDesc("removexattr", unimplementedFunc), 406 /* 234 */ SyscallDesc("lremovexattr", unimplementedFunc), 407 /* 235 */ SyscallDesc("fremovexattr", ignoreFunc), 408 /* 236 */ SyscallDesc("tkill", unimplementedFunc), 409 /* 237 */ SyscallDesc("sendfile64", unimplementedFunc), 410 /* 238 */ SyscallDesc("futex", unimplementedFunc), 411 /* 239 */ SyscallDesc("sched_setaffinity", unimplementedFunc), 412 /* 240 */ SyscallDesc("sched_getaffinity", unimplementedFunc), 413 /* 241 */ SyscallDesc("io_setup", unimplementedFunc), 414 /* 242 */ SyscallDesc("io_destroy", unimplementedFunc), 415 /* 243 */ SyscallDesc("io_getevents", unimplementedFunc), 416 /* 244 */ SyscallDesc("io_submit", unimplementedFunc), 417 /* 245 */ SyscallDesc("io_cancel", unimplementedFunc), 418 /* 246 */ SyscallDesc("exit_group", exitFunc), 419 /* 247 */ SyscallDesc("lookup_dcookie", unimplementedFunc), 420 /* 248 */ SyscallDesc("epoll_create", unimplementedFunc), 421 /* 249 */ SyscallDesc("epoll_ctl", unimplementedFunc), 422 /* 250 */ SyscallDesc("epoll_wait", unimplementedFunc), 423 /* 251 */ SyscallDesc("remap_file_pages", unimplementedFunc), 424 /* 252 */ SyscallDesc("set_tid_address", unimplementedFunc), 425 /* 253 */ SyscallDesc("restart_syscall", unimplementedFunc), 426 /* 254 */ SyscallDesc("fadvise64", unimplementedFunc), 427 /* 255 */ SyscallDesc("statfs64", unimplementedFunc), 428 /* 256 */ SyscallDesc("fstafs64", unimplementedFunc), 429 /* 257 */ SyscallDesc("timer_create", sys_getsysinfoFunc), 430 /* 258 */ SyscallDesc("timer_settime", sys_setsysinfoFunc), 431 /* 259 */ SyscallDesc("timer_gettime", unimplementedFunc), 432 /* 260 */ SyscallDesc("timer_getoverrun", unimplementedFunc), 433 /* 261 */ SyscallDesc("timer_delete", unimplementedFunc), 434 /* 262 */ SyscallDesc("clock_settime", unimplementedFunc), 435 /* 263 */ SyscallDesc("clock_gettime", unimplementedFunc), 436 /* 264 */ SyscallDesc("clock_getres", unimplementedFunc), 437 /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc), 438 /* 266 */ SyscallDesc("tgkill", unimplementedFunc), 439 /* 267 */ SyscallDesc("utimes", unimplementedFunc), 440 /* 268 */ SyscallDesc("mbind", unimplementedFunc), 441 /* 269 */ SyscallDesc("get_mempolicy", unimplementedFunc), 442 /* 270 */ SyscallDesc("set_mempolicy", unimplementedFunc), 443 /* 271 */ SyscallDesc("mq_open", unimplementedFunc), 444 /* 272 */ SyscallDesc("mq_unlink", unimplementedFunc), 445 /* 273 */ SyscallDesc("mq_timedsend", unimplementedFunc), 446 /* 274 */ SyscallDesc("mq_timedreceive", unimplementedFunc), 447 /* 275 */ SyscallDesc("mq_notify", unimplementedFunc), 448 /* 276 */ SyscallDesc("mq_getsetattr", unimplementedFunc), 449 /* 277 */ SyscallDesc("vserver", unimplementedFunc), 450 /* 278 */ SyscallDesc("waitid", unimplementedFunc), 451 /* 279 */ SyscallDesc("unknown #279", unimplementedFunc), 452 /* 280 */ SyscallDesc("add_key", unimplementedFunc), 453 /* 281 */ SyscallDesc("request_key", unimplementedFunc), 454 /* 282 */ SyscallDesc("keyctl", unimplementedFunc), 455 /* 283 */ SyscallDesc("set_thread_area", setThreadAreaFunc), 456 /* 284 */ SyscallDesc("inotify_init", unimplementedFunc), 457 /* 285 */ SyscallDesc("inotify_add_watch", unimplementedFunc), 458 /* 286 */ SyscallDesc("inotify_rm_watch", unimplementedFunc), 459 /* 287 */ SyscallDesc("migrate_pages", unimplementedFunc), 460 /* 288 */ SyscallDesc("openat", unimplementedFunc), 461 /* 289 */ SyscallDesc("mkdirat", unimplementedFunc), 462 /* 290 */ SyscallDesc("mknodat", unimplementedFunc), 463 /* 291 */ SyscallDesc("fchownat", unimplementedFunc), 464 /* 292 */ SyscallDesc("futimesat", unimplementedFunc), 465 /* 293 */ SyscallDesc("fstatat64", unimplementedFunc), 466 /* 294 */ SyscallDesc("unlinkat", unimplementedFunc), 467 /* 295 */ SyscallDesc("renameat", unimplementedFunc), 468 /* 296 */ SyscallDesc("linkat", unimplementedFunc), 469 /* 297 */ SyscallDesc("symlinkat", unimplementedFunc), 470 /* 298 */ SyscallDesc("readlinkat", unimplementedFunc), 471 /* 299 */ SyscallDesc("fchmodat", unimplementedFunc), 472 /* 300 */ SyscallDesc("faccessat", unimplementedFunc), 473 /* 301 */ SyscallDesc("pselect6", unimplementedFunc), 474 /* 302 */ SyscallDesc("ppoll", unimplementedFunc), 475 /* 303 */ SyscallDesc("unshare", unimplementedFunc), 476 /* 304 */ SyscallDesc("splice", unimplementedFunc), 477 /* 305 */ SyscallDesc("sync_file_range", unimplementedFunc), 478 /* 306 */ SyscallDesc("tee", unimplementedFunc), 479 /* 307 */ SyscallDesc("vmsplice", unimplementedFunc), 480 /* 308 */ SyscallDesc("move_pages", unimplementedFunc), 481 /* 309 */ SyscallDesc("set_robust_list", unimplementedFunc), 482 /* 310 */ SyscallDesc("get_robust_list", unimplementedFunc), 483 /* 311 */ SyscallDesc("kexec_load", unimplementedFunc), 484 /* 312 */ SyscallDesc("getcpu", unimplementedFunc), 485 /* 313 */ SyscallDesc("epoll_pwait", unimplementedFunc), 486 /* 314 */ SyscallDesc("ioprio_set", unimplementedFunc), 487 /* 315 */ SyscallDesc("ioprio_get", unimplementedFunc), 488 /* 316 */ SyscallDesc("utimensat", unimplementedFunc), 489 /* 317 */ SyscallDesc("signalfd", unimplementedFunc), 490 /* 318 */ SyscallDesc("timerfd", unimplementedFunc), 491 /* 319 */ SyscallDesc("eventfd", unimplementedFunc) 492}; 493 494MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params, 495 ObjectFile *objFile) 496 : MipsProcess(params, objFile), 497 Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) 498{ } 499 500SyscallDesc* 501MipsLinuxProcess::getDesc(int callnum) 502{ 503 //MIPS32 syscalls are in the range of 4000 - 4999 504 int m5_sys_idx = callnum - 4000; 505 506 if (m5_sys_idx < 0 || m5_sys_idx >= Num_Syscall_Descs) 507 return NULL; 508 509 return &syscallDescs[m5_sys_idx]; 510} 511 512 513 514 515 516