Add mprotect helper function to MemMap class.

Change-Id: I3967b76301d339de987fb8e094adbde4ef18573d
diff --git a/src/mem_map.cc b/src/mem_map.cc
index ba34d8b..8201fa8 100644
--- a/src/mem_map.cc
+++ b/src/mem_map.cc
@@ -223,4 +223,18 @@
   CHECK_NE(base_size_, 0U);
 };
 
+
+bool MemMap::Protect(int prot) {
+  if (base_begin_ == NULL && base_size_ == 0) {
+    return true;
+  }
+
+  if (mprotect(base_begin_, base_size_, prot) == 0) {
+    return true;
+  }
+
+  PLOG(ERROR) << "mprotect(" << base_begin_ << ", " << base_size_ << ", " << prot << ") failed";
+  return false;
+}
+
 }  // namespace art