arch,sim: Create a common structure to hold syscall tables.

Also add the syscall number into the SyscallDesc class.

The common table structure is basically just a map that extracts its
key value from the SyscallDesc class using a new num() accessor. By
using a map instead of an array (like RISCV was already doing), it's
easy to support gaps of arbitrary size and non-zero offsets of groups
of system calls without lots of filler or additional logic. This
simplified the ARM system call tables in particular which had a lot
of filler entries.

Also, both the 32 and 64 bit ARM syscall tables had entries for a
syscall at 123456 which was the "Angel SWI system call". This value
is actually the immediate constant passed to the SWI system call
instruction and is not interpreted as the system call number in linux.
This constant can be intercepted by hardware or a simulator to, for
instance, implement ARM semihosting.

Also, that constant in combination with the SWI instruction is only
used for semihosting in 32 bit ARM mode, not in 64 bit mode or in
thumb.

Since checking for that system call number was very likely a mistake
from misinterpreting how the semihosting calls work, this change
drops those checks.

Change-Id: I9b2a902d7326791449cf0e1b98e932dcadba54f7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24117
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2020-01-01 00:39:09 -08:00
parent db7f6a5fa8
commit ab8d484c27
20 changed files with 3636 additions and 5640 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -40,19 +40,6 @@
class ArmFreebsdProcessBits
{
protected:
SyscallDesc* getFreebsdDesc(int callnum);
struct SyscallTable
{
int base;
SyscallDesc *descs;
int size;
SyscallDesc *getDesc(int offset) const;
};
std::vector<SyscallTable> syscallTables;
struct SyscallABI {};
};

File diff suppressed because it is too large Load Diff

View File

@@ -48,19 +48,6 @@
class ArmLinuxProcessBits
{
protected:
SyscallDesc* getLinuxDesc(int callnum);
struct SyscallTable
{
int base;
SyscallDesc *descs;
int size;
SyscallDesc *getDesc(int offset) const;
};
std::vector<SyscallTable> syscallTables;
struct SyscallABI {};
};

View File

