1 // 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
17 use log::info;
18 use vmbase::layout;
19
print_addresses()20 pub fn print_addresses() {
21 let text = layout::text_range();
22 info!("text: {}..{} ({} bytes)", text.start, text.end, text.end - text.start);
23 let rodata = layout::rodata_range();
24 info!("rodata: {}..{} ({} bytes)", rodata.start, rodata.end, rodata.end - rodata.start);
25 info!("binary end: {}", layout::binary_end());
26 let data = layout::data_range();
27 info!(
28 "data: {}..{} ({} bytes, loaded at {})",
29 data.start,
30 data.end,
31 data.end - data.start,
32 layout::data_load_address(),
33 );
34 let bss = layout::bss_range();
35 info!("bss: {}..{} ({} bytes)", bss.start, bss.end, bss.end - bss.start);
36 let boot_stack = layout::stack_range();
37 info!(
38 "boot_stack: {}..{} ({} bytes)",
39 boot_stack.start,
40 boot_stack.end,
41 boot_stack.end - boot_stack.start
42 );
43 }
44