Don't bother checking canRead() before calling getMagicNumber();
[oota-llvm.git] / lib / System / Win32 / Memory.inc
index 620801583a07eee4a3b6d738e38fa77c412865ca..19fccbddc26bd0e6501fea9d5649c456cf37d965 100644 (file)
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Win32.h"
+#include "llvm/System/DataTypes.h"
 #include "llvm/System/Process.h"
 
 namespace llvm {
@@ -23,13 +24,13 @@ using namespace sys;
 //===          and must not be UNIX code
 //===----------------------------------------------------------------------===//
 
-MemoryBlock Memory::AllocateRWX(unsigned NumBytes,
+MemoryBlock Memory::AllocateRWX(size_t NumBytes,
                                 const MemoryBlock *NearBlock,
                                 std::string *ErrMsg) {
   if (NumBytes == 0) return MemoryBlock();
 
-  static const long pageSize = Process::GetPageSize();
-  unsigned NumPages = (NumBytes+pageSize-1)/pageSize;
+  static const size_t pageSize = Process::GetPageSize();
+  size_t NumPages = (NumBytes+pageSize-1)/pageSize;
 
   //FIXME: support NearBlock if ever needed on Win64.
 
@@ -53,13 +54,20 @@ bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) {
   return false;
 }
 
-bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) {
+bool Memory::setWritable(MemoryBlock &M, std::string *ErrMsg) {
   return true;
 }
 
-bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
+bool Memory::setExecutable(MemoryBlock &M, std::string *ErrMsg) {
   return false;
 }
 
+bool Memory::setRangeWritable(const void *Addr, size_t Size) {
+  return true;
 }
 
+bool Memory::setRangeExecutable(const void *Addr, size_t Size) {
+  return false;
+}
+
+}