@@ -151,345 +151,338 @@ setThreadAreaFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, Addr addr)
return 0;
}
SyscallDescABI<MipsProcess::SyscallABI> MipsLinuxProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
/* 3 */ { "read", readFunc<MipsLinux> },
/* 4 */ { "write", writeFunc<MipsLinux> },
/* 5 */ { "open", openFunc<MipsLinux> },
/* 6 */ { "close", closeFunc },
/* 7 */ { "waitpid" },
/* 8 */ { "creat" },
/* 9 */ { "link" },
/* 10 */ { "unlink", unlinkFunc },
/* 11 */ { "execve" },
/* 12 */ { "chdir" },
/* 13 */ { "time" },
/* 14 */ { "mknod" },
/* 15 */ { "chmod", chmodFunc<MipsLinux> },
/* 16 */ { "lchown", chownFunc },
/* 17 */ { "break", brkFunc },
/* 18 */ { "unused#18" },
/* 19 */ { "lseek", lseekFunc },
/* 20 */ { "getpid", getpidFunc },
/* 21 */ { "mount" },
/* 22 */ { "umount" },
/* 23 */ { "setuid", ignoreFunc },
/* 24 */ { "getuid", getuidFunc },
/* 25 */ { "stime" },
/* 26 */ { "ptrace" },
/* 27 */ { "alarm" },
/* 28 */ { "unused#28" },
/* 29 */ { "pause" },
/* 30 */ { "utime" },
/* 31 */ { "stty" },
/* 32 */ { "gtty" },
/* 33 */ { "access" },
/* 34 */ { "nice" },
/* 35 */ { "ftime" },
/* 36 */ { "sync" },
/* 37 */ { "kill" },
/* 38 */ { "rename" },
/* 39 */ { "mkdir", mkdirFunc },
/* 40 */ { "rmdir" },
/* 41 */ { "dup" },
/* 42 */ { "pipe", pipePseudoFunc },
/* 43 */ { "times" },
/* 44 */ { "prof" },
/* 45 */ { "brk", brkFunc },
/* 46 */ { "setgid" },
/* 47 */ { "getgid", getgidFunc },
/* 48 */ { "signal", ignoreFunc },
/* 49 */ { "geteuid", geteuidFunc },
/* 50 */ { "getegid", getegidFunc },
/* 51 */ { "acct" },
/* 52 */ { "umount2" },
/* 53 */ { "lock" },
/* 54 */ { "ioctl", ioctlFunc<MipsLinux> },
/* 55 */ { "fcntl", fcntlFunc },
/* 56 */ { "mpx" },
/* 57 */ { "setpgid" },
/* 58 */ { "ulimit" },
/* 59 */ { "unused#59" },
/* 60 */ { "umask", umaskFunc },
/* 61 */ { "chroot" },
/* 62 */ { "ustat" },
/* 63 */ { "dup2" },
/* 64 */ { "getppid", getpagesizeFunc },
/* 65 */ { "getpgrp" },
/* 66 */ { "setsid" },
/* 67 */ { "sigaction" },
/* 68 */ { "sgetmask" },
/* 69 */ { "ssetmask" },
/* 70 */ { "setreuid" },
/* 71 */ { "setregid" },
/* 72 */ { "sigsuspend" },
/* 73 */ { "sigpending" },
/* 74 */ { "sethostname", ignoreFunc },
/* 75 */ { "setrlimit" },
/* 76 */ { "getrlimit" },
/* 77 */ { "getrusage", getrusageFunc<MipsLinux> },
/* 78 */ { "gettimeofday" },
/* 79 */ { "settimeofday" },
/* 80 */ { "getgroups" },
/* 81 */ { "setgroups" },
/* 82 */ { "reserved#82" },
/* 83 */ { "symlink" },
/* 84 */ { "unused#84" },
/* 85 */ { "readlink", readlinkFunc },
/* 86 */ { "uselib" },
/* 87 */ { "swapon", gethostnameFunc },
/* 88 */ { "reboot" },
/* 89 */ { "readdir" },
/* 90 */ { "mmap", mmapFunc<MipsLinux> },
/* 91 */ { "munmap",munmapFunc },
/* 92 */ { "truncate", truncateFunc },
/* 93 */ { "ftruncate", ftruncateFunc },
/* 94 */ { "fchmod", fchmodFunc<MipsLinux> },
/* 95 */ { "fchown", fchownFunc },
/* 96 */ { "getpriority" },
/* 97 */ { "setpriority" },
/* 98 */ { "profil" },
/* 99 */ { "statfs" },
/* 100 */ { "fstatfs" },
/* 101 */ { "ioperm" },
/* 102 */ { "socketcall" },
/* 103 */ { "syslog" },
/* 104 */ { "setitimer" },
/* 105 */ { "getitimer" },
/* 106 */ { "stat", statFunc<MipsLinux> },
/* 107 */ { "lstat" },
/* 108 */ { "fstat", fstatFunc<MipsLinux> },
/* 109 */ { "unused#109" },
/* 110 */ { "iopl" },
/* 111 */ { "vhangup" },
/* 112 */ { "idle", ignoreFunc },
/* 113 */ { "vm86" },
/* 114 */ { "wait4" },
/* 115 */ { "swapoff" },
/* 116 */ { "sysinfo", sysinfoFunc<MipsLinux> },
/* 117 */ { "ipc" },
/* 118 */ { "fsync" },
/* 119 */ { "sigreturn" },
/* 120 */ { "clone" },
/* 121 */ { "setdomainname" },
/* 122 */ { "uname", unameFunc },
/* 123 */ { "modify_ldt" },
/* 124 */ { "adjtimex" },
/* 125 */ { "mprotect", ignoreFunc },
/* 126 */ { "sigprocmask" },
/* 127 */ { "create_module" },
/* 128 */ { "init_module" },
/* 129 */ { "delete_module" },
/* 130 */ { "get_kernel_syms" },
/* 131 */ { "quotactl" },
/* 132 */ { "getpgid" },
/* 133 */ { "fchdir" },
/* 134 */ { "bdflush" },
/* 135 */ { "sysfs" },
/* 136 */ { "personality" },
/* 137 */ { "afs_syscall" },
/* 138 */ { "setfsuid" },
/* 139 */ { "setfsgid" },
/* 140 */ { "llseek" },
/* 141 */ { "getdents" },
/* 142 */ { "newselect" },
/* 143 */ { "flock" },
/* 144 */ { "msync" },
/* 145 */ { "readv" },
/* 146 */ { "writev", writevFunc<MipsLinux> },
/* 147 */ { "cacheflush" },
/* 148 */ { "cachectl" },
/* 149 */ { "sysmips" },
/* 150 */ { "unused#150" },
/* 151 */ { "getsid" },
/* 152 */ { "fdatasync" },
/* 153 */ { "sysctl", ignoreFunc },
/* 154 */ { "mlock" },
/* 155 */ { "munlock" },
/* 156 */ { "mlockall" },
/* 157 */ { "munlockall" },
/* 158 */ { "sched_setparam" },
/* 159 */ { "sched_getparam" },
/* 160 */ { "sched_setscheduler" },
/* 161 */ { "sched_getscheduler" },
/* 162 */ { "sched_yield" },
/* 163 */ { "sched_get_prioritymax" },
/* 164 */ { "sched_get_priority_min" },
/* 165 */ { "sched_rr_get_interval" },
/* 166 */ { "nanosleep" },
/* 167 */ { "mremap", mremapFunc<MipsLinux> },
/* 168 */ { "accept" },
/* 169 */ { "bind" },
/* 170 */ { "connect" },
/* 171 */ { "getpeername" },
/* 172 */ { "getsockname" },
/* 173 */ { "getsockopt" },
/* 174 */ { "listen" },
/* 175 */ { "recv" },
/* 176 */ { "recvmsg" },
/* 177 */ { "send" },
/* 178 */ { "sendmsg", ignoreFunc },
/* 179 */ { "sendto" },
/* 180 */ { "setsockopt" },
/* 181 */ { "shutdown" },
/* 182 */ { "unknown #182" },
/* 183 */ { "socket", ignoreFunc },
/* 184 */ { "socketpair" },
/* 185 */ { "setresuid" },
/* 186 */ { "getresuid" },
/* 187 */ { "query_module" },
/* 188 */ { "poll" },
/* 189 */ { "nfsservctl" },
/* 190 */ { "setresgid" },
/* 191 */ { "getresgid" },
/* 192 */ { "prctl" },
/* 193 */ { "rt_sigreturn" },
/* 194 */ { "rt_sigaction" },
/* 195 */ { "rt_sigprocmask" },
/* 196 */ { "rt_sigpending" },
/* 197 */ { "rt_sigtimedwait" },
/* 198 */ { "rt_sigqueueinfo", ignoreFunc },
/* 199 */ { "rt_sigsuspend" },
/* 200 */ { "pread64" },
/* 201 */ { "pwrite64" },
/* 202 */ { "chown" },
/* 203 */ { "getcwd", getcwdFunc },
/* 204 */ { "capget" },
/* 205 */ { "capset" },
/* 206 */ { "sigalstack" },
/* 207 */ { "sendfile" },
/* 208 */ { "getpmsg" },
/* 209 */ { "putpmsg" },
/* 210 */ { "mmap2" },
/* 211 */ { "truncate64" },
/* 212 */ { "ftruncate64" },
/* 213 */ { "stat64" },
/* 214 */ { "lstat64", lstat64Func<MipsLinux> },
/* 215 */ { "fstat64", fstat64Func<MipsLinux> },
/* 216 */ { "pivot_root" },
/* 217 */ { "mincore" },
/* 218 */ { "madvise" },
/* 219 */ { "getdents64" },
/* 220 */ { "fcntl64", fcntl64Func },
/* 221 */ { "reserved#221" },
/* 222 */ { "gettid" },
/* 223 */ { "readahead" },
/* 224 */ { "setxattr" },
/* 225 */ { "lsetxattr" },
/* 226 */ { "fsetxattr" },
/* 227 */ { "getxattr" },
/* 228 */ { "lgetxattr" },
/* 229 */ { "fgetxattr" },
/* 230 */ { "listxattr" },
/* 231 */ { "llistxattr" },
/* 232 */ { "flistxattr" },
/* 233 */ { "removexattr" },
/* 234 */ { "lremovexattr" },
/* 235 */ { "fremovexattr", ignoreFunc },
/* 236 */ { "tkill" },
/* 237 */ { "sendfile64" },
/* 238 */ { "futex" },
/* 239 */ { "sched_setaffinity" },
/* 240 */ { "sched_getaffinity" },
/* 241 */ { "io_setup" },
/* 242 */ { "io_destroy" },
/* 243 */ { "io_getevents" },
/* 244 */ { "io_submit" },
/* 245 */ { "io_cancel" },
/* 246 */ { "exit_group", exitFunc },
/* 247 */ { "lookup_dcookie" },
/* 248 */ { "epoll_create" },
/* 249 */ { "epoll_ctl" },
/* 250 */ { "epoll_wait" },
/* 251 */ { "remap_file_pages" },
/* 252 */ { "set_tid_address" },
/* 253 */ { "restart_syscall" },
/* 254 */ { "fadvise64" },
/* 255 */ { "statfs64" },
/* 256 */ { "fstafs64" },
/* 257 */ { "timer_create", sys_getsysinfoFunc },
/* 258 */ { "timer_settime", sys_setsysinfoFunc },
/* 259 */ { "timer_gettime" },
/* 260 */ { "timer_getoverrun" },
/* 261 */ { "timer_delete" },
/* 262 */ { "clock_settime" },
/* 263 */ { "clock_gettime" },
/* 264 */ { "clock_getres" },
/* 265 */ { "clock_nanosleep" },
/* 266 */ { "tgkill" },
/* 267 */ { "utimes" },
/* 268 */ { "mbind" },
/* 269 */ { "get_mempolicy" },
/* 270 */ { "set_mempolicy" },
/* 271 */ { "mq_open" },
/* 272 */ { "mq_unlink" },
/* 273 */ { "mq_timedsend" },
/* 274 */ { "mq_timedreceive" },
/* 275 */ { "mq_notify" },
/* 276 */ { "mq_getsetattr" },
/* 277 */ { "vserver" },
/* 278 */ { "waitid" },
/* 279 */ { "unknown #279" },
/* 280 */ { "add_key" },
/* 281 */ { "request_key" },
/* 282 */ { "keyctl" },
/* 283 */ { "set_thread_area", setThreadAreaFunc },
/* 284 */ { "inotify_init" },
/* 285 */ { "inotify_add_watch" },
/* 286 */ { "inotify_rm_watch" },
/* 287 */ { "migrate_pages" },
/* 288 */ { "openat" },
/* 289 */ { "mkdirat" },
/* 290 */ { "mknodat" },
/* 291 */ { "fchownat" },
/* 292 */ { "futimesat" },
/* 293 */ { "fstatat64" },
/* 294 */ { "unlinkat" },
/* 295 */ { "renameat" },
/* 296 */ { "linkat" },
/* 297 */ { "symlinkat" },
/* 298 */ { "readlinkat" },
/* 299 */ { "fchmodat" },
/* 300 */ { "faccessat" },
/* 301 */ { "pselect6" },
/* 302 */ { "ppoll" },
/* 303 */ { "unshare" },
/* 304 */ { "splice" },
/* 305 */ { "sync_file_range" },
/* 306 */ { "tee" },
/* 307 */ { "vmsplice" },
/* 308 */ { "move_pages" },
/* 309 */ { "set_robust_list" },
/* 310 */ { "get_robust_list" },
/* 311 */ { "kexec_load" },
/* 312 */ { "getcpu" },
/* 313 */ { "epoll_pwait" },
/* 314 */ { "ioprio_set" },
/* 315 */ { "ioprio_get" },
/* 316 */ { "utimensat" },
/* 317 */ { "signalfd" },
/* 318 */ { "timerfd" },
/* 319 */ { "eventfd" }
SyscallDescTable<MipsProcess::SyscallABI> MipsLinuxProcess::syscallDescs = {
{ 4000, "syscall" },
{ 4001, "exit", exitFunc },
{ 4002, "fork" },
{ 4003, "read", readFunc<MipsLinux> },
{ 4004, "write", writeFunc<MipsLinux> },
{ 4005, "open", openFunc<MipsLinux> },
{ 4006, "close", closeFunc },
{ 4007, "waitpid" },
{ 4008, "creat" },
{ 4009, "link" },
{ 4010, "unlink", unlinkFunc },
{ 4011, "execve" },
{ 4012, "chdir" },
{ 4013, "time" },
{ 4014, "mknod" },
{ 4015, "chmod", chmodFunc<MipsLinux> },
{ 4016, "lchown", chownFunc },
{ 4017, "break", brkFunc },
{ 4018, "unused#18" },
{ 4019, "lseek", lseekFunc },
{ 4020, "getpid", getpidFunc },
{ 4021, "mount" },
{ 4022, "umount" },
{ 4023, "setuid", ignoreFunc },
{ 4024, "getuid", getuidFunc },
{ 4025, "stime" },
{ 4026, "ptrace" },
{ 4027, "alarm" },
{ 4028, "unused#28" },
{ 4029, "pause" },
{ 4030, "utime" },
{ 4031, "stty" },
{ 4032, "gtty" },
{ 4033, "access" },
{ 4034, "nice" },
{ 4035, "ftime" },
{ 4036, "sync" },
{ 4037, "kill" },
{ 4038, "rename" },
{ 4039, "mkdir", mkdirFunc },
{ 4040, "rmdir" },
{ 4041, "dup" },
{ 4042, "pipe", pipePseudoFunc },
{ 4043, "times" },
{ 4044, "prof" },
{ 4045, "brk", brkFunc },
{ 4046, "setgid" },
{ 4047, "getgid", getgidFunc },
{ 4048, "signal", ignoreFunc },
{ 4049, "geteuid", geteuidFunc },
{ 4050, "getegid", getegidFunc },
{ 4051, "acct" },
{ 4052, "umount2" },
{ 4053, "lock" },
{ 4054, "ioctl", ioctlFunc<MipsLinux> },
{ 4055, "fcntl", fcntlFunc },
{ 4056, "mpx" },
{ 4057, "setpgid" },
{ 4058, "ulimit" },
{ 4059, "unused#59" },
{ 4060, "umask", umaskFunc },
{ 4061, "chroot" },
{ 4062, "ustat" },
{ 4063, "dup2" },
{ 4064, "getppid", getpagesizeFunc },
{ 4065, "getpgrp" },
{ 4066, "setsid" },
{ 4067, "sigaction" },
{ 4068, "sgetmask" },
{ 4069, "ssetmask" },
{ 4070, "setreuid" },
{ 4071, "setregid" },
{ 4072, "sigsuspend" },
{ 4073, "sigpending" },
{ 4074, "sethostname", ignoreFunc },
{ 4075, "setrlimit" },
{ 4076, "getrlimit" },
{ 4077, "getrusage", getrusageFunc<MipsLinux> },
{ 4078, "gettimeofday" },
{ 4079, "settimeofday" },
{ 4080, "getgroups" },
{ 4081, "setgroups" },
{ 4082, "reserved#82" },
{ 4083, "symlink" },
{ 4084, "unused#84" },
{ 4085, "readlink", readlinkFunc },
{ 4086, "uselib" },
{ 4087, "swapon", gethostnameFunc },
{ 4088, "reboot" },
{ 4089, "readdir" },
{ 4090, "mmap", mmapFunc<MipsLinux> },
{ 4091, "munmap",munmapFunc },
{ 4092, "truncate", truncateFunc },
{ 4093, "ftruncate", ftruncateFunc },
{ 4094, "fchmod", fchmodFunc<MipsLinux> },
{ 4095, "fchown", fchownFunc },
{ 4096, "getpriority" },
{ 4097, "setpriority" },
{ 4098, "profil" },
{ 4099, "statfs" },
{ 4100, "fstatfs" },
{ 4101, "ioperm" },
{ 4102, "socketcall" },
{ 4103, "syslog" },
{ 4104, "setitimer" },
{ 4105, "getitimer" },
{ 4106, "stat", statFunc<MipsLinux> },
{ 4107, "lstat" },
{ 4108, "fstat", fstatFunc<MipsLinux> },
{ 4109, "unused#109" },
{ 4110, "iopl" },
{ 4111, "vhangup" },
{ 4112, "idle", ignoreFunc },
{ 4113, "vm86" },
{ 4114, "wait4" },
{ 4115, "swapoff" },
{ 4116, "sysinfo", sysinfoFunc<MipsLinux> },
{ 4117, "ipc" },
{ 4118, "fsync" },
{ 4119, "sigreturn" },
{ 4120, "clone" },
{ 4121, "setdomainname" },
{ 4122, "uname", unameFunc },
{ 4123, "modify_ldt" },
{ 4124, "adjtimex" },
{ 4125, "mprotect", ignoreFunc },
{ 4126, "sigprocmask" },
{ 4127, "create_module" },
{ 4128, "init_module" },
{ 4129, "delete_module" },
{ 4130, "get_kernel_syms" },
{ 4131, "quotactl" },
{ 4132, "getpgid" },
{ 4133, "fchdir" },
{ 4134, "bdflush" },
{ 4135, "sysfs" },
{ 4136, "personality" },
{ 4137, "afs_syscall" },
{ 4138, "setfsuid" },
{ 4139, "setfsgid" },
{ 4140, "llseek" },
{ 4141, "getdents" },
{ 4142, "newselect" },
{ 4143, "flock" },
{ 4144, "msync" },
{ 4145, "readv" },
{ 4146, "writev", writevFunc<MipsLinux> },
{ 4147, "cacheflush" },
{ 4148, "cachectl" },
{ 4149, "sysmips" },
{ 4150, "unused#150" },
{ 4151, "getsid" },
{ 4152, "fdatasync" },
{ 4153, "sysctl", ignoreFunc },
{ 4154, "mlock" },
{ 4155, "munlock" },
{ 4156, "mlockall" },
{ 4157, "munlockall" },
{ 4158, "sched_setparam" },
{ 4159, "sched_getparam" },
{ 4160, "sched_setscheduler" },
{ 4161, "sched_getscheduler" },
{ 4162, "sched_yield" },
{ 4163, "sched_get_prioritymax" },
{ 4164, "sched_get_priority_min" },
{ 4165, "sched_rr_get_interval" },
{ 4166, "nanosleep" },
{ 4167, "mremap", mremapFunc<MipsLinux> },
{ 4168, "accept" },
{ 4169, "bind" },
{ 4170, "connect" },
{ 4171, "getpeername" },
{ 4172, "getsockname" },
{ 4173, "getsockopt" },
{ 4174, "listen" },
{ 4175, "recv" },
{ 4176, "recvmsg" },
{ 4177, "send" },
{ 4178, "sendmsg", ignoreFunc },
{ 4179, "sendto" },
{ 4180, "setsockopt" },
{ 4181, "shutdown" },
{ 4182, "unknown #182" },
{ 4183, "socket", ignoreFunc },
{ 4184, "socketpair" },
{ 4185, "setresuid" },
{ 4186, "getresuid" },
{ 4187, "query_module" },
{ 4188, "poll" },
{ 4189, "nfsservctl" },
{ 4190, "setresgid" },
{ 4191, "getresgid" },
{ 4192, "prctl" },
{ 4193, "rt_sigreturn" },
{ 4194, "rt_sigaction" },
{ 4195, "rt_sigprocmask" },
{ 4196, "rt_sigpending" },
{ 4197, "rt_sigtimedwait" },
{ 4198, "rt_sigqueueinfo", ignoreFunc },
{ 4199, "rt_sigsuspend" },
{ 4200, "pread64" },
{ 4201, "pwrite64" },
{ 4202, "chown" },
{ 4203, "getcwd", getcwdFunc },
{ 4204, "capget" },
{ 4205, "capset" },
{ 4206, "sigalstack" },
{ 4207, "sendfile" },
{ 4208, "getpmsg" },
{ 4209, "putpmsg" },
{ 4210, "mmap2" },
{ 4211, "truncate64" },
{ 4212, "ftruncate64" },
{ 4213, "stat64" },
{ 4214, "lstat64", lstat64Func<MipsLinux> },
{ 4215, "fstat64", fstat64Func<MipsLinux> },
{ 4216, "pivot_root" },
{ 4217, "mincore" },
{ 4218, "madvise" },
{ 4219, "getdents64" },
{ 4220, "fcntl64", fcntl64Func },
{ 4221, "reserved#221" },
{ 4222, "gettid" },
{ 4223, "readahead" },
{ 4224, "setxattr" },
{ 4225, "lsetxattr" },
{ 4226, "fsetxattr" },
{ 4227, "getxattr" },
{ 4228, "lgetxattr" },
{ 4229, "fgetxattr" },
{ 4230, "listxattr" },
{ 4231, "llistxattr" },
{ 4232, "flistxattr" },
{ 4233, "removexattr" },
{ 4234, "lremovexattr" },
{ 4235, "fremovexattr", ignoreFunc },
{ 4236, "tkill" },
{ 4237, "sendfile64" },
{ 4238, "futex" },
{ 4239, "sched_setaffinity" },
{ 4240, "sched_getaffinity" },
{ 4241, "io_setup" },
{ 4242, "io_destroy" },
{ 4243, "io_getevents" },
{ 4244, "io_submit" },
{ 4245, "io_cancel" },
{ 4246, "exit_group", exitFunc },
{ 4247, "lookup_dcookie" },
{ 4248, "epoll_create" },
{ 4249, "epoll_ctl" },
{ 4250, "epoll_wait" },
{ 4251, "remap_file_pages" },
{ 4252, "set_tid_address" },
{ 4253, "restart_syscall" },
{ 4254, "fadvise64" },
{ 4255, "statfs64" },
{ 4256, "fstafs64" },
{ 4257, "timer_create", sys_getsysinfoFunc },
{ 4258, "timer_settime", sys_setsysinfoFunc },
{ 4259, "timer_gettime" },
{ 4260, "timer_getoverrun" },
{ 4261, "timer_delete" },
{ 4262, "clock_settime" },
{ 4263, "clock_gettime" },
{ 4264, "clock_getres" },
{ 4265, "clock_nanosleep" },
{ 4266, "tgkill" },
{ 4267, "utimes" },
{ 4268, "mbind" },
{ 4269, "get_mempolicy" },
{ 4270, "set_mempolicy" },
{ 4271, "mq_open" },
{ 4272, "mq_unlink" },
{ 4273, "mq_timedsend" },
{ 4274, "mq_timedreceive" },
{ 4275, "mq_notify" },
{ 4276, "mq_getsetattr" },
{ 4277, "vserver" },
{ 4278, "waitid" },
{ 4279, "unknown #279" },
{ 4280, "add_key" },
{ 4281, "request_key" },
{ 4282, "keyctl" },
{ 4283, "set_thread_area", setThreadAreaFunc },
{ 4284, "inotify_init" },
{ 4285, "inotify_add_watch" },
{ 4286, "inotify_rm_watch" },
{ 4287, "migrate_pages" },
{ 4288, "openat" },
{ 4289, "mkdirat" },
{ 4290, "mknodat" },
{ 4291, "fchownat" },
{ 4292, "futimesat" },
{ 4293, "fstatat64" },
{ 4294, "unlinkat" },
{ 4295, "renameat" },
{ 4296, "linkat" },
{ 4297, "symlinkat" },
{ 4298, "readlinkat" },
{ 4299, "fchmodat" },
{ 4300, "faccessat" },
{ 4301, "pselect6" },
{ 4302, "ppoll" },
{ 4303, "unshare" },
{ 4304, "splice" },
{ 4305, "sync_file_range" },
{ 4306, "tee" },
{ 4307, "vmsplice" },
{ 4308, "move_pages" },
{ 4309, "set_robust_list" },
{ 4310, "get_robust_list" },
{ 4311, "kexec_load" },
{ 4312, "getcpu" },
{ 4313, "epoll_pwait" },
{ 4314, "ioprio_set" },
{ 4315, "ioprio_get" },
{ 4316, "utimensat" },
{ 4317, "signalfd" },
{ 4318, "timerfd" },
{ 4319, "eventfd" }
};
MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params,
ObjectFile *objFile)
: MipsProcess(params, objFile),
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
{ }
ObjectFile *objFile) :
MipsProcess(params, objFile)
{}
SyscallDesc*
MipsLinuxProcess::getDesc(int callnum)
{
//MIPS32 syscalls are in the range of 4000 - 4999
int m5_sys_idx = callnum - 4000;
if (m5_sys_idx < 0 || m5_sys_idx >= Num_Syscall_Descs)
return NULL;
return &syscallDescs[m5_sys_idx];
return syscallDescs.get(callnum);
}
void

View File

@@ -51,9 +51,8 @@ class MipsLinuxProcess : public MipsProcess
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
static SyscallDescABI<SyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
/// Syscall descriptors, indexed by call number.
static SyscallDescTable<SyscallABI> syscallDescs;
};
#endif // __MIPS_LINUX_PROCESS_HH__

View File

@@ -91,370 +91,365 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, Addr utsname)
return 0;
}
SyscallDescABI<PowerProcess::SyscallABI> PowerLinuxProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
/* 3 */ { "read", readFunc<PowerLinux> },
/* 4 */ { "write", writeFunc<PowerLinux> },
/* 5 */ { "open", openFunc<PowerLinux> },
/* 6 */ { "close", closeFunc },
/* 7 */ { "waitpid" }, //???
/* 8 */ { "creat" },
/* 9 */ { "link" },
/* 10 */ { "unlink", unlinkFunc },
/* 11 */ { "execve" },
/* 12 */ { "chdir" },
/* 13 */ { "time", timeFunc<PowerLinux> },
/* 14 */ { "mknod" },
/* 15 */ { "chmod", chmodFunc<PowerLinux> },
/* 16 */ { "lchown", chownFunc },
/* 17 */ { "break", brkFunc }, //???
/* 18 */ { "unused#18" }, //???
/* 19 */ { "lseek", lseekFunc },
/* 20 */ { "getpid", getpidFunc },
/* 21 */ { "mount" },
/* 22 */ { "umount" },
/* 23 */ { "setuid", ignoreFunc },
/* 24 */ { "getuid", getuidFunc },
/* 25 */ { "stime" },
/* 26 */ { "ptrace" },
/* 27 */ { "alarm" },
/* 28 */ { "unused#28" },
/* 29 */ { "pause" },
/* 30 */ { "utime" },
/* 31 */ { "stty" },
/* 32 */ { "gtty" },
/* 33 */ { "access" },
/* 34 */ { "nice" },
/* 35 */ { "ftime" },
/* 36 */ { "sync" },
/* 37 */ { "kill", ignoreFunc },
/* 38 */ { "rename", renameFunc },
/* 39 */ { "mkdir" },
/* 40 */ { "rmdir" },
/* 41 */ { "dup", dupFunc },
/* 42 */ { "pipe" },
/* 43 */ { "times", timesFunc<PowerLinux> },
/* 44 */ { "prof" },
/* 45 */ { "brk", brkFunc },
/* 46 */ { "setgid" },
/* 47 */ { "getgid", getgidFunc },
/* 48 */ { "signal", ignoreFunc },
/* 49 */ { "geteuid", geteuidFunc },
/* 50 */ { "getegid", getegidFunc },
/* 51 */ { "acct" },
/* 52 */ { "umount2" },
/* 53 */ { "lock" },
/* 54 */ { "ioctl", ioctlFunc<PowerLinux> },
/* 55 */ { "fcntl", fcntlFunc },
/* 56 */ { "mpx" },
/* 57 */ { "setpgid" },
/* 58 */ { "ulimit" },
/* 59 */ { "unused#59" },
/* 60 */ { "umask", umaskFunc },
/* 61 */ { "chroot" },
/* 62 */ { "ustat" },
/* 63 */ { "dup2" },
/* 64 */ { "getppid", getpagesizeFunc },
/* 65 */ { "getpgrp" },
/* 66 */ { "setsid" },
/* 67 */ { "sigaction" },
/* 68 */ { "sgetmask" },
/* 69 */ { "ssetmask" },
/* 70 */ { "setreuid" },
/* 71 */ { "setregid" },
/* 72 */ { "sigsuspend" },
/* 73 */ { "sigpending" },
/* 74 */ { "sethostname", ignoreFunc },
/* 75 */ { "setrlimit", ignoreFunc },
/* 76 */ { "getrlimit" },
/* 77 */ { "getrusage", ignoreFunc },
/* 78 */ { "gettimeofday" },
/* 79 */ { "settimeofday" },
/* 80 */ { "getgroups" },
/* 81 */ { "setgroups" },
/* 82 */ { "reserved#82" },
/* 83 */ { "symlink" },
/* 84 */ { "unused#84" },
/* 85 */ { "readlink" },
/* 86 */ { "uselib" },
/* 87 */ { "swapon", gethostnameFunc },
/* 88 */ { "reboot" },
/* 89 */ { "readdir" },
/* 90 */ { "mmap", mmapFunc<PowerLinux> },
/* 91 */ { "munmap",munmapFunc },
/* 92 */ { "truncate", truncateFunc },
/* 93 */ { "ftruncate", ftruncateFunc },
/* 94 */ { "fchmod" },
/* 95 */ { "fchown" },
/* 96 */ { "getpriority" },
/* 97 */ { "setpriority" },
/* 98 */ { "profil" },
/* 99 */ { "statfs" },
/* 100 */ { "fstatfs" },
/* 101 */ { "ioperm" },
/* 102 */ { "socketcall" },
/* 103 */ { "syslog" },
/* 104 */ { "setitimer" },
/* 105 */ { "getitimer" },
/* 106 */ { "stat", statFunc<PowerLinux> },
/* 107 */ { "lstat" },
/* 108 */ { "fstat", fstatFunc<PowerLinux> },
/* 109 */ { "unused#109" },
/* 110 */ { "iopl" },
/* 111 */ { "vhangup" },
/* 112 */ { "idle", ignoreFunc },
/* 113 */ { "vm86" },
/* 114 */ { "wait4" },
/* 115 */ { "swapoff" },
/* 116 */ { "sysinfo" },
/* 117 */ { "ipc" },
/* 118 */ { "fsync" },
/* 119 */ { "sigreturn" },
/* 120 */ { "clone" },
/* 121 */ { "setdomainname" },
/* 122 */ { "uname", unameFunc },
/* 123 */ { "modify_ldt" },
/* 124 */ { "adjtimex" },
/* 125 */ { "mprotect", ignoreFunc },
/* 126 */ { "sigprocmask" },
/* 127 */ { "create_module" },
/* 128 */ { "init_module" },
/* 129 */ { "delete_module" },
/* 130 */ { "get_kernel_syms" },
/* 131 */ { "quotactl" },
/* 132 */ { "getpgid" },
/* 133 */ { "fchdir" },
/* 134 */ { "bdflush" },
/* 135 */ { "sysfs" },
/* 136 */ { "personality" },
/* 137 */ { "afs_syscall" },
/* 138 */ { "setfsuid" },
/* 139 */ { "setfsgid" },
/* 140 */ { "llseek", _llseekFunc },
/* 141 */ { "getdents" },
/* 142 */ { "newselect" },
/* 143 */ { "flock" },
/* 144 */ { "msync" },
/* 145 */ { "readv" },
/* 146 */ { "writev", writevFunc<PowerLinux> },
/* 147 */ { "getsid" },
/* 148 */ { "fdatasync" },
/* 149 */ { "sysctl" },
/* 150 */ { "mlock" },
/* 151 */ { "munlock" },
/* 152 */ { "mlockall" },
/* 153 */ { "munlockall" },
/* 154 */ { "sched_setparam" },
/* 155 */ { "sched_getparam" },
/* 156 */ { "sched_setscheduler" },
/* 157 */ { "sched_getscheduler" },
/* 158 */ { "sched_yield" },
/* 159 */ { "sched_get_priority_max" },
/* 160 */ { "sched_get_priority_min" },
/* 161 */ { "sched_rr_get_interval" },
/* 162 */ { "nanosleep" },
/* 163 */ { "mremap" },
/* 164 */ { "setresuid" },
/* 165 */ { "getresuid" },
/* 166 */ { "vm862" },
/* 167 */ { "query_module" },
/* 168 */ { "poll" },
/* 169 */ { "nfsservctl" },
/* 170 */ { "setresgid" },
/* 171 */ { "getresgid" },
/* 172 */ { "prctl" },
/* 173 */ { "rt_sigaction", ignoreFunc },
/* 174 */ { "rt_sigprocmask" },
/* 175 */ { "unknown#175" },
/* 176 */ { "rt_sigpending" },
/* 177 */ { "rt_sigtimedwait" },
/* 178 */ { "rt_sigqueueinfo", ignoreFunc },
/* 179 */ { "rt_sigsuspend" },
/* 180 */ { "pread64" },
/* 181 */ { "pwrite64" },
/* 182 */ { "chown" },
/* 183 */ { "getcwd" },
/* 184 */ { "capget" },
/* 185 */ { "capset" },
/* 186 */ { "sigaltstack" },
/* 187 */ { "sendfile" },
/* 188 */ { "getpmsg" },
/* 189 */ { "putpmsg" },
/* 190 */ { "ugetrlimit", ignoreFunc },
/* 191 */ { "getrlimit" },
/* 192 */ { "mmap2", mmapFunc<PowerLinux> },
/* 193 */ { "truncate64" },
/* 194 */ { "ftruncate64", ftruncate64Func },
/* 195 */ { "stat64", stat64Func<PowerLinux> },
/* 196 */ { "lstat64", lstat64Func<PowerLinux> },
/* 197 */ { "fstat64", fstat64Func<PowerLinux> },
/* 198 */ { "lchown" },
/* 199 */ { "getuid", getuidFunc },
/* 200 */ { "getgid", getgidFunc },
/* 201 */ { "geteuid", geteuidFunc },
/* 202 */ { "getegid", getegidFunc },
/* 203 */ { "setreuid" },
/* 204 */ { "fcntl64", fcntl64Func },
/* 205 */ { "getgroups" },
/* 206 */ { "setgroups" },
/* 207 */ { "fchown" },
/* 208 */ { "setresuid" },
/* 209 */ { "getresuid" },
/* 210 */ { "setresgid" },
/* 211 */ { "getresgid" },
/* 212 */ { "chown" },
/* 213 */ { "setuid" },
/* 214 */ { "setgid" },
/* 215 */ { "setfsuid" },
/* 216 */ { "setfsgid" },
/* 217 */ { "getdents64" },
/* 218 */ { "pivot_root" },
/* 219 */ { "mincore" },
/* 220 */ { "madvise" },
/* 221 */ { "unknown#221" },
/* 222 */ { "tux" },
/* 223 */ { "unknown#223" },
/* 224 */ { "gettid" },
/* 225 */ { "readahead" },
/* 226 */ { "setxattr" },
/* 227 */ { "lsetxattr" },
/* 228 */ { "fsetxattr" },
/* 229 */ { "getxattr" },
/* 230 */ { "lgetxattr" },
/* 231 */ { "fgetxattr" },
/* 232 */ { "listxattr" },
/* 233 */ { "llistxattr" },
/* 234 */ { "exit_group", exitGroupFunc },
/* 235 */ { "removexattr" },
/* 236 */ { "lremovexattr" },
/* 237 */ { "fremovexattr" },
/* 238 */ { "tkill" },
/* 239 */ { "sendfile64" },
/* 240 */ { "futex" },
/* 241 */ { "sched_setaffinity" },
/* 242 */ { "sched_getaffinity" },
/* 243 */ { "io_setup" },
/* 244 */ { "io_destory" },
/* 245 */ { "io_getevents" },
/* 246 */ { "io_submit" },
/* 247 */ { "io_cancel" },
/* 248 */ { "unknown#248" },
/* 249 */ { "lookup_dcookie" },
/* 250 */ { "epoll_create" },
/* 251 */ { "epoll_ctl" },
/* 252 */ { "epoll_wait" },
/* 253 */ { "remap_file_pages" },
/* 254 */ { "set_thread_area" },
/* 255 */ { "get_thread_area" },
/* 256 */ { "set_tid_address" },
/* 257 */ { "timer_create" },
/* 258 */ { "timer_settime" },
/* 259 */ { "timer_gettime" },
/* 260 */ { "timer_getoverrun" },
/* 261 */ { "timer_delete" },
/* 262 */ { "clock_settime" },
/* 263 */ { "clock_gettime" },
/* 264 */ { "clock_getres" },
/* 265 */ { "clock_nanosleep" },
/* 266 */ { "statfs64" },
/* 267 */ { "fstatfs64" },
/* 268 */ { "tgkill" },
/* 269 */ { "utimes" },
/* 270 */ { "arm_fadvise64_64" },
/* 271 */ { "pciconfig_iobase" },
/* 272 */ { "pciconfig_read" },
/* 273 */ { "pciconfig_write" },
/* 274 */ { "mq_open" },
/* 275 */ { "mq_unlink" },
/* 276 */ { "mq_timedsend" },
/* 277 */ { "mq_timedreceive" },
/* 278 */ { "mq_notify" },
/* 279 */ { "mq_getsetattr" },
/* 280 */ { "waitid" },
/* 281 */ { "socket" },
/* 282 */ { "bind" },
/* 283 */ { "connect" },
/* 284 */ { "listen" },
/* 285 */ { "accept" },
/* 286 */ { "getsockname" },
/* 287 */ { "getpeername" },
/* 288 */ { "socketpair" },
/* 289 */ { "send" },
/* 290 */ { "sendto" },
/* 291 */ { "recv" },
/* 292 */ { "recvfrom" },
/* 293 */ { "shutdown" },
/* 294 */ { "setsockopt" },
/* 295 */ { "getsockopt" },
/* 296 */ { "sendmsg" },
/* 297 */ { "rcvmsg" },
/* 298 */ { "semop" },
/* 299 */ { "semget" },
/* 300 */ { "semctl" },
/* 301 */ { "msgsend" },
/* 302 */ { "msgrcv" },
/* 303 */ { "msgget" },
/* 304 */ { "msgctl" },
/* 305 */ { "shmat" },
/* 306 */ { "shmdt" },
/* 307 */ { "shmget" },
/* 308 */ { "shmctl" },
/* 309 */ { "add_key" },
/* 310 */ { "request_key" },
/* 311 */ { "keyctl" },
/* 312 */ { "semtimedop" },
/* 313 */ { "vserver" },
/* 314 */ { "ioprio_set" },
/* 315 */ { "ioprio_get" },
/* 316 */ { "inotify_init" },
/* 317 */ { "inotify_add_watch" },
/* 318 */ { "inotify_rm_watch" },
/* 319 */ { "mbind" },
/* 320 */ { "get_mempolicy" },
/* 321 */ { "set_mempolicy" },
/* 322 */ { "openat" },
/* 323 */ { "mkdirat" },
/* 324 */ { "mknodat" },
/* 325 */ { "fchownat" },
/* 326 */ { "futimesat" },
/* 327 */ { "fstatat64" },
/* 328 */ { "unlinkat" },
/* 329 */ { "renameat" },
/* 330 */ { "linkat" },
/* 331 */ { "symlinkat" },
/* 332 */ { "readlinkat" },
/* 333 */ { "fchmodat" },
/* 334 */ { "faccessat" },
/* 335 */ { "pselect6" },
/* 336 */ { "ppoll" },
/* 337 */ { "unshare" },
/* 338 */ { "set_robust_list" },
/* 339 */ { "get_robust_list" },
/* 340 */ { "splice" },
/* 341 */ { "arm_sync_file_range" },
/* 342 */ { "tee" },
/* 343 */ { "vmsplice" },
/* 344 */ { "move_pages" },
/* 345 */ { "getcpu" },
/* 346 */ { "epoll_pwait" },
SyscallDescTable<PowerProcess::SyscallABI> PowerLinuxProcess::syscallDescs = {
{ 0, "syscall" },
{ 1, "exit", exitFunc },
{ 2, "fork" },
{ 3, "read", readFunc<PowerLinux> },
{ 4, "write", writeFunc<PowerLinux> },
{ 5, "open", openFunc<PowerLinux> },
{ 6, "close", closeFunc },
{ 7, "waitpid" }, //???
{ 8, "creat" },
{ 9, "link" },
{ 10, "unlink", unlinkFunc },
{ 11, "execve" },
{ 12, "chdir" },
{ 13, "time", timeFunc<PowerLinux> },
{ 14, "mknod" },
{ 15, "chmod", chmodFunc<PowerLinux> },
{ 16, "lchown", chownFunc },
{ 17, "break", brkFunc }, //???
{ 18, "unused#18" }, //???
{ 19, "lseek", lseekFunc },
{ 20, "getpid", getpidFunc },
{ 21, "mount" },
{ 22, "umount" },
{ 23, "setuid", ignoreFunc },
{ 24, "getuid", getuidFunc },
{ 25, "stime" },
{ 26, "ptrace" },
{ 27, "alarm" },
{ 28, "unused#28" },
{ 29, "pause" },
{ 30, "utime" },
{ 31, "stty" },
{ 32, "gtty" },
{ 33, "access" },
{ 34, "nice" },
{ 35, "ftime" },
{ 36, "sync" },
{ 37, "kill", ignoreFunc },
{ 38, "rename", renameFunc },
{ 39, "mkdir" },
{ 40, "rmdir" },
{ 41, "dup", dupFunc },
{ 42, "pipe" },
{ 43, "times", timesFunc<PowerLinux> },
{ 44, "prof" },
{ 45, "brk", brkFunc },
{ 46, "setgid" },
{ 47, "getgid", getgidFunc },
{ 48, "signal", ignoreFunc },
{ 49, "geteuid", geteuidFunc },
{ 50, "getegid", getegidFunc },
{ 51, "acct" },
{ 52, "umount2" },
{ 53, "lock" },
{ 54, "ioctl", ioctlFunc<PowerLinux> },
{ 55, "fcntl", fcntlFunc },
{ 56, "mpx" },
{ 57, "setpgid" },
{ 58, "ulimit" },
{ 59, "unused#59" },
{ 60, "umask", umaskFunc },
{ 61, "chroot" },
{ 62, "ustat" },
{ 63, "dup2" },
{ 64, "getppid", getpagesizeFunc },
{ 65, "getpgrp" },
{ 66, "setsid" },
{ 67, "sigaction" },
{ 68, "sgetmask" },
{ 69, "ssetmask" },
{ 70, "setreuid" },
{ 71, "setregid" },
{ 72, "sigsuspend" },
{ 73, "sigpending" },
{ 74, "sethostname", ignoreFunc },
{ 75, "setrlimit", ignoreFunc },
{ 76, "getrlimit" },
{ 77, "getrusage", ignoreFunc },
{ 78, "gettimeofday" },
{ 79, "settimeofday" },
{ 80, "getgroups" },
{ 81, "setgroups" },
{ 82, "reserved#82" },
{ 83, "symlink" },
{ 84, "unused#84" },
{ 85, "readlink" },
{ 86, "uselib" },
{ 87, "swapon", gethostnameFunc },
{ 88, "reboot" },
{ 89, "readdir" },
{ 90, "mmap", mmapFunc<PowerLinux> },
{ 91, "munmap",munmapFunc },
{ 92, "truncate", truncateFunc },
{ 93, "ftruncate", ftruncateFunc },
{ 94, "fchmod" },
{ 95, "fchown" },
{ 96, "getpriority" },
{ 97, "setpriority" },
{ 98, "profil" },
{ 99, "statfs" },
{ 100, "fstatfs" },
{ 101, "ioperm" },
{ 102, "socketcall" },
{ 103, "syslog" },
{ 104, "setitimer" },
{ 105, "getitimer" },
{ 106, "stat", statFunc<PowerLinux> },
{ 107, "lstat" },
{ 108, "fstat", fstatFunc<PowerLinux> },
{ 109, "unused#109" },
{ 110, "iopl" },
{ 111, "vhangup" },
{ 112, "idle", ignoreFunc },
{ 113, "vm86" },
{ 114, "wait4" },
{ 115, "swapoff" },
{ 116, "sysinfo" },
{ 117, "ipc" },
{ 118, "fsync" },
{ 119, "sigreturn" },
{ 120, "clone" },
{ 121, "setdomainname" },
{ 122, "uname", unameFunc },
{ 123, "modify_ldt" },
{ 124, "adjtimex" },
{ 125, "mprotect", ignoreFunc },
{ 126, "sigprocmask" },
{ 127, "create_module" },
{ 128, "init_module" },
{ 129, "delete_module" },
{ 130, "get_kernel_syms" },
{ 131, "quotactl" },
{ 132, "getpgid" },
{ 133, "fchdir" },
{ 134, "bdflush" },
{ 135, "sysfs" },
{ 136, "personality" },
{ 137, "afs_syscall" },
{ 138, "setfsuid" },
{ 139, "setfsgid" },
{ 140, "llseek", _llseekFunc },
{ 141, "getdents" },
{ 142, "newselect" },
{ 143, "flock" },
{ 144, "msync" },
{ 145, "readv" },
{ 146, "writev", writevFunc<PowerLinux> },
{ 147, "getsid" },
{ 148, "fdatasync" },
{ 149, "sysctl" },
{ 150, "mlock" },
{ 151, "munlock" },
{ 152, "mlockall" },
{ 153, "munlockall" },
{ 154, "sched_setparam" },
{ 155, "sched_getparam" },
{ 156, "sched_setscheduler" },
{ 157, "sched_getscheduler" },
{ 158, "sched_yield" },
{ 159, "sched_get_priority_max" },
{ 160, "sched_get_priority_min" },
{ 161, "sched_rr_get_interval" },
{ 162, "nanosleep" },
{ 163, "mremap" },
{ 164, "setresuid" },
{ 165, "getresuid" },
{ 166, "vm862" },
{ 167, "query_module" },
{ 168, "poll" },
{ 169, "nfsservctl" },
{ 170, "setresgid" },
{ 171, "getresgid" },
{ 172, "prctl" },
{ 173, "rt_sigaction", ignoreFunc },
{ 174, "rt_sigprocmask" },
{ 175, "unknown#175" },
{ 176, "rt_sigpending" },
{ 177, "rt_sigtimedwait" },
{ 178, "rt_sigqueueinfo", ignoreFunc },
{ 179, "rt_sigsuspend" },
{ 180, "pread64" },
{ 181, "pwrite64" },
{ 182, "chown" },
{ 183, "getcwd" },
{ 184, "capget" },
{ 185, "capset" },
{ 186, "sigaltstack" },
{ 187, "sendfile" },
{ 188, "getpmsg" },
{ 189, "putpmsg" },
{ 190, "ugetrlimit", ignoreFunc },
{ 191, "getrlimit" },
{ 192, "mmap2", mmapFunc<PowerLinux> },
{ 193, "truncate64" },
{ 194, "ftruncate64", ftruncate64Func },
{ 195, "stat64", stat64Func<PowerLinux> },
{ 196, "lstat64", lstat64Func<PowerLinux> },
{ 197, "fstat64", fstat64Func<PowerLinux> },
{ 198, "lchown" },
{ 199, "getuid", getuidFunc },
{ 200, "getgid", getgidFunc },
{ 201, "geteuid", geteuidFunc },
{ 202, "getegid", getegidFunc },
{ 203, "setreuid" },
{ 204, "fcntl64", fcntl64Func },
{ 205, "getgroups" },
{ 206, "setgroups" },
{ 207, "fchown" },
{ 208, "setresuid" },
{ 209, "getresuid" },
{ 210, "setresgid" },
{ 211, "getresgid" },
{ 212, "chown" },
{ 213, "setuid" },
{ 214, "setgid" },
{ 215, "setfsuid" },
{ 216, "setfsgid" },
{ 217, "getdents64" },
{ 218, "pivot_root" },
{ 219, "mincore" },
{ 220, "madvise" },
{ 221, "unknown#221" },
{ 222, "tux" },
{ 223, "unknown#223" },
{ 224, "gettid" },
{ 225, "readahead" },
{ 226, "setxattr" },
{ 227, "lsetxattr" },
{ 228, "fsetxattr" },
{ 229, "getxattr" },
{ 230, "lgetxattr" },
{ 231, "fgetxattr" },
{ 232, "listxattr" },
{ 233, "llistxattr" },
{ 234, "exit_group", exitGroupFunc },
{ 235, "removexattr" },
{ 236, "lremovexattr" },
{ 237, "fremovexattr" },
{ 238, "tkill" },
{ 239, "sendfile64" },
{ 240, "futex" },
{ 241, "sched_setaffinity" },
{ 242, "sched_getaffinity" },
{ 243, "io_setup" },
{ 244, "io_destory" },
{ 245, "io_getevents" },
{ 246, "io_submit" },
{ 247, "io_cancel" },
{ 248, "unknown#248" },
{ 249, "lookup_dcookie" },
{ 250, "epoll_create" },
{ 251, "epoll_ctl" },
{ 252, "epoll_wait" },
{ 253, "remap_file_pages" },
{ 254, "set_thread_area" },
{ 255, "get_thread_area" },
{ 256, "set_tid_address" },
{ 257, "timer_create" },
{ 258, "timer_settime" },
{ 259, "timer_gettime" },
{ 260, "timer_getoverrun" },
{ 261, "timer_delete" },
{ 262, "clock_settime" },
{ 263, "clock_gettime" },
{ 264, "clock_getres" },
{ 265, "clock_nanosleep" },
{ 266, "statfs64" },
{ 267, "fstatfs64" },
{ 268, "tgkill" },
{ 269, "utimes" },
{ 270, "arm_fadvise64_64" },
{ 271, "pciconfig_iobase" },
{ 272, "pciconfig_read" },
{ 273, "pciconfig_write" },
{ 274, "mq_open" },
{ 275, "mq_unlink" },
{ 276, "mq_timedsend" },
{ 277, "mq_timedreceive" },
{ 278, "mq_notify" },
{ 279, "mq_getsetattr" },
{ 280, "waitid" },
{ 281, "socket" },
{ 282, "bind" },
{ 283, "connect" },
{ 284, "listen" },
{ 285, "accept" },
{ 286, "getsockname" },
{ 287, "getpeername" },
{ 288, "socketpair" },
{ 289, "send" },
{ 290, "sendto" },
{ 291, "recv" },
{ 292, "recvfrom" },
{ 293, "shutdown" },
{ 294, "setsockopt" },
{ 295, "getsockopt" },
{ 296, "sendmsg" },
{ 297, "rcvmsg" },
{ 298, "semop" },
{ 299, "semget" },
{ 300, "semctl" },
{ 301, "msgsend" },
{ 302, "msgrcv" },
{ 303, "msgget" },
{ 304, "msgctl" },
{ 305, "shmat" },
{ 306, "shmdt" },
{ 307, "shmget" },
{ 308, "shmctl" },
{ 309, "add_key" },
{ 310, "request_key" },
{ 311, "keyctl" },
{ 312, "semtimedop" },
{ 313, "vserver" },
{ 314, "ioprio_set" },
{ 315, "ioprio_get" },
{ 316, "inotify_init" },
{ 317, "inotify_add_watch" },
{ 318, "inotify_rm_watch" },
{ 319, "mbind" },
{ 320, "get_mempolicy" },
{ 321, "set_mempolicy" },
{ 322, "openat" },
{ 323, "mkdirat" },
{ 324, "mknodat" },
{ 325, "fchownat" },
{ 326, "futimesat" },
{ 327, "fstatat64" },
{ 328, "unlinkat" },
{ 329, "renameat" },
{ 330, "linkat" },
{ 331, "symlinkat" },
{ 332, "readlinkat" },
{ 333, "fchmodat" },
{ 334, "faccessat" },
{ 335, "pselect6" },
{ 336, "ppoll" },
{ 337, "unshare" },
{ 338, "set_robust_list" },
{ 339, "get_robust_list" },
{ 340, "splice" },
{ 341, "arm_sync_file_range" },
{ 342, "tee" },
{ 343, "vmsplice" },
{ 344, "move_pages" },
{ 345, "getcpu" },
{ 346, "epoll_pwait" },
};
PowerLinuxProcess::PowerLinuxProcess(ProcessParams * params,
ObjectFile *objFile)
: PowerProcess(params, objFile),
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
{
}
ObjectFile *objFile) :
PowerProcess(params, objFile)
{}
SyscallDesc*
PowerLinuxProcess::getDesc(int callnum)
{
if (callnum < 0 || callnum > Num_Syscall_Descs)
return NULL;
return &syscallDescs[callnum];
return syscallDescs.get(callnum);
}
void

View File

@@ -46,10 +46,8 @@ class PowerLinuxProcess : public PowerProcess
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
static SyscallDescABI<SyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
/// Syscall descriptors, indexed by call number.
static SyscallDescTable<SyscallABI> syscallDescs;
};
#endif // __POWER_LINUX_PROCESS_HH__

File diff suppressed because it is too large Load Diff

View File

@@ -54,8 +54,8 @@ class RiscvLinuxProcess64 : public RiscvProcess64
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
static std::map<int, SyscallDescABI<SyscallABI>> syscallDescs;
/// Syscall descriptors, indexed by call number.
static SyscallDescTable<SyscallABI> syscallDescs;
};
class RiscvLinuxProcess32 : public RiscvProcess32
@@ -75,7 +75,7 @@ class RiscvLinuxProcess32 : public RiscvProcess32
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
static std::map<int, SyscallDescABI<SyscallABI>> syscallDescs;
static SyscallDescTable<SyscallABI> syscallDescs;
};
#endif // __RISCV_LINUX_PROCESS_HH__

View File

@@ -78,17 +78,13 @@ SparcLinuxObjectFileLoader loader;
SyscallDesc*
SparcLinuxProcess::getDesc(int callnum)
{
if (callnum < 0 || callnum >= Num_Syscall_Descs)
return NULL;
return &syscallDescs[callnum];
return syscallDescs.get(callnum);
}
SyscallDesc*
SparcLinuxProcess::getDesc32(int callnum)
{
if (callnum < 0 || callnum >= Num_Syscall32_Descs)
return NULL;
return &syscall32Descs[callnum];
return syscall32Descs.get(callnum);
}
Sparc32LinuxProcess::Sparc32LinuxProcess(ProcessParams * params,

View File

@@ -42,12 +42,11 @@ namespace SparcISA {
class SparcLinuxProcess
{
public:
/// Array of syscall descriptors, indexed by call number.
static SyscallDescABI<Sparc64Process::SyscallABI> syscallDescs[];
/// 64 bit syscall descriptors, indexed by call number.
static SyscallDescTable<Sparc64Process::SyscallABI> syscallDescs;
/// Array of 32 bit compatibility syscall descriptors,
/// indexed by call number.
static SyscallDescABI<Sparc32Process::SyscallABI> syscall32Descs[];
/// 32 bit compatibility syscall descriptors, indexed by call number.
static SyscallDescTable<Sparc32Process::SyscallABI> syscall32Descs;
SyscallDesc *getDesc(int callnum);
SyscallDesc *getDesc32(int callnum);

File diff suppressed because it is too large Load Diff

View File

@@ -87,284 +87,275 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, Addr utsname)
}
SyscallDescABI<Sparc64Process::SyscallABI>
SparcSolarisProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
/* 3 */ { "read", readFunc<SparcSolaris> },
/* 4 */ { "write", writeFunc<SparcSolaris> },
/* 5 */ { "open", openFunc<SparcSolaris> },
/* 6 */ { "close", closeFunc },
/* 7 */ { "wait" },
/* 8 */ { "creat" },
/* 9 */ { "link" },
/* 10 */ { "unlink", unlinkFunc },
/* 11 */ { "exec" },
/* 12 */ { "chdir" },
/* 13 */ { "time" },
/* 14 */ { "mknod" },
/* 15 */ { "chmod", chmodFunc<Solaris> },
/* 16 */ { "chown", chownFunc },
/* 17 */ { "brk", brkFunc },
/* 18 */ { "stat" },
/* 19 */ { "lseek", lseekFunc },
/* 20 */ { "getpid", getpidFunc },
/* 21 */ { "mount" },
/* 22 */ { "umount" },
/* 23 */ { "setuid", ignoreFunc },
/* 24 */ { "getuid", getuidFunc },
/* 25 */ { "stime" },
/* 26 */ { "pcsample" },
/* 27 */ { "alarm" },
/* 28 */ { "fstat", fstatFunc<SparcSolaris> },
/* 29 */ { "pause" },
/* 30 */ { "utime" },
/* 31 */ { "stty" },
/* 32 */ { "gtty" },
/* 33 */ { "access" },
/* 34 */ { "nice" },
/* 35 */ { "statfs" },
/* 36 */ { "sync" },
/* 37 */ { "kill" },
/* 38 */ { "fstatfs" },
/* 39 */ { "pgrpsys" },
/* 40 */ { "xenix" },
/* 41 */ { "dup" },
/* 42 */ { "pipe", pipePseudoFunc },
/* 43 */ { "times" },
/* 44 */ { "profil" },
/* 45 */ { "plock" },
/* 46 */ { "setgid" },
/* 47 */ { "getgid", getgidFunc },
/* 48 */ { "signal" },
/* 49 */ { "msgsys" },
/* 50 */ { "syssun" },
/* 51 */ { "acct" },
/* 52 */ { "shmsys" },
/* 53 */ { "semsys" },
/* 54 */ { "ioctl" },
/* 55 */ { "uadmin" },
/* 56 */ { "RESERVED" },
/* 57 */ { "utssys" },
/* 58 */ { "fdsync" },
/* 59 */ { "execve" },
/* 60 */ { "umask", umaskFunc },
/* 61 */ { "chroot" },
/* 62 */ { "fcntl" },
/* 63 */ { "ulimit" },
/* 64 */ { "reserved_64" },
/* 65 */ { "reserved_65" },
/* 66 */ { "reserved_66" },
/* 67 */ { "reserved_67" },
/* 68 */ { "reserved_68" },
/* 69 */ { "reserved_69" },
/* 70 */ { "tasksys" },
/* 71 */ { "acctctl" },
/* 72 */ { "reserved_72" },
/* 73 */ { "getpagesizes" },
/* 74 */ { "rctlsys" },
/* 75 */ { "issetugid" },
/* 76 */ { "fsat" },
/* 77 */ { "lwp_park" },
/* 78 */ { "sendfilev" },
/* 79 */ { "rmdir" },
/* 80 */ { "mkdir" },
/* 81 */ { "getdents" },
/* 82 */ { "reserved_82" },
/* 83 */ { "reserved_83" },
/* 84 */ { "sysfs" },
/* 85 */ { "getmsg" },
/* 86 */ { "putmsg" },
/* 87 */ { "poll" },
/* 88 */ { "lstat" },
/* 89 */ { "symlink" },
/* 90 */ { "readlink", readlinkFunc },
/* 91 */ { "setgroups" },
/* 92 */ { "getgroups" },
/* 93 */ { "fchmod" },
/* 94 */ { "fchown" },
/* 95 */ { "sigprocmask" },
/* 96 */ { "sigsuspend" },
/* 97 */ { "sigaltstack" },
/* 98 */ { "sigaction" },
/* 99 */ { "sigpending" },
/* 100 */ { "context" },
/* 101 */ { "evsys" },
/* 102 */ { "evtrapret" },
/* 103 */ { "statvfs" },
/* 104 */ { "fstatvfs" },
/* 105 */ { "getloadavg" },
/* 106 */ { "nfssys" },
/* 107 */ { "waitsys" },
/* 108 */ { "sigsendsys" },
/* 109 */ { "hrtsys" },
/* 110 */ { "acancel" },
/* 111 */ { "async" },
/* 112 */ { "priocntlsys" },
/* 113 */ { "pathconf" },
/* 114 */ { "mincore" },
/* 115 */ { "mmap", mmapFunc<SparcSolaris> },
/* 116 */ { "mprotect" },
/* 117 */ { "munmap", munmapFunc },
/* 118 */ { "fpathconf" },
/* 119 */ { "vfork" },
/* 120 */ { "fchdir" },
/* 121 */ { "readv" },
/* 122 */ { "writev" },
/* 123 */ { "xstat" },
/* 124 */ { "lxstat" },
/* 125 */ { "fxstat" },
/* 126 */ { "xmknod" },
/* 127 */ { "clocal" },
/* 128 */ { "setrlimit" },
/* 129 */ { "getrlimit" },
/* 130 */ { "lchown" },
/* 131 */ { "memcntl" },
/* 132 */ { "getpmsg" },
/* 133 */ { "putpmsg" },
/* 134 */ { "rename" },
/* 135 */ { "uname", unameFunc },
/* 136 */ { "setegid" },
/* 137 */ { "sysconfig" },
/* 138 */ { "adjtime" },
/* 139 */ { "systeminfo" },
/* 140 */ { "reserved_140" },
/* 141 */ { "seteuid" },
/* 142 */ { "vtrace" },
/* 143 */ { "fork1" },
/* 144 */ { "sigtimedwait" },
/* 145 */ { "lwp_info" },
/* 146 */ { "yield" },
/* 147 */ { "lwp_sema_wait" },
/* 148 */ { "lwp_sema_post" },
/* 149 */ { "lwp_sema_trywait" },
/* 150 */ { "lwp_detach" },
/* 151 */ { "corectl" },
/* 152 */ { "modctl" },
/* 153 */ { "fchroot" },
/* 154 */ { "utimes" },
/* 155 */ { "vhangup" },
/* 156 */ { "gettimeofday" },
/* 157 */ { "getitimer" },
/* 158 */ { "setitimer" },
/* 159 */ { "lwp_create" },
/* 160 */ { "lwp_exit" },
/* 161 */ { "lwp_suspend" },
/* 162 */ { "lwp_continue" },
/* 163 */ { "lwp_kill" },
/* 164 */ { "lwp_self" },
/* 165 */ { "lwp_setprivate" },
/* 166 */ { "lwp_getprivate" },
/* 167 */ { "lwp_wait" },
/* 168 */ { "lwp_mutex_wakeup" },
/* 169 */ { "lwp_mutex_lock" },
/* 170 */ { "lwp_cond_wait" },
/* 171 */ { "lwp_cond_signal" },
/* 172 */ { "lwp_cond_broadcast" },
/* 173 */ { "pread" },
/* 174 */ { "pwrite" },
/* 175 */ { "llseek" },
/* 176 */ { "inst_sync" },
/* 177 */ { "srmlimitsys" },
/* 178 */ { "kaio" },
/* 179 */ { "cpc" },
/* 180 */ { "lgrpsys_meminfosys" },
/* 181 */ { "rusagesys" },
/* 182 */ { "reserved_182" },
/* 183 */ { "reserved_183" },
/* 184 */ { "tsolsys" },
/* 185 */ { "acl" },
/* 186 */ { "auditsys" },
/* 187 */ { "processor_bind" },
/* 188 */ { "processor_info" },
/* 189 */ { "p_online" },
/* 190 */ { "sigqueue" },
/* 191 */ { "clock_gettime" },
/* 192 */ { "clock_settime" },
/* 193 */ { "clock_getres" },
/* 194 */ { "timer_create" },
/* 195 */ { "timer_delete" },
/* 196 */ { "timer_settime" },
/* 197 */ { "timer_gettime" },
/* 198 */ { "timer_getoverrun" },
/* 199 */ { "nanosleep" },
/* 200 */ { "facl" },
/* 201 */ { "door" },
/* 202 */ { "setreuid" },
/* 203 */ { "setregid" },
/* 204 */ { "install_utrap" },
/* 205 */ { "signotify" },
/* 206 */ { "schedctl" },
/* 207 */ { "pset" },
/* 208 */ { "sparc_utrap_install" },
/* 209 */ { "resolvepath" },
/* 210 */ { "signotifywait" },
/* 211 */ { "lwp_sigredirect" },
/* 212 */ { "lwp_alarm" },
/* 213 */ { "getdents64" },
/* 214 */ { "mmap64" },
/* 215 */ { "stat64" },
/* 216 */ { "lstat64" },
/* 217 */ { "fstat64" },
/* 218 */ { "statvfs64" },
/* 219 */ { "fstatvfs64" },
/* 220 */ { "setrlimit64" },
/* 221 */ { "getrlimit64" },
/* 222 */ { "pread64" },
/* 223 */ { "pwrite64" },
/* 224 */ { "creat64" },
/* 225 */ { "open64" },
/* 226 */ { "rpcsys" },
/* 227 */ { "reserved_227" },
/* 228 */ { "reserved_228" },
/* 229 */ { "reserved_229" },
/* 230 */ { "so_socket" },
/* 231 */ { "so_socketpair" },
/* 232 */ { "bind" },
/* 233 */ { "listen" },
/* 234 */ { "accept" },
/* 235 */ { "connect" },
/* 236 */ { "shutdown" },
/* 237 */ { "recv" },
/* 238 */ { "recvfrom" },
/* 239 */ { "recvmsg" },
/* 240 */ { "send" },
/* 241 */ { "sendmsg" },
/* 242 */ { "sendto" },
/* 243 */ { "getpeername" },
/* 244 */ { "getsockname" },
/* 245 */ { "getsockopt" },
/* 246 */ { "setsockopt" },
/* 247 */ { "sockconfig" },
/* 248 */ { "ntp_gettime" },
/* 249 */ { "ntp_adjtime" },
/* 250 */ { "lwp_mutex_unlock" },
/* 251 */ { "lwp_mutex_trylock" },
/* 252 */ { "lwp_mutex_init" },
/* 253 */ { "cladm" },
/* 254 */ { "lwp_sigtimedwait" },
/* 255 */ { "umount2" }
SyscallDescTable<Sparc64Process::SyscallABI>
SparcSolarisProcess::syscallDescs = {
{ 0, "syscall" },
{ 1, "exit", exitFunc },
{ 2, "fork" },
{ 3, "read", readFunc<SparcSolaris> },
{ 4, "write", writeFunc<SparcSolaris> },
{ 5, "open", openFunc<SparcSolaris> },
{ 6, "close", closeFunc },
{ 7, "wait" },
{ 8, "creat" },
{ 9, "link" },
{ 10, "unlink", unlinkFunc },
{ 11, "exec" },
{ 12, "chdir" },
{ 13, "time" },
{ 14, "mknod" },
{ 15, "chmod", chmodFunc<Solaris> },
{ 16, "chown", chownFunc },
{ 17, "brk", brkFunc },
{ 18, "stat" },
{ 19, "lseek", lseekFunc },
{ 20, "getpid", getpidFunc },
{ 21, "mount" },
{ 22, "umount" },
{ 23, "setuid", ignoreFunc },
{ 24, "getuid", getuidFunc },
{ 25, "stime" },
{ 26, "pcsample" },
{ 27, "alarm" },
{ 28, "fstat", fstatFunc<SparcSolaris> },
{ 29, "pause" },
{ 30, "utime" },
{ 31, "stty" },
{ 32, "gtty" },
{ 33, "access" },
{ 34, "nice" },
{ 35, "statfs" },
{ 36, "sync" },
{ 37, "kill" },
{ 38, "fstatfs" },
{ 39, "pgrpsys" },
{ 40, "xenix" },
{ 41, "dup" },
{ 42, "pipe", pipePseudoFunc },
{ 43, "times" },
{ 44, "profil" },
{ 45, "plock" },
{ 46, "setgid" },
{ 47, "getgid", getgidFunc },
{ 48, "signal" },
{ 49, "msgsys" },
{ 50, "syssun" },
{ 51, "acct" },
{ 52, "shmsys" },
{ 53, "semsys" },
{ 54, "ioctl" },
{ 55, "uadmin" },
{ 56, "RESERVED" },
{ 57, "utssys" },
{ 58, "fdsync" },
{ 59, "execve" },
{ 60, "umask", umaskFunc },
{ 61, "chroot" },
{ 62, "fcntl" },
{ 63, "ulimit" },
{ 64, "reserved_64" },
{ 65, "reserved_65" },
{ 66, "reserved_66" },
{ 67, "reserved_67" },
{ 68, "reserved_68" },
{ 69, "reserved_69" },
{ 70, "tasksys" },
{ 71, "acctctl" },
{ 72, "reserved_72" },
{ 73, "getpagesizes" },
{ 74, "rctlsys" },
{ 75, "issetugid" },
{ 76, "fsat" },
{ 77, "lwp_park" },
{ 78, "sendfilev" },
{ 79, "rmdir" },
{ 80, "mkdir" },
{ 81, "getdents" },
{ 82, "reserved_82" },
{ 83, "reserved_83" },
{ 84, "sysfs" },
{ 85, "getmsg" },
{ 86, "putmsg" },
{ 87, "poll" },
{ 88, "lstat" },
{ 89, "symlink" },
{ 90, "readlink", readlinkFunc },
{ 91, "setgroups" },
{ 92, "getgroups" },
{ 93, "fchmod" },
{ 94, "fchown" },
{ 95, "sigprocmask" },
{ 96, "sigsuspend" },
{ 97, "sigaltstack" },
{ 98, "sigaction" },
{ 99, "sigpending" },
{ 100, "context" },
{ 101, "evsys" },
{ 102, "evtrapret" },
{ 103, "statvfs" },
{ 104, "fstatvfs" },
{ 105, "getloadavg" },
{ 106, "nfssys" },
{ 107, "waitsys" },
{ 108, "sigsendsys" },
{ 109, "hrtsys" },
{ 110, "acancel" },
{ 111, "async" },
{ 112, "priocntlsys" },
{ 113, "pathconf" },
{ 114, "mincore" },
{ 115, "mmap", mmapFunc<SparcSolaris> },
{ 116, "mprotect" },
{ 117, "munmap", munmapFunc },
{ 118, "fpathconf" },
{ 119, "vfork" },
{ 120, "fchdir" },
{ 121, "readv" },
{ 122, "writev" },
{ 123, "xstat" },
{ 124, "lxstat" },
{ 125, "fxstat" },
{ 126, "xmknod" },
{ 127, "clocal" },
{ 128, "setrlimit" },
{ 129, "getrlimit" },
{ 130, "lchown" },
{ 131, "memcntl" },
{ 132, "getpmsg" },
{ 133, "putpmsg" },
{ 134, "rename" },
{ 135, "uname", unameFunc },
{ 136, "setegid" },
{ 137, "sysconfig" },
{ 138, "adjtime" },
{ 139, "systeminfo" },
{ 140, "reserved_140" },
{ 141, "seteuid" },
{ 142, "vtrace" },
{ 143, "fork1" },
{ 144, "sigtimedwait" },
{ 145, "lwp_info" },
{ 146, "yield" },
{ 147, "lwp_sema_wait" },
{ 148, "lwp_sema_post" },
{ 149, "lwp_sema_trywait" },
{ 150, "lwp_detach" },
{ 151, "corectl" },
{ 152, "modctl" },
{ 153, "fchroot" },
{ 154, "utimes" },
{ 155, "vhangup" },
{ 156, "gettimeofday" },
{ 157, "getitimer" },
{ 158, "setitimer" },
{ 159, "lwp_create" },
{ 160, "lwp_exit" },
{ 161, "lwp_suspend" },
{ 162, "lwp_continue" },
{ 163, "lwp_kill" },
{ 164, "lwp_self" },
{ 165, "lwp_setprivate" },
{ 166, "lwp_getprivate" },
{ 167, "lwp_wait" },
{ 168, "lwp_mutex_wakeup" },
{ 169, "lwp_mutex_lock" },
{ 170, "lwp_cond_wait" },
{ 171, "lwp_cond_signal" },
{ 172, "lwp_cond_broadcast" },
{ 173, "pread" },
{ 174, "pwrite" },
{ 175, "llseek" },
{ 176, "inst_sync" },
{ 177, "srmlimitsys" },
{ 178, "kaio" },
{ 179, "cpc" },
{ 180, "lgrpsys_meminfosys" },
{ 181, "rusagesys" },
{ 182, "reserved_182" },
{ 183, "reserved_183" },
{ 184, "tsolsys" },
{ 185, "acl" },
{ 186, "auditsys" },
{ 187, "processor_bind" },
{ 188, "processor_info" },
{ 189, "p_online" },
{ 190, "sigqueue" },
{ 191, "clock_gettime" },
{ 192, "clock_settime" },
{ 193, "clock_getres" },
{ 194, "timer_create" },
{ 195, "timer_delete" },
{ 196, "timer_settime" },
{ 197, "timer_gettime" },
{ 198, "timer_getoverrun" },
{ 199, "nanosleep" },
{ 200, "facl" },
{ 201, "door" },
{ 202, "setreuid" },
{ 203, "setregid" },
{ 204, "install_utrap" },
{ 205, "signotify" },
{ 206, "schedctl" },
{ 207, "pset" },
{ 208, "sparc_utrap_install" },
{ 209, "resolvepath" },
{ 210, "signotifywait" },
{ 211, "lwp_sigredirect" },
{ 212, "lwp_alarm" },
{ 213, "getdents64" },
{ 214, "mmap64" },
{ 215, "stat64" },
{ 216, "lstat64" },
{ 217, "fstat64" },
{ 218, "statvfs64" },
{ 219, "fstatvfs64" },
{ 220, "setrlimit64" },
{ 221, "getrlimit64" },
{ 222, "pread64" },
{ 223, "pwrite64" },
{ 224, "creat64" },
{ 225, "open64" },
{ 226, "rpcsys" },
{ 227, "reserved_227" },
{ 228, "reserved_228" },
{ 229, "reserved_229" },
{ 230, "so_socket" },
{ 231, "so_socketpair" },
{ 232, "bind" },
{ 233, "listen" },
{ 234, "accept" },
{ 235, "connect" },
{ 236, "shutdown" },
{ 237, "recv" },
{ 238, "recvfrom" },
{ 239, "recvmsg" },
{ 240, "send" },
{ 241, "sendmsg" },
{ 242, "sendto" },
{ 243, "getpeername" },
{ 244, "getsockname" },
{ 245, "getsockopt" },
{ 246, "setsockopt" },
{ 247, "sockconfig" },
{ 248, "ntp_gettime" },
{ 249, "ntp_adjtime" },
{ 250, "lwp_mutex_unlock" },
{ 251, "lwp_mutex_trylock" },
{ 252, "lwp_mutex_init" },
{ 253, "cladm" },
{ 254, "lwp_sigtimedwait" },
{ 255, "umount2" }
};
SparcSolarisProcess::SparcSolarisProcess(ProcessParams * params,
ObjectFile *objFile)
: Sparc64Process(params, objFile),
Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
{
// The sparc syscall table must be <= 284 entries because that is all there
// is space for.
assert(Num_Syscall_Descs <= 284);
}
: Sparc64Process(params, objFile)
{}
SyscallDesc*
SparcSolarisProcess::getDesc(int callnum)
{
if (callnum < 0 || callnum >= Num_Syscall_Descs)
return NULL;
return &syscallDescs[callnum];
return syscallDescs.get(callnum);
}
void

View File

@@ -51,9 +51,7 @@ class SparcSolarisProcess : public Sparc64Process
void syscall(ThreadContext *tc, Fault *fault) override;
/// Array of syscall descriptors, indexed by call number.
static SyscallDescABI<Sparc64Process::SyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
static SyscallDescTable<Sparc64Process::SyscallABI> syscallDescs;
};

File diff suppressed because it is too large Load Diff

View File

@@ -46,14 +46,15 @@
struct ProcessParams;
struct ThreadContext;
namespace X86ISA {
namespace X86ISA
{
class X86_64LinuxProcess : public X86_64Process
{
public:
/// Constructor.
X86_64LinuxProcess(ProcessParams * params, ObjectFile *objFile);
using X86_64Process::X86_64Process;
void syscall(ThreadContext *tc, Fault *fault) override;
SyscallDesc *getDesc(int callnum) override;
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process,
RegVal flags) override;
@@ -66,9 +67,9 @@ class X86_64LinuxProcess : public X86_64Process
class I386LinuxProcess : public I386Process
{
public:
/// Constructor.
I386LinuxProcess(ProcessParams * params, ObjectFile *objFile);
using I386Process::I386Process;
void syscall(ThreadContext *tc, Fault *fault) override;
SyscallDesc *getDesc(int callnum) override;
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process,
RegVal flags) override;

View File

@@ -103,16 +103,14 @@ typedef MultiLevelPageTable<LongModePTE<47, 39>,
LongModePTE<29, 21>,
LongModePTE<20, 12> > ArchPageTable;
X86Process::X86Process(ProcessParams *params, ObjectFile *objFile,
SyscallDesc *_syscallDescs, int _numSyscallDescs)
: Process(params, params->useArchPT ?
static_cast<EmulationPageTable *>(
X86Process::X86Process(ProcessParams *params, ObjectFile *objFile) :
Process(params, params->useArchPT ?
static_cast<EmulationPageTable *>(
new ArchPageTable(params->name, params->pid,
params->system, PageBytes)) :
new EmulationPageTable(params->name, params->pid,
PageBytes),
objFile),
syscallDescs(_syscallDescs), numSyscallDescs(_numSyscallDescs)
new EmulationPageTable(params->name, params->pid,
PageBytes),
objFile)
{
}
@@ -124,11 +122,9 @@ void X86Process::clone(ThreadContext *old_tc, ThreadContext *new_tc,
*process = *this;
}
X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile,
SyscallDesc *_syscallDescs, int _numSyscallDescs)
: X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile) :
X86Process(params, objFile)
{
vsyscallPage.base = 0xffffffffff600000ULL;
vsyscallPage.size = PageBytes;
vsyscallPage.vtimeOffset = 0x400;
@@ -145,9 +141,8 @@ X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile,
}
I386Process::I386Process(ProcessParams *params, ObjectFile *objFile,
SyscallDesc *_syscallDescs, int _numSyscallDescs)
: X86Process(params, objFile, _syscallDescs, _numSyscallDescs)
I386Process::I386Process(ProcessParams *params, ObjectFile *objFile) :
X86Process(params, objFile)
{
if (kvmInSE)
panic("KVM CPU model does not support 32 bit processes");
@@ -170,14 +165,6 @@ I386Process::I386Process(ProcessParams *params, ObjectFile *objFile,
next_thread_stack_base, mmap_end);
}
SyscallDesc*
X86Process::getDesc(int callnum)
{
if (callnum < 0 || callnum >= numSyscallDescs)
return NULL;
return &syscallDescs[callnum];
}
void
X86_64Process::initState()
{

View File

@@ -61,11 +61,7 @@ namespace X86ISA
Addr _gdtStart;
Addr _gdtSize;
SyscallDesc *syscallDescs;
const int numSyscallDescs;
X86Process(ProcessParams * params, ObjectFile *objFile,
SyscallDesc *_syscallDescs, int _numSyscallDescs);
X86Process(ProcessParams * params, ObjectFile *objFile);
template<class IntType>
void argsInit(int pageSize,
@@ -78,8 +74,6 @@ namespace X86ISA
Addr gdtSize()
{ return _gdtSize; }
SyscallDesc* getDesc(int callnum) override;
void clone(ThreadContext *old_tc, ThreadContext *new_tc,
Process *process, RegVal flags) override;
@@ -91,7 +85,6 @@ namespace X86ISA
_gdtStart = in._gdtStart;
_gdtSize = in._gdtSize;
syscallDescs = in.syscallDescs;
return *this;
}
@@ -100,9 +93,6 @@ namespace X86ISA
class X86_64Process : public X86Process
{
protected:
X86_64Process(ProcessParams *params, ObjectFile *objFile,
SyscallDesc *_syscallDescs, int _numSyscallDescs);
class VSyscallPage
{
public:
@@ -128,6 +118,8 @@ namespace X86ISA
VSyscallPage vsyscallPage;
public:
X86_64Process(ProcessParams *params, ObjectFile *objFile);
void argsInit(int pageSize);
void initState() override;
@@ -138,9 +130,6 @@ namespace X86ISA
class I386Process : public X86Process
{
protected:
I386Process(ProcessParams *params, ObjectFile *objFile,
SyscallDesc *_syscallDescs, int _numSyscallDescs);
class VSyscallPage
{
public:
@@ -166,6 +155,8 @@ namespace X86ISA
VSyscallPage vsyscallPage;
public:
I386Process(ProcessParams *params, ObjectFile *objFile);
void argsInit(int pageSize);
void initState() override;

View File

@@ -43,8 +43,10 @@
#define __SIM_SYSCALL_DESC_HH__
#include <functional>
#include <map>
#include <string>
#include "base/logging.hh"
#include "base/types.hh"
#include "cpu/thread_context.hh"
#include "sim/guest_abi.hh"
@@ -74,7 +76,8 @@ class SyscallDesc {
*/
void doSyscall(int callnum, ThreadContext *tc, Fault *fault);
std::string name() { return _name; }
std::string name() const { return _name; }
int num() const { return _num; }
/**
* For use within the system call executor if new threads are created and
@@ -87,13 +90,14 @@ class SyscallDesc {
std::function<SyscallReturn(SyscallDesc *, int num, ThreadContext *)>;
using Dumper = std::function<std::string(std::string, ThreadContext *)>;
SyscallDesc(const char *name, Executor exec, Dumper dump) :
_name(name), executor(exec), dumper(dump)
SyscallDesc(int num, const char *name, Executor exec, Dumper dump) :
_name(name), _num(num), executor(exec), dumper(dump)
{}
private:
/** System call name (e.g., open, mmap, clone, socket, etc.) */
std::string _name;
int _num;
/** Mechanism for ISAs to connect to the emul function definitions */
Executor executor;
@@ -155,18 +159,18 @@ class SyscallDescABI : public SyscallDesc
public:
// Constructors which plumb in buildExecutor.
template <typename ...Args>
SyscallDescABI(const char *name, ABIExecutor<Args...> target) :
SyscallDesc(name, buildExecutor<Args...>(target),
buildDumper<Args...>())
SyscallDescABI(int num, const char *name, ABIExecutor<Args...> target) :
SyscallDesc(num, name, buildExecutor<Args...>(target),
buildDumper<Args...>())
{}
template <typename ...Args>
SyscallDescABI(const char *name, ABIExecutorPtr<Args...> target) :
SyscallDescABI(name, ABIExecutor<Args...>(target))
SyscallDescABI(int num, const char *name, ABIExecutorPtr<Args...> target) :
SyscallDescABI(num, name, ABIExecutor<Args...>(target))
{}
SyscallDescABI(const char *name) :
SyscallDescABI(name, ABIExecutor<>(unimplementedFunc))
SyscallDescABI(int num, const char *name) :
SyscallDescABI(num, name, ABIExecutor<>(unimplementedFunc))
{}
void
@@ -176,4 +180,29 @@ class SyscallDescABI : public SyscallDesc
}
};
template <typename ABI>
class SyscallDescTable
{
private:
std::map<int, SyscallDescABI<ABI>> _descs;
public:
SyscallDescTable(std::initializer_list<SyscallDescABI<ABI>> descs)
{
for (auto &desc: descs) {
auto res = _descs.insert({desc.num(), desc});
panic_if(!res.second, "Failed to insert desc %s", desc.name());
}
}
SyscallDesc
*get(int num)
{
auto it = _descs.find(num);
if (it == _descs.end())
return nullptr;
return &it->second;
}
};
#endif // __SIM_SYSCALL_DESC_HH__