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