Commit db2d2b0c authored by vegorov@chromium.org's avatar vegorov@chromium.org

Don't use mprotect on Cygwin as virtual memory is managed directly via WinAPI calls.

Patch by Bert Belder.

Review URL: http://codereview.chromium.org/7549009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8793 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 129a2ba0
......@@ -166,6 +166,18 @@ void OS::Free(void* address, const size_t size) {
}
void OS::ProtectCode(void* address, const size_t size) {
DWORD old_protect;
VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect);
}
void OS::Guard(void* address, const size_t size) {
DWORD oldprotect;
VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect);
}
void OS::Sleep(int milliseconds) {
unsigned int ms = static_cast<unsigned int>(milliseconds);
usleep(1000 * ms);
......
......@@ -70,6 +70,7 @@ intptr_t OS::MaxVirtualMemory() {
}
#ifndef __CYGWIN__
// Get rid of writable permission on code allocations.
void OS::ProtectCode(void* address, const size_t size) {
mprotect(address, size, PROT_READ | PROT_EXEC);
......@@ -80,6 +81,7 @@ void OS::ProtectCode(void* address, const size_t size) {
void OS::Guard(void* address, const size_t size) {
mprotect(address, size, PROT_NONE);
}
#endif // __CYGWIN__
// ----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment