process.cc revision 13617
1955SN/A/* 2955SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 31762SN/A * Copyright (c) 2007-2008 The Florida State University 4955SN/A * Copyright (c) 2009 The University of Edinburgh 5955SN/A * All rights reserved. 6955SN/A * 7955SN/A * Redistribution and use in source and binary forms, with or without 8955SN/A * modification, are permitted provided that the following conditions are 9955SN/A * met: redistributions of source code must retain the above copyright 10955SN/A * notice, this list of conditions and the following disclaimer; 11955SN/A * redistributions in binary form must reproduce the above copyright 12955SN/A * notice, this list of conditions and the following disclaimer in the 13955SN/A * documentation and/or other materials provided with the distribution; 14955SN/A * neither the name of the copyright holders nor the names of its 15955SN/A * contributors may be used to endorse or promote products derived from 16955SN/A * this software without specific prior written permission. 17955SN/A * 18955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 282665Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 294762Snate@binkert.org * 30955SN/A * Authors: Korey Sewell 315522Snate@binkert.org * Stephen Hines 326143Snate@binkert.org * Timothy M. Jones 334762Snate@binkert.org */ 345522Snate@binkert.org 35955SN/A#include "arch/power/linux/process.hh" 365522Snate@binkert.org 3711974Sgabeblack@google.com#include "arch/power/isa_traits.hh" 38955SN/A#include "arch/power/linux/linux.hh" 395522Snate@binkert.org#include "base/trace.hh" 404202Sbinkertn@umich.edu#include "cpu/thread_context.hh" 415742Snate@binkert.org#include "kern/linux/linux.hh" 42955SN/A#include "sim/process.hh" 434381Sbinkertn@umich.edu#include "sim/syscall_desc.hh" 444381Sbinkertn@umich.edu#include "sim/syscall_emul.hh" 458334Snate@binkert.org#include "sim/system.hh" 46955SN/A 47955SN/Ausing namespace std; 484202Sbinkertn@umich.eduusing namespace PowerISA; 49955SN/A 504382Sbinkertn@umich.edu/// Target uname() handler. 514382Sbinkertn@umich.edustatic SyscallReturn 524382Sbinkertn@umich.eduunameFunc(SyscallDesc *desc, int callnum, Process *process, 536654Snate@binkert.org ThreadContext *tc) 545517Snate@binkert.org{ 558614Sgblack@eecs.umich.edu int index = 0; 567674Snate@binkert.org TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); 576143Snate@binkert.org 586143Snate@binkert.org strcpy(name->sysname, "Linux"); 596143Snate@binkert.org strcpy(name->nodename, "sim.gem5.org"); 608233Snate@binkert.org strcpy(name->release, "3.0.0"); 618233Snate@binkert.org strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 628233Snate@binkert.org strcpy(name->machine, "power"); 638233Snate@binkert.org 648233Snate@binkert.org name.copyOut(tc->getMemProxy()); 658334Snate@binkert.org return 0; 668334Snate@binkert.org} 6710453SAndrew.Bardsley@arm.com 6810453SAndrew.Bardsley@arm.comSyscallDesc PowerLinuxProcess::syscallDescs[] = { 698233Snate@binkert.org /* 0 */ SyscallDesc("syscall", unimplementedFunc), 708233Snate@binkert.org /* 1 */ SyscallDesc("exit", exitFunc), 718233Snate@binkert.org /* 2 */ SyscallDesc("fork", unimplementedFunc), 728233Snate@binkert.org /* 3 */ SyscallDesc("read", readFunc<PowerLinux>), 738233Snate@binkert.org /* 4 */ SyscallDesc("write", writeFunc<PowerLinux>), 748233Snate@binkert.org /* 5 */ SyscallDesc("open", openFunc<PowerLinux>), 7511983Sgabeblack@google.com /* 6 */ SyscallDesc("close", closeFunc), 7611983Sgabeblack@google.com /* 7 */ SyscallDesc("waitpid", unimplementedFunc), //??? 7711983Sgabeblack@google.com /* 8 */ SyscallDesc("creat", unimplementedFunc), 7811983Sgabeblack@google.com /* 9 */ SyscallDesc("link", unimplementedFunc), 7911983Sgabeblack@google.com /* 10 */ SyscallDesc("unlink", unlinkFunc), 8011983Sgabeblack@google.com /* 11 */ SyscallDesc("execve", unimplementedFunc), 8111983Sgabeblack@google.com /* 12 */ SyscallDesc("chdir", unimplementedFunc), 8211983Sgabeblack@google.com /* 13 */ SyscallDesc("time", timeFunc<PowerLinux>), 8311983Sgabeblack@google.com /* 14 */ SyscallDesc("mknod", unimplementedFunc), 8411983Sgabeblack@google.com /* 15 */ SyscallDesc("chmod", chmodFunc<PowerLinux>), 8511983Sgabeblack@google.com /* 16 */ SyscallDesc("lchown", chownFunc), 866143Snate@binkert.org /* 17 */ SyscallDesc("break", brkFunc), //??? 878233Snate@binkert.org /* 18 */ SyscallDesc("unused#18", unimplementedFunc), //??? 888233Snate@binkert.org /* 19 */ SyscallDesc("lseek", lseekFunc), 898233Snate@binkert.org /* 20 */ SyscallDesc("getpid", getpidFunc), 906143Snate@binkert.org /* 21 */ SyscallDesc("mount", unimplementedFunc), 916143Snate@binkert.org /* 22 */ SyscallDesc("umount", unimplementedFunc), 926143Snate@binkert.org /* 23 */ SyscallDesc("setuid", setuidFunc), 9311308Santhony.gutierrez@amd.com /* 24 */ SyscallDesc("getuid", getuidFunc), 948233Snate@binkert.org /* 25 */ SyscallDesc("stime", unimplementedFunc), 958233Snate@binkert.org /* 26 */ SyscallDesc("ptrace", unimplementedFunc), 968233Snate@binkert.org /* 27 */ SyscallDesc("alarm", unimplementedFunc), 9711983Sgabeblack@google.com /* 28 */ SyscallDesc("unused#28", unimplementedFunc), 9811983Sgabeblack@google.com /* 29 */ SyscallDesc("pause", unimplementedFunc), 994762Snate@binkert.org /* 30 */ SyscallDesc("utime", unimplementedFunc), 1006143Snate@binkert.org /* 31 */ SyscallDesc("stty", unimplementedFunc), 1018233Snate@binkert.org /* 32 */ SyscallDesc("gtty", unimplementedFunc), 1028233Snate@binkert.org /* 33 */ SyscallDesc("access", unimplementedFunc), 1038233Snate@binkert.org /* 34 */ SyscallDesc("nice", unimplementedFunc), 1048233Snate@binkert.org /* 35 */ SyscallDesc("ftime", unimplementedFunc), 1058233Snate@binkert.org /* 36 */ SyscallDesc("sync", unimplementedFunc), 1066143Snate@binkert.org /* 37 */ SyscallDesc("kill", ignoreFunc), 1078233Snate@binkert.org /* 38 */ SyscallDesc("rename", renameFunc), 1088233Snate@binkert.org /* 39 */ SyscallDesc("mkdir", unimplementedFunc), 1098233Snate@binkert.org /* 40 */ SyscallDesc("rmdir", unimplementedFunc), 1108233Snate@binkert.org /* 41 */ SyscallDesc("dup", dupFunc), 1116143Snate@binkert.org /* 42 */ SyscallDesc("pipe", unimplementedFunc), 1126143Snate@binkert.org /* 43 */ SyscallDesc("times", timesFunc<PowerLinux>), 1136143Snate@binkert.org /* 44 */ SyscallDesc("prof", unimplementedFunc), 1146143Snate@binkert.org /* 45 */ SyscallDesc("brk", brkFunc), 1156143Snate@binkert.org /* 46 */ SyscallDesc("setgid", unimplementedFunc), 1166143Snate@binkert.org /* 47 */ SyscallDesc("getgid", getgidFunc), 1176143Snate@binkert.org /* 48 */ SyscallDesc("signal", ignoreFunc), 1186143Snate@binkert.org /* 49 */ SyscallDesc("geteuid", geteuidFunc), 1196143Snate@binkert.org /* 50 */ SyscallDesc("getegid", getegidFunc), 1207065Snate@binkert.org /* 51 */ SyscallDesc("acct", unimplementedFunc), 1216143Snate@binkert.org /* 52 */ SyscallDesc("umount2", unimplementedFunc), 1228233Snate@binkert.org /* 53 */ SyscallDesc("lock", unimplementedFunc), 1238233Snate@binkert.org /* 54 */ SyscallDesc("ioctl", ioctlFunc<PowerLinux>), 1248233Snate@binkert.org /* 55 */ SyscallDesc("fcntl", fcntlFunc), 1258233Snate@binkert.org /* 56 */ SyscallDesc("mpx", unimplementedFunc), 1268233Snate@binkert.org /* 57 */ SyscallDesc("setpgid", unimplementedFunc), 1278233Snate@binkert.org /* 58 */ SyscallDesc("ulimit", unimplementedFunc), 1288233Snate@binkert.org /* 59 */ SyscallDesc("unused#59", unimplementedFunc), 1298233Snate@binkert.org /* 60 */ SyscallDesc("umask", umaskFunc), 1308233Snate@binkert.org /* 61 */ SyscallDesc("chroot", unimplementedFunc), 1318233Snate@binkert.org /* 62 */ SyscallDesc("ustat", unimplementedFunc), 1328233Snate@binkert.org /* 63 */ SyscallDesc("dup2", unimplementedFunc), 1338233Snate@binkert.org /* 64 */ SyscallDesc("getppid", getpagesizeFunc), 1348233Snate@binkert.org /* 65 */ SyscallDesc("getpgrp", unimplementedFunc), 1358233Snate@binkert.org /* 66 */ SyscallDesc("setsid", unimplementedFunc), 1368233Snate@binkert.org /* 67 */ SyscallDesc("sigaction",unimplementedFunc), 1378233Snate@binkert.org /* 68 */ SyscallDesc("sgetmask", unimplementedFunc), 1388233Snate@binkert.org /* 69 */ SyscallDesc("ssetmask", unimplementedFunc), 1398233Snate@binkert.org /* 70 */ SyscallDesc("setreuid", unimplementedFunc), 1408233Snate@binkert.org /* 71 */ SyscallDesc("setregid", unimplementedFunc), 1418233Snate@binkert.org /* 72 */ SyscallDesc("sigsuspend", unimplementedFunc), 1428233Snate@binkert.org /* 73 */ SyscallDesc("sigpending", unimplementedFunc), 1438233Snate@binkert.org /* 74 */ SyscallDesc("sethostname", ignoreFunc), 1448233Snate@binkert.org /* 75 */ SyscallDesc("setrlimit", ignoreFunc), 1458233Snate@binkert.org /* 76 */ SyscallDesc("getrlimit", unimplementedFunc), 1468233Snate@binkert.org /* 77 */ SyscallDesc("getrusage", ignoreFunc), 1478233Snate@binkert.org /* 78 */ SyscallDesc("gettimeofday", unimplementedFunc), 1488233Snate@binkert.org /* 79 */ SyscallDesc("settimeofday", unimplementedFunc), 1498233Snate@binkert.org /* 80 */ SyscallDesc("getgroups", unimplementedFunc), 1508233Snate@binkert.org /* 81 */ SyscallDesc("setgroups", unimplementedFunc), 1518233Snate@binkert.org /* 82 */ SyscallDesc("reserved#82", unimplementedFunc), 1528233Snate@binkert.org /* 83 */ SyscallDesc("symlink", unimplementedFunc), 1536143Snate@binkert.org /* 84 */ SyscallDesc("unused#84", unimplementedFunc), 1546143Snate@binkert.org /* 85 */ SyscallDesc("readlink", unimplementedFunc), 1556143Snate@binkert.org /* 86 */ SyscallDesc("uselib", unimplementedFunc), 1566143Snate@binkert.org /* 87 */ SyscallDesc("swapon", gethostnameFunc), 1576143Snate@binkert.org /* 88 */ SyscallDesc("reboot", unimplementedFunc), 1586143Snate@binkert.org /* 89 */ SyscallDesc("readdir", unimplementedFunc), 1599982Satgutier@umich.edu /* 90 */ SyscallDesc("mmap", mmapFunc<PowerLinux>), 16010196SCurtis.Dunham@arm.com /* 91 */ SyscallDesc("munmap",munmapFunc), 16110196SCurtis.Dunham@arm.com /* 92 */ SyscallDesc("truncate", truncateFunc), 16210196SCurtis.Dunham@arm.com /* 93 */ SyscallDesc("ftruncate", ftruncateFunc), 16310196SCurtis.Dunham@arm.com /* 94 */ SyscallDesc("fchmod", unimplementedFunc), 16410196SCurtis.Dunham@arm.com /* 95 */ SyscallDesc("fchown", unimplementedFunc), 16510196SCurtis.Dunham@arm.com /* 96 */ SyscallDesc("getpriority", unimplementedFunc), 16610196SCurtis.Dunham@arm.com /* 97 */ SyscallDesc("setpriority", unimplementedFunc), 16710196SCurtis.Dunham@arm.com /* 98 */ SyscallDesc("profil", unimplementedFunc), 1686143Snate@binkert.org /* 99 */ SyscallDesc("statfs", unimplementedFunc), 16911983Sgabeblack@google.com /* 100 */ SyscallDesc("fstatfs", unimplementedFunc), 17011983Sgabeblack@google.com /* 101 */ SyscallDesc("ioperm", unimplementedFunc), 17111983Sgabeblack@google.com /* 102 */ SyscallDesc("socketcall", unimplementedFunc), 17211983Sgabeblack@google.com /* 103 */ SyscallDesc("syslog", unimplementedFunc), 17311983Sgabeblack@google.com /* 104 */ SyscallDesc("setitimer", unimplementedFunc), 17411983Sgabeblack@google.com /* 105 */ SyscallDesc("getitimer", unimplementedFunc), 17511983Sgabeblack@google.com /* 106 */ SyscallDesc("stat", statFunc<PowerLinux>), 17611983Sgabeblack@google.com /* 107 */ SyscallDesc("lstat", unimplementedFunc), 17711983Sgabeblack@google.com /* 108 */ SyscallDesc("fstat", fstatFunc<PowerLinux>), 1786143Snate@binkert.org /* 109 */ SyscallDesc("unused#109", unimplementedFunc), 1798945Ssteve.reinhardt@amd.com /* 110 */ SyscallDesc("iopl", unimplementedFunc), 1808233Snate@binkert.org /* 111 */ SyscallDesc("vhangup", unimplementedFunc), 1818233Snate@binkert.org /* 112 */ SyscallDesc("idle", ignoreFunc), 1826143Snate@binkert.org /* 113 */ SyscallDesc("vm86", unimplementedFunc), 1838945Ssteve.reinhardt@amd.com /* 114 */ SyscallDesc("wait4", unimplementedFunc), 1846143Snate@binkert.org /* 115 */ SyscallDesc("swapoff", unimplementedFunc), 1856143Snate@binkert.org /* 116 */ SyscallDesc("sysinfo", unimplementedFunc), 18611983Sgabeblack@google.com /* 117 */ SyscallDesc("ipc", unimplementedFunc), 18711983Sgabeblack@google.com /* 118 */ SyscallDesc("fsync", unimplementedFunc), 1886143Snate@binkert.org /* 119 */ SyscallDesc("sigreturn", unimplementedFunc), 1896143Snate@binkert.org /* 120 */ SyscallDesc("clone", unimplementedFunc), 1905522Snate@binkert.org /* 121 */ SyscallDesc("setdomainname", unimplementedFunc), 1916143Snate@binkert.org /* 122 */ SyscallDesc("uname", unameFunc), 1926143Snate@binkert.org /* 123 */ SyscallDesc("modify_ldt", unimplementedFunc), 1936143Snate@binkert.org /* 124 */ SyscallDesc("adjtimex", unimplementedFunc), 1949982Satgutier@umich.edu /* 125 */ SyscallDesc("mprotect", ignoreFunc), 1958233Snate@binkert.org /* 126 */ SyscallDesc("sigprocmask", unimplementedFunc), 1968233Snate@binkert.org /* 127 */ SyscallDesc("create_module", unimplementedFunc), 1978233Snate@binkert.org /* 128 */ SyscallDesc("init_module", unimplementedFunc), 1986143Snate@binkert.org /* 129 */ SyscallDesc("delete_module", unimplementedFunc), 1996143Snate@binkert.org /* 130 */ SyscallDesc("get_kernel_syms", unimplementedFunc), 2006143Snate@binkert.org /* 131 */ SyscallDesc("quotactl", unimplementedFunc), 2016143Snate@binkert.org /* 132 */ SyscallDesc("getpgid", unimplementedFunc), 2025522Snate@binkert.org /* 133 */ SyscallDesc("fchdir", unimplementedFunc), 2035522Snate@binkert.org /* 134 */ SyscallDesc("bdflush", unimplementedFunc), 2045522Snate@binkert.org /* 135 */ SyscallDesc("sysfs", unimplementedFunc), 2055522Snate@binkert.org /* 136 */ SyscallDesc("personality", unimplementedFunc), 2065604Snate@binkert.org /* 137 */ SyscallDesc("afs_syscall", unimplementedFunc), 2075604Snate@binkert.org /* 138 */ SyscallDesc("setfsuid", unimplementedFunc), 2086143Snate@binkert.org /* 139 */ SyscallDesc("setfsgid", unimplementedFunc), 2096143Snate@binkert.org /* 140 */ SyscallDesc("llseek", _llseekFunc), 2104762Snate@binkert.org /* 141 */ SyscallDesc("getdents", unimplementedFunc), 2114762Snate@binkert.org /* 142 */ SyscallDesc("newselect", unimplementedFunc), 2126143Snate@binkert.org /* 143 */ SyscallDesc("flock", unimplementedFunc), 2136727Ssteve.reinhardt@amd.com /* 144 */ SyscallDesc("msync", unimplementedFunc), 2146727Ssteve.reinhardt@amd.com /* 145 */ SyscallDesc("readv", unimplementedFunc), 2156727Ssteve.reinhardt@amd.com /* 146 */ SyscallDesc("writev", writevFunc<PowerLinux>), 2164762Snate@binkert.org /* 147 */ SyscallDesc("getsid", unimplementedFunc), 2176143Snate@binkert.org /* 148 */ SyscallDesc("fdatasync", unimplementedFunc), 2186143Snate@binkert.org /* 149 */ SyscallDesc("sysctl", unimplementedFunc), 2196143Snate@binkert.org /* 150 */ SyscallDesc("mlock", unimplementedFunc), 2206143Snate@binkert.org /* 151 */ SyscallDesc("munlock", unimplementedFunc), 2216727Ssteve.reinhardt@amd.com /* 152 */ SyscallDesc("mlockall", unimplementedFunc), 2226143Snate@binkert.org /* 153 */ SyscallDesc("munlockall", unimplementedFunc), 2237674Snate@binkert.org /* 154 */ SyscallDesc("sched_setparam", unimplementedFunc), 2247674Snate@binkert.org /* 155 */ SyscallDesc("sched_getparam", unimplementedFunc), 2255604Snate@binkert.org /* 156 */ SyscallDesc("sched_setscheduler", unimplementedFunc), 2266143Snate@binkert.org /* 157 */ SyscallDesc("sched_getscheduler", unimplementedFunc), 2276143Snate@binkert.org /* 158 */ SyscallDesc("sched_yield", unimplementedFunc), 2286143Snate@binkert.org /* 159 */ SyscallDesc("sched_get_priority_max", unimplementedFunc), 2294762Snate@binkert.org /* 160 */ SyscallDesc("sched_get_priority_min", unimplementedFunc), 2306143Snate@binkert.org /* 161 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc), 2314762Snate@binkert.org /* 162 */ SyscallDesc("nanosleep", unimplementedFunc), 2324762Snate@binkert.org /* 163 */ SyscallDesc("mremap", unimplementedFunc), 2334762Snate@binkert.org /* 164 */ SyscallDesc("setresuid", unimplementedFunc), 2346143Snate@binkert.org /* 165 */ SyscallDesc("getresuid", unimplementedFunc), 2356143Snate@binkert.org /* 166 */ SyscallDesc("vm862", unimplementedFunc), 2364762Snate@binkert.org /* 167 */ SyscallDesc("query_module", unimplementedFunc), 2378233Snate@binkert.org /* 168 */ SyscallDesc("poll", unimplementedFunc), 2388233Snate@binkert.org /* 169 */ SyscallDesc("nfsservctl", unimplementedFunc), 2398233Snate@binkert.org /* 170 */ SyscallDesc("setresgid", unimplementedFunc), 2408233Snate@binkert.org /* 171 */ SyscallDesc("getresgid", unimplementedFunc), 2416143Snate@binkert.org /* 172 */ SyscallDesc("prctl", unimplementedFunc), 2426143Snate@binkert.org /* 173 */ SyscallDesc("rt_sigaction", ignoreFunc), 2434762Snate@binkert.org /* 174 */ SyscallDesc("rt_sigprocmask", unimplementedFunc), 2446143Snate@binkert.org /* 175 */ SyscallDesc("unknown#175", unimplementedFunc), 2454762Snate@binkert.org /* 176 */ SyscallDesc("rt_sigpending", unimplementedFunc), 2466143Snate@binkert.org /* 177 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc), 2474762Snate@binkert.org /* 178 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc), 2486143Snate@binkert.org /* 179 */ SyscallDesc("rt_sigsuspend", unimplementedFunc), 2498233Snate@binkert.org /* 180 */ SyscallDesc("pread64", unimplementedFunc), 2508233Snate@binkert.org /* 181 */ SyscallDesc("pwrite64", unimplementedFunc), 25110453SAndrew.Bardsley@arm.com /* 182 */ SyscallDesc("chown", unimplementedFunc), 2526143Snate@binkert.org /* 183 */ SyscallDesc("getcwd", unimplementedFunc), 2536143Snate@binkert.org /* 184 */ SyscallDesc("capget", unimplementedFunc), 2546143Snate@binkert.org /* 185 */ SyscallDesc("capset", unimplementedFunc), 2556143Snate@binkert.org /* 186 */ SyscallDesc("sigaltstack", unimplementedFunc), 25611548Sandreas.hansson@arm.com /* 187 */ SyscallDesc("sendfile", unimplementedFunc), 2576143Snate@binkert.org /* 188 */ SyscallDesc("getpmsg", unimplementedFunc), 2586143Snate@binkert.org /* 189 */ SyscallDesc("putpmsg", unimplementedFunc), 2596143Snate@binkert.org /* 190 */ SyscallDesc("ugetrlimit", ignoreFunc), 2606143Snate@binkert.org /* 191 */ SyscallDesc("getrlimit", unimplementedFunc), 26110453SAndrew.Bardsley@arm.com /* 192 */ SyscallDesc("mmap2", mmapFunc<PowerLinux>), 26210453SAndrew.Bardsley@arm.com /* 193 */ SyscallDesc("truncate64", unimplementedFunc), 263955SN/A /* 194 */ SyscallDesc("ftruncate64", ftruncate64Func), 2649396Sandreas.hansson@arm.com /* 195 */ SyscallDesc("stat64", stat64Func<PowerLinux>), 2659396Sandreas.hansson@arm.com /* 196 */ SyscallDesc("lstat64", lstat64Func<PowerLinux>), 2669396Sandreas.hansson@arm.com /* 197 */ SyscallDesc("fstat64", fstat64Func<PowerLinux>), 2679396Sandreas.hansson@arm.com /* 198 */ SyscallDesc("lchown", unimplementedFunc), 2689396Sandreas.hansson@arm.com /* 199 */ SyscallDesc("getuid", getuidFunc), 2699396Sandreas.hansson@arm.com /* 200 */ SyscallDesc("getgid", getgidFunc), 2709396Sandreas.hansson@arm.com /* 201 */ SyscallDesc("geteuid", geteuidFunc), 2719396Sandreas.hansson@arm.com /* 202 */ SyscallDesc("getegid", getegidFunc), 2729396Sandreas.hansson@arm.com /* 203 */ SyscallDesc("setreuid", unimplementedFunc), 2739396Sandreas.hansson@arm.com /* 204 */ SyscallDesc("fcntl64", fcntl64Func), 2749396Sandreas.hansson@arm.com /* 205 */ SyscallDesc("getgroups", unimplementedFunc), 2759396Sandreas.hansson@arm.com /* 206 */ SyscallDesc("setgroups", unimplementedFunc), 2769396Sandreas.hansson@arm.com /* 207 */ SyscallDesc("fchown", unimplementedFunc), 2779930Sandreas.hansson@arm.com /* 208 */ SyscallDesc("setresuid", unimplementedFunc), 2789930Sandreas.hansson@arm.com /* 209 */ SyscallDesc("getresuid", unimplementedFunc), 2799396Sandreas.hansson@arm.com /* 210 */ SyscallDesc("setresgid", unimplementedFunc), 2808235Snate@binkert.org /* 211 */ SyscallDesc("getresgid", unimplementedFunc), 2818235Snate@binkert.org /* 212 */ SyscallDesc("chown", unimplementedFunc), 2826143Snate@binkert.org /* 213 */ SyscallDesc("setuid", unimplementedFunc), 2838235Snate@binkert.org /* 214 */ SyscallDesc("setgid", unimplementedFunc), 2849003SAli.Saidi@ARM.com /* 215 */ SyscallDesc("setfsuid", unimplementedFunc), 2858235Snate@binkert.org /* 216 */ SyscallDesc("setfsgid", unimplementedFunc), 2868235Snate@binkert.org /* 217 */ SyscallDesc("getdents64", unimplementedFunc), 2878235Snate@binkert.org /* 218 */ SyscallDesc("pivot_root", unimplementedFunc), 2888235Snate@binkert.org /* 219 */ SyscallDesc("mincore", unimplementedFunc), 2898235Snate@binkert.org /* 220 */ SyscallDesc("madvise", unimplementedFunc), 2908235Snate@binkert.org /* 221 */ SyscallDesc("unknown#221", unimplementedFunc), 2918235Snate@binkert.org /* 222 */ SyscallDesc("tux", unimplementedFunc), 2928235Snate@binkert.org /* 223 */ SyscallDesc("unknown#223", unimplementedFunc), 2938235Snate@binkert.org /* 224 */ SyscallDesc("gettid", unimplementedFunc), 2948235Snate@binkert.org /* 225 */ SyscallDesc("readahead", unimplementedFunc), 2958235Snate@binkert.org /* 226 */ SyscallDesc("setxattr", unimplementedFunc), 2968235Snate@binkert.org /* 227 */ SyscallDesc("lsetxattr", unimplementedFunc), 2978235Snate@binkert.org /* 228 */ SyscallDesc("fsetxattr", unimplementedFunc), 2988235Snate@binkert.org /* 229 */ SyscallDesc("getxattr", unimplementedFunc), 2999003SAli.Saidi@ARM.com /* 230 */ SyscallDesc("lgetxattr", unimplementedFunc), 3008235Snate@binkert.org /* 231 */ SyscallDesc("fgetxattr", unimplementedFunc), 3015584Snate@binkert.org /* 232 */ SyscallDesc("listxattr", unimplementedFunc), 3024382Sbinkertn@umich.edu /* 233 */ SyscallDesc("llistxattr", unimplementedFunc), 3034202Sbinkertn@umich.edu /* 234 */ SyscallDesc("exit_group", exitGroupFunc), 3044382Sbinkertn@umich.edu /* 235 */ SyscallDesc("removexattr", unimplementedFunc), 3054382Sbinkertn@umich.edu /* 236 */ SyscallDesc("lremovexattr", unimplementedFunc), 3064382Sbinkertn@umich.edu /* 237 */ SyscallDesc("fremovexattr", unimplementedFunc), 3079396Sandreas.hansson@arm.com /* 238 */ SyscallDesc("tkill", unimplementedFunc), 3085584Snate@binkert.org /* 239 */ SyscallDesc("sendfile64", unimplementedFunc), 3094382Sbinkertn@umich.edu /* 240 */ SyscallDesc("futex", unimplementedFunc), 3104382Sbinkertn@umich.edu /* 241 */ SyscallDesc("sched_setaffinity", unimplementedFunc), 3114382Sbinkertn@umich.edu /* 242 */ SyscallDesc("sched_getaffinity", unimplementedFunc), 3128232Snate@binkert.org /* 243 */ SyscallDesc("io_setup", unimplementedFunc), 3135192Ssaidi@eecs.umich.edu /* 244 */ SyscallDesc("io_destory", unimplementedFunc), 3148232Snate@binkert.org /* 245 */ SyscallDesc("io_getevents", unimplementedFunc), 3158232Snate@binkert.org /* 246 */ SyscallDesc("io_submit", unimplementedFunc), 3168232Snate@binkert.org /* 247 */ SyscallDesc("io_cancel", unimplementedFunc), 3175192Ssaidi@eecs.umich.edu /* 248 */ SyscallDesc("unknown#248", unimplementedFunc), 3188232Snate@binkert.org /* 249 */ SyscallDesc("lookup_dcookie", unimplementedFunc), 3195192Ssaidi@eecs.umich.edu /* 250 */ SyscallDesc("epoll_create", unimplementedFunc), 3205799Snate@binkert.org /* 251 */ SyscallDesc("epoll_ctl", unimplementedFunc), 3218232Snate@binkert.org /* 252 */ SyscallDesc("epoll_wait", unimplementedFunc), 3225192Ssaidi@eecs.umich.edu /* 253 */ SyscallDesc("remap_file_pages", unimplementedFunc), 3235192Ssaidi@eecs.umich.edu /* 254 */ SyscallDesc("set_thread_area", unimplementedFunc), 3245192Ssaidi@eecs.umich.edu /* 255 */ SyscallDesc("get_thread_area", unimplementedFunc), 3258232Snate@binkert.org /* 256 */ SyscallDesc("set_tid_address", unimplementedFunc), 3265192Ssaidi@eecs.umich.edu /* 257 */ SyscallDesc("timer_create", unimplementedFunc), 3278232Snate@binkert.org /* 258 */ SyscallDesc("timer_settime", unimplementedFunc), 3285192Ssaidi@eecs.umich.edu /* 259 */ SyscallDesc("timer_gettime", unimplementedFunc), 3295192Ssaidi@eecs.umich.edu /* 260 */ SyscallDesc("timer_getoverrun", unimplementedFunc), 3305192Ssaidi@eecs.umich.edu /* 261 */ SyscallDesc("timer_delete", unimplementedFunc), 3315192Ssaidi@eecs.umich.edu /* 262 */ SyscallDesc("clock_settime", unimplementedFunc), 3324382Sbinkertn@umich.edu /* 263 */ SyscallDesc("clock_gettime", unimplementedFunc), 3334382Sbinkertn@umich.edu /* 264 */ SyscallDesc("clock_getres", unimplementedFunc), 3344382Sbinkertn@umich.edu /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc), 3352667Sstever@eecs.umich.edu /* 266 */ SyscallDesc("statfs64", unimplementedFunc), 3362667Sstever@eecs.umich.edu /* 267 */ SyscallDesc("fstatfs64", unimplementedFunc), 3372667Sstever@eecs.umich.edu /* 268 */ SyscallDesc("tgkill", unimplementedFunc), 3382667Sstever@eecs.umich.edu /* 269 */ SyscallDesc("utimes", unimplementedFunc), 3392667Sstever@eecs.umich.edu /* 270 */ SyscallDesc("arm_fadvise64_64", unimplementedFunc), 3402667Sstever@eecs.umich.edu /* 271 */ SyscallDesc("pciconfig_iobase", unimplementedFunc), 3415742Snate@binkert.org /* 272 */ SyscallDesc("pciconfig_read", unimplementedFunc), 3425742Snate@binkert.org /* 273 */ SyscallDesc("pciconfig_write", unimplementedFunc), 3435742Snate@binkert.org /* 274 */ SyscallDesc("mq_open", unimplementedFunc), 3445793Snate@binkert.org /* 275 */ SyscallDesc("mq_unlink", unimplementedFunc), 3458334Snate@binkert.org /* 276 */ SyscallDesc("mq_timedsend", unimplementedFunc), 3465793Snate@binkert.org /* 277 */ SyscallDesc("mq_timedreceive", unimplementedFunc), 3475793Snate@binkert.org /* 278 */ SyscallDesc("mq_notify", unimplementedFunc), 3485793Snate@binkert.org /* 279 */ SyscallDesc("mq_getsetattr", unimplementedFunc), 3494382Sbinkertn@umich.edu /* 280 */ SyscallDesc("waitid", unimplementedFunc), 3504762Snate@binkert.org /* 281 */ SyscallDesc("socket", unimplementedFunc), 3515344Sstever@gmail.com /* 282 */ SyscallDesc("bind", unimplementedFunc), 3524382Sbinkertn@umich.edu /* 283 */ SyscallDesc("connect", unimplementedFunc), 3535341Sstever@gmail.com /* 284 */ SyscallDesc("listen", unimplementedFunc), 3545742Snate@binkert.org /* 285 */ SyscallDesc("accept", unimplementedFunc), 3555742Snate@binkert.org /* 286 */ SyscallDesc("getsockname", unimplementedFunc), 3565742Snate@binkert.org /* 287 */ SyscallDesc("getpeername", unimplementedFunc), 3575742Snate@binkert.org /* 288 */ SyscallDesc("socketpair", unimplementedFunc), 3585742Snate@binkert.org /* 289 */ SyscallDesc("send", unimplementedFunc), 3594762Snate@binkert.org /* 290 */ SyscallDesc("sendto", unimplementedFunc), 3605742Snate@binkert.org /* 291 */ SyscallDesc("recv", unimplementedFunc), 3615742Snate@binkert.org /* 292 */ SyscallDesc("recvfrom", unimplementedFunc), 36211984Sgabeblack@google.com /* 293 */ SyscallDesc("shutdown", unimplementedFunc), 3637722Sgblack@eecs.umich.edu /* 294 */ SyscallDesc("setsockopt", unimplementedFunc), 3645742Snate@binkert.org /* 295 */ SyscallDesc("getsockopt", unimplementedFunc), 3655742Snate@binkert.org /* 296 */ SyscallDesc("sendmsg", unimplementedFunc), 3665742Snate@binkert.org /* 297 */ SyscallDesc("rcvmsg", unimplementedFunc), 3679930Sandreas.hansson@arm.com /* 298 */ SyscallDesc("semop", unimplementedFunc), 3689930Sandreas.hansson@arm.com /* 299 */ SyscallDesc("semget", unimplementedFunc), 3699930Sandreas.hansson@arm.com /* 300 */ SyscallDesc("semctl", unimplementedFunc), 3709930Sandreas.hansson@arm.com /* 301 */ SyscallDesc("msgsend", unimplementedFunc), 3719930Sandreas.hansson@arm.com /* 302 */ SyscallDesc("msgrcv", unimplementedFunc), 3725742Snate@binkert.org /* 303 */ SyscallDesc("msgget", unimplementedFunc), 3738242Sbradley.danofsky@amd.com /* 304 */ SyscallDesc("msgctl", unimplementedFunc), 3748242Sbradley.danofsky@amd.com /* 305 */ SyscallDesc("shmat", unimplementedFunc), 3758242Sbradley.danofsky@amd.com /* 306 */ SyscallDesc("shmdt", unimplementedFunc), 3768242Sbradley.danofsky@amd.com /* 307 */ SyscallDesc("shmget", unimplementedFunc), 3775341Sstever@gmail.com /* 308 */ SyscallDesc("shmctl", unimplementedFunc), 3785742Snate@binkert.org /* 309 */ SyscallDesc("add_key", unimplementedFunc), 3797722Sgblack@eecs.umich.edu /* 310 */ SyscallDesc("request_key", unimplementedFunc), 3804773Snate@binkert.org /* 311 */ SyscallDesc("keyctl", unimplementedFunc), 3816108Snate@binkert.org /* 312 */ SyscallDesc("semtimedop", unimplementedFunc), 3821858SN/A /* 313 */ SyscallDesc("vserver", unimplementedFunc), 3831085SN/A /* 314 */ SyscallDesc("ioprio_set", unimplementedFunc), 3846658Snate@binkert.org /* 315 */ SyscallDesc("ioprio_get", unimplementedFunc), 3856658Snate@binkert.org /* 316 */ SyscallDesc("inotify_init", unimplementedFunc), 3867673Snate@binkert.org /* 317 */ SyscallDesc("inotify_add_watch", unimplementedFunc), 3876658Snate@binkert.org /* 318 */ SyscallDesc("inotify_rm_watch", unimplementedFunc), 3886658Snate@binkert.org /* 319 */ SyscallDesc("mbind", unimplementedFunc), 38911308Santhony.gutierrez@amd.com /* 320 */ SyscallDesc("get_mempolicy", unimplementedFunc), 3906658Snate@binkert.org /* 321 */ SyscallDesc("set_mempolicy", unimplementedFunc), 39111308Santhony.gutierrez@amd.com /* 322 */ SyscallDesc("openat", unimplementedFunc), 3926658Snate@binkert.org /* 323 */ SyscallDesc("mkdirat", unimplementedFunc), 3936658Snate@binkert.org /* 324 */ SyscallDesc("mknodat", unimplementedFunc), 3947673Snate@binkert.org /* 325 */ SyscallDesc("fchownat", unimplementedFunc), 3957673Snate@binkert.org /* 326 */ SyscallDesc("futimesat", unimplementedFunc), 3967673Snate@binkert.org /* 327 */ SyscallDesc("fstatat64", unimplementedFunc), 3977673Snate@binkert.org /* 328 */ SyscallDesc("unlinkat", unimplementedFunc), 3987673Snate@binkert.org /* 329 */ SyscallDesc("renameat", unimplementedFunc), 3997673Snate@binkert.org /* 330 */ SyscallDesc("linkat", unimplementedFunc), 4007673Snate@binkert.org /* 331 */ SyscallDesc("symlinkat", unimplementedFunc), 40110467Sandreas.hansson@arm.com /* 332 */ SyscallDesc("readlinkat", unimplementedFunc), 4026658Snate@binkert.org /* 333 */ SyscallDesc("fchmodat", unimplementedFunc), 4037673Snate@binkert.org /* 334 */ SyscallDesc("faccessat", unimplementedFunc), 40410467Sandreas.hansson@arm.com /* 335 */ SyscallDesc("pselect6", unimplementedFunc), 40510467Sandreas.hansson@arm.com /* 336 */ SyscallDesc("ppoll", unimplementedFunc), 40610467Sandreas.hansson@arm.com /* 337 */ SyscallDesc("unshare", unimplementedFunc), 40710467Sandreas.hansson@arm.com /* 338 */ SyscallDesc("set_robust_list", unimplementedFunc), 40810467Sandreas.hansson@arm.com /* 339 */ SyscallDesc("get_robust_list", unimplementedFunc), 40910467Sandreas.hansson@arm.com /* 340 */ SyscallDesc("splice", unimplementedFunc), 41010467Sandreas.hansson@arm.com /* 341 */ SyscallDesc("arm_sync_file_range", unimplementedFunc), 41110467Sandreas.hansson@arm.com /* 342 */ SyscallDesc("tee", unimplementedFunc), 41210467Sandreas.hansson@arm.com /* 343 */ SyscallDesc("vmsplice", unimplementedFunc), 41310467Sandreas.hansson@arm.com /* 344 */ SyscallDesc("move_pages", unimplementedFunc), 41410467Sandreas.hansson@arm.com /* 345 */ SyscallDesc("getcpu", unimplementedFunc), 4157673Snate@binkert.org /* 346 */ SyscallDesc("epoll_pwait", unimplementedFunc), 4167673Snate@binkert.org}; 4177673Snate@binkert.org 4187673Snate@binkert.orgPowerLinuxProcess::PowerLinuxProcess(ProcessParams * params, 4197673Snate@binkert.org ObjectFile *objFile) 4209048SAli.Saidi@ARM.com : PowerProcess(params, objFile), 4217673Snate@binkert.org Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) 4227673Snate@binkert.org{ 4237673Snate@binkert.org} 4247673Snate@binkert.org 4256658Snate@binkert.orgSyscallDesc* 4267756SAli.Saidi@ARM.comPowerLinuxProcess::getDesc(int callnum) 4277816Ssteve.reinhardt@amd.com{ 4286658Snate@binkert.org if (callnum < 0 || callnum > Num_Syscall_Descs) 42911308Santhony.gutierrez@amd.com return NULL; 43011308Santhony.gutierrez@amd.com 43111308Santhony.gutierrez@amd.com return &syscallDescs[callnum]; 43211308Santhony.gutierrez@amd.com} 43311308Santhony.gutierrez@amd.com 43411308Santhony.gutierrez@amd.comvoid 43511308Santhony.gutierrez@amd.comPowerLinuxProcess::initState() 43611308Santhony.gutierrez@amd.com{ 43711308Santhony.gutierrez@amd.com PowerProcess::initState(); 43811308Santhony.gutierrez@amd.com} 43911308Santhony.gutierrez@amd.com 44011308Santhony.gutierrez@amd.comRegVal 44111308Santhony.gutierrez@amd.comPowerLinuxProcess::getSyscallArg(ThreadContext *tc, int &i) 44211308Santhony.gutierrez@amd.com{ 44311308Santhony.gutierrez@amd.com // Linux apparently allows more parameter than the ABI says it should. 44411308Santhony.gutierrez@amd.com // This limit may need to be increased even further. 44511308Santhony.gutierrez@amd.com assert(i < 6); 44611308Santhony.gutierrez@amd.com return tc->readIntReg(ArgumentReg0 + i++); 44711308Santhony.gutierrez@amd.com} 44811308Santhony.gutierrez@amd.com 44911308Santhony.gutierrez@amd.comvoid 45011308Santhony.gutierrez@amd.comPowerLinuxProcess::setSyscallArg(ThreadContext *tc, int i, RegVal val) 45111308Santhony.gutierrez@amd.com{ 45211308Santhony.gutierrez@amd.com // Linux apparently allows more parameter than the ABI says it should. 45311308Santhony.gutierrez@amd.com // This limit may need to be increased even further. 45411308Santhony.gutierrez@amd.com assert(i < 6); 45511308Santhony.gutierrez@amd.com tc->setIntReg(ArgumentReg0 + i, val); 45611308Santhony.gutierrez@amd.com} 45711308Santhony.gutierrez@amd.com