< prev index next >

src/os/bsd/vm/os_bsd.cpp

Print this page

        

*** 2270,2289 **** return anon_munmap(addr, size); } static bool bsd_mprotect(char* addr, size_t size, int prot) { // Bsd wants the mprotect address argument to be page aligned. ! char* bottom = (char*)align_size_down((intptr_t)addr, os::Bsd::page_size()); // According to SUSv3, mprotect() should only be used with mappings // established by mmap(), and mmap() always maps whole pages. Unaligned // 'addr' likely indicates problem in the VM (e.g. trying to change // protection of malloc'ed or statically allocated memory). Check the // caller if you hit this assert. assert(addr == bottom, "sanity check"); ! size = align_size_up(pointer_delta(addr, bottom, 1) + size, os::Bsd::page_size()); return ::mprotect(bottom, size, prot) == 0; } // Set protections specified bool os::protect_memory(char* addr, size_t bytes, ProtType prot, --- 2270,2289 ---- return anon_munmap(addr, size); } static bool bsd_mprotect(char* addr, size_t size, int prot) { // Bsd wants the mprotect address argument to be page aligned. ! char* bottom = (char*)align_down((intptr_t)addr, os::Bsd::page_size()); // According to SUSv3, mprotect() should only be used with mappings // established by mmap(), and mmap() always maps whole pages. Unaligned // 'addr' likely indicates problem in the VM (e.g. trying to change // protection of malloc'ed or statically allocated memory). Check the // caller if you hit this assert. assert(addr == bottom, "sanity check"); ! size = align_up(pointer_delta(addr, bottom, 1) + size, os::Bsd::page_size()); return ::mprotect(bottom, size, prot) == 0; } // Set protections specified bool os::protect_memory(char* addr, size_t bytes, ProtType prot,
< prev index next >