void privload_add_areas(privmod_t *privmod) { os_privmod_data_t *opd; uint i; app_pc text_addr; /* Save text_addr and store it in opd after we create it. We need this to * support auto loading symbols on gdb attach (i#531). */ text_addr = (app_pc)privmod->os_privmod_data; /* create and init the os_privmod_data for privmod. * The os_privmod_data can only be created after heap is ready and * should be done before adding in vmvector_add, * so it can be either right before calling to privload_add_areas * in the privload_load_finalize, or in here. * We prefer here because it avoids changing the code in * loader_shared.c, which affects windows too. */ privload_create_os_privmod_data(privmod); opd = (os_privmod_data_t *) privmod->os_privmod_data; opd->text_addr = text_addr; for (i = 0; i < opd->os_data.num_segments; i++) { vmvector_add(modlist_areas, opd->os_data.segments[i].start, opd->os_data.segments[i].end, (void *)privmod); } }
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)); }