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