]> git.saurik.com Git - apple/libc.git/blobdiff - mach/mach_init.c
Libc-339.tar.gz
[apple/libc.git] / mach / mach_init.c
index bcf94b3646cbe8bc82092ff1b74f1c996b7a9f48..518c64a4982252b3f5bb444fbe2aa926ec15b102 100644 (file)
@@ -62,6 +62,8 @@ mach_port_t     mach_host_self_ = MACH_PORT_NULL;
 __private_extern__ kern_return_t _host_mach_msg_trap_return_;
 
 vm_size_t      vm_page_size;
+vm_size_t      vm_page_mask;
+int            vm_page_shift;
 
 /*
  * Forward internal declarations for automatic mach_init during
@@ -139,7 +141,25 @@ int mach_init_doit(int forkchild)
         *      Cache some other valuable system constants
         */
 
+#if defined(__ppc64__) /* NGK hack for now */
+       vm_page_size = 4096;
+#else
        (void)host_page_size(host, &vm_page_size);
+#endif
+       vm_page_mask = vm_page_size - 1;
+       if (vm_page_size == 0) {
+               /* guard against unlikely craziness */
+               vm_page_shift = 0;
+       } else {
+               /*
+                * Unfortunately there's no kernel interface to get the
+                * vm_page_shift, but it's easy enough to calculate.
+                */
+               for (vm_page_shift = 0;
+                    (vm_page_size & (1 << vm_page_shift)) == 0;
+                    vm_page_shift++)
+                       continue;
+       }
 
        mach_port_deallocate(mach_task_self_, host);