diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/alpha/linux/linux.cc | 94 | ||||
-rw-r--r-- | src/arch/arm/linux/linux.cc | 206 | ||||
-rw-r--r-- | src/arch/mips/linux/linux.cc | 93 | ||||
-rw-r--r-- | src/arch/mips/linux/linux.hh | 1 | ||||
-rw-r--r-- | src/arch/power/linux/linux.cc | 99 | ||||
-rw-r--r-- | src/arch/sparc/linux/linux.cc | 94 | ||||
-rw-r--r-- | src/arch/sparc/linux/linux.hh | 3 | ||||
-rw-r--r-- | src/arch/x86/linux/linux.cc | 198 |
8 files changed, 23 insertions, 765 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" diff --git a/src/arch/arm/linux/linux.cc b/src/arch/arm/linux/linux.cc index 3dde8c217..1c10d410c 100644 --- a/src/arch/arm/linux/linux.cc +++ b/src/arch/arm/linux/linux.cc @@ -46,205 +46,9 @@ #include <fcntl.h> #include <sys/mman.h> -// open(2) flags translation table -SyscallFlagTransTable ArmLinux32::openFlagTable[] = { -#ifdef _MSC_VER - { ArmLinux32::TGT_O_RDONLY, _O_RDONLY }, - { ArmLinux32::TGT_O_WRONLY, _O_WRONLY }, - { ArmLinux32::TGT_O_RDWR, _O_RDWR }, - { ArmLinux32::TGT_O_CREAT, _O_CREAT }, - { ArmLinux32::TGT_O_EXCL, _O_EXCL }, -#ifdef _O_NOCTTY - { ArmLinux32::TGT_O_NOCTTY, _O_NOCTTY }, -#endif - { ArmLinux32::TGT_O_TRUNC, _O_TRUNC }, - { ArmLinux32::TGT_O_APPEND, _O_APPEND }, -#ifdef _O_NONBLOCK - { ArmLinux32::TGT_O_NONBLOCK, _O_NONBLOCK }, -#endif -#ifdef _O_DSYNC - { ArmLinux32::TGT_O_DSYNC, _O_DSYNC }, -#endif - { ArmLinux32::TGT_FASYNC, _O_ASYNC }, - { ArmLinux32::TGT_O_DIRECT, _O_DIRECT }, - { ArmLinux32::TGT_O_LARGEFILE, _O_LARGEFILE }, - { ArmLinux32::TGT_O_DIRECTORY, _O_DIRECTORY }, - { ArmLinux32::TGT_O_NOFOLLOW, _O_NOFOLLOW }, - { ArmLinux32::TGT_O_NOATIME, _O_NOATIME }, -#ifdef _O_CLOEXEC - { ArmLinux32::TGT_O_CLOEXEC, _O_CLOEXEC }, -#endif -#ifdef _O_SYNC - { ArmLinux32::TGT_O_SYNC, _O_SYNC }, -#endif -#ifdef _O_PATH - { ArmLinux32::TGT_O_PATH, _O_PATH }, -#endif -#else /* !_MSC_VER */ - { ArmLinux32::TGT_O_RDONLY, O_RDONLY }, - { ArmLinux32::TGT_O_WRONLY, O_WRONLY }, - { ArmLinux32::TGT_O_RDWR, O_RDWR }, - { ArmLinux32::TGT_O_CREAT, O_CREAT }, - { ArmLinux32::TGT_O_EXCL, O_EXCL }, - { ArmLinux32::TGT_O_NOCTTY, O_NOCTTY }, - { ArmLinux32::TGT_O_TRUNC, O_TRUNC }, - { ArmLinux32::TGT_O_APPEND, O_APPEND }, - { ArmLinux32::TGT_O_NONBLOCK, O_NONBLOCK }, -#ifdef O_DSYNC - { ArmLinux32::TGT_O_DSYNC, O_DSYNC }, -#endif - { ArmLinux32::TGT_FASYNC, O_ASYNC }, -#ifdef O_DIRECT - { ArmLinux32::TGT_O_DIRECT, O_DIRECT }, -#endif -#ifdef O_LARGEFILE - { ArmLinux32::TGT_O_LARGEFILE, O_LARGEFILE }, -#endif -#ifdef O_DIRECTORY - { ArmLinux32::TGT_O_DIRECTORY, O_DIRECTORY }, -#endif -#ifdef O_NOFOLLOW - { ArmLinux32::TGT_O_NOFOLLOW, O_NOFOLLOW }, -#endif - { ArmLinux32::TGT_O_NOATIME, O_NOATIME }, -#ifdef O_CLOEXEC - { ArmLinux32::TGT_O_CLOEXEC, O_CLOEXEC }, -#endif -#ifdef O_SYNC - { ArmLinux32::TGT_O_SYNC, O_SYNC }, -#endif -#ifdef O_PATH - { ArmLinux32::TGT_O_PATH, O_PATH }, -#endif -#endif /* _MSC_VER */ -}; - -const int ArmLinux32::NUM_OPEN_FLAGS = sizeof(ArmLinux32::openFlagTable) / - sizeof(ArmLinux32::openFlagTable[0]); - -// mmap(2) flags translation table -SyscallFlagTransTable ArmLinux32::mmapFlagTable[] = { - { ArmLinux32::TGT_MAP_SHARED, MAP_SHARED }, - { ArmLinux32::TGT_MAP_PRIVATE, MAP_PRIVATE }, - { ArmLinux32::TGT_MAP_ANON, MAP_ANON }, - { ArmLinux32::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, - { ArmLinux32::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, - { ArmLinux32::TGT_MAP_FILE, MAP_FILE }, - { ArmLinux32::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, - { ArmLinux32::TGT_MAP_HUGETLB, MAP_HUGETLB }, - { ArmLinux32::TGT_MAP_LOCKED, MAP_LOCKED }, - { ArmLinux32::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, - { ArmLinux32::TGT_MAP_NORESERVE, MAP_NORESERVE }, - { ArmLinux32::TGT_MAP_POPULATE, MAP_POPULATE }, -#ifdef MAP_STACK - { ArmLinux32::TGT_MAP_STACK, MAP_STACK }, -#endif - { ArmLinux32::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, - { ArmLinux32::TGT_MAP_FIXED, MAP_FIXED }, -}; - -const unsigned ArmLinux32::NUM_MMAP_FLAGS = - sizeof(ArmLinux32::mmapFlagTable) / - sizeof(ArmLinux32::mmapFlagTable[0]); - -// open(2) flags translation table -SyscallFlagTransTable ArmLinux64::openFlagTable[] = { -#ifdef _MSC_VER - { ArmLinux64::TGT_O_RDONLY, _O_RDONLY }, - { ArmLinux64::TGT_O_WRONLY, _O_WRONLY }, - { ArmLinux64::TGT_O_RDWR, _O_RDWR }, - { ArmLinux64::TGT_O_CREAT, _O_CREAT }, - { ArmLinux64::TGT_O_EXCL, _O_EXCL }, -#ifdef _O_NOCTTY - { ArmLinux64::TGT_O_NOCTTY, _O_NOCTTY }, -#endif - { ArmLinux64::TGT_O_TRUNC, _O_TRUNC }, - { ArmLinux64::TGT_O_APPEND, _O_APPEND }, -#ifdef _O_NONBLOCK - { ArmLinux64::TGT_O_NONBLOCK, _O_NONBLOCK }, -#endif -#ifdef _O_DSYNC - { ArmLinux64::TGT_O_DSYNC, _O_DSYNC }, -#endif - { ArmLinux64::TGT_FASYNC, _O_ASYNC }, - { ArmLinux64::TGT_O_DIRECT, _O_DIRECT }, - { ArmLinux64::TGT_O_LARGEFILE, _O_LARGEFILE }, - { ArmLinux64::TGT_O_DIRECTORY, _O_DIRECTORY }, - { ArmLinux64::TGT_O_NOFOLLOW, _O_NOFOLLOW }, - { ArmLinux64::TGT_O_NOATIME, _O_NOATIME }, -#ifdef _O_CLOEXEC - { ArmLinux64::TGT_O_CLOEXEC, _O_CLOEXEC }, -#endif -#ifdef _O_SYNC - { ArmLinux64::TGT_O_SYNC, _O_SYNC }, -#endif -#ifdef _O_PATH - { ArmLinux64::TGT_O_PATH, _O_PATH }, -#endif -#else /* !_MSC_VER */ - { ArmLinux64::TGT_O_RDONLY, O_RDONLY }, - { ArmLinux64::TGT_O_WRONLY, O_WRONLY }, - { ArmLinux64::TGT_O_RDWR, O_RDWR }, - { ArmLinux64::TGT_O_CREAT, O_CREAT }, - { ArmLinux64::TGT_O_EXCL, O_EXCL }, - { ArmLinux64::TGT_O_NOCTTY, O_NOCTTY }, - { ArmLinux64::TGT_O_TRUNC, O_TRUNC }, - { ArmLinux64::TGT_O_APPEND, O_APPEND }, - { ArmLinux64::TGT_O_NONBLOCK, O_NONBLOCK }, - { ArmLinux64::TGT_O_DSYNC, O_DSYNC }, -#ifdef FASYNC - { ArmLinux64::TGT_FASYNC, O_ASYNC }, -#endif -#ifdef O_DIRECT - { ArmLinux64::TGT_O_DIRECT, O_DIRECT }, -#endif -#ifdef O_LARGEFILE - { ArmLinux64::TGT_O_LARGEFILE, O_LARGEFILE }, -#endif -#ifdef O_DIRECTORY - { ArmLinux64::TGT_O_DIRECTORY, O_DIRECTORY }, -#endif -#ifdef O_NOFOLLOW - { ArmLinux64::TGT_O_NOFOLLOW, O_NOFOLLOW }, -#endif - { ArmLinux64::TGT_O_NOATIME, O_NOATIME }, -#ifdef O_CLOEXEC - { ArmLinux64::TGT_O_CLOEXEC, O_CLOEXEC }, -#endif -#ifdef O_SYNC - { ArmLinux64::TGT_O_SYNC, O_SYNC }, -#endif -#ifdef O_PATH - { ArmLinux64::TGT_O_PATH, O_PATH }, -#endif -#endif /* _MSC_VER */ -}; - -const int ArmLinux64::NUM_OPEN_FLAGS = sizeof(ArmLinux64::openFlagTable) / - sizeof(ArmLinux64::openFlagTable[0]); - -// mmap(2) flags translation table -SyscallFlagTransTable ArmLinux64::mmapFlagTable[] = { - { ArmLinux64::TGT_MAP_SHARED, MAP_SHARED }, - { ArmLinux64::TGT_MAP_PRIVATE, MAP_PRIVATE }, - { ArmLinux64::TGT_MAP_ANON, MAP_ANON }, - { ArmLinux64::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, - { ArmLinux64::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, - { ArmLinux64::TGT_MAP_FILE, MAP_FILE }, - { ArmLinux64::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, - { ArmLinux64::TGT_MAP_HUGETLB, MAP_HUGETLB }, - { ArmLinux64::TGT_MAP_LOCKED, MAP_LOCKED }, - { ArmLinux64::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, - { ArmLinux64::TGT_MAP_NORESERVE, MAP_NORESERVE }, - { ArmLinux64::TGT_MAP_POPULATE, MAP_POPULATE }, -#ifdef MAP_STACK - { ArmLinux64::TGT_MAP_STACK, MAP_STACK }, -#endif - { ArmLinux64::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, - { ArmLinux64::TGT_MAP_FIXED, MAP_FIXED }, -}; - -const unsigned ArmLinux64::NUM_MMAP_FLAGS = - sizeof(ArmLinux64::mmapFlagTable) / - sizeof(ArmLinux64::mmapFlagTable[0]); +#define TARGET ArmLinux32 +#include "kern/linux/flag_tables.hh" +#undef TARGET +#define TARGET ArmLinux64 +#include "kern/linux/flag_tables.hh" 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 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" 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 diff --git a/src/arch/x86/linux/linux.cc b/src/arch/x86/linux/linux.cc index f51bb16e7..a7bf77300 100644 --- a/src/arch/x86/linux/linux.cc +++ b/src/arch/x86/linux/linux.cc @@ -42,196 +42,12 @@ #include <fcntl.h> #include <sys/mman.h> -// open(2) flags translation table -SyscallFlagTransTable X86Linux64::openFlagTable[] = { -#ifdef _MSC_VER - { X86Linux64::TGT_O_RDONLY, _O_RDONLY }, - { X86Linux64::TGT_O_WRONLY, _O_WRONLY }, - { X86Linux64::TGT_O_RDWR, _O_RDWR }, - { X86Linux64::TGT_O_CREAT, _O_CREAT }, - { X86Linux64::TGT_O_EXCL, _O_EXCL }, -#ifdef _O_NOCTTY - { X86Linux64::TGT_O_NOCTTY, _O_NOCTTY }, -#endif - { X86Linux64::TGT_O_TRUNC, _O_TRUNC }, - { X86Linux64::TGT_O_APPEND, _O_APPEND }, -#ifdef _O_NONBLOCK - { X86Linux64::TGT_O_NONBLOCK, _O_NONBLOCK }, -#endif -#ifdef _O_DSYNC - { X86Linux64::TGT_O_DSYNC , _O_DSYNC }, -#endif - { X86Linux64::TGT_FASYNC, _O_ASYNC }, - { X86Linux64::TGT_O_DIRECT, _O_DIRECT }, - { X86Linux64::TGT_O_LARGEFILE, _O_LARGEFILE }, - { X86Linux64::TGT_O_DIRECTORY, _O_DIRECTORY }, - { X86Linux64::TGT_O_NOFOLLOW, _O_NOFOLLOW }, - { X86Linux64::TGT_O_NOATIME, _O_NOATIME }, -#ifdef _O_CLOEXEC - { X86Linux64::TGT_O_CLOEXEC, _O_CLOEXEC }, -#endif -#ifdef _O_SYNC - { X86Linux64::TGT_O_SYNC, _O_SYNC }, -#endif -#ifdef _O_PATH - { X86Linux64::TGT_O_PATH , _O_PATH }, -#endif -#else /* !_MSC_VER */ - { X86Linux64::TGT_O_RDONLY, O_RDONLY }, - { X86Linux64::TGT_O_WRONLY, O_WRONLY }, - { X86Linux64::TGT_O_RDWR, O_RDWR }, - { X86Linux64::TGT_O_CREAT, O_CREAT }, - { X86Linux64::TGT_O_EXCL, O_EXCL }, - { X86Linux64::TGT_O_NOCTTY, O_NOCTTY }, - { X86Linux64::TGT_O_TRUNC, O_TRUNC }, - { X86Linux64::TGT_O_APPEND, O_APPEND }, - { X86Linux64::TGT_O_NONBLOCK, O_NONBLOCK }, -#ifdef O_DSYNC - { X86Linux64::TGT_O_DSYNC, O_DSYNC }, -#endif - { X86Linux64::TGT_FASYNC, O_ASYNC }, - { X86Linux64::TGT_O_DIRECT, O_DIRECT }, - { X86Linux64::TGT_O_LARGEFILE, O_LARGEFILE }, - { X86Linux64::TGT_O_DIRECTORY, O_DIRECTORY }, - { X86Linux64::TGT_O_NOFOLLOW, O_NOFOLLOW }, - { X86Linux64::TGT_O_NOATIME, O_NOATIME }, -#ifdef O_CLOEXEC - { X86Linux64::TGT_O_CLOEXEC, O_CLOEXEC }, -#endif -#ifdef O_SYNC - { X86Linux64::TGT_O_SYNC, O_SYNC }, -#endif -#ifdef O_PATH - { X86Linux64::TGT_O_PATH, O_PATH }, -#endif -#endif /* _MSC_VER */ -}; +// true for both X86Linux32 and X86Linux64 +#define TARGET_HAS_MAP_32BIT -const int X86Linux64::NUM_OPEN_FLAGS = - sizeof(X86Linux64::openFlagTable) / - sizeof(X86Linux64::openFlagTable[0]); +#define TARGET X86Linux32 +#include "kern/linux/flag_tables.hh" -// mmap(2) flags translation table -SyscallFlagTransTable X86Linux64::mmapFlagTable[] = { - { X86Linux64::TGT_MAP_SHARED, MAP_SHARED }, - { X86Linux64::TGT_MAP_PRIVATE, MAP_PRIVATE }, - { X86Linux64::TGT_MAP_32BIT, MAP_32BIT}, - { X86Linux64::TGT_MAP_ANON, MAP_ANON }, - { X86Linux64::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, - { X86Linux64::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, - { X86Linux64::TGT_MAP_FILE, MAP_FILE }, - { X86Linux64::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, -#ifdef MAP_HUGETLB - { X86Linux64::TGT_MAP_HUGETLB, MAP_HUGETLB }, -#endif - { X86Linux64::TGT_MAP_LOCKED, MAP_LOCKED }, - { X86Linux64::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, - { X86Linux64::TGT_MAP_NORESERVE, MAP_NORESERVE }, - { X86Linux64::TGT_MAP_POPULATE, MAP_POPULATE }, -#ifdef MAP_STACK - { X86Linux64::TGT_MAP_STACK, MAP_STACK }, -#endif - { X86Linux64::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, - { X86Linux64::TGT_MAP_FIXED, MAP_FIXED }, -}; - -const unsigned X86Linux64::NUM_MMAP_FLAGS = - sizeof(X86Linux64::mmapFlagTable) / - sizeof(X86Linux64::mmapFlagTable[0]); - -// open(2) flags translation table -SyscallFlagTransTable X86Linux32::openFlagTable[] = { -#ifdef _MSC_VER - { X86Linux32::TGT_O_RDONLY, _O_RDONLY }, - { X86Linux32::TGT_O_WRONLY, _O_WRONLY }, - { X86Linux32::TGT_O_RDWR, _O_RDWR }, - { X86Linux32::TGT_O_CREAT, _O_CREAT }, - { X86Linux32::TGT_O_EXCL, _O_EXCL }, -#ifdef _O_NOCTTY - { X86Linux32::TGT_O_NOCTTY, _O_NOCTTY }, -#endif - { X86Linux32::TGT_O_TRUNC, _O_TRUNC }, - { X86Linux32::TGT_O_APPEND, _O_APPEND }, -#ifdef _O_NONBLOCK - { X86Linux32::TGT_O_NONBLOCK, _O_NONBLOCK }, -#endif -#ifdef O_DSYNC - { X86Linux32::TGT_O_DSYNC, _O_DSYNC }, -#endif - { X86Linux32::TGT_FASYNC, _O_ASYNC }, - { X86Linux32::TGT_O_DIRECT, _O_DIRECT }, - { X86Linux32::TGT_O_LARGEFILE, _O_LARGEFILE }, - { X86Linux32::TGT_O_DIRECTORY, _O_DIRECTORY }, - { X86Linux32::TGT_O_NOFOLLOW, _O_NOFOLLOW }, - { X86Linux32::TGT_O_NOATIME, _O_NOATIME }, -#ifdef _O_CLOEXEC - { X86Linux32::TGT_O_CLOEXEC, _O_CLOEXEC }, -#endif -#ifdef _O_SYNC - { X86Linux32::TGT_O_SYNC, _O_SYNC }, -#endif -#ifdef _O_PATH - { X86Linux32::TGT_O_PATH, _O_PATH }, -#endif -#else /* !_MSC_VER */ - { X86Linux32::TGT_O_RDONLY, O_RDONLY }, - { X86Linux32::TGT_O_WRONLY, O_WRONLY }, - { X86Linux32::TGT_O_RDWR, O_RDWR }, - { X86Linux32::TGT_O_CREAT, O_CREAT }, - { X86Linux32::TGT_O_EXCL, O_EXCL }, - { X86Linux32::TGT_O_NOCTTY, O_NOCTTY }, - { X86Linux32::TGT_O_TRUNC, O_TRUNC }, - { X86Linux32::TGT_O_APPEND, O_APPEND }, - { X86Linux32::TGT_O_NONBLOCK, O_NONBLOCK }, -#ifdef O_DSYNC - { X86Linux32::TGT_O_DSYNC, O_DSYNC }, -#endif - { X86Linux32::TGT_FASYNC, O_ASYNC }, - { X86Linux32::TGT_O_DIRECT, O_DIRECT }, - { X86Linux32::TGT_O_LARGEFILE, O_LARGEFILE }, - { X86Linux32::TGT_O_DIRECTORY, O_DIRECTORY }, - { X86Linux32::TGT_O_NOFOLLOW, O_NOFOLLOW }, - { X86Linux32::TGT_O_NOATIME, O_NOATIME }, -#ifdef O_CLOEXEC - { X86Linux32::TGT_O_CLOEXEC, O_CLOEXEC }, -#endif -#ifdef O_SYNC - { X86Linux32::TGT_O_SYNC, O_SYNC }, -#endif -#ifdef O_PATH - { X86Linux32::TGT_O_PATH, O_PATH }, -#endif -#endif /* _MSC_VER */ -}; - -const int X86Linux32::NUM_OPEN_FLAGS = - sizeof(X86Linux32::openFlagTable) / - sizeof(X86Linux32::openFlagTable[0]); - -// mmap(2) flags translation table -SyscallFlagTransTable X86Linux32::mmapFlagTable[] = { - { X86Linux32::TGT_MAP_SHARED, MAP_SHARED }, - { X86Linux32::TGT_MAP_PRIVATE, MAP_PRIVATE }, - { X86Linux32::TGT_MAP_32BIT, MAP_32BIT}, - { X86Linux32::TGT_MAP_ANON, MAP_ANON }, - { X86Linux32::TGT_MAP_DENYWRITE, MAP_DENYWRITE }, - { X86Linux32::TGT_MAP_EXECUTABLE, MAP_EXECUTABLE }, - { X86Linux32::TGT_MAP_FILE, MAP_FILE }, - { X86Linux32::TGT_MAP_GROWSDOWN, MAP_GROWSDOWN }, -#ifdef MAP_HUGETLB - { X86Linux32::TGT_MAP_HUGETLB, MAP_HUGETLB }, -#endif - { X86Linux32::TGT_MAP_LOCKED, MAP_LOCKED }, - { X86Linux32::TGT_MAP_NONBLOCK, MAP_NONBLOCK }, - { X86Linux32::TGT_MAP_NORESERVE, MAP_NORESERVE }, - { X86Linux32::TGT_MAP_POPULATE, MAP_POPULATE }, -#ifdef MAP_STACK - { X86Linux32::TGT_MAP_STACK, MAP_STACK }, -#endif - { X86Linux32::TGT_MAP_ANONYMOUS, MAP_ANONYMOUS }, - { X86Linux32::TGT_MAP_FIXED, MAP_FIXED }, -}; - -const unsigned X86Linux32::NUM_MMAP_FLAGS = - sizeof(X86Linux32::mmapFlagTable) / - sizeof(X86Linux32::mmapFlagTable[0]); +#undef TARGET +#define TARGET X86Linux64 +#include "kern/linux/flag_tables.hh" |