xref: /xnu-11417.140.69/osfmk/kern/exclaves_xnuproxy.h (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
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 #if CONFIG_EXCLAVES
30 
31 #pragma once
32 
33 #include <stdint.h>
34 #include <mach/kern_return.h>
35 #include <mach/exclaves_l4.h>
36 
37 #include "exclaves_internal.h"
38 
39 #include "kern/exclaves.tightbeam.h"
40 
41 __BEGIN_DECLS
42 
43 extern kern_return_t
44 exclaves_xnuproxy_pmm_usage(void);
45 
46 extern kern_return_t
47 exclaves_xnuproxy_ctx_alloc(exclaves_ctx_t *ctx);
48 
49 extern kern_return_t
50 exclaves_xnuproxy_ctx_free(exclaves_ctx_t *ctx);
51 
52 extern kern_return_t
53 exclaves_xnuproxy_init(uint64_t bootinfo_pa);
54 
55 /* BEGIN IGNORE CODESTYLE */
56 /*
57  * Note: strings passed to callback are not valid outside of the context of the
58  * callback.
59  */
60 extern kern_return_t
61 exclaves_xnuproxy_resource_info(void (^cb)(const char *name, const char *domain,
62     xnuproxy_resourcetype_s, uint64_t id, bool));
63 /* END IGNORE CODESTYLE */
64 
65 extern kern_return_t
66 exclaves_xnuproxy_audio_buffer_copyout(uint64_t id,
67     uint64_t size1, uint64_t offset1, uint64_t size2, uint64_t offset2);
68 
69 extern kern_return_t
70 exclaves_xnuproxy_audio_buffer_delete(uint64_t id);
71 
72 extern kern_return_t
73 exclaves_xnuproxy_audio_buffer_map(uint64_t id, size_t size, bool *read_only);
74 
75 /* BEGIN IGNORE CODESTYLE */
76 extern kern_return_t
77 exclaves_xnuproxy_audio_buffer_layout(uint64_t id, uint32_t start,
78     uint32_t npages, kern_return_t (^cb)(uint64_t base, uint32_t npages));
79 /* ENDIGNORE CODESTYLE */
80 
81 extern kern_return_t
82 exclaves_xnuproxy_named_buffer_delete(uint64_t id);
83 
84 extern kern_return_t
85 exclaves_xnuproxy_named_buffer_map(uint64_t id, size_t size, bool *read_only);
86 
87 /* BEGIN IGNORE CODESTYLE */
88 extern kern_return_t
89 exclaves_xnuproxy_named_buffer_layout(uint64_t id, uint32_t start,
90     uint32_t npages, kern_return_t (^cb)(uint64_t base, uint32_t npages));
91 /* END IGNORE CODESTYLE */
92 
93 extern kern_return_t
94 exclaves_xnuproxy_endpoint_call(Exclaves_L4_Word_t endpoint_id);
95 
96 __END_DECLS
97 
98 #endif /* CONFIG_EXCLAVES */
99