xref: /minix3/sys/uvm/uvm_fault.h (revision 6c8f7fc3bac7ab5f78ee27de8bed706631d8c836)
1*6c8f7fc3SBen Gras /*	$NetBSD: uvm_fault.h,v 1.20 2011/02/02 15:13:34 chuck Exp $	*/
2*6c8f7fc3SBen Gras 
3*6c8f7fc3SBen Gras /*
4*6c8f7fc3SBen Gras  * Copyright (c) 1997 Charles D. Cranor and Washington University.
5*6c8f7fc3SBen Gras  * All rights reserved.
6*6c8f7fc3SBen Gras  *
7*6c8f7fc3SBen Gras  * Redistribution and use in source and binary forms, with or without
8*6c8f7fc3SBen Gras  * modification, are permitted provided that the following conditions
9*6c8f7fc3SBen Gras  * are met:
10*6c8f7fc3SBen Gras  * 1. Redistributions of source code must retain the above copyright
11*6c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer.
12*6c8f7fc3SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
13*6c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer in the
14*6c8f7fc3SBen Gras  *    documentation and/or other materials provided with the distribution.
15*6c8f7fc3SBen Gras  *
16*6c8f7fc3SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*6c8f7fc3SBen Gras  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*6c8f7fc3SBen Gras  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*6c8f7fc3SBen Gras  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*6c8f7fc3SBen Gras  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21*6c8f7fc3SBen Gras  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22*6c8f7fc3SBen Gras  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23*6c8f7fc3SBen Gras  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*6c8f7fc3SBen Gras  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25*6c8f7fc3SBen Gras  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*6c8f7fc3SBen Gras  *
27*6c8f7fc3SBen Gras  * from: Id: uvm_fault.h,v 1.1.2.2 1997/12/08 16:07:12 chuck Exp
28*6c8f7fc3SBen Gras  */
29*6c8f7fc3SBen Gras 
30*6c8f7fc3SBen Gras #ifndef _UVM_UVM_FAULT_H_
31*6c8f7fc3SBen Gras #define _UVM_UVM_FAULT_H_
32*6c8f7fc3SBen Gras 
33*6c8f7fc3SBen Gras /*
34*6c8f7fc3SBen Gras  * fault data structures
35*6c8f7fc3SBen Gras  */
36*6c8f7fc3SBen Gras 
37*6c8f7fc3SBen Gras /*
38*6c8f7fc3SBen Gras  * uvm_faultinfo: to load one of these fill in all orig_* fields and
39*6c8f7fc3SBen Gras  * then call uvmfault_lookup on it.
40*6c8f7fc3SBen Gras  */
41*6c8f7fc3SBen Gras 
42*6c8f7fc3SBen Gras 
43*6c8f7fc3SBen Gras struct uvm_faultinfo {
44*6c8f7fc3SBen Gras 	struct vm_map *orig_map;		/* IN: original map */
45*6c8f7fc3SBen Gras 	vaddr_t orig_rvaddr;		/* IN: original rounded VA */
46*6c8f7fc3SBen Gras 	vsize_t orig_size;		/* IN: original size of interest */
47*6c8f7fc3SBen Gras 	struct vm_map *map;			/* map (could be a submap) */
48*6c8f7fc3SBen Gras 	unsigned int mapv;		/* map's version number */
49*6c8f7fc3SBen Gras 	struct vm_map_entry *entry;		/* map entry (from 'map') */
50*6c8f7fc3SBen Gras 	vsize_t size;			/* size of interest */
51*6c8f7fc3SBen Gras };
52*6c8f7fc3SBen Gras 
53*6c8f7fc3SBen Gras #ifdef _KERNEL
54*6c8f7fc3SBen Gras 
55*6c8f7fc3SBen Gras /*
56*6c8f7fc3SBen Gras  * fault prototypes
57*6c8f7fc3SBen Gras  */
58*6c8f7fc3SBen Gras 
59*6c8f7fc3SBen Gras int uvmfault_anonget(struct uvm_faultinfo *, struct vm_amap *,
60*6c8f7fc3SBen Gras 		     struct vm_anon *);
61*6c8f7fc3SBen Gras 
62*6c8f7fc3SBen Gras int uvm_fault_wire(struct vm_map *, vaddr_t, vaddr_t, vm_prot_t, int);
63*6c8f7fc3SBen Gras void uvm_fault_unwire(struct vm_map *, vaddr_t, vaddr_t);
64*6c8f7fc3SBen Gras void uvm_fault_unwire_locked(struct vm_map *, vaddr_t, vaddr_t);
65*6c8f7fc3SBen Gras 
66*6c8f7fc3SBen Gras #endif /* _KERNEL */
67*6c8f7fc3SBen Gras 
68*6c8f7fc3SBen Gras #endif /* _UVM_UVM_FAULT_H_ */
69