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