summaryrefslogtreecommitdiff
path: root/src/arch/sparc/linux
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2016-04-01 16:38:15 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2016-04-01 16:38:15 -0700
commit0e214bdfd1dd2e963200875bc8f5ea31e5262503 (patch)
treefb1402ef189c8904cc9f62a65cc9bbcfef26412c /src/arch/sparc/linux
parent41c358c411a0a1dd555c9da9b01c3ff39937b367 (diff)
downloadgem5-0e214bdfd1dd2e963200875bc8f5ea31e5262503.tar.xz
syscall_emul: factor out flag tables into common file
The openFlagTable and mmapFlagTables for emulated Linux platforms are basically identical, but are specified repetitively for every platform. Use a common file that gets included for each platform so that we only have one copy, making them more consistent and simplifying changes (like adding #ifdefs). In the process, made some minor fixes that slipped through due to previous inconsistencies, and added more #ifdefs to try to fix building on alternative hosts.
Diffstat (limited to 'src/arch/sparc/linux')
-rw-r--r--src/arch/sparc/linux/linux.cc94
-rw-r--r--src/arch/sparc/linux/linux.hh3
2 files changed, 4 insertions, 93 deletions
diff --git a/src/arch/sparc/linux/linux.cc b/src/arch/sparc/linux/linux.cc
index dbc7e9691..691124a69 100644
--- a/src/arch/sparc/linux/linux.cc
+++ b/src/arch/sparc/linux/linux.cc
@@ -33,95 +33,5 @@
#include <fcntl.h>
#include <sys/mman.h>
-// open(2) flags translation table
-SyscallFlagTransTable SparcLinux::openFlagTable[] = {
-#ifdef _MSC_VER
- { SparcLinux::TGT_O_RDONLY, _O_RDONLY },
- { SparcLinux::TGT_O_WRONLY, _O_WRONLY },
- { SparcLinux::TGT_O_RDWR, _O_RDWR },
- { SparcLinux::TGT_O_CREAT, _O_CREAT },
- { SparcLinux::TGT_O_EXCL, _O_EXCL },
-#ifdef _O_NOCTTY
- { SparcLinux::TGT_O_NOCTTY, _O_NOCTTY },
-#endif
- { SparcLinux::TGT_O_TRUNC, _O_TRUNC },
- { SparcLinux::TGT_O_APPEND, _O_APPEND },
-#ifdef _O_NONBLOCK
- { SparcLinux::TGT_O_NONBLOCK, _O_NONBLOCK },
-#endif
- { SparcLinux::TGT_O_DSYNC, _O_DSYNC },
- { SparcLinux::TGT_FASYNC, _O_ASYNC },
- { SparcLinux::TGT_O_DIRECT, _O_DIRECT },
- { SparcLinux::TGT_O_LARGEFILE, _O_LARGEFILE },
- { SparcLinux::TGT_O_DIRECTORY, _O_DIRECTORY },
- { SparcLinux::TGT_O_NOFOLLOW, _O_NOFOLLOW },
- { SparcLinux::TGT_O_NOATIME, _O_NOATIME },
-#ifdef _O_CLOEXEC
- { SparcLinux::TGT_O_CLOEXEC, _O_CLOEXEC },
-#endif
-#ifdef _O_SYNC
- { SparcLinux::TGT_O_SYNC, _O_SYNC },
-#endif
-#ifdef _O_PATH
- { SparcLinux::TGT_O_PATH, _O_PATH },
-#endif
-#else /* !_MSC_VER */
- { SparcLinux::TGT_O_RDONLY, O_RDONLY },
- { SparcLinux::TGT_O_WRONLY, O_WRONLY },
- { SparcLinux::TGT_O_RDWR, O_RDWR },
- { SparcLinux::TGT_O_CREAT, O_CREAT },
- { SparcLinux::TGT_O_EXCL, O_EXCL },
- { SparcLinux::TGT_O_NOCTTY, O_NOCTTY },
- { SparcLinux::TGT_O_TRUNC, O_TRUNC },
- { SparcLinux::TGT_O_APPEND, O_APPEND },
- { SparcLinux::TGT_O_NONBLOCK, O_NONBLOCK },
- { SparcLinux::TGT_FASYNC, O_ASYNC },
- { SparcLinux::TGT_O_DIRECT, O_DIRECT },
- { SparcLinux::TGT_O_LARGEFILE, O_LARGEFILE },
- { SparcLinux::TGT_O_DIRECTORY, O_DIRECTORY },
- { SparcLinux::TGT_O_NOFOLLOW, O_NOFOLLOW },
- { SparcLinux::TGT_O_NOATIME, O_NOATIME },
-#ifdef O_CLOEXEC
- { SparcLinux::TGT_O_CLOEXEC, O_CLOEXEC },
-#endif
-#ifdef O_SYNC
- { SparcLinux::TGT_O_SYNC, O_SYNC },
-#endif
-#ifdef _O_PATH
- { SparcLinux::TGT_O_PATH, O_PATH },
-#endif
-#endif /* _MSC_VER */
-};
-
-const int SparcLinux::NUM_OPEN_FLAGS =
- (sizeof(SparcLinux::openFlagTable)/sizeof(SparcLinux::openFlagTable[0]));
-
-// mmap(2) flags translation table
-SyscallFlagTransTable SparcLinux::mmapFlagTable[] = {
- { SparcLinux::TGT_MAP_SHARED, MAP_SHARED },
- { SparcLinux::TGT_MAP_PRIVATE, MAP_PRIVATE },
- { SparcLinux::TGT_MAP_ANON, MAP_ANON },
- { SparcLinux::TGT_MAP_DENYWRITE, MAP_DENYWRITE },
- { SparcLinux::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE },
- { SparcLinux::TGT_MAP_FILE, MAP_FILE },
- { SparcLinux::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN },
- { SparcLinux::TGT_MAP_HUGETLB, MAP_HUGETLB },
- { SparcLinux::TGT_MAP_LOCKED, MAP_LOCKED },
- { SparcLinux::TGT_MAP_NONBLOCK, MAP_NONBLOCK },
- { SparcLinux::TGT_MAP_NORESERVE, MAP_NORESERVE },
- { SparcLinux::TGT_MAP_POPULATE, MAP_POPULATE },
-#ifdef MAP_STACK
- { SparcLinux::TGT_MAP_STACK, MAP_STACK },
-#endif
- { SparcLinux::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS },
- { SparcLinux::TGT_MAP_FIXED, MAP_FIXED },
-#ifdef MAP_INHERIT
- { SparcLinux::TGT_MAP_INHERIT, MAP_INHERIT },
-#endif
- { SparcLinux::TGT_MAP_POPULATE, MAP_POPULATE },
-};
-
-const unsigned SparcLinux::NUM_MMAP_FLAGS =
- sizeof(SparcLinux::mmapFlagTable) /
- sizeof(SparcLinux::mmapFlagTable[0]);
-
+#define TARGET SparcLinux
+#include "kern/linux/flag_tables.hh"
diff --git a/src/arch/sparc/linux/linux.hh b/src/arch/sparc/linux/linux.hh
index d0631f82b..d209dcef0 100644
--- a/src/arch/sparc/linux/linux.hh
+++ b/src/arch/sparc/linux/linux.hh
@@ -106,11 +106,12 @@ class SparcLinux : public Linux
static const int TGT_O_TRUNC = 0x00000400; //!< O_TRUNC
static const int TGT_O_EXCL = 0x00000800; //!< O_EXCL
static const int TGT_O_NOCTTY = 0x00008000; //!< O_NOCTTY
- static const int TGT_O_SYNC = 0x00002000; //!< O_SYNC
+ static const int TGT_O_DSYNC = 0x00002000; //!< O_DSYNC
static const int TGT_O_LARGEFILE = 0x00040000; //!< O_LARGEFILE
static const int TGT_O_DIRECT = 0x00100000; //!< O_DIRECT
static const int TGT_O_NOATIME = 0x00200000; //!< O_NOATIME
static const int TGT_O_CLOEXEC = 0x00400000; //!< O_CLOEXEC
+ static const int TGT_O_SYNC = 0x00802000; //!< O_SYNC
static const int TGT_O_PATH = 0x01000000; //!< O_PATH
static const int TGT_O_DIRECTORY = 000200000; //!< O_DIRECTORY