1 | #ifndef _memory_entry_server_ |
2 | #define _memory_entry_server_ |
3 | |
4 | /* Module memory_entry */ |
5 | |
6 | #include <string.h> |
7 | #include <mach/ndr.h> |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/notify.h> |
11 | #include <mach/mach_types.h> |
12 | #include <mach/message.h> |
13 | #include <mach/mig_errors.h> |
14 | #include <mach/port.h> |
15 | |
16 | /* BEGIN MIG_STRNCPY_ZEROFILL CODE */ |
17 | |
18 | #if defined(__has_include) |
19 | #if __has_include(<mach/mig_strncpy_zerofill_support.h>) |
20 | #ifndef USING_MIG_STRNCPY_ZEROFILL |
21 | #define USING_MIG_STRNCPY_ZEROFILL |
22 | #endif |
23 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
24 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
25 | #ifdef __cplusplus |
26 | extern "C" { |
27 | #endif |
28 | extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); |
29 | #ifdef __cplusplus |
30 | } |
31 | #endif |
32 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
33 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
34 | #endif /* __has_include */ |
35 | |
36 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
37 | |
38 | |
39 | #ifdef AUTOTEST |
40 | #ifndef FUNCTION_PTR_T |
41 | #define FUNCTION_PTR_T |
42 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
43 | typedef struct { |
44 | char *name; |
45 | function_ptr_t function; |
46 | } function_table_entry; |
47 | typedef function_table_entry *function_table_t; |
48 | #endif /* FUNCTION_PTR_T */ |
49 | #endif /* AUTOTEST */ |
50 | |
51 | #ifndef memory_entry_MSG_COUNT |
52 | #define memory_entry_MSG_COUNT 2 |
53 | #endif /* memory_entry_MSG_COUNT */ |
54 | |
55 | #include <mach/std_types.h> |
56 | #include <mach/mig.h> |
57 | #include <ipc/ipc_voucher.h> |
58 | #include <kern/ipc_kobject.h> |
59 | #include <kern/ipc_tt.h> |
60 | #include <kern/ipc_host.h> |
61 | #include <kern/ipc_sync.h> |
62 | #include <kern/ledger.h> |
63 | #include <kern/processor.h> |
64 | #include <kern/sync_lock.h> |
65 | #include <kern/sync_sema.h> |
66 | #include <vm/memory_object.h> |
67 | #include <vm/vm_map.h> |
68 | #include <kern/ipc_mig.h> |
69 | #include <mach/mig.h> |
70 | #include <mach/mach_types.h> |
71 | #include <mach_debug/mach_debug_types.h> |
72 | |
73 | #ifdef __BeforeMigServerHeader |
74 | __BeforeMigServerHeader |
75 | #endif /* __BeforeMigServerHeader */ |
76 | |
77 | |
78 | /* Routine mach_memory_entry_purgable_control */ |
79 | #ifdef mig_external |
80 | mig_external |
81 | #else |
82 | extern |
83 | #endif /* mig_external */ |
84 | kern_return_t mach_memory_entry_purgable_control |
85 | ( |
86 | mem_entry_name_port_t mem_entry, |
87 | vm_purgable_t control, |
88 | int *state |
89 | ); |
90 | |
91 | /* Routine mach_memory_entry_access_tracking */ |
92 | #ifdef mig_external |
93 | mig_external |
94 | #else |
95 | extern |
96 | #endif /* mig_external */ |
97 | kern_return_t mach_memory_entry_access_tracking |
98 | ( |
99 | mem_entry_name_port_t mem_entry, |
100 | int *access_tracking, |
101 | uint32_t *access_tracking_reads, |
102 | uint32_t *access_tracking_writes |
103 | ); |
104 | |
105 | #ifdef mig_external |
106 | mig_external |
107 | #else |
108 | extern |
109 | #endif /* mig_external */ |
110 | boolean_t memory_entry_server( |
111 | mach_msg_header_t *InHeadP, |
112 | mach_msg_header_t *OutHeadP); |
113 | |
114 | #ifdef mig_external |
115 | mig_external |
116 | #else |
117 | extern |
118 | #endif /* mig_external */ |
119 | mig_routine_t memory_entry_server_routine( |
120 | mach_msg_header_t *InHeadP); |
121 | |
122 | |
123 | /* Description of this subsystem, for use in direct RPC */ |
124 | extern const struct memory_entry_subsystem { |
125 | mig_server_routine_t server; /* Server routine */ |
126 | mach_msg_id_t start; /* Min routine number */ |
127 | mach_msg_id_t end; /* Max routine number + 1 */ |
128 | unsigned int maxsize; /* Max msg size */ |
129 | vm_address_t reserved; /* Reserved */ |
130 | struct routine_descriptor /*Array of routine descriptors */ |
131 | routine[2]; |
132 | } memory_entry_subsystem; |
133 | |
134 | /* typedefs for all requests */ |
135 | |
136 | #ifndef __Request__memory_entry_subsystem__defined |
137 | #define __Request__memory_entry_subsystem__defined |
138 | |
139 | #ifdef __MigPackStructs |
140 | #pragma pack(4) |
141 | #endif |
142 | typedef struct { |
143 | mach_msg_header_t Head; |
144 | NDR_record_t NDR; |
145 | vm_purgable_t control; |
146 | int state; |
147 | } __Request__mach_memory_entry_purgable_control_t __attribute__((unused)); |
148 | #ifdef __MigPackStructs |
149 | #pragma pack() |
150 | #endif |
151 | |
152 | #ifdef __MigPackStructs |
153 | #pragma pack(4) |
154 | #endif |
155 | typedef struct { |
156 | mach_msg_header_t Head; |
157 | NDR_record_t NDR; |
158 | int access_tracking; |
159 | } __Request__mach_memory_entry_access_tracking_t __attribute__((unused)); |
160 | #ifdef __MigPackStructs |
161 | #pragma pack() |
162 | #endif |
163 | #endif /* !__Request__memory_entry_subsystem__defined */ |
164 | |
165 | |
166 | /* union of all requests */ |
167 | |
168 | #ifndef __RequestUnion__memory_entry_subsystem__defined |
169 | #define __RequestUnion__memory_entry_subsystem__defined |
170 | union __RequestUnion__memory_entry_subsystem { |
171 | __Request__mach_memory_entry_purgable_control_t Request_mach_memory_entry_purgable_control; |
172 | __Request__mach_memory_entry_access_tracking_t Request_mach_memory_entry_access_tracking; |
173 | }; |
174 | #endif /* __RequestUnion__memory_entry_subsystem__defined */ |
175 | /* typedefs for all replies */ |
176 | |
177 | #ifndef __Reply__memory_entry_subsystem__defined |
178 | #define __Reply__memory_entry_subsystem__defined |
179 | |
180 | #ifdef __MigPackStructs |
181 | #pragma pack(4) |
182 | #endif |
183 | typedef struct { |
184 | mach_msg_header_t Head; |
185 | NDR_record_t NDR; |
186 | kern_return_t RetCode; |
187 | int state; |
188 | } __Reply__mach_memory_entry_purgable_control_t __attribute__((unused)); |
189 | #ifdef __MigPackStructs |
190 | #pragma pack() |
191 | #endif |
192 | |
193 | #ifdef __MigPackStructs |
194 | #pragma pack(4) |
195 | #endif |
196 | typedef struct { |
197 | mach_msg_header_t Head; |
198 | NDR_record_t NDR; |
199 | kern_return_t RetCode; |
200 | int access_tracking; |
201 | uint32_t access_tracking_reads; |
202 | uint32_t access_tracking_writes; |
203 | } __Reply__mach_memory_entry_access_tracking_t __attribute__((unused)); |
204 | #ifdef __MigPackStructs |
205 | #pragma pack() |
206 | #endif |
207 | #endif /* !__Reply__memory_entry_subsystem__defined */ |
208 | |
209 | |
210 | /* union of all replies */ |
211 | |
212 | #ifndef __ReplyUnion__memory_entry_subsystem__defined |
213 | #define __ReplyUnion__memory_entry_subsystem__defined |
214 | union __ReplyUnion__memory_entry_subsystem { |
215 | __Reply__mach_memory_entry_purgable_control_t Reply_mach_memory_entry_purgable_control; |
216 | __Reply__mach_memory_entry_access_tracking_t Reply_mach_memory_entry_access_tracking; |
217 | }; |
218 | #endif /* __RequestUnion__memory_entry_subsystem__defined */ |
219 | |
220 | #ifndef subsystem_to_name_map_memory_entry |
221 | #define subsystem_to_name_map_memory_entry \ |
222 | { "mach_memory_entry_purgable_control", 4900 },\ |
223 | { "mach_memory_entry_access_tracking", 4901 } |
224 | #endif |
225 | |
226 | #ifdef __AfterMigServerHeader |
227 | __AfterMigServerHeader |
228 | #endif /* __AfterMigServerHeader */ |
229 | |
230 | #endif /* _memory_entry_server_ */ |
231 | |