]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/task_swap.h
6aecbad7624a98e5bb78e1599b0a23453f481352
[apple/xnu.git] / osfmk / kern / task_swap.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_COPYRIGHT@
25 */
26 /*
27 * HISTORY
28 *
29 * Revision 1.1.1.1 1998/09/22 21:05:32 wsanchez
30 * Import of Mac OS X kernel (~semeria)
31 *
32 * Revision 1.1.1.1 1998/03/07 02:25:56 wsanchez
33 * Import of OSF Mach kernel (~mburg)
34 *
35 * Revision 1.1.4.1 1995/04/07 19:02:38 barbou
36 * Merged into mainline.
37 * [95/03/09 barbou]
38 *
39 * Revision 1.1.2.2 1995/02/13 15:35:45 barbou
40 * Merged/ported to MK6.
41 *
42 * Revision 1.1.1.3 94/08/12 15:44:39 barbou
43 * VM Merge - Task Swapper.
44 *
45 * Changed host_priv_t into host_t.
46 * [94/07/28 barbou]
47 *
48 * Revision 1.1.1.2 1994/07/28 15:33:46 barbou
49 * Copied from IK.
50 *
51 * Revision 3.0.3.2 1994/01/20 19:53:01 chasb
52 * Remove excessively restrictive copyright notice
53 * [1994/01/20 17:50:40 chasb]
54 *
55 * Revision 3.0.3.1 1993/12/20 21:06:49 gupta
56 * Expanded C O P Y R I G H T
57 * [1993/12/17 22:19:22 gupta]
58 *
59 * Revision 3.0 1992/12/31 22:08:24 ede
60 * Initial revision for OSF/1 R1.3
61 *
62 * Revision 1.1.4.5 1992/03/16 18:02:52 gmf
63 * Add TASK_SW_ELIGIBLE flag to swap_flags; prototype
64 * task_swapout_eligible, task_swapout_ineligible.
65 * [1992/02/12 22:01:48 gmf]
66 *
67 * Revision 1.1.4.4 1992/01/22 22:14:13 gmf
68 * Change prototype for task_swappable() to use host_priv_t
69 * instead of host_t.
70 * [1992/01/17 17:48:13 gmf]
71 *
72 * Revision 1.1.4.3 1991/12/10 17:20:55 gmf
73 * Add extern declaration for new thread.
74 * Changed TASK_SW_WAIT flag to TASK_SW_WANT_IN.
75 * [1991/12/10 16:19:10 gmf]
76 *
77 * Revision 1.1.4.2 1991/11/21 21:48:35 mmp
78 * initial task swapping code
79 * [1991/11/21 21:01:37 mmp]
80 *
81 * $EndLog$
82 */
83
84 /*
85 * File: kern/task_swap.h
86 *
87 * Task residency management primitives declarations.
88 */
89
90 #ifndef _KERN_TASK_SWAP_H_
91 #define _KERN_TASK_SWAP_H_
92
93 #include <kern/host.h>
94
95 /*
96 * swap states
97 */
98 #define TASK_SW_UNSWAPPABLE 1 /* not swappable */
99 #define TASK_SW_IN 2 /* swapped in (resident) */
100 #define TASK_SW_OUT 3 /* swapped out (non-resident) */
101 #define TASK_SW_COMING_IN 4 /* about to be swapped in */
102 #define TASK_SW_GOING_OUT 5 /* being swapped out */
103
104 /*
105 * swap flags
106 */
107 #define TASK_SW_MAKE_UNSWAPPABLE 0x01 /* make it unswappable */
108 #define TASK_SW_WANT_IN 0x02 /* sleeping on state */
109 #define TASK_SW_ELIGIBLE 0x04 /* eligible for swapping */
110
111 /*
112 * exported routines
113 */
114 extern void task_swapper_init(void);
115 extern kern_return_t task_swapin(
116 task_t, /* task */
117 boolean_t); /* make_unswappable */
118 extern kern_return_t task_swapout(task_t /* task */);
119 extern void task_swapper(void);
120 extern void task_swap_swapout_thread(void);
121 extern void compute_vm_averages(void);
122 extern kern_return_t task_swappable(
123 host_priv_t, /* host */
124 task_t, /* task */
125 boolean_t); /* swappable */
126 extern void task_swapout_eligible(task_t /* task */);
127 extern void task_swapout_ineligible(task_t /* task */);
128 extern void swapout_ast(void);
129
130 #endif /* _KERN_TASK_SWAP_H_ */