blob: 6058639b22e9210264625e6999adb5a7420c7bdc [file] [log] [blame]
Alice Wang4dd20932023-05-26 13:47:16 +00001// 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
17mod dbm;
Alice Wang110476e2023-06-07 13:12:21 +000018mod error;
Alice Wangf47b2342023-06-02 11:51:57 +000019mod shared;
Pierre-Clément Tosieba83162024-11-02 12:11:48 +000020mod stack;
Pierre-Clément Tosi90dfd692024-10-30 19:36:46 +000021mod tracker;
Alice Wangf47b2342023-06-02 11:51:57 +000022mod util;
Alice Wang4dd20932023-05-26 13:47:16 +000023
Alice Wang110476e2023-06-07 13:12:21 +000024pub use error::MemoryTrackerError;
Pierre-Clément Tosi90dfd692024-10-30 19:36:46 +000025pub use shared::MemoryRange;
Pierre-Clément Tosic26e2202024-11-01 23:12:23 +000026pub use tracker::{
Pierre-Clément Tosi02c6f562024-12-06 19:12:24 +000027 deactivate_dynamic_page_tables, init_shared_pool, map_data, map_data_noflush, map_device,
28 map_image_footer, map_rodata, map_rodata_outside_main_memory, resize_available_memory,
29 unshare_all_memory, unshare_all_mmio_except_uart, unshare_uart,
Pierre-Clément Tosic26e2202024-11-01 23:12:23 +000030};
Michał Mazurek5b294692024-11-29 13:05:46 +010031
32#[cfg(target_arch = "aarch64")]
33pub use crate::arch::aarch64::page_table::PageTable;
34
Alice Wang3fa9b802023-06-06 07:52:31 +000035pub use util::{
Pierre-Clément Tosi8ab7c372024-10-30 20:46:04 +000036 flush, flushed_zeroize, page_4kb_of, PAGE_SIZE, SIZE_128KB, SIZE_16KB, SIZE_2MB, SIZE_4KB,
37 SIZE_4MB, SIZE_64KB,
Alice Wang3fa9b802023-06-06 07:52:31 +000038};
Alice Wang6c4cda02023-07-18 08:18:07 +000039
40pub(crate) use shared::{alloc_shared, dealloc_shared};
Pierre-Clément Tosieba83162024-11-02 12:11:48 +000041pub(crate) use stack::max_stack_size;
Pierre-Clément Tosiae071612024-11-02 13:13:34 +000042pub(crate) use tracker::{switch_to_dynamic_page_tables, MEMORY};
Alice Wang6c4cda02023-07-18 08:18:07 +000043pub(crate) use util::{phys_to_virt, virt_to_phys};