X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0b4e3aa066abc0728aacb4bbeb86f53f9737156e..43866e378188c25dd1e2208016ab3cbeb086ae6c:/bsd/kern/mach_loader.c diff --git a/bsd/kern/mach_loader.c b/bsd/kern/mach_loader.c index ea6eda046..c851ff478 100644 --- a/bsd/kern/mach_loader.c +++ b/bsd/kern/mach_loader.c @@ -1,21 +1,24 @@ /* - * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ @@ -54,9 +57,13 @@ #include #include #include -#include #include +#include +#include + +#include + /* * Prototypes of static functions. */ @@ -403,20 +410,18 @@ RedoLookup: &(map_info.alternate_next), &(map_info.flags), &next); - if((map_info.flags & SHARED_REGION_FULL) && + if((map_info.self != (vm_offset_t)system_shared_region) && (map_info.flags & SHARED_REGION_SYSTEM)) { - if(map_info.self != (vm_offset_t)system_shared_region) { - shared_region_mapping_ref(system_shared_region); - vm_set_shared_region(task, - system_shared_region); - shared_region_mapping_dealloc( + shared_region_mapping_ref(system_shared_region); + vm_set_shared_region(task, system_shared_region); + shared_region_mapping_dealloc( (shared_region_mapping_t)map_info.self); - goto RedoLookup; - } + goto RedoLookup; } if (dylink_test) { + p->p_flag |= P_NOSHLIB; /* no shlibs in use */ addr = map_info.client_base; vm_map(map, &addr, map_info.text_size, 0, (VM_MEMORY_SHARED_PMAP << 24) @@ -723,17 +728,15 @@ load_threadstack( unsigned long size; int flavor; - /* - * Set the thread state. - */ - *user_stack = 0; while (total_size > 0) { flavor = *ts++; size = *ts++; total_size -= (size+2)*sizeof(unsigned long); if (total_size < 0) return(LOAD_BADMACHO); - ret = thread_userstack(thread, flavor, ts, size, user_stack, customstack); + *user_stack = USRSTACK; + ret = thread_userstack(thread, flavor, ts, size, + user_stack, customstack); if (ret != KERN_SUCCESS) return(LOAD_FAILURE); ts += size; /* ts is a (unsigned long *) */