239 bool executable = false);
240 static bool uncommit_memory(char* addr, size_t bytes);
241 static bool release_memory(char* addr, size_t bytes);
242
243 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
244 static bool protect_memory(char* addr, size_t bytes, ProtType prot,
245 bool is_committed = true);
246
247 static bool guard_memory(char* addr, size_t bytes);
248 static bool unguard_memory(char* addr, size_t bytes);
249 static bool create_stack_guard_pages(char* addr, size_t bytes);
250 static bool remove_stack_guard_pages(char* addr, size_t bytes);
251
252 static char* map_memory(int fd, const char* file_name, size_t file_offset,
253 char *addr, size_t bytes, bool read_only = false,
254 bool allow_exec = false);
255 static char* remap_memory(int fd, const char* file_name, size_t file_offset,
256 char *addr, size_t bytes, bool read_only,
257 bool allow_exec);
258 static bool unmap_memory(char *addr, size_t bytes);
259 static void free_memory(char *addr, size_t bytes);
260 static void realign_memory(char *addr, size_t bytes, size_t alignment_hint);
261
262 // NUMA-specific interface
263 static bool numa_has_static_binding();
264 static bool numa_has_group_homing();
265 static void numa_make_local(char *addr, size_t bytes, int lgrp_hint);
266 static void numa_make_global(char *addr, size_t bytes);
267 static size_t numa_get_groups_num();
268 static size_t numa_get_leaf_groups(int *ids, size_t size);
269 static bool numa_topology_changed();
270 static int numa_get_group_id();
271
272 // Page manipulation
273 struct page_info {
274 size_t size;
275 int lgrp_id;
276 };
277 static bool get_page_info(char *start, page_info* info);
278 static char* scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found);
279
|
239 bool executable = false);
240 static bool uncommit_memory(char* addr, size_t bytes);
241 static bool release_memory(char* addr, size_t bytes);
242
243 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
244 static bool protect_memory(char* addr, size_t bytes, ProtType prot,
245 bool is_committed = true);
246
247 static bool guard_memory(char* addr, size_t bytes);
248 static bool unguard_memory(char* addr, size_t bytes);
249 static bool create_stack_guard_pages(char* addr, size_t bytes);
250 static bool remove_stack_guard_pages(char* addr, size_t bytes);
251
252 static char* map_memory(int fd, const char* file_name, size_t file_offset,
253 char *addr, size_t bytes, bool read_only = false,
254 bool allow_exec = false);
255 static char* remap_memory(int fd, const char* file_name, size_t file_offset,
256 char *addr, size_t bytes, bool read_only,
257 bool allow_exec);
258 static bool unmap_memory(char *addr, size_t bytes);
259 static void free_memory(char *addr, size_t bytes, size_t alignment_hint);
260 static void realign_memory(char *addr, size_t bytes, size_t alignment_hint);
261
262 // NUMA-specific interface
263 static bool numa_has_static_binding();
264 static bool numa_has_group_homing();
265 static void numa_make_local(char *addr, size_t bytes, int lgrp_hint);
266 static void numa_make_global(char *addr, size_t bytes);
267 static size_t numa_get_groups_num();
268 static size_t numa_get_leaf_groups(int *ids, size_t size);
269 static bool numa_topology_changed();
270 static int numa_get_group_id();
271
272 // Page manipulation
273 struct page_info {
274 size_t size;
275 int lgrp_id;
276 };
277 static bool get_page_info(char *start, page_info* info);
278 static char* scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found);
279
|