Move DataTypes.h to include/llvm/System, update all users. This breaks the last
[oota-llvm.git] / lib / System / Win32 / Memory.inc
index 12627521a3d2e7e5ed3c5e5bba296266824481c5..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.
 
@@ -46,29 +47,6 @@ MemoryBlock Memory::AllocateRWX(unsigned NumBytes,
   return result;
 }
 
-MemoryBlock Memory::AllocateRW(unsigned NumBytes,
-                                const MemoryBlock *NearBlock,
-                                std::string *ErrMsg) {
-  if (NumBytes == 0) return MemoryBlock();
-
-  static const long pageSize = Process::GetPageSize();
-  unsigned NumPages = (NumBytes+pageSize-1)/pageSize;
-
-  //FIXME: support NearBlock if ever needed on Win64.
-
-  void *pa = VirtualAlloc(NULL, NumPages*pageSize, MEM_COMMIT,
-                  PAGE_READWRITE);
-  if (pa == NULL) {
-    MakeErrMsg(ErrMsg, "Can't allocate RWX Memory: ");
-    return MemoryBlock();
-  }
-
-  MemoryBlock result;
-  result.Address = pa;
-  result.Size = NumPages*pageSize;
-  return result;
-}
-
 bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) {
   if (M.Address == 0 || M.Size == 0) return false;
   if (!VirtualFree(M.Address, 0, MEM_RELEASE))
@@ -76,5 +54,20 @@ bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) {
   return false;
 }
 
+bool Memory::setWritable(MemoryBlock &M, std::string *ErrMsg) {
+  return true;
+}
+
+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;
+}
+
+}