Debian Codegraph @

src/platform/memory_mapping.hpp

raw
1 #include "utils/common.hpp"
2
3 #ifndef _MSC_VER
4
5 #if IS_WINDOWS
6 #ifndef WIN32_LEAN_AND_MEAN
7 #define WIN32_LEAN_AND_MEAN
8 #endif
9 #include <windows.h>
10 #else
11 #include <sys/mman.h>
12 #endif
13
14 CPPTRACE_BEGIN_NAMESPACE
15 namespace detail {
16 #if IS_WINDOWS
17 constexpr auto memory_readonly = PAGE_READONLY;
18 constexpr auto memory_readwrite = PAGE_READWRITE;
19 #else
20 constexpr auto memory_readonly = PROT_READ;
21 constexpr auto memory_readwrite = PROT_READ | PROT_WRITE;
22 #endif
23 int get_page_size();
24 int mprotect_page_and_return_old_protections(void* page, int page_size, int protections);
25 void mprotect_page(void* page, int page_size, int protections);
26 void* allocate_page(int page_size);
27 }
28 CPPTRACE_END_NAMESPACE
29
30 #endif