xref: /xnu-11215.1.10/osfmk/kern/exclaves_xnuproxy.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 #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_panic_setup(uint64_t *phys, uint64_t *scid);
48 
49 extern kern_return_t
50 exclaves_xnuproxy_ctx_alloc(exclaves_ctx_t *ctx);
51 
52 extern kern_return_t
53 exclaves_xnuproxy_ctx_free(exclaves_ctx_t *ctx);
54 
55 extern kern_return_t
56 exclaves_xnuproxy_init(uint64_t bootinfo_pa);
57 
58 /* BEGIN IGNORE CODESTYLE */
59 /*
60  * Note: strings passed to callback are not valid outside of the context of the
61  * callback.
62  */
63 extern kern_return_t
64 exclaves_xnuproxy_resource_info(void (^cb)(const char *name, const char *domain,
65     xnuproxy_resourcetype_s, uint64_t id, bool));
66 /* END IGNORE CODESTYLE */
67 
68 extern kern_return_t
69 exclaves_xnuproxy_audio_buffer_copyout(uint64_t id,
70     uint64_t size1, uint64_t offset1, uint64_t size2, uint64_t offset2);
71 
72 extern kern_return_t
73 exclaves_xnuproxy_audio_buffer_delete(uint64_t id);
74 
75 extern kern_return_t
76 exclaves_xnuproxy_audio_buffer_map(uint64_t id, size_t size, bool *read_only);
77 
78 /* BEGIN IGNORE CODESTYLE */
79 extern kern_return_t
80 exclaves_xnuproxy_audio_buffer_layout(uint64_t id, uint32_t start,
81     uint32_t npages, kern_return_t (^cb)(uint64_t base, uint32_t npages));
82 /* ENDIGNORE CODESTYLE */
83 
84 extern kern_return_t
85 exclaves_xnuproxy_named_buffer_delete(uint64_t id);
86 
87 extern kern_return_t
88 exclaves_xnuproxy_named_buffer_map(uint64_t id, size_t size, bool *read_only);
89 
90 /* BEGIN IGNORE CODESTYLE */
91 extern kern_return_t
92 exclaves_xnuproxy_named_buffer_layout(uint64_t id, uint32_t start,
93     uint32_t npages, kern_return_t (^cb)(uint64_t base, uint32_t npages));
94 /* END IGNORE CODESTYLE */
95 
96 extern kern_return_t
97 exclaves_xnuproxy_endpoint_call(Exclaves_L4_Word_t endpoint_id);
98 
99 __END_DECLS
100 
101 #endif /* CONFIG_EXCLAVES */
102