Index: src/platform-macos.cc |
=================================================================== |
--- src/platform-macos.cc (revision 1577) |
+++ src/platform-macos.cc (working copy) |
@@ -231,9 +231,9 @@ |
void* OS::Allocate(const size_t requested, |
size_t* allocated, |
- bool executable) { |
+ bool is_executable) { |
const size_t msize = RoundUp(requested, getpagesize()); |
- int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); |
+ int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0); |
if (mbase == MAP_FAILED) { |
LOG(StringEvent("OS::Allocate", "mmap failed")); |
@@ -245,12 +245,26 @@ |
} |
-void OS::Free(void* buf, const size_t length) { |
+void OS::Free(void* address, const size_t size) { |
// TODO(1240712): munmap has a return value which is ignored here. |
- munmap(buf, length); |
+ munmap(address, size); |
} |
+#ifdef ENABLE_HEAP_PROTECTION |
+ |
+void OS::Protect(void* address, size_t size) { |
+ UNIMPLEMENTED(); |
+} |
+ |
+ |
+void OS::Unprotect(void* address, size_t size, bool is_executable) { |
+ UNIMPLEMENTED(); |
+} |
+ |
+#endif |
+ |
+ |
void OS::Sleep(int milliseconds) { |
usleep(1000 * milliseconds); |
} |
@@ -373,8 +387,8 @@ |
} |
-bool VirtualMemory::Commit(void* address, size_t size, bool executable) { |
- int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); |
+bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { |
+ int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
if (MAP_FAILED == mmap(address, size, prot, |
MAP_PRIVATE | MAP_ANON | MAP_FIXED, |
kMmapFd, kMmapFdOffset)) { |
@@ -392,6 +406,7 @@ |
kMmapFd, kMmapFdOffset) != MAP_FAILED; |
} |
+ |
class ThreadHandle::PlatformData : public Malloced { |
public: |
explicit PlatformData(ThreadHandle::Kind kind) { |