1#![expect(non_camel_case_types)]
8#![expect(non_upper_case_globals)]
9#![no_std]
10use attribution_bindings::vm_AttributionCounts;
11use page_bindings::vm_page_t;
12use page_source_bindings::MultiPageRequest;
13use vm_page_list_bindings::VmPageSpliceList;
14pub use zx_types::zx_vmo_lock_state_t;
15use zx_types::{zx_koid_t, zx_paddr_t as paddr_t, zx_pager_vmo_stats_t, zx_status_t};
16
17#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
18#[repr(C, align(8))]
19pub struct __BindgenOpaqueArray8<T>(pub T);
20impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray8<[T; N]> {
21 fn default() -> Self {
22 Self([<T as Default>::default(); N])
23 }
24}
25pub type arch_mmu_flags_t = u8;
26#[repr(C)]
27#[derive(Debug)]
28pub struct StreamSizeManager {
29 _unused: [u8; 0],
30}
31#[repr(C)]
32#[repr(align(8))]
33#[derive(Debug, Copy, Clone)]
34pub struct VmObjectChildObserver {
35 pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 8usize]>,
36}
37#[repr(i32)]
38#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
39pub enum Resizability {
40 Resizable = 0,
41 NonResizable = 1,
42}
43#[repr(i32)]
44#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
45pub enum SnapshotType {
46 Full = 0,
47 Modified = 1,
48 OnWrite = 2,
49}
50#[repr(u8)]
51#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
52pub enum SupplyOptions {
53 PagerSupply = 0,
54 TransferData = 1,
55 PhysicalPageProvider = 2,
56}
57pub const VmObjectReadWriteOptions_None: VmObjectReadWriteOptions = 0;
58pub const VmObjectReadWriteOptions_TrimLength: VmObjectReadWriteOptions = 1;
59pub type VmObjectReadWriteOptions = u8;
60unsafe extern "C" {
61 pub fn cpp_vm_object_free(vmo: *mut VmObject);
62}
63#[repr(C)]
64#[repr(align(8))]
65#[derive(Debug, Copy, Clone)]
66pub struct VmObject {
67 pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 128usize]>,
68}
69#[repr(u32)]
70#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
71pub enum VmObject_EvictionHint {
72 DontNeed = 0,
73 AlwaysNeed = 1,
74}
75#[repr(i32)]
76#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
77pub enum VmObject_CacheOpType {
78 Invalidate = 0,
79 Clean = 1,
80 CleanInvalidate = 2,
81 Sync = 3,
82}
83#[repr(u32)]
84#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
85pub enum VmObject_ChildType {
86 kNotChild = 0,
87 kCowClone = 1,
88 kSlice = 2,
89 kReference = 3,
90}
91#[repr(C)]
92#[derive(Debug, Copy, Clone)]
93pub struct VmObject_ChildListLock {
94 pub _base: __BindgenOpaqueArray8<[u8; 24usize]>,
95}
96#[repr(C)]
97#[derive(Debug, Copy, Clone)]
98pub struct VmObject_AllVmosLock {
99 pub _base: __BindgenOpaqueArray8<[u8; 24usize]>,
100}
101pub const VmObject_MAX_SIZE: u64 = 18446744073709486080;
102pub type cpp_vm_object_lookup_fn = ::core::option::Option<
103 unsafe extern "C" fn(ctx: *mut ::core::ffi::c_void, offset: u64, paddr: u64) -> zx_status_t,
104>;
105unsafe extern "C" {
106 pub fn cpp_vm_object_get_ref_counted(vmo: *const VmObject) -> *mut ::core::ffi::c_void;
107}
108unsafe extern "C" {
109 pub fn cpp_vm_object_decommit_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
110}
111unsafe extern "C" {
112 pub fn cpp_vm_object_commit_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
113}
114unsafe extern "C" {
115 pub fn cpp_vm_object_hint_range(
116 vmo: *mut VmObject,
117 offset: u64,
118 len: u64,
119 hint: VmObject_EvictionHint,
120 ) -> zx_status_t;
121}
122unsafe extern "C" {
123 pub fn cpp_vm_object_size_locked(vmo: *const VmObject) -> u64;
124}
125unsafe extern "C" {
126 pub fn cpp_vm_object_is_resizable(vmo: *const VmObject) -> bool;
127}
128unsafe extern "C" {
129 pub fn cpp_vm_object_is_discardable(vmo: *const VmObject) -> bool;
130}
131unsafe extern "C" {
132 pub fn cpp_vm_object_is_contiguous(vmo: *const VmObject) -> bool;
133}
134unsafe extern "C" {
135 pub fn cpp_vm_object_is_stream_compatible(vmo: *const VmObject) -> bool;
136}
137unsafe extern "C" {
138 pub fn cpp_vm_object_lock(vmo: *const VmObject) -> *mut ::core::ffi::c_void;
139}
140unsafe extern "C" {
141 pub fn cpp_vm_object_resize(vmo: *mut VmObject, size: u64) -> zx_status_t;
142}
143unsafe extern "C" {
144 pub fn cpp_vm_object_write(
145 vmo: *mut VmObject,
146 ptr: *const ::core::ffi::c_void,
147 offset: u64,
148 len: usize,
149 ) -> zx_status_t;
150}
151unsafe extern "C" {
152 pub fn cpp_vm_object_set_name(
153 vmo: *mut VmObject,
154 name: *const ::core::ffi::c_char,
155 len: usize,
156 ) -> zx_status_t;
157}
158unsafe extern "C" {
159 pub fn cpp_vm_object_get_name(
160 vmo: *const VmObject,
161 out_name: *mut ::core::ffi::c_char,
162 len: usize,
163 );
164}
165unsafe extern "C" {
166 pub fn cpp_vm_object_set_child_observer(
167 vmo: *mut VmObject,
168 child_observer: *mut VmObjectChildObserver,
169 );
170}
171unsafe extern "C" {
172 pub fn cpp_vm_object_commit_range_pinned(
173 vmo: *mut VmObject,
174 offset: u64,
175 len: u64,
176 write: bool,
177 ) -> zx_status_t;
178}
179unsafe extern "C" {
180 pub fn cpp_vm_object_unpin(vmo: *mut VmObject, offset: u64, len: u64);
181}
182unsafe extern "C" {
183 pub fn cpp_vm_object_get_mapping_cache_policy(vmo: *const VmObject) -> arch_mmu_flags_t;
184}
185unsafe extern "C" {
186 pub fn cpp_vm_object_set_mapping_cache_policy(
187 vmo: *mut VmObject,
188 cache_policy: arch_mmu_flags_t,
189 ) -> zx_status_t;
190}
191unsafe extern "C" {
192 pub fn cpp_vm_object_create_clone(
193 vmo: *mut VmObject,
194 resizable: Resizability,
195 snapshot_type: SnapshotType,
196 offset: u64,
197 size: u64,
198 copy_name: bool,
199 out_status: *mut zx_status_t,
200 ) -> *mut VmObject;
201}
202unsafe extern "C" {
203 pub fn cpp_vm_object_get_page_blocking(
204 vmo: *mut VmObject,
205 offset: u64,
206 pf_flags: u32,
207 out_page: *mut *mut vm_page_t,
208 out_pa: *mut paddr_t,
209 ) -> zx_status_t;
210}
211unsafe extern "C" {
212 pub fn cpp_vm_object_create_child_slice(
213 vmo: *mut VmObject,
214 offset: u64,
215 size: u64,
216 copy_name: bool,
217 out_status: *mut zx_status_t,
218 ) -> *mut VmObject;
219}
220unsafe extern "C" {
221 pub fn cpp_vm_object_create_child_reference(
222 vmo: *mut VmObject,
223 resizable: Resizability,
224 offset: u64,
225 size: u64,
226 copy_name: bool,
227 out_first_child: *mut bool,
228 out_status: *mut zx_status_t,
229 ) -> *mut VmObject;
230}
231unsafe extern "C" {
232 pub fn cpp_vm_object_set_user_id(vmo: *mut VmObject, user_id: u64);
233}
234unsafe extern "C" {
235 pub fn cpp_vm_object_user_id(vmo: *const VmObject) -> u64;
236}
237unsafe extern "C" {
238 pub fn cpp_vm_object_parent_user_id(vmo: *const VmObject) -> u64;
239}
240unsafe extern "C" {
241 pub fn cpp_vm_object_num_children(vmo: *const VmObject) -> u32;
242}
243unsafe extern "C" {
244 pub fn cpp_vm_object_lookup(
245 vmo: *mut VmObject,
246 offset: u64,
247 len: u64,
248 ctx: *mut ::core::ffi::c_void,
249 callback: cpp_vm_object_lookup_fn,
250 ) -> zx_status_t;
251}
252unsafe extern "C" {
253 pub fn cpp_vm_object_lookup_contiguous(
254 vmo: *mut VmObject,
255 offset: u64,
256 len: u64,
257 out_paddr: *mut paddr_t,
258 ) -> zx_status_t;
259}
260unsafe extern "C" {
261 pub fn cpp_vm_object_get_page(
262 vmo: *mut VmObject,
263 offset: u64,
264 pf_flags: u32,
265 page_request: *mut MultiPageRequest,
266 out_page: *mut *mut vm_page_t,
267 out_pa: *mut paddr_t,
268 ) -> zx_status_t;
269}
270unsafe extern "C" {
271 pub fn cpp_vm_object_get_attributed_memory(
272 vmo: *const VmObject,
273 out_counts: *mut vm_AttributionCounts,
274 );
275}
276unsafe extern "C" {
277 pub fn cpp_vm_object_get_attributed_memory_in_reference_owner(
278 vmo: *const VmObject,
279 out_counts: *mut vm_AttributionCounts,
280 );
281}
282unsafe extern "C" {
283 pub fn cpp_vm_object_read(
284 vmo: *mut VmObject,
285 ptr: *mut ::core::ffi::c_void,
286 offset: u64,
287 len: usize,
288 ) -> zx_status_t;
289}
290unsafe extern "C" {
291 pub fn cpp_vm_object_zero_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
292}
293unsafe extern "C" {
294 pub fn cpp_vm_object_dirty_pages(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
295}
296unsafe extern "C" {
297 pub fn cpp_vm_object_writeback_begin(
298 vmo: *mut VmObject,
299 offset: u64,
300 len: u64,
301 is_zero_range: bool,
302 ) -> zx_status_t;
303}
304unsafe extern "C" {
305 pub fn cpp_vm_object_writeback_end(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
306}
307unsafe extern "C" {
308 pub fn cpp_vm_object_reclamation_event_count(vmo: *const VmObject) -> u64;
309}
310unsafe extern "C" {
311 pub fn cpp_vm_object_detach_source(vmo: *mut VmObject);
312}
313unsafe extern "C" {
314 pub fn cpp_vm_object_get_attributed_memory_in_range(
315 vmo: *const VmObject,
316 offset: u64,
317 len: u64,
318 out_counts: *mut vm_AttributionCounts,
319 );
320}
321unsafe extern "C" {
322 pub fn cpp_vm_object_try_lock_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
323}
324unsafe extern "C" {
325 pub fn cpp_vm_object_lock_range(
326 vmo: *mut VmObject,
327 offset: u64,
328 len: u64,
329 lock_state_out: *mut zx_vmo_lock_state_t,
330 ) -> zx_status_t;
331}
332unsafe extern "C" {
333 pub fn cpp_vm_object_unlock_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
334}
335unsafe extern "C" {
336 pub fn cpp_vm_object_read_user(
337 vmo: *mut VmObject,
338 buffer: *mut ::core::ffi::c_void,
339 offset: u64,
340 size: usize,
341 options: u8,
342 out_actual: *mut usize,
343 ) -> zx_status_t;
344}
345unsafe extern "C" {
346 pub fn cpp_vm_object_write_user(
347 vmo: *mut VmObject,
348 buffer: *const ::core::ffi::c_void,
349 offset: u64,
350 size: usize,
351 options: u8,
352 on_bytes_transferred: ::core::option::Option<
353 unsafe extern "C" fn(ctx: *mut ::core::ffi::c_void, offset: u64, len: usize),
354 >,
355 on_bytes_transferred_ctx: *mut ::core::ffi::c_void,
356 out_actual: *mut usize,
357 ) -> zx_status_t;
358}
359unsafe extern "C" {
360 pub fn cpp_vm_object_take_pages(
361 vmo: *mut VmObject,
362 offset: u64,
363 len: u64,
364 pages: *mut VmPageSpliceList,
365 ) -> zx_status_t;
366}
367unsafe extern "C" {
368 pub fn cpp_vm_object_supply_pages(
369 vmo: *mut VmObject,
370 offset: u64,
371 len: u64,
372 pages: *mut VmPageSpliceList,
373 options: SupplyOptions,
374 ) -> zx_status_t;
375}
376unsafe extern "C" {
377 pub fn cpp_vm_object_dump(vmo: *mut VmObject, depth: u32, verbose: bool);
378}
379unsafe extern "C" {
380 pub fn cpp_vm_object_commit_high_priority_pages(vmo: *mut VmObject, offset: u64, len: u64);
381}
382pub type cpp_vm_object_dirty_range_fn = ::core::option::Option<
383 unsafe extern "C" fn(
384 ctx: *mut ::core::ffi::c_void,
385 range_offset: u64,
386 range_len: u64,
387 range_is_zero: bool,
388 ) -> zx_status_t,
389>;
390unsafe extern "C" {
391 pub fn cpp_vm_object_enumerate_dirty_ranges(
392 vmo: *mut VmObject,
393 offset: u64,
394 len: u64,
395 ctx: *mut ::core::ffi::c_void,
396 dirty_range_fn: cpp_vm_object_dirty_range_fn,
397 ) -> zx_status_t;
398}
399unsafe extern "C" {
400 pub fn cpp_vm_object_fail_page_requests(
401 vmo: *mut VmObject,
402 offset: u64,
403 len: u64,
404 error_status: zx_status_t,
405 ) -> zx_status_t;
406}
407unsafe extern "C" {
408 pub fn cpp_vm_object_query_pager_vmo_stats(
409 vmo: *mut VmObject,
410 reset: bool,
411 stats: *mut zx_pager_vmo_stats_t,
412 ) -> zx_status_t;
413}
414unsafe extern "C" {
415 pub fn cpp_vm_object_get_page_source_koid(vmo: *const VmObject) -> zx_koid_t;
416}
417unsafe extern "C" {
418 pub fn cpp_vm_object_is_paged(vmo: *const VmObject) -> bool;
419}
420unsafe extern "C" {
421 pub fn cpp_vm_object_num_mappings(vmo: *const VmObject) -> u32;
422}
423unsafe extern "C" {
424 pub fn cpp_vm_object_share_count(vmo: *const VmObject) -> u32;
425}
426unsafe extern "C" {
427 pub fn cpp_vm_object_is_user_pager_backed(vmo: *const VmObject) -> bool;
428}
429unsafe extern "C" {
430 pub fn cpp_vm_object_child_type(vmo: *const VmObject) -> VmObject_ChildType;
431}
432unsafe extern "C" {
433 pub fn cpp_vm_object_heap_allocation_bytes(vmo: *const VmObject) -> u64;
434}
435unsafe extern "C" {
436 pub fn cpp_vm_object_cache_op(
437 vmo: *mut VmObject,
438 offset: u64,
439 len: u64,
440 type_: VmObject_CacheOpType,
441 ) -> zx_status_t;
442}
443unsafe extern "C" {
444 pub fn cpp_vm_object_prefetch_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
445}
446unsafe extern "C" {
447 pub fn cpp_vm_object_zero_range_untracked(
448 vmo: *mut VmObject,
449 offset: u64,
450 len: u64,
451 ) -> zx_status_t;
452}
453unsafe extern "C" {
454 pub fn cpp_vm_object_set_user_stream_size(vmo: *mut VmObject, ssm: *mut StreamSizeManager);
455}