aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Interix/Memory.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-09-13 22:38:11 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-09-13 22:38:11 +0000
commit33189e787b98c79bd03be466ec19dfb2f65eb65f (patch)
tree5a89a9849c359508b329a3cdf9876b33eae45d5d /lib/System/Interix/Memory.cpp
parent2565943289cf53ff1b8dd1dfa13b6068e4d31681 (diff)
Simplify the sys::Memory interface per Chris' request.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Interix/Memory.cpp')
-rw-r--r--lib/System/Interix/Memory.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/System/Interix/Memory.cpp b/lib/System/Interix/Memory.cpp
index b79f8b6268..94e5893932 100644
--- a/lib/System/Interix/Memory.cpp
+++ b/lib/System/Interix/Memory.cpp
@@ -25,8 +25,8 @@ using namespace sys;
//=== and must not be generic UNIX code (see ../Unix/Memory.cpp)
//===----------------------------------------------------------------------===//
-void* Memory::AllocateRWX(Memory& M, unsigned NumBytes) {
- if (NumBytes == 0) return 0;
+MemoryBlock Memory::AllocateRWX(unsigned NumBytes) {
+ if (NumBytes == 0) return MemoryBlock();
static const long pageSize = Process::GetPageSize();
unsigned NumPages = (NumBytes+pageSize-1)/pageSize;
@@ -36,14 +36,15 @@ void* Memory::AllocateRWX(Memory& M, unsigned NumBytes) {
if (pa == (void*)-1) {
throw std::string("Can't allocate RWX Memory: ") + strerror(errno);
}
- M.Address = pa;
- M.AllocSize = NumPages*pageSize;
- return pa;
+ MemoryBlock result;
+ result.Address = pa;
+ result.Size = NumPages*pageSize;
+ return result;
}
-void Memory::ReleaseRWX(Memory& M) {
- if (M.Address == 0 || M.AllocSize == 0) return;
- if (0 != munmap(M.Address, M.AllocSize)) {
+void Memory::ReleaseRWX(MemoryBlock& M) {
+ if (M.Address == 0 || M.Size == 0) return;
+ if (0 != munmap(M.Address, M.Size)) {
throw std::string("Can't release RWX Memory: ") + strerror(errno);
}
}