diff options
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/freebsd/freebsd.hh | 4 | ||||
-rw-r--r-- | src/arch/arm/linux/linux.cc | 55 | ||||
-rw-r--r-- | src/arch/arm/linux/linux.hh | 42 |
3 files changed, 95 insertions, 6 deletions
diff --git a/src/arch/arm/freebsd/freebsd.hh b/src/arch/arm/freebsd/freebsd.hh index 7e85659ec..e2c5e493c 100644 --- a/src/arch/arm/freebsd/freebsd.hh +++ b/src/arch/arm/freebsd/freebsd.hh @@ -74,6 +74,8 @@ class ArmFreebsd32 : public FreeBSD //@} /// For mmap(). + static const unsigned TGT_MAP_SHARED = 0x0001; + static const unsigned TGT_MAP_PRIVATE = 0x0002; static const unsigned TGT_MAP_ANONYMOUS = 0x1000; static const unsigned TGT_MAP_FIXED = 0x0010; @@ -229,6 +231,8 @@ class ArmFreebsd64 : public FreeBSD //@} /// For mmap(). + static const unsigned TGT_MAP_SHARED = 0x0001; + static const unsigned TGT_MAP_PRIVATE = 0x0002; static const unsigned TGT_MAP_ANONYMOUS = 0x1000; static const unsigned TGT_MAP_FIXED = 0x0010; diff --git a/src/arch/arm/linux/linux.cc b/src/arch/arm/linux/linux.cc index ac114048a..3dde8c217 100644 --- a/src/arch/arm/linux/linux.cc +++ b/src/arch/arm/linux/linux.cc @@ -41,10 +41,11 @@ * Authors: Stephen Hines */ -#include <fcntl.h> - #include "arch/arm/linux/linux.hh" +#include <fcntl.h> +#include <sys/mman.h> + // open(2) flags translation table SyscallFlagTransTable ArmLinux32::openFlagTable[] = { #ifdef _MSC_VER @@ -121,6 +122,31 @@ SyscallFlagTransTable ArmLinux32::openFlagTable[] = { 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 @@ -197,3 +223,28 @@ SyscallFlagTransTable ArmLinux64::openFlagTable[] = { 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]); + diff --git a/src/arch/arm/linux/linux.hh b/src/arch/arm/linux/linux.hh index a2eaea52c..5c814cde1 100644 --- a/src/arch/arm/linux/linux.hh +++ b/src/arch/arm/linux/linux.hh @@ -125,8 +125,25 @@ class ArmLinux32 : public Linux //@} /// For mmap(). - static const unsigned TGT_MAP_ANONYMOUS = 0x20; - static const unsigned TGT_MAP_FIXED = 0x10; + static SyscallFlagTransTable mmapFlagTable[]; + + static const unsigned TGT_MAP_SHARED = 0x00001; + static const unsigned TGT_MAP_PRIVATE = 0x00002; + static const unsigned TGT_MAP_ANON = 0x00020; + static const unsigned TGT_MAP_DENYWRITE = 0x00800; + static const unsigned TGT_MAP_EXECUTABLE = 0x01000; + static const unsigned TGT_MAP_FILE = 0x00000; + static const unsigned TGT_MAP_GROWSDOWN = 0x00100; + static const unsigned TGT_MAP_HUGETLB = 0x40000; + static const unsigned TGT_MAP_LOCKED = 0x02000; + static const unsigned TGT_MAP_NONBLOCK = 0x10000; + static const unsigned TGT_MAP_NORESERVE = 0x04000; + static const unsigned TGT_MAP_POPULATE = 0x08000; + static const unsigned TGT_MAP_STACK = 0x20000; + static const unsigned TGT_MAP_ANONYMOUS = 0x00020; + static const unsigned TGT_MAP_FIXED = 0x00010; + + static const unsigned NUM_MMAP_FLAGS; /// For table(). static const int TBL_SYSINFO = 12; @@ -320,8 +337,25 @@ class ArmLinux64 : public Linux //@} /// For mmap(). - static const unsigned TGT_MAP_ANONYMOUS = 0x20; - static const unsigned TGT_MAP_FIXED = 0x10; + static SyscallFlagTransTable mmapFlagTable[]; + + static const unsigned TGT_MAP_SHARED = 0x00001; + static const unsigned TGT_MAP_PRIVATE = 0x00002; + static const unsigned TGT_MAP_ANON = 0x00020; + static const unsigned TGT_MAP_DENYWRITE = 0x00800; + static const unsigned TGT_MAP_EXECUTABLE = 0x01000; + static const unsigned TGT_MAP_FILE = 0x00000; + static const unsigned TGT_MAP_GROWSDOWN = 0x00100; + static const unsigned TGT_MAP_HUGETLB = 0x40000; + static const unsigned TGT_MAP_LOCKED = 0x02000; + static const unsigned TGT_MAP_NONBLOCK = 0x10000; + static const unsigned TGT_MAP_NORESERVE = 0x04000; + static const unsigned TGT_MAP_POPULATE = 0x08000; + static const unsigned TGT_MAP_STACK = 0x20000; + static const unsigned TGT_MAP_ANONYMOUS = 0x00020; + static const unsigned TGT_MAP_FIXED = 0x00010; + + static const unsigned NUM_MMAP_FLAGS; //@{ /// For getrusage(). |