1#![expect(non_camel_case_types)]
8#![expect(non_upper_case_globals)]
9#![no_std]
10use anonymous_page_request_bindings::AnonymousPageRequest;
11pub use compressor_bindings::VmCompressor;
12use page_bindings::vm_page_t;
13use page_source_bindings::MultiPageRequest;
14pub use pmm_bindings::{PmmOptDelayReuse, VmPageDoublyLinkedList};
15pub use vm_object_bindings::SupplyOptions;
16use vm_page_list_bindings::VmPageSpliceList;
17use zx_types::zx_status_t;
18
19#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
20#[repr(C, align(8))]
21pub struct __BindgenOpaqueArray8<T>(pub T);
22impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray8<[T; N]> {
23 fn default() -> Self {
24 Self([<T as Default>::default(); N])
25 }
26}
27pub const VmCowPagesOptions_kNone: VmCowPagesOptions = 0;
28pub const VmCowPagesOptions_kUserPagerBackedRoot: VmCowPagesOptions = 1;
29pub const VmCowPagesOptions_kPageSourceRoot: VmCowPagesOptions = 2;
30pub const VmCowPagesOptions_kCannotDecommitZeroPages: VmCowPagesOptions = 4;
31pub const VmCowPagesOptions_kHidden: VmCowPagesOptions = 8;
32pub const VmCowPagesOptions_kInternalOnlyMask: VmCowPagesOptions = 8;
33pub type VmCowPagesOptions = u32;
34#[repr(C)]
35#[derive(Debug, Copy, Clone)]
36pub struct VmCowRange {
37 pub offset: u64,
38 pub len: u64,
39}
40#[repr(C)]
41#[derive(Debug, Copy, Clone)]
42pub struct VmCowReclaimSuccess {
43 pub type_: VmCowReclaimSuccess_Type,
44 pub __bindgen_padding_0: [u8; 7usize],
45 pub num_pages: u64,
46 pub num_loaned_pages: u64,
47}
48#[repr(u8)]
49#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
50pub enum VmCowReclaimSuccess_Type {
51 Evict = 0,
52 Discard = 1,
53 Compress = 2,
54}
55#[repr(u8)]
56#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
57pub enum VmCowReclaimFailure {
58 EvictAccessed = 0,
59 CompressAccessed = 1,
60 CompressFailed = 2,
61 IncorrectPage = 3,
62 Other = 4,
63}
64#[repr(u8)]
65#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
66pub enum PageSourceType {
67 Anonymous = 0,
68 Contiguous = 1,
69 UserPager = 2,
70}
71unsafe extern "C" {
72 pub fn cpp_vm_cow_pages_free(arg1: *mut VmCowPages);
73}
74#[repr(C)]
75#[repr(align(8))]
76#[derive(Debug, Copy, Clone)]
77pub struct VmCowPages {
78 pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 192usize]>,
79}
80#[repr(u8)]
81#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
82pub enum VmCowPages_DirtyState {
83 Untracked = 0,
84 Clean = 1,
85 Dirty = 2,
86 AwaitingClean = 3,
87 NumStates = 4,
88}
89#[repr(u8)]
90#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
91pub enum VmCowPages_CanOverwriteSlot {
92 Empty = 0,
93 EmptyOrParent = 1,
94 ZeroMarkerOrInterval = 2,
95 PageOrRef = 3,
96}
97#[repr(u8)]
98#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
99pub enum VmCowPages_EvictionAction {
100 FollowHint = 0,
101 IgnoreHint = 1,
102}
103#[repr(C)]
104#[derive(Debug, Copy, Clone)]
105pub struct VmCowPages_DiscardablePageCounts {
106 pub locked: u64,
107 pub unlocked: u64,
108}
109#[repr(C)]
110#[derive(Debug, Copy, Clone)]
111pub struct VmCowPages_RootListTag {
112 pub __bindgen_padding_0: u8,
113 pub _address: u8,
114}
115#[repr(C)]
116#[derive(Debug, Copy, Clone)]
117pub struct VmCowPages_CurListTag {
118 pub __bindgen_padding_0: u8,
119 pub _address: u8,
120}
121#[repr(C)]
122#[derive(Debug)]
123pub struct VmCowPages_TreeWalkCursor {
124 _unused: [u8; 0],
125}
126pub const VmCowPages_LifeCycle_Init: VmCowPages_LifeCycle = 0;
127pub const VmCowPages_LifeCycle_Alive: VmCowPages_LifeCycle = 1;
128pub const VmCowPages_LifeCycle_Dying: VmCowPages_LifeCycle = 2;
129pub const VmCowPages_LifeCycle_Dead: VmCowPages_LifeCycle = 3;
130pub type VmCowPages_LifeCycle = u8;
131#[repr(C)]
132#[repr(align(8))]
133#[derive(Debug, Copy, Clone)]
134pub struct VmCowPages_DeferredOps {
135 pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 112usize]>,
136}
137#[repr(C)]
138#[repr(align(8))]
139#[derive(Debug, Copy, Clone)]
140pub struct PriorityChanger {
141 pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 152usize]>,
142}
143pub const PriorityChanger_PriorityChangerState_CONSTRUCTED: PriorityChanger_PriorityChangerState =
144 0;
145pub const PriorityChanger_PriorityChangerState_READY_TO_CHANGE:
146 PriorityChanger_PriorityChangerState = 1;
147pub const PriorityChanger_PriorityChangerState_DONE: PriorityChanger_PriorityChangerState = 2;
148pub type PriorityChanger_PriorityChangerState = u8;
149#[repr(C)]
150#[repr(align(8))]
151#[derive(Debug, Copy, Clone)]
152pub struct DiscardableVmoTracker {
153 pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 48usize]>,
154}
155pub const DiscardableVmoTracker_DiscardableState_kUnset: DiscardableVmoTracker_DiscardableState = 0;
156pub const DiscardableVmoTracker_DiscardableState_kReclaimable:
157 DiscardableVmoTracker_DiscardableState = 1;
158pub const DiscardableVmoTracker_DiscardableState_kUnreclaimable:
159 DiscardableVmoTracker_DiscardableState = 2;
160pub const DiscardableVmoTracker_DiscardableState_kDiscarded:
161 DiscardableVmoTracker_DiscardableState = 3;
162pub type DiscardableVmoTracker_DiscardableState = u8;
163pub type DiscardableVmoTracker_DiscardablePageCounts = VmCowPages_DiscardablePageCounts;
164pub type cpp_vm_cow_pages_lookup_readable_fn = ::core::option::Option<
165 unsafe extern "C" fn(ctx: *mut ::core::ffi::c_void, offset: u64, paddr: u64) -> zx_status_t,
166>;
167unsafe extern "C" {
168 pub fn cpp_vm_cow_pages_replace_page_with_loaned(
169 cow: *mut VmCowPages,
170 before_page: *mut vm_page_t,
171 offset: u64,
172 ) -> zx_status_t;
173}
174unsafe extern "C" {
175 pub fn cpp_vm_cow_pages_replace_page(
176 cow: *mut VmCowPages,
177 before_page: *mut vm_page_t,
178 offset: u64,
179 with_loaned: bool,
180 after_page: *mut *mut vm_page_t,
181 page_request: *mut AnonymousPageRequest,
182 ) -> zx_status_t;
183}
184unsafe extern "C" {
185 pub fn cpp_vm_cow_pages_get_ref_counted(cow: *const VmCowPages) -> *mut ::core::ffi::c_void;
186}
187unsafe extern "C" {
188 pub fn cpp_vm_cow_pages_initialize_page_cache(level: u32);
189}
190unsafe extern "C" {
191 pub fn cpp_vm_cow_pages_should_delay_reuse_on_free(cow: *const VmCowPages) -> PmmOptDelayReuse;
192}
193unsafe extern "C" {
194 pub fn cpp_vm_cow_pages_debug_get_parent(cow: *mut VmCowPages) -> *mut VmCowPages;
195}
196unsafe extern "C" {
197 pub fn cpp_vm_cow_pages_dedup_zero_page(
198 cow: *mut VmCowPages,
199 page: *mut vm_page_t,
200 offset: u64,
201 ) -> bool;
202}
203unsafe extern "C" {
204 pub fn cpp_vm_cow_pages_evict_loaned_page(
205 cow: *mut VmCowPages,
206 page: *mut vm_page_t,
207 offset: u64,
208 ) -> zx_status_t;
209}
210unsafe extern "C" {
211 pub fn cpp_vm_cow_pages_debug_get_page(cow: *const VmCowPages, offset: u64) -> *mut vm_page_t;
212}
213unsafe extern "C" {
214 pub fn cpp_vm_cow_pages_debug_is_empty(cow: *const VmCowPages, offset: u64) -> bool;
215}
216unsafe extern "C" {
217 pub fn cpp_vm_cow_pages_debug_is_page(cow: *const VmCowPages, offset: u64) -> bool;
218}
219unsafe extern "C" {
220 pub fn cpp_vm_cow_pages_debug_is_high_memory_priority(cow: *const VmCowPages) -> bool;
221}
222unsafe extern "C" {
223 pub fn cpp_vm_cow_pages_lock_is_held(cow: *const VmCowPages) -> bool;
224}
225unsafe extern "C" {
226 pub fn cpp_vm_cow_pages_debug_get_discardable_tracker(
227 cow: *const VmCowPages,
228 ) -> *mut DiscardableVmoTracker;
229}
230unsafe extern "C" {
231 pub fn cpp_vm_cow_pages_reclaim_page(
232 cow: *mut VmCowPages,
233 page: *mut vm_page_t,
234 offset: u64,
235 eviction_action: VmCowPages_EvictionAction,
236 compressor: *mut VmCompressor,
237 out_success: *mut VmCowReclaimSuccess,
238 out_failure: *mut VmCowReclaimFailure,
239 ) -> bool;
240}
241unsafe extern "C" {
242 pub fn cpp_vm_cow_pages_debug_lookup_readable(
243 cow: *mut VmCowPages,
244 range: VmCowRange,
245 ctx: *mut ::core::ffi::c_void,
246 callback: cpp_vm_cow_pages_lookup_readable_fn,
247 ) -> zx_status_t;
248}
249unsafe extern "C" {
250 pub fn cpp_vm_cow_pages_get_lock(cow: *const VmCowPages) -> *mut ::core::ffi::c_void;
251}
252unsafe extern "C" {
253 pub fn cpp_vm_cow_pages_deferred_ops_construct(ops: *mut u8, cow: *mut VmCowPages);
254}
255unsafe extern "C" {
256 pub fn cpp_vm_cow_pages_deferred_ops_destroy(ops: *mut VmCowPages_DeferredOps);
257}
258unsafe extern "C" {
259 pub fn cpp_vm_cow_pages_add_new_pages_locked(
260 cow: *mut VmCowPages,
261 start_offset: u64,
262 pages: *mut VmPageDoublyLinkedList,
263 overwrite: VmCowPages_CanOverwriteSlot,
264 zero: bool,
265 deferred: *mut VmCowPages_DeferredOps,
266 ) -> zx_status_t;
267}
268unsafe extern "C" {
269 pub fn cpp_vm_cow_pages_zero_pages_locked(
270 cow: *mut VmCowPages,
271 range: VmCowRange,
272 dirty_track: bool,
273 deferred: *mut VmCowPages_DeferredOps,
274 page_request: *mut MultiPageRequest,
275 out_zeroed_bytes: *mut u64,
276 ) -> zx_status_t;
277}
278unsafe extern "C" {
279 pub fn cpp_vm_cow_pages_supply_pages_locked(
280 cow: *mut VmCowPages,
281 range: VmCowRange,
282 pages: *mut VmPageSpliceList,
283 options: SupplyOptions,
284 deferred: *mut VmCowPages_DeferredOps,
285 page_request: *mut MultiPageRequest,
286 ) -> zx_status_t;
287}
288unsafe extern "C" {
289 pub fn cpp_vm_cow_pages_debug_get_populated_slots_count(cow: *const VmCowPages) -> u32;
290}
291unsafe extern "C" {
292 pub fn cpp_vm_cow_pages_debug_is_parent_content(cow: *const VmCowPages, offset: u64) -> bool;
293}
294unsafe extern "C" {
295 pub fn cpp_vm_cow_pages_can_borrow(cow: *const VmCowPages) -> bool;
296}
297unsafe extern "C" {
298 pub fn cpp_vm_cow_pages_can_evict(cow: *const VmCowPages) -> bool;
299}
300unsafe extern "C" {
301 pub fn cpp_vm_cow_pages_is_discardable(cow: *const VmCowPages) -> bool;
302}
303unsafe extern "C" {
304 pub fn cpp_vm_cow_pages_upgrade_from_raw(cow: *mut VmCowPages) -> *mut VmCowPages;
305}
306unsafe extern "C" {
307 pub fn cpp_vm_cow_pages_debug_get_discardable_page_counts(
308 cow: *const VmCowPages,
309 out_counts: *mut VmCowPages_DiscardablePageCounts,
310 );
311}
312unsafe extern "C" {
313 pub fn cpp_priority_changer_construct(out: *mut u8, cow: *mut VmCowPages, delta: i64);
314}
315unsafe extern "C" {
316 pub fn cpp_priority_changer_destroy(pc: *mut PriorityChanger);
317}
318unsafe extern "C" {
319 pub fn cpp_priority_changer_prepare_may_not_already_be_high_priority(pc: *mut PriorityChanger);
320}
321unsafe extern "C" {
322 pub fn cpp_priority_changer_prepare_is_already_high_priority_locked(pc: *mut PriorityChanger);
323}
324unsafe extern "C" {
325 pub fn cpp_priority_changer_change_high_priority_count_locked(pc: *mut PriorityChanger);
326}
327unsafe extern "C" {
328 pub fn cpp_priority_changer_lock(pc: *const PriorityChanger) -> *mut ::core::ffi::c_void;
329}