pmm_bindings/
pmm_bindings.rs1#![no_std]
8use page_bindings::vm_page_t;
9pub use pmm_arena_bindings::{pmm_arena_info, pmm_arena_info_t};
10pub use pmm_node_bindings::PmmOptDelayReuse;
11pub use zx_types::{zx_paddr_t, zx_status_t};
12pub type PmmNode = pmm_node_bindings::PmmNode;
13pub type VmPageDoublyLinkedList = core::ffi::c_void;
14
15pub const PMM_ALLOC_FLAG_ANY: u32 = 0;
16pub const PMM_ALLOC_FLAG_CAN_WAIT: u32 = 1;
17unsafe extern "C" {
18 pub fn cpp_paddr_to_vm_page(paddr: zx_paddr_t) -> *mut vm_page_t;
19}
20unsafe extern "C" {
21 pub fn cpp_pmm_alloc_page(
22 flags: u32,
23 out_page: *mut *mut vm_page_t,
24 out_paddr: *mut zx_paddr_t,
25 ) -> zx_status_t;
26}
27unsafe extern "C" {
28 pub fn cpp_pmm_alloc_pages(
29 count: usize,
30 flags: u32,
31 list: *mut VmPageDoublyLinkedList,
32 ) -> zx_status_t;
33}
34unsafe extern "C" {
35 pub fn cpp_pmm_alloc_contiguous(
36 count: usize,
37 flags: u32,
38 align_log2: u8,
39 out_pa: *mut zx_paddr_t,
40 list: *mut VmPageDoublyLinkedList,
41 ) -> zx_status_t;
42}
43unsafe extern "C" {
44 pub fn cpp_pmm_free_page(page: *mut vm_page_t);
45}
46unsafe extern "C" {
47 pub fn cpp_pmm_free_list(list: *mut VmPageDoublyLinkedList);
48}
49unsafe extern "C" {
50 pub fn cpp_pmm_num_arenas() -> usize;
51}
52unsafe extern "C" {
53 pub fn cpp_pmm_get_arena_info(
54 count: usize,
55 i: u64,
56 buffer: *mut pmm_arena_info_t,
57 buffer_size: usize,
58 ) -> zx_status_t;
59}