1 // Copyright 2023, The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 //! Memory management.
16 
17 mod dbm;
18 mod error;
19 mod page_table;
20 mod shared;
21 mod stack;
22 mod tracker;
23 mod util;
24 
25 pub use error::MemoryTrackerError;
26 pub use page_table::PageTable;
27 pub use shared::MemoryRange;
28 pub use tracker::{
29     deactivate_dynamic_page_tables, init_shared_pool, map_data, map_data_noflush, map_device,
30     map_image_footer, map_rodata, map_rodata_outside_main_memory, resize_available_memory,
31     unshare_all_memory, unshare_all_mmio_except_uart, unshare_uart,
32 };
33 pub use util::{
34     flush, flushed_zeroize, page_4kb_of, PAGE_SIZE, SIZE_128KB, SIZE_16KB, SIZE_2MB, SIZE_4KB,
35     SIZE_4MB, SIZE_64KB,
36 };
37 
38 pub(crate) use shared::{alloc_shared, dealloc_shared};
39 pub(crate) use stack::max_stack_size;
40 pub(crate) use tracker::{switch_to_dynamic_page_tables, MEMORY};
41 pub(crate) use util::{phys_to_virt, virt_to_phys};
42