summaryrefslogtreecommitdiff
path: root/src/arch/mips/linux
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/mips/linux')
-rw-r--r--src/arch/mips/linux/linux.cc31
-rw-r--r--src/arch/mips/linux/linux.hh21
2 files changed, 48 insertions, 4 deletions
diff --git a/src/arch/mips/linux/linux.cc b/src/arch/mips/linux/linux.cc
index 4861f7cb9..2f0ca6090 100644
--- a/src/arch/mips/linux/linux.cc
+++ b/src/arch/mips/linux/linux.cc
@@ -28,10 +28,11 @@
* Authors: Korey Sewell
*/
-#include <fcntl.h>
-
#include "arch/mips/linux/linux.hh"
+#include <fcntl.h>
+#include <sys/mman.h>
+
// open(2) flags translation table
SyscallFlagTransTable MipsLinux::openFlagTable[] = {
#ifdef _MSC_VER
@@ -97,3 +98,29 @@ SyscallFlagTransTable MipsLinux::openFlagTable[] = {
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]);
+
diff --git a/src/arch/mips/linux/linux.hh b/src/arch/mips/linux/linux.hh
index 6e4b6a82d..f4b18397e 100644
--- a/src/arch/mips/linux/linux.hh
+++ b/src/arch/mips/linux/linux.hh
@@ -102,8 +102,25 @@ class MipsLinux : public Linux
//@}
/// For mmap().
- static const unsigned TGT_MAP_ANONYMOUS = 0x800;
- 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 = 0x00800;
+ static const unsigned TGT_MAP_DENYWRITE = 0x02000;
+ static const unsigned TGT_MAP_EXECUTABLE = 0x04000;
+ static const unsigned TGT_MAP_FILE = 0x00000;
+ static const unsigned TGT_MAP_GROWSDOWN = 0x01000;
+ static const unsigned TGT_MAP_HUGETLB = 0x80000;
+ static const unsigned TGT_MAP_LOCKED = 0x08000;
+ static const unsigned TGT_MAP_NONBLOCK = 0x20000;
+ static const unsigned TGT_MAP_NORESERVE = 0x00400;
+ static const unsigned TGT_MAP_POPULATE = 0x10000;
+ static const unsigned TGT_MAP_STACK = 0x40000;
+ static const unsigned TGT_MAP_ANONYMOUS = 0x00800;
+ static const unsigned TGT_MAP_FIXED = 0x00010;
+
+ static const unsigned NUM_MMAP_FLAGS;
//@{
/// For getsysinfo().