diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2016-04-01 16:38:15 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2016-04-01 16:38:15 -0700 |
commit | 0e214bdfd1dd2e963200875bc8f5ea31e5262503 (patch) | |
tree | fb1402ef189c8904cc9f62a65cc9bbcfef26412c /src/arch/power | |
parent | 41c358c411a0a1dd555c9da9b01c3ff39937b367 (diff) | |
download | gem5-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/power')
-rw-r--r-- | src/arch/power/linux/linux.cc | 99 |
1 files changed, 2 insertions, 97 deletions
diff --git a/src/arch/power/linux/linux.cc b/src/arch/power/linux/linux.cc index 6382ca72a..d569ec279 100644 --- a/src/arch/power/linux/linux.cc +++ b/src/arch/power/linux/linux.cc @@ -34,100 +34,5 @@ #include <fcntl.h> #include <sys/mman.h> -// open(2) flags translation table -SyscallFlagTransTable PowerLinux::openFlagTable[] = { -#ifdef _MSC_VER - { PowerLinux::TGT_O_RDONLY, _O_RDONLY }, - { PowerLinux::TGT_O_WRONLY, _O_WRONLY }, - { PowerLinux::TGT_O_RDWR, _O_RDWR }, - { PowerLinux::TGT_O_CREAT, _O_CREAT }, - { PowerLinux::TGT_O_EXCL, _O_EXCL }, -#ifdef _O_NOCTTY - { PowerLinux::TGT_O_NOCTTY, _O_NOCTTY }, -#endif - { PowerLinux::TGT_O_TRUNC, _O_TRUNC }, - { PowerLinux::TGT_O_APPEND, _O_APPEND }, -#ifdef _O_NONBLOCK - { PowerLinux::TGT_O_NONBLOCK, _O_NONBLOCK }, -#endif -#ifdef _O_DSYNC - { PowerLinux::TGT_O_DSYNC, _O_DSYNC }, -#endif - { PowerLinux::TGT_FASYNC, _O_ASYNC }, - { PowerLinux::TGT_O_DIRECT, _O_DIRECT }, -#ifdef _O_LARGEFILE - { PowerLinux::TGT_O_LARGEFILE, _O_LARGEFILE }, -#endif - { PowerLinux::TGT_O_DIRECTORY, _O_DIRECTORY }, - { PowerLinux::TGT_O_NOFOLLOW, _O_NOFOLLOW }, - { PowerLinux::TGT_O_NOATIME, _O_NOATIME }, -#ifdef _O_CLOEXEC - { PowerLinux::TGT_O_CLOEXEC, _O_CLOEXEC }, -#endif -#ifdef _O_SYNC - { PowerLinux::TGT_O_SYNC, _O_SYNC }, -#endif -#ifdef _O_PATH - { PowerLinux::TGT_O_PATH, _O_PATH}, -#endif -#else /* !_MSC_VER */ - { PowerLinux::TGT_O_RDONLY, O_RDONLY }, - { PowerLinux::TGT_O_WRONLY, O_WRONLY }, - { PowerLinux::TGT_O_RDWR, O_RDWR }, - { PowerLinux::TGT_O_CREAT, O_CREAT }, - { PowerLinux::TGT_O_EXCL, O_EXCL }, - { PowerLinux::TGT_O_NOCTTY, O_NOCTTY }, - { PowerLinux::TGT_O_TRUNC, O_TRUNC }, - { PowerLinux::TGT_O_APPEND, O_APPEND }, - { PowerLinux::TGT_O_NONBLOCK, O_NONBLOCK }, -#ifdef O_DSYNC - { PowerLinux::TGT_O_DSYNC, O_DSYNC }, -#endif - { PowerLinux::TGT_FASYNC, O_ASYNC }, - { PowerLinux::TGT_O_DIRECT, O_DIRECT }, -#ifdef O_LARGEFILE - { PowerLinux::TGT_O_LARGEFILE, O_LARGEFILE }, -#endif - { PowerLinux::TGT_O_DIRECTORY, O_DIRECTORY }, - { PowerLinux::TGT_O_NOFOLLOW, O_NOFOLLOW }, - { PowerLinux::TGT_O_NOATIME, O_NOATIME }, -#ifdef O_CLOEXEC - { PowerLinux::TGT_O_CLOEXEC, O_CLOEXEC }, -#endif -#ifdef O_SYNC - { PowerLinux::TGT_O_SYNC, O_SYNC }, -#endif -#ifdef O_PATH - { PowerLinux::TGT_O_PATH, O_PATH}, -#endif -#endif /* _MSC_VER */ -}; - -const int PowerLinux::NUM_OPEN_FLAGS = - (sizeof(PowerLinux::openFlagTable)/sizeof(PowerLinux::openFlagTable[0])); - -// mmap(2) flags translation table -SyscallFlagTransTable PowerLinux::mmapFlagTable[] = { - { PowerLinux::TGT_MAP_SHARED, MAP_SHARED }, - { PowerLinux::TGT_MAP_PRIVATE, MAP_PRIVATE }, - { PowerLinux::TGT_MAP_ANON, MAP_ANON }, - { PowerLinux::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, - { PowerLinux::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, - { PowerLinux::TGT_MAP_FILE, MAP_FILE }, - { PowerLinux::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, - { PowerLinux::TGT_MAP_HUGETLB, MAP_HUGETLB }, - { PowerLinux::TGT_MAP_LOCKED, MAP_LOCKED }, - { PowerLinux::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, - { PowerLinux::TGT_MAP_NORESERVE, MAP_NORESERVE }, - { PowerLinux::TGT_MAP_POPULATE, MAP_POPULATE }, -#ifdef MAP_STACK - { PowerLinux::TGT_MAP_STACK, MAP_STACK }, -#endif - { PowerLinux::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, - { PowerLinux::TGT_MAP_FIXED, MAP_FIXED }, -}; - -const unsigned PowerLinux::NUM_MMAP_FLAGS = - sizeof(PowerLinux::mmapFlagTable) / - sizeof(PowerLinux::mmapFlagTable[0]); - +#define TARGET PowerLinux +#include "kern/linux/flag_tables.hh" |