2018-02-19 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_mac_libcdep.cc
blobb376a0710b9f7576274e54c615b87b4223361599
1 //===-- sanitizer_mac_libcdep.cc ------------------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is shared between various sanitizers' runtime libraries and
9 // implements OSX-specific functions.
10 //===----------------------------------------------------------------------===//
12 #include "sanitizer_platform.h"
13 #if SANITIZER_MAC
14 #include "sanitizer_mac.h"
16 #include <sys/mman.h>
18 namespace __sanitizer {
20 void RestrictMemoryToMaxAddress(uptr max_address) {
21 uptr size_to_mmap = GetMaxVirtualAddress() + 1 - max_address;
22 void *res = MmapFixedNoAccess(max_address, size_to_mmap, "high gap");
23 CHECK(res != MAP_FAILED);
26 } // namespace __sanitizer
28 #endif // SANITIZER_MAC