]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/sched_prim.h
xnu-1228.3.13.tar.gz
[apple/xnu.git] / osfmk / kern / sched_prim.h
index 9297957872ed067dc23b5e180e5eeb67878463b7..6cdde8933d496ff1806769811b5bfc1a726c4ecb 100644 (file)
@@ -1,23 +1,29 @@
 /*
 /*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
  *
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_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.
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
  * 
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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,
  * 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@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
  */
 /*
  * @OSF_COPYRIGHT@
@@ -71,7 +77,7 @@
 #ifdef MACH_KERNEL_PRIVATE
 
 /* Initialization */
 #ifdef MACH_KERNEL_PRIVATE
 
 /* Initialization */
-extern void            sched_init(void);
+extern void            sched_init(void) __attribute__((section("__TEXT, initcode")));
 
 extern void            sched_startup(void);
 
 
 extern void            sched_startup(void);
 
@@ -89,10 +95,6 @@ extern void                  thread_unstop(
 extern void                    thread_wait(
                                                thread_t        thread);
 
 extern void                    thread_wait(
                                                thread_t        thread);
 
-/* Select a thread to run */
-extern thread_t                thread_select(
-                                               processor_t             myprocessor);
-
 /* Unblock thread on wake up */
 extern boolean_t       thread_unblock(
                                                thread_t                thread,
 /* Unblock thread on wake up */
 extern boolean_t       thread_unblock(
                                                thread_t                thread,
@@ -103,26 +105,10 @@ extern kern_return_t      thread_go(
                                                        thread_t                thread,
                                                        wait_result_t   wresult);
 
                                                        thread_t                thread,
                                                        wait_result_t   wresult);
 
-/* Context switch primitive */
-extern boolean_t       thread_invoke(
-                                               thread_t                        old_thread,
-                                               thread_t                        new_thread,
-                                               ast_t                           reason);
-
-/* Perform calculations for thread finishing execution */
-extern void                    thread_done(
-                                               thread_t                old_thread,
-                                               thread_t                new_thread,
-                                               processor_t             processor);
-
-/* Set up for thread beginning execution */
-extern void                    thread_begin(
-                                               thread_t                thread,
-                                               processor_t             processor);
-
-/* Handle previous thread at context switch */
+/* Handle threads at context switch */
 extern void                    thread_dispatch(
 extern void                    thread_dispatch(
-                                               thread_t                thread);
+                                               thread_t                old_thread,
+                                               thread_t                new_thread);
 
 /* Switch directly to a particular thread */
 extern int                     thread_run(
 
 /* Switch directly to a particular thread */
 extern int                     thread_run(
@@ -191,15 +177,17 @@ extern void               thread_setrun(
                                        thread_t        thread,
                                        integer_t       options);
 
                                        thread_t        thread,
                                        integer_t       options);
 
-#define SCHED_TAILQ            0
-#define SCHED_HEADQ            1
-#define SCHED_PREEMPT  2
+#define SCHED_TAILQ            1
+#define SCHED_HEADQ            2
+#define SCHED_PREEMPT  4
 
 
-/* Bind thread to a particular processor */
+/* Bind the current thread to a particular processor */
 extern processor_t             thread_bind(
 extern processor_t             thread_bind(
-                                                       thread_t                thread,
                                                        processor_t             processor);
 
                                                        processor_t             processor);
 
+extern void            run_queue_init(
+                                       run_queue_t             runq);
+
 extern void            thread_timer_expire(
                                        void                    *thread,
                                        void                    *p1);
 extern void            thread_timer_expire(
                                        void                    *thread,
                                        void                    *p1);
@@ -235,7 +223,7 @@ extern kern_return_t clear_wait(
                                                wait_result_t   result);
 
 /* Return from exception (BSD-visible interface) */
                                                wait_result_t   result);
 
 /* Return from exception (BSD-visible interface) */
-extern void            thread_exception_return(void);
+extern void            thread_exception_return(void) __dead2;
 
 #endif /* XNU_KERNEL_PRIVATE */
 
 
 #endif /* XNU_KERNEL_PRIVATE */