- if ((ret == LOAD_SUCCESS) && (depth == 1)) {
- vm_offset_t addr;
- shared_region_mapping_t shared_region;
- struct shared_region_task_mappings map_info;
- shared_region_mapping_t next;
-
-RedoLookup:
- vm_get_shared_region(task, &shared_region);
- map_info.self = (vm_offset_t)shared_region;
- shared_region_mapping_info(shared_region,
- &(map_info.text_region),
- &(map_info.text_size),
- &(map_info.data_region),
- &(map_info.data_size),
- &(map_info.region_mappings),
- &(map_info.client_base),
- &(map_info.alternate_base),
- &(map_info.alternate_next),
- &(map_info.fs_base),
- &(map_info.system),
- &(map_info.flags), &next);
-
- if((map_info.flags & SHARED_REGION_FULL) ||
- (map_info.flags & SHARED_REGION_STALE)) {
- shared_region_mapping_t system_region;
- system_region = lookup_default_shared_region(
- map_info.fs_base, map_info.system);
- if((map_info.self != (vm_offset_t)system_region) &&
- (map_info.flags & SHARED_REGION_SYSTEM)) {
- if(system_region == NULL) {
- shared_file_boot_time_init(
- map_info.fs_base, map_info.system);
- } else {
- vm_set_shared_region(task, system_region);
- }
- shared_region_mapping_dealloc(
- (shared_region_mapping_t)map_info.self);
- goto RedoLookup;
- } else if (map_info.flags & SHARED_REGION_SYSTEM) {
- shared_region_mapping_dealloc(system_region);
- shared_file_boot_time_init(
- map_info.fs_base, map_info.system);
- shared_region_mapping_dealloc(
- (shared_region_mapping_t)map_info.self);
- } else {
- shared_region_mapping_dealloc(system_region);
- }
- }
-
-
- if (dylink_test) {
- p->p_flag |= P_NOSHLIB; /* no shlibs in use */
- addr = map_info.client_base;
- if(clean_regions) {
- vm_map(map, &addr, map_info.text_size,
- 0, SHARED_LIB_ALIAS,
- map_info.text_region, 0, FALSE,
- VM_PROT_READ, VM_PROT_READ, VM_INHERIT_SHARE);
- } else {
- vm_map(map, &addr, map_info.text_size, 0,
- (VM_MEMORY_SHARED_PMAP << 24)
- | SHARED_LIB_ALIAS,
- map_info.text_region, 0, FALSE,
- VM_PROT_READ, VM_PROT_READ, VM_INHERIT_SHARE);
- }
- addr = map_info.client_base + map_info.text_size;
- vm_map(map, &addr, map_info.data_size,
- 0, SHARED_LIB_ALIAS,
- map_info.data_region, 0, TRUE,
- VM_PROT_READ, VM_PROT_READ, VM_INHERIT_SHARE);
-
- while (next) {
- /* this should be fleshed out for the general case */
- /* but this is not necessary for now. Indeed we */
- /* are handling the com page inside of the */
- /* shared_region mapping create calls for now for */
- /* simplicities sake. If more general support is */
- /* needed the code to manipulate the shared range */
- /* chain can be pulled out and moved to the callers*/
- shared_region_mapping_info(next,
- &(map_info.text_region),
- &(map_info.text_size),
- &(map_info.data_region),
- &(map_info.data_size),
- &(map_info.region_mappings),
- &(map_info.client_base),
- &(map_info.alternate_base),
- &(map_info.alternate_next),
- &(map_info.fs_base),
- &(map_info.system),
- &(map_info.flags), &next);
-
- addr = map_info.client_base;
- vm_map(map, &addr, map_info.text_size,
- 0, SHARED_LIB_ALIAS,
- map_info.text_region, 0, FALSE,
- VM_PROT_READ, VM_PROT_READ, VM_INHERIT_SHARE);
- }
+ if (ret == LOAD_SUCCESS) {
+ if (! got_code_signatures) {
+ struct cs_blob *blob;
+ /* no embedded signatures: look for detached ones */
+ blob = ubc_cs_blob_get(vp, -1, file_offset);
+ if (blob != NULL) {
+ /* get flags to be applied to the process */
+ result->csflags |= blob->csb_flags;
+ }
+ }
+
+ if (dlp != 0)
+ ret = load_dylinker(dlp, dlarchbits, map, thread, depth, result, abi64);
+
+ if(depth == 1) {
+ if (result->thread_count == 0) {
+ ret = LOAD_FAILURE;
+ } else if ( abi64 ) {
+#ifdef __ppc__
+ /* Map in 64-bit commpage */
+ /* LP64todo - make this clean */
+ /*
+ * PPC51: ppc64 is limited to 51-bit addresses.
+ * Memory above that limit is handled specially
+ * at the pmap level.
+ */
+ pmap_map_sharedpage(current_task(), get_map_pmap(map));
+#endif /* __ppc__ */