diff options
author | Brandon Potter <brandon.potter@amd.com> | 2018-04-18 14:57:57 -0400 |
---|---|---|
committer | Anthony Gutierrez <anthony.gutierrez@amd.com> | 2019-01-22 02:05:48 +0000 |
commit | bc74c58eaf55005a6a4b2e67657da4121554943c (patch) | |
tree | 92b04de877f151c7d5c562a117d695fdf913dc37 /src/arch | |
parent | c4e67f68377d9b3e909c76412b6ed2fde6a50e01 (diff) | |
download | gem5-bc74c58eaf55005a6a4b2e67657da4121554943c.tar.xz |
sim-se: add syscalls related to polling
Fix poll so that it will use the syscall retry capability
instead of causing a blocking call.
Add the accept and wait4 system calls.
Add polling to read to remove deadlocks that occur in the
event queue that are caused by blocking system calls.
Modify the write system call to return an error number in
case of error.
Change-Id: I0b4091a2e41e4187ebf69d63e0088f988f37d5da
Reviewed-on: https://gem5-review.googlesource.com/c/12115
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/alpha/linux/process.cc | 4 | ||||
-rw-r--r-- | src/arch/arm/freebsd/process.cc | 4 | ||||
-rw-r--r-- | src/arch/arm/linux/process.cc | 8 | ||||
-rw-r--r-- | src/arch/mips/linux/process.cc | 4 | ||||
-rw-r--r-- | src/arch/power/linux/process.cc | 4 | ||||
-rw-r--r-- | src/arch/riscv/linux/process.cc | 4 | ||||
-rw-r--r-- | src/arch/sparc/linux/syscalls.cc | 8 | ||||
-rw-r--r-- | src/arch/sparc/solaris/process.cc | 4 | ||||
-rw-r--r-- | src/arch/x86/linux/process.cc | 22 |
9 files changed, 31 insertions, 31 deletions
diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index dbfbcaf6a..c1162bad0 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -128,8 +128,8 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = { /* 0 */ SyscallDesc("osf_syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<AlphaLinux>), + /* 4 */ SyscallDesc("write", writeFunc<AlphaLinux>), /* 5 */ SyscallDesc("osf_old_open", unimplementedFunc), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("osf_wait4", unimplementedFunc), diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc index 1ecbdd678..e6aa74068 100644 --- a/src/arch/arm/freebsd/process.cc +++ b/src/arch/arm/freebsd/process.cc @@ -659,8 +659,8 @@ static SyscallDesc syscallDescs64[] = { /* 0 */ SyscallDesc("unused#000", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("unused#002", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<ArmFreebsd64>), + /* 4 */ SyscallDesc("write", writeFunc<ArmFreebsd64>), /* 5 */ SyscallDesc("unused#005", unimplementedFunc), /* 6 */ SyscallDesc("unused#006", unimplementedFunc), /* 7 */ SyscallDesc("unused#007", unimplementedFunc), diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 61caa456b..a7ec70e25 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -126,8 +126,8 @@ static SyscallDesc syscallDescs32[] = { /* 0 */ SyscallDesc("syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<ArmLinux32>), + /* 4 */ SyscallDesc("write", writeFunc<ArmLinux32>), /* 5 */ SyscallDesc("open", openFunc<ArmLinux32>), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("unused#7", unimplementedFunc), @@ -567,8 +567,8 @@ static SyscallDesc syscallDescs64[] = { /* 61 */ SyscallDesc("getdents64", unimplementedFunc), #endif /* 62 */ SyscallDesc("llseek", lseekFunc), - /* 63 */ SyscallDesc("read", readFunc), - /* 64 */ SyscallDesc("write", writeFunc), + /* 63 */ SyscallDesc("read", readFunc<ArmLinux64>), + /* 64 */ SyscallDesc("write", writeFunc<ArmLinux64>), /* 65 */ SyscallDesc("readv", unimplementedFunc), /* 66 */ SyscallDesc("writev", writevFunc<ArmLinux64>), /* 67 */ SyscallDesc("pread64", unimplementedFunc), diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index b36a26fbf..b1c09a5f1 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -141,8 +141,8 @@ SyscallDesc MipsLinuxProcess::syscallDescs[] = { /* 0 */ SyscallDesc("syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<MipsLinux>), + /* 4 */ SyscallDesc("write", writeFunc<MipsLinux>), /* 5 */ SyscallDesc("open", openFunc<MipsLinux>), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("waitpid", unimplementedFunc), diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index 801274969..f219852f8 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -69,8 +69,8 @@ SyscallDesc PowerLinuxProcess::syscallDescs[] = { /* 0 */ SyscallDesc("syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<PowerLinux>), + /* 4 */ SyscallDesc("write", writeFunc<PowerLinux>), /* 5 */ SyscallDesc("open", openFunc<PowerLinux>), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("waitpid", unimplementedFunc), //??? diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index 0f540af9d..6806079a3 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -133,8 +133,8 @@ std::map<int, SyscallDesc> RiscvLinuxProcess::syscallDescs = { {60, SyscallDesc("quotactl")}, {61, SyscallDesc("getdents64")}, {62, SyscallDesc("lseek", lseekFunc)}, - {63, SyscallDesc("read", readFunc)}, - {64, SyscallDesc("write", writeFunc)}, + {63, SyscallDesc("read", readFunc<RiscvLinux>)}, + {64, SyscallDesc("write", writeFunc<RiscvLinux>)}, {66, SyscallDesc("writev", writevFunc<RiscvLinux>)}, {67, SyscallDesc("pread64")}, {68, SyscallDesc("pwrite64", pwrite64Func<RiscvLinux>)}, diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index 7fdc922ef..ee8c60c45 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -91,8 +91,8 @@ SyscallDesc SparcLinuxProcess::syscall32Descs[] = { /* 0 */ SyscallDesc("restart_syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), // 32 bit /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<Sparc32Linux>), + /* 4 */ SyscallDesc("write", writeFunc<Sparc32Linux>), /* 5 */ SyscallDesc("open", openFunc<Sparc32Linux>), // 32 bit /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("wait4", unimplementedFunc), // 32 bit @@ -397,8 +397,8 @@ SyscallDesc SparcLinuxProcess::syscallDescs[] = { /* 0 */ SyscallDesc("restart_syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<SparcLinux>), + /* 4 */ SyscallDesc("write", writeFunc<SparcLinux>), /* 5 */ SyscallDesc("open", openFunc<SparcLinux>), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("wait4", unimplementedFunc), diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index 1afa35398..bcdd08814 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -67,8 +67,8 @@ SyscallDesc SparcSolarisProcess::syscallDescs[] = { /* 0 */ SyscallDesc("syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<SparcSolaris>), + /* 4 */ SyscallDesc("write", writeFunc<SparcSolaris>), /* 5 */ SyscallDesc("open", openFunc<SparcSolaris>), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("wait", unimplementedFunc), diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 65d0238f4..03a88fc6e 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -222,14 +222,14 @@ setThreadArea32Func(SyscallDesc *desc, int callnum, } static SyscallDesc syscallDescs64[] = { - /* 0 */ SyscallDesc("read", readFunc), - /* 1 */ SyscallDesc("write", writeFunc), + /* 0 */ SyscallDesc("read", readFunc<X86Linux64>), + /* 1 */ SyscallDesc("write", writeFunc<X86Linux64>), /* 2 */ SyscallDesc("open", openFunc<X86Linux64>), /* 3 */ SyscallDesc("close", closeFunc), /* 4 */ SyscallDesc("stat", stat64Func<X86Linux64>), /* 5 */ SyscallDesc("fstat", fstat64Func<X86Linux64>), /* 6 */ SyscallDesc("lstat", lstat64Func<X86Linux64>), - /* 7 */ SyscallDesc("poll", unimplementedFunc), + /* 7 */ SyscallDesc("poll", pollFunc<X86Linux64>), /* 8 */ SyscallDesc("lseek", lseekFunc), /* 9 */ SyscallDesc("mmap", mmapFunc<X86Linux64>), /* 10 */ SyscallDesc("mprotect", ignoreFunc), @@ -245,7 +245,7 @@ static SyscallDesc syscallDescs64[] = { /* 20 */ SyscallDesc("writev", writevFunc<X86Linux64>), /* 21 */ SyscallDesc("access", ignoreFunc), /* 22 */ SyscallDesc("pipe", pipeFunc), - /* 23 */ SyscallDesc("select", unimplementedFunc), + /* 23 */ SyscallDesc("select", selectFunc<X86Linux64>), /* 24 */ SyscallDesc("sched_yield", ignoreFunc), /* 25 */ SyscallDesc("mremap", mremapFunc<X86Linux64>), /* 26 */ SyscallDesc("msync", unimplementedFunc), @@ -265,7 +265,7 @@ static SyscallDesc syscallDescs64[] = { /* 40 */ SyscallDesc("sendfile", unimplementedFunc), /* 41 */ SyscallDesc("socket", socketFunc<X86Linux64>), /* 42 */ SyscallDesc("connect", connectFunc), - /* 43 */ SyscallDesc("accept", unimplementedFunc), + /* 43 */ SyscallDesc("accept", acceptFunc<X86Linux64>), /* 44 */ SyscallDesc("sendto", sendtoFunc), /* 45 */ SyscallDesc("recvfrom", recvfromFunc), /* 46 */ SyscallDesc("sendmsg", sendmsgFunc), @@ -283,7 +283,7 @@ static SyscallDesc syscallDescs64[] = { /* 58 */ SyscallDesc("vfork", unimplementedFunc), /* 59 */ SyscallDesc("execve", execveFunc<X86Linux64>), /* 60 */ SyscallDesc("exit", exitFunc), - /* 61 */ SyscallDesc("wait4", unimplementedFunc), + /* 61 */ SyscallDesc("wait4", wait4Func<X86Linux64>), /* 62 */ SyscallDesc("kill", unimplementedFunc), /* 63 */ SyscallDesc("uname", unameFunc), /* 64 */ SyscallDesc("semget", unimplementedFunc), @@ -558,8 +558,8 @@ static SyscallDesc syscallDescs32[] = { /* 0 */ SyscallDesc("restart_syscall", unimplementedFunc), /* 1 */ SyscallDesc("exit", exitFunc), /* 2 */ SyscallDesc("fork", unimplementedFunc), - /* 3 */ SyscallDesc("read", readFunc), - /* 4 */ SyscallDesc("write", writeFunc), + /* 3 */ SyscallDesc("read", readFunc<X86Linux32>), + /* 4 */ SyscallDesc("write", writeFunc<X86Linux32>), /* 5 */ SyscallDesc("open", openFunc<X86Linux32>), /* 6 */ SyscallDesc("close", closeFunc), /* 7 */ SyscallDesc("waitpid", unimplementedFunc), @@ -637,7 +637,7 @@ static SyscallDesc syscallDescs32[] = { /* 79 */ SyscallDesc("settimeofday", unimplementedFunc), /* 80 */ SyscallDesc("getgroups", unimplementedFunc), /* 81 */ SyscallDesc("setgroups", unimplementedFunc), - /* 82 */ SyscallDesc("select", unimplementedFunc), + /* 82 */ SyscallDesc("select", selectFunc<X86Linux32>), /* 83 */ SyscallDesc("symlink", unimplementedFunc), /* 84 */ SyscallDesc("oldlstat", unimplementedFunc), /* 85 */ SyscallDesc("readlink", readlinkFunc), @@ -669,7 +669,7 @@ static SyscallDesc syscallDescs32[] = { /* 111 */ SyscallDesc("vhangup", unimplementedFunc), /* 112 */ SyscallDesc("idle", unimplementedFunc), /* 113 */ SyscallDesc("vm86old", unimplementedFunc), - /* 114 */ SyscallDesc("wait4", unimplementedFunc), + /* 114 */ SyscallDesc("wait4", wait4Func<X86Linux32>), /* 115 */ SyscallDesc("swapoff", unimplementedFunc), /* 116 */ SyscallDesc("sysinfo", sysinfoFunc<X86Linux32>), /* 117 */ SyscallDesc("ipc", unimplementedFunc), @@ -727,7 +727,7 @@ static SyscallDesc syscallDescs32[] = { /* 165 */ SyscallDesc("getresuid", unimplementedFunc), /* 166 */ SyscallDesc("vm86", unimplementedFunc), /* 167 */ SyscallDesc("query_module", unimplementedFunc), - /* 168 */ SyscallDesc("poll", unimplementedFunc), + /* 168 */ SyscallDesc("poll", pollFunc<X86Linux32>), /* 169 */ SyscallDesc("nfsservctl", unimplementedFunc), /* 170 */ SyscallDesc("setresgid", unimplementedFunc), /* 171 */ SyscallDesc("getresgid", unimplementedFunc), |