From 4eb2360001066e59aefd987643977ba6ee417185 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 20 Oct 2020 17:37:00 -0700 Subject: [PATCH] sparc: Remove support for Solaris SE mode. In SPARC and SE mode, system calls are triggered by a trap exception with the appropriate trap number, and then a handler within the Workload (formerly the Process) object recognizes the trap number and triggers the system call. For Linux, this special handling happens in the Linux specific Workload, and other types of traps are passed through to the base SPARC SE Workload class. For Solaris however, no special handling is implemented. That means that it's actually impossible for a Solaris SE mode program to actually trigger a system call, and so while there is some code written for Solaris SE mode, this feature does not actually work at all. Also, while it's relatively easy to build binaries for Linux on various architectures using, for instance, the crosstool-ng configs in util/, there is no ready made option that I could find for building a SPARC Solaris cross compiler which would run on x86 linux. Given that the support that exists isn't actually hooked up properly, SPARC is not one of the most popular ISAs within gem5, Solaris is not a widely used operating system, we have (to my knowledge) no test binary to run, and setting up a cross compiler would be non-trivial, it makes the most sense to me to remove this support. Change-Id: I896b5abc4bf337bd4e4c06c49de7111a3b2b784c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33996 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- src/arch/sparc/SConscript | 1 - src/arch/sparc/SparcSeWorkload.py | 10 - src/arch/sparc/solaris/se_workload.cc | 364 -------------------------- src/arch/sparc/solaris/se_workload.hh | 62 ----- 4 files changed, 437 deletions(-) delete mode 100644 src/arch/sparc/solaris/se_workload.cc delete mode 100644 src/arch/sparc/solaris/se_workload.hh diff --git a/src/arch/sparc/SConscript b/src/arch/sparc/SConscript index 7ba6d10b0..700c076e7 100644 --- a/src/arch/sparc/SConscript +++ b/src/arch/sparc/SConscript @@ -44,7 +44,6 @@ if env['TARGET_ISA'] == 'sparc': Source('process.cc') Source('remote_gdb.cc') Source('se_workload.cc') - Source('solaris/se_workload.cc') Source('solaris/solaris.cc') Source('tlb.cc') Source('ua2005.cc') diff --git a/src/arch/sparc/SparcSeWorkload.py b/src/arch/sparc/SparcSeWorkload.py index 03d4b7301..75327eddb 100644 --- a/src/arch/sparc/SparcSeWorkload.py +++ b/src/arch/sparc/SparcSeWorkload.py @@ -42,13 +42,3 @@ class SparcEmuLinux(SparcSEWorkload): def _is_compatible_with(cls, obj): return obj.get_arch() in ('sparc64', 'sparc32') and \ obj.get_op_sys() in ('linux', 'unknown') - -class SparcEmuSolaris(SparcSEWorkload): - type = 'SparcEmuSolaris' - cxx_header = "arch/sparc/solaris/se_workload.hh" - cxx_class = 'SparcISA::EmuSolaris' - - @classmethod - def _is_compatible_with(cls, obj): - return obj.get_arch() in ('sparc64', 'sparc32') and \ - obj.get_op_sys() == 'solaris' diff --git a/src/arch/sparc/solaris/se_workload.cc b/src/arch/sparc/solaris/se_workload.cc deleted file mode 100644 index 9372f15b0..000000000 --- a/src/arch/sparc/solaris/se_workload.cc +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "arch/sparc/solaris/se_workload.hh" - -#include - -#include "arch/sparc/process.hh" -#include "base/loader/object_file.hh" -#include "base/trace.hh" -#include "cpu/thread_context.hh" -#include "sim/proxy_ptr.hh" -#include "sim/syscall_desc.hh" -#include "sim/syscall_emul.hh" - -namespace -{ - -class SolarisLoader : public Process::Loader -{ - public: - Process * - load(const ProcessParams ¶ms, ::Loader::ObjectFile *obj) override - { - auto arch = obj->getArch(); - auto opsys = obj->getOpSys(); - - if (arch != ::Loader::SPARC64) - return nullptr; - - if (opsys != ::Loader::Solaris) - return nullptr; - - return new Sparc64Process(params, obj); - } -}; - -SolarisLoader loader; - -} // anonymous namespace - -namespace SparcISA -{ - -EmuSolaris::EmuSolaris(const Params &p) : SEWorkload(p), _params(p) -{} - -void -EmuSolaris::syscall(ThreadContext *tc) -{ - Process *process = tc->getProcessPtr(); - // Call the syscall function in the base Process class to update stats. - // This will move into the base SEWorkload function at some point. - process->Process::syscall(tc); - - syscallDescs.get(tc->readIntReg(1))->doSyscall(tc); -} - -/// Target uname() handler. -static SyscallReturn -unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr name) -{ - auto process = tc->getProcessPtr(); - - strcpy(name->sysname, "SunOS"); - strcpy(name->nodename, "m5.eecs.umich.edu"); - strcpy(name->release, process->release.c_str()); - strcpy(name->version, "Generic_118558-21"); - strcpy(name->machine, "sun4u"); - - return 0; -} - - -SyscallDescTable EmuSolaris::syscallDescs = { - { 0, "syscall" }, - { 1, "exit", exitFunc }, - { 2, "fork" }, - { 3, "read", readFunc }, - { 4, "write", writeFunc }, - { 5, "open", openFunc }, - { 6, "close", closeFunc }, - { 7, "wait" }, - { 8, "creat" }, - { 9, "link" }, - { 10, "unlink", unlinkFunc }, - { 11, "exec" }, - { 12, "chdir" }, - { 13, "time" }, - { 14, "mknod" }, - { 15, "chmod", chmodFunc }, - { 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 }, - { 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 }, - { 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" } -}; - -} // namespace SparcISA - -SparcISA::EmuSolaris * -SparcEmuSolarisParams::create() const -{ - return new SparcISA::EmuSolaris(*this); -} diff --git a/src/arch/sparc/solaris/se_workload.hh b/src/arch/sparc/solaris/se_workload.hh deleted file mode 100644 index 3faf20f94..000000000 --- a/src/arch/sparc/solaris/se_workload.hh +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __ARCH_SPARC_SOLARIS_SE_WORKLOAD_HH__ -#define __ARCH_SPARC_SOLARIS_SE_WORKLOAD_HH__ - -#include "arch/sparc/se_workload.hh" -#include "arch/sparc/solaris/solaris.hh" -#include "params/SparcEmuSolaris.hh" -#include "sim/syscall_desc.hh" - -namespace SparcISA -{ - -class EmuSolaris : public SEWorkload -{ - public: - using Params = SparcEmuSolarisParams; - - protected: - const Params &_params; - - /// Array of syscall descriptors, indexed by call number. - static SyscallDescTable syscallDescs; - - public: - const Params ¶ms() const { return _params; } - - EmuSolaris(const Params &p); - - ::Loader::Arch getArch() const override { return ::Loader::SPARC64; } - - void syscall(ThreadContext *tc) override; -}; - -} // namespace SparcISA - -#endif // __ARCH_SPARC_SOLARIS_SE_WORKLOAD_HH__ -- 2.30.2