blob: bafce101803860042b16b24b8f69700f6bfb825e [file] [log] [blame]
Andrew Walbran153aad92022-06-28 15:51:13 +00001// Copyright 2022, 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 layout.
16
Jakob Vukalovicef996292023-04-13 14:28:34 +000017use log::info;
Pierre-Clément Tosieba83162024-11-02 12:11:48 +000018use vmbase::layout;
Andrew Walbran153aad92022-06-28 15:51:13 +000019
Andrew Walbran153aad92022-06-28 15:51:13 +000020pub fn print_addresses() {
Alice Wanga3931aa2023-07-05 12:52:09 +000021 let text = layout::text_range();
Jakob Vukalovicef996292023-04-13 14:28:34 +000022 info!("text: {}..{} ({} bytes)", text.start, text.end, text.end - text.start);
Alice Wanga3931aa2023-07-05 12:52:09 +000023 let rodata = layout::rodata_range();
Jakob Vukalovicef996292023-04-13 14:28:34 +000024 info!("rodata: {}..{} ({} bytes)", rodata.start, rodata.end, rodata.end - rodata.start);
Alice Wang8b097042023-07-06 14:56:58 +000025 info!("binary end: {}", layout::binary_end());
Alice Wanga3931aa2023-07-05 12:52:09 +000026 let data = layout::data_range();
Jakob Vukalovicef996292023-04-13 14:28:34 +000027 info!(
Andrew Walbran153aad92022-06-28 15:51:13 +000028 "data: {}..{} ({} bytes, loaded at {})",
29 data.start,
30 data.end,
31 data.end - data.start,
Alice Wang8b097042023-07-06 14:56:58 +000032 layout::data_load_address(),
Andrew Walbran153aad92022-06-28 15:51:13 +000033 );
Alice Wanga3931aa2023-07-05 12:52:09 +000034 let bss = layout::bss_range();
Jakob Vukalovicef996292023-04-13 14:28:34 +000035 info!("bss: {}..{} ({} bytes)", bss.start, bss.end, bss.end - bss.start);
Pierre-Clément Tosieba83162024-11-02 12:11:48 +000036 let boot_stack = layout::stack_range();
Jakob Vukalovicef996292023-04-13 14:28:34 +000037 info!(
Andrew Walbran153aad92022-06-28 15:51:13 +000038 "boot_stack: {}..{} ({} bytes)",
39 boot_stack.start,
40 boot_stack.end,
41 boot_stack.end - boot_stack.start
42 );
43}