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