static bool check_and_mark_native_exec(module_area_t *ma, bool add) { bool is_native = false; const char *name = GET_MODULE_NAME(&ma->names); ASSERT(os_get_module_info_locked()); if (DYNAMO_OPTION(native_exec) && name != NULL && on_native_exec_list(name)) { LOG(GLOBAL, LOG_INTERP|LOG_VMAREAS, 1, "module %s is on native_exec list\n", name); is_native = true; } if (add && is_native) { RSTATS_INC(num_native_module_loads); vmvector_add(native_exec_areas, ma->start, ma->end, NULL); } else if (!add) { /* If we're removing and it's native, it should be on there already. If * it's not native, then it shouldn't be present, but we'll remove * whatever is there. */ DEBUG_DECLARE(bool present =) vmvector_remove(native_exec_areas, ma->start, ma->end); ASSERT_CURIOSITY((is_native && present) || (!is_native && !present)); }
void privload_remove_areas(privmod_t *privmod) { uint i; os_privmod_data_t *opd = (os_privmod_data_t *) privmod->os_privmod_data; /* walk the program header to remove areas */ for (i = 0; i < opd->os_data.num_segments; i++) { vmvector_remove(modlist_areas, opd->os_data.segments[i].start, opd->os_data.segments[i].end); } /* NOTE: we create os_privmod_data in privload_add_areas but * do not delete here, non-symmetry. * This is because we still need the information in os_privmod_data * to unmap the segments in privload_unmap_file, which happens after * privload_remove_areas. * The create of os_privmod_data should be done when mapping the file * into memory, but the heap is not ready at that time, so postponed * until privload_add_areas. */ }