]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/mach_loader.c
xnu-344.49.tar.gz
[apple/xnu.git] / bsd / kern / mach_loader.c
index ea6eda046b378c136e67c714a655b2135bb308e6..c851ff478a05c7831480b88acd3bc9c2c748173e 100644 (file)
@@ -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@
  */
 #include <vm/vm_kern.h>
 #include <vm/vm_pager.h>
 #include <vm/vnode_pager.h>
-#include <mach/shared_memory_server.h>
 #include <mach/vm_statistics.h>
 
+#include <mach/shared_memory_server.h>
+#include <vm/vm_shared_memory_server.h>
+
+#include <machine/vmparam.h>
+
 /*
  * 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 *) */