You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pub fn heap_test() {
use alloc::boxed::Box;
use alloc::vec::Vec;
extern "C" {
fn sbss();
fn ebss();
}
let bss_range = sbss as usize..ebss as usize;
let a = Box::new(5);
assert_eq!(*a, 5);
assert!(bss_range.contains(&(a.as_ref() as *const _ as usize)));
drop(a);
let mut v: Vec<usize> = Vec::new();
for i in 0..500 {
v.push(i);
}
for (i, vi) in v.iter().enumerate().take(500) {
assert_eq!(*vi, i);
}
assert!(bss_range.contains(&(v.as_ptr() as usize)));
drop(v);
info!("heap_test passed!");
}
从
heap_allocator.rs
的测试代码可以推出内核堆在bss段。请问
1.内核堆在bss段的具体位置,从哪开始到哪结束,在哪段代码设置的?
2.为什么内核堆要在bss段?
The text was updated successfully, but these errors were encountered: