arch-arm, sim-se: Wire up syscalls needed for pthreads
authorJavier Setoain <javier.setoain@arm.com>
Wed, 9 Jan 2019 12:52:20 +0000 (12:52 +0000)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Thu, 10 Jan 2019 17:50:28 +0000 (17:50 +0000)
Change-Id: I8da5e3e0d7dc5d31ac82ed2045109d6d73cbf99d
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Cc: Giacomo Travaglini <giacomo.travaglini@arm.com>
Cc: Javier Setoain <javier.setoain@arm.com>
Cc: Brandon Potter <Brandon.Potter@amd.com>
Reviewed-on: https://gem5-review.googlesource.com/c/15415
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Brandon Potter <Brandon.Potter@amd.com>

src/arch/arm/linux/process.cc

index 2c64a46cae27d38a357ad3c3bffa9d7cec70a1ab..cb62e6ee7490066ed3b93b113f308ae17670a845 100644 (file)
@@ -132,7 +132,7 @@ static SyscallDesc syscallDescs32[] = {
     /*  8 */ SyscallDesc("creat", unimplementedFunc),
     /*  9 */ SyscallDesc("link", unimplementedFunc),
     /* 10 */ SyscallDesc("unlink", unlinkFunc),
-    /* 11 */ SyscallDesc("execve", unimplementedFunc),
+    /* 11 */ SyscallDesc("execve", execveFunc<ArmLinux32>),
     /* 12 */ SyscallDesc("chdir", unimplementedFunc),
     /* 13 */ SyscallDesc("time", timeFunc<ArmLinux32>),
     /* 14 */ SyscallDesc("mknod", unimplementedFunc),
@@ -262,7 +262,11 @@ static SyscallDesc syscallDescs32[] = {
     /* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
     /* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
     /* 140 */ SyscallDesc("llseek", _llseekFunc),
+#if defined(SYS_getdents)
+    /* 141 */ SyscallDesc("getdents", getdentsFunc),
+#else
     /* 141 */ SyscallDesc("getdents", unimplementedFunc),
+#endif
     /* 142 */ SyscallDesc("newselect", unimplementedFunc),
     /* 143 */ SyscallDesc("flock", unimplementedFunc),
     /* 144 */ SyscallDesc("msync", unimplementedFunc),
@@ -341,11 +345,11 @@ static SyscallDesc syscallDescs32[] = {
     /* 217 */ SyscallDesc("getdents64", unimplementedFunc),
     /* 218 */ SyscallDesc("pivot_root", unimplementedFunc),
     /* 219 */ SyscallDesc("mincore", unimplementedFunc),
-    /* 220 */ SyscallDesc("madvise", unimplementedFunc),
+    /* 220 */ SyscallDesc("madvise", ignoreFunc),
     /* 221 */ SyscallDesc("fcntl64", fcntl64Func),
     /* 222 */ SyscallDesc("unused#222", unimplementedFunc),
     /* 223 */ SyscallDesc("unknown#223", unimplementedFunc),
-    /* 224 */ SyscallDesc("gettid", unimplementedFunc),
+    /* 224 */ SyscallDesc("gettid", gettidFunc),
     /* 225 */ SyscallDesc("readahead", unimplementedFunc),
     /* 226 */ SyscallDesc("setxattr", unimplementedFunc),
     /* 227 */ SyscallDesc("lsetxattr", unimplementedFunc),
@@ -361,9 +365,9 @@ static SyscallDesc syscallDescs32[] = {
     /* 237 */ SyscallDesc("fremovexattr", unimplementedFunc),
     /* 238 */ SyscallDesc("tkill", unimplementedFunc),
     /* 239 */ SyscallDesc("sendfile64", unimplementedFunc),
-    /* 240 */ SyscallDesc("futex", ignoreFunc, SyscallDesc::WarnOnce),
+    /* 240 */ SyscallDesc("futex", futexFunc<ArmLinux32>),
     /* 241 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
-    /* 242 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
+    /* 242 */ SyscallDesc("sched_getaffinity", ignoreFunc),
     /* 243 */ SyscallDesc("io_setup", unimplementedFunc),
     /* 244 */ SyscallDesc("io_destroy", unimplementedFunc),
     /* 245 */ SyscallDesc("io_getevents", unimplementedFunc),
@@ -377,7 +381,7 @@ static SyscallDesc syscallDescs32[] = {
     /* 253 */ SyscallDesc("remap_file_pages", unimplementedFunc),
     /* 254 */ SyscallDesc("unused#254", unimplementedFunc),
     /* 255 */ SyscallDesc("unused#255", unimplementedFunc),
-    /* 256 */ SyscallDesc("set_tid_address", unimplementedFunc),
+    /* 256 */ SyscallDesc("set_tid_address", setTidAddressFunc),
     /* 257 */ SyscallDesc("timer_create", unimplementedFunc),
     /* 258 */ SyscallDesc("timer_settime", unimplementedFunc),
     /* 259 */ SyscallDesc("timer_gettime", unimplementedFunc),
@@ -389,7 +393,7 @@ static SyscallDesc syscallDescs32[] = {
     /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
     /* 266 */ SyscallDesc("statfs64", unimplementedFunc),
     /* 267 */ SyscallDesc("fstatfs64", unimplementedFunc),
-    /* 268 */ SyscallDesc("tgkill", unimplementedFunc),
+    /* 268 */ SyscallDesc("tgkill", tgkillFunc<ArmLinux32>),
     /* 269 */ SyscallDesc("utimes", unimplementedFunc),
     /* 270 */ SyscallDesc("arm_fadvise64_64", unimplementedFunc),
     /* 271 */ SyscallDesc("pciconfig_iobase", unimplementedFunc),
@@ -459,7 +463,7 @@ static SyscallDesc syscallDescs32[] = {
     /* 335 */ SyscallDesc("pselect6", unimplementedFunc),
     /* 336 */ SyscallDesc("ppoll", unimplementedFunc),
     /* 337 */ SyscallDesc("unshare", unimplementedFunc),
-    /* 338 */ SyscallDesc("set_robust_list", unimplementedFunc),
+    /* 338 */ SyscallDesc("set_robust_list", ignoreFunc),
     /* 339 */ SyscallDesc("get_robust_list", unimplementedFunc),
     /* 340 */ SyscallDesc("splice", unimplementedFunc),
     /* 341 */ SyscallDesc("arm_sync_file_range", unimplementedFunc),
@@ -586,10 +590,10 @@ static SyscallDesc syscallDescs64[] = {
     /*   93 */ SyscallDesc("exit", exitFunc),
     /*   94 */ SyscallDesc("exit_group", exitGroupFunc),
     /*   95 */ SyscallDesc("waitid", unimplementedFunc),
-    /*   96 */ SyscallDesc("set_tid_address", unimplementedFunc),
+    /*   96 */ SyscallDesc("set_tid_address", setTidAddressFunc),
     /*   97 */ SyscallDesc("unshare", unimplementedFunc),
-    /*   98 */ SyscallDesc("futex", unimplementedFunc),
-    /*   99 */ SyscallDesc("set_robust_list", unimplementedFunc),
+    /*   98 */ SyscallDesc("futex", futexFunc<ArmLinux64>),
+    /*   99 */ SyscallDesc("set_robust_list", ignoreFunc),
     /*  100 */ SyscallDesc("get_robust_list", unimplementedFunc),
     /*  101 */ SyscallDesc("nanosleep", ignoreFunc, SyscallDesc::WarnOnce),
     /*  102 */ SyscallDesc("getitimer", unimplementedFunc),
@@ -613,7 +617,7 @@ static SyscallDesc syscallDescs64[] = {
     /*  120 */ SyscallDesc("sched_getscheduler", unimplementedFunc),
     /*  121 */ SyscallDesc("sched_getparam", unimplementedFunc),
     /*  122 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
-    /*  123 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
+    /*  123 */ SyscallDesc("sched_getaffinity", ignoreFunc),
     /*  124 */ SyscallDesc("sched_yield", unimplementedFunc),
     /*  125 */ SyscallDesc("sched_get_priority_max", unimplementedFunc),
     /*  126 */ SyscallDesc("sched_get_priority_min", unimplementedFunc),
@@ -621,7 +625,7 @@ static SyscallDesc syscallDescs64[] = {
     /*  128 */ SyscallDesc("restart_syscall", unimplementedFunc),
     /*  129 */ SyscallDesc("kill", ignoreFunc),
     /*  130 */ SyscallDesc("tkill", unimplementedFunc),
-    /*  131 */ SyscallDesc("tgkill", unimplementedFunc),
+    /*  131 */ SyscallDesc("tgkill", tgkillFunc<ArmLinux64>),
     /*  132 */ SyscallDesc("sigaltstack", unimplementedFunc),
     /*  133 */ SyscallDesc("rt_sigsuspend", unimplementedFunc),
     /*  134 */ SyscallDesc("rt_sigaction", ignoreFunc),
@@ -668,7 +672,7 @@ static SyscallDesc syscallDescs64[] = {
     /*  175 */ SyscallDesc("geteuid", geteuidFunc),
     /*  176 */ SyscallDesc("getgid", getgidFunc),
     /*  177 */ SyscallDesc("getegid", getegidFunc),
-    /*  178 */ SyscallDesc("gettid", unimplementedFunc),
+    /*  178 */ SyscallDesc("gettid", gettidFunc),
     /*  179 */ SyscallDesc("sysinfo", sysinfoFunc<ArmLinux64>),
     /*  180 */ SyscallDesc("mq_open", unimplementedFunc),
     /*  181 */ SyscallDesc("mq_unlink", unimplementedFunc),
@@ -710,8 +714,8 @@ static SyscallDesc syscallDescs64[] = {
     /*  217 */ SyscallDesc("add_key", unimplementedFunc),
     /*  218 */ SyscallDesc("request_key", unimplementedFunc),
     /*  219 */ SyscallDesc("keyctl", unimplementedFunc),
-    /*  220 */ SyscallDesc("clone", unimplementedFunc),
-    /*  221 */ SyscallDesc("execve", unimplementedFunc),
+    /*  220 */ SyscallDesc("clone", cloneFunc<ArmLinux64>),
+    /*  221 */ SyscallDesc("execve", execveFunc<ArmLinux64>),
     /*  222 */ SyscallDesc("mmap2", mmapFunc<ArmLinux64>),
     /*  223 */ SyscallDesc("fadvise64_64", unimplementedFunc),
     /*  224 */ SyscallDesc("swapon", unimplementedFunc),
@@ -723,7 +727,7 @@ static SyscallDesc syscallDescs64[] = {
     /*  230 */ SyscallDesc("mlockall", unimplementedFunc),
     /*  231 */ SyscallDesc("munlockall", unimplementedFunc),
     /*  232 */ SyscallDesc("mincore", unimplementedFunc),
-    /*  233 */ SyscallDesc("madvise", unimplementedFunc),
+    /*  233 */ SyscallDesc("madvise", ignoreFunc),
     /*  234 */ SyscallDesc("remap_file_pages", unimplementedFunc),
     /*  235 */ SyscallDesc("mbind", unimplementedFunc),
     /*  236 */ SyscallDesc("get_mempolicy", unimplementedFunc),
@@ -751,7 +755,7 @@ static SyscallDesc syscallDescs64[] = {
     /*  258 */ SyscallDesc("unused#258", unimplementedFunc),
     /*  259 */ SyscallDesc("unused#259", unimplementedFunc),
     /*  260 */ SyscallDesc("wait4", unimplementedFunc),
-    /*  261 */ SyscallDesc("prlimit64", unimplementedFunc),
+    /*  261 */ SyscallDesc("prlimit64", prlimitFunc<ArmLinux64>),
     /*  262 */ SyscallDesc("fanotify_init", unimplementedFunc),
     /*  263 */ SyscallDesc("fanotify_mark", unimplementedFunc),
     /*  264 */ SyscallDesc("name_to_handle_at", unimplementedFunc),
@@ -1555,7 +1559,11 @@ static SyscallDesc syscallDescs64[] = {
     /* 1062 */ SyscallDesc("time", timeFunc<ArmLinux64>),
     /* 1063 */ SyscallDesc("utime", unimplementedFunc),
     /* 1064 */ SyscallDesc("creat", unimplementedFunc),
+#if defined(SYS_getdents)
+    /* 1065 */ SyscallDesc("getdents", getdentsFunc),
+#else
     /* 1065 */ SyscallDesc("getdents", unimplementedFunc),
+#endif
     /* 1066 */ SyscallDesc("futimesat", unimplementedFunc),
     /* 1067 */ SyscallDesc("select", unimplementedFunc),
     /* 1068 */ SyscallDesc("poll", unimplementedFunc),