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