summaryrefslogtreecommitdiff
path: root/src/arch/mips
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/mips
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/mips')
-rw-r--r--src/arch/mips/linux/linux.cc93
-rw-r--r--src/arch/mips/linux/linux.hh1
2 files changed, 3 insertions, 91 deletions
diff --git a/src/arch/mips/linux/linux.cc b/src/arch/mips/linux/linux.cc
index 2f0ca6090..e99bd9810 100644
--- a/src/arch/mips/linux/linux.cc
+++ b/src/arch/mips/linux/linux.cc
@@ -33,94 +33,5 @@
#include <fcntl.h>
#include <sys/mman.h>
-// open(2) flags translation table
-SyscallFlagTransTable MipsLinux::openFlagTable[] = {
-#ifdef _MSC_VER
- { MipsLinux::TGT_O_RDONLY, _O_RDONLY },
- { MipsLinux::TGT_O_WRONLY, _O_WRONLY },
- { MipsLinux::TGT_O_RDWR, _O_RDWR },
- { MipsLinux::TGT_O_CREAT, _O_CREAT },
- { MipsLinux::TGT_O_EXCL, _O_EXCL },
-#ifdef _O_NOCTTY
- { MipsLinux::TGT_O_NOCTTY, _O_NOCTTY },
-#endif
- { MipsLinux::TGT_O_TRUNC, _O_TRUNC },
- { MipsLinux::TGT_O_APPEND, _O_APPEND },
-#ifdef _O_NONBLOCK
- { MipsLinux::TGT_O_NONBLOCK, _O_NONBLOCK },
-#endif
-#ifdef _O_DSYNC
- { MipsLinux::TGT_O_DSYNC, _O_DSYNC },
-#endif
- { MipsLinux::TGT_O_DIRECT, _O_DIRECT },
- { MipsLinux::TGT_O_LARGEFILE, _O_LARGEFILE },
- { MipsLinux::TGT_O_DIRECTORY, _O_DIRECTORY },
- { MipsLinux::TGT_O_NOFOLLOW, _O_NOFOLLOW },
- { MipsLinux::TGT_O_NOATIME, _O_NOATIME },
-#ifdef _O_CLOEXEC
- { MipsLinux::TGT_O_CLOEXEC, _O_CLOEXEC },
-#endif
-#ifdef _O_SYNC
- { MipsLinux::TGT_O_SYNC, _O_SYNC },
-#endif
-#ifdef _O_PATH
- { MipsLinux::TGT_O_PATH, _O_PATH },
-#endif
-#else /* !_MSC_VER */
- { MipsLinux::TGT_O_RDONLY, O_RDONLY },
- { MipsLinux::TGT_O_WRONLY, O_WRONLY },
- { MipsLinux::TGT_O_RDWR, O_RDWR },
- { MipsLinux::TGT_O_CREAT, O_CREAT },
- { MipsLinux::TGT_O_EXCL, O_EXCL },
- { MipsLinux::TGT_O_NOCTTY, O_NOCTTY },
- { MipsLinux::TGT_O_TRUNC, O_TRUNC },
- { MipsLinux::TGT_O_APPEND, O_APPEND },
- { MipsLinux::TGT_O_NONBLOCK, O_NONBLOCK },
-#ifdef O_DSYNC
- { MipsLinux::TGT_O_DSYNC, O_DSYNC },
-#endif
- { MipsLinux::TGT_O_DIRECT, O_DIRECT },
- { MipsLinux::TGT_O_LARGEFILE, O_LARGEFILE },
- { MipsLinux::TGT_O_DIRECTORY, O_DIRECTORY },
- { MipsLinux::TGT_O_NOFOLLOW, O_NOFOLLOW },
- { MipsLinux::TGT_O_NOATIME, O_NOATIME },
-#ifdef O_CLOEXEC
- { MipsLinux::TGT_O_CLOEXEC, O_CLOEXEC },
-#endif
-#ifdef O_SYNC
- { MipsLinux::TGT_O_SYNC, O_SYNC },
-#endif
-#ifdef O_PATH
- { MipsLinux::TGT_O_PATH, O_PATH },
-#endif
-#endif /* _MSC_VER */
-};
-
-const int MipsLinux::NUM_OPEN_FLAGS =
- (sizeof(MipsLinux::openFlagTable)/sizeof(MipsLinux::openFlagTable[0]));
-
-// mmap(2) flags translation table
-SyscallFlagTransTable MipsLinux::mmapFlagTable[] = {
- { MipsLinux::TGT_MAP_SHARED, MAP_SHARED },
- { MipsLinux::TGT_MAP_PRIVATE, MAP_PRIVATE },
- { MipsLinux::TGT_MAP_ANON, MAP_ANON },
- { MipsLinux::TGT_MAP_DENYWRITE, MAP_DENYWRITE },
- { MipsLinux::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE },
- { MipsLinux::TGT_MAP_FILE, MAP_FILE },
- { MipsLinux::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN },
- { MipsLinux::TGT_MAP_HUGETLB, MAP_HUGETLB },
- { MipsLinux::TGT_MAP_LOCKED, MAP_LOCKED },
- { MipsLinux::TGT_MAP_NONBLOCK, MAP_NONBLOCK },
- { MipsLinux::TGT_MAP_NORESERVE, MAP_NORESERVE },
- { MipsLinux::TGT_MAP_POPULATE, MAP_POPULATE },
-#ifdef MAP_STACK
- { MipsLinux::TGT_MAP_STACK, MAP_STACK },
-#endif
- { MipsLinux::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS },
- { MipsLinux::TGT_MAP_FIXED, MAP_FIXED },
-};
-
-const unsigned MipsLinux::NUM_MMAP_FLAGS =
- sizeof(MipsLinux::mmapFlagTable) /
- sizeof(MipsLinux::mmapFlagTable[0]);
-
+#define TARGET MipsLinux
+#include "kern/linux/flag_tables.hh"
diff --git a/src/arch/mips/linux/linux.hh b/src/arch/mips/linux/linux.hh
index f4b18397e..e0b785c76 100644
--- a/src/arch/mips/linux/linux.hh
+++ b/src/arch/mips/linux/linux.hh
@@ -91,6 +91,7 @@ class MipsLinux : public Linux
static const int TGT_O_APPEND = 0x00000008; //!< O_APPEND
static const int TGT_O_NONBLOCK = 0x00000080; //!< O_NONBLOCK
static const int TGT_O_DSYNC = 0x00000010; //!< O_DSYNC
+ static const int TGT_FASYNC = 0x00001000; //!< O_FASYNC
static const int TGT_O_DIRECT = 0x00008000; //!< O_DIRECT
static const int TGT_O_LARGEFILE = 0x00002000; //!< O_LARGEFILE
static const int TGT_O_DIRECTORY = 0x00010000; //!< O_DIRECTORY