xref: /xnu-11215.1.10/osfmk/vm/vm_upl.h (revision 8d741a5de7ff4191bf97d57b9f54c2f6d4a15585)
1 /*
2  * Copyright (c) 2024 Apple 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 #ifdef  XNU_KERNEL_PRIVATE
30 
31 #ifndef _VM_UPL_
32 #define _VM_UPL_
33 
34 #include <mach/vm_types.h>
35 #include <mach/vm_prot.h>
36 #include <mach/kern_return.h>
37 #include <mach/memory_object_types.h>
38 
39 __BEGIN_DECLS
40 /*
41  * VM routines that used to be published to
42  * user space, and are now restricted to the kernel.
43  *
44  * They should eventually go away entirely -
45  * to be replaced with standard vm_map() and
46  * vm_deallocate() calls.
47  */
48 extern kern_return_t vm_upl_map
49 (
50 	vm_map_t target_task,
51 	upl_t upl,
52 	vm_address_t *address
53 );
54 
55 extern kern_return_t vm_upl_unmap
56 (
57 	vm_map_t target_task,
58 	upl_t upl
59 );
60 
61 extern kern_return_t vm_upl_map_range
62 (
63 	vm_map_t target_task,
64 	upl_t upl,
65 	vm_offset_t offset,
66 	vm_size_t size,
67 	vm_prot_t prot,
68 	vm_address_t *address
69 );
70 
71 extern kern_return_t vm_upl_unmap_range
72 (
73 	vm_map_t target_task,
74 	upl_t upl,
75 	vm_offset_t offset,
76 	vm_size_t size
77 );
78 
79 /* Support for UPLs from vm_maps */
80 extern kern_return_t vm_map_get_upl(
81 	vm_map_t                target_map,
82 	vm_map_offset_t         map_offset,
83 	upl_size_t              *size,
84 	upl_t                   *upl,
85 	upl_page_info_array_t   page_info,
86 	unsigned int            *page_infoCnt,
87 	upl_control_flags_t     *flags,
88 	vm_tag_t                tag,
89 	int                     force_data_sync);
90 
91 __END_DECLS
92 
93 #endif /* _VM_UPL_ */
94 #endif /* XNU_KERNEL_PRIVATE */
95