diff --git a/kernel/src/system.rs b/kernel/src/system.rs index bcb22aad..cd4c6f7c 100644 --- a/kernel/src/system.rs +++ b/kernel/src/system.rs @@ -111,7 +111,7 @@ pub fn syslog(log_type: u32, buf: usize, len: usize) -> isize { } extern "C" { - fn eheap(); + fn sheap(); } /// 一个系统调用函数,用于获取系统相关信息。信息包括系统的自启动经过的时间、对于内存的使用情况、共享存储区的大小、 @@ -134,7 +134,7 @@ pub fn sys_info(dst_info: usize) -> isize { task_number * LINUX_SYSINFO_LOADS_SCALE / 900, ], totalram: memory_info.end - memory_info.start, - freeram: memory_info.end - eheap as usize, + freeram: memory_info.end - sheap as usize, sharedram: 0, bufferram: 0, totalswap: 0, diff --git a/subsystems/mem/src/lib.rs b/subsystems/mem/src/lib.rs index 1ec1d3c8..06a32d4f 100644 --- a/subsystems/mem/src/lib.rs +++ b/subsystems/mem/src/lib.rs @@ -29,17 +29,17 @@ static HEAP_ALLOCATOR: heap::HeapAllocator = heap::HeapAllocator::new(); static HEAP_ALLOCATOR: talc_wrapper::TalcAllocator = talc_wrapper::TalcAllocator; extern "C" { - fn eheap(); + fn sheap(); } pub fn init_memory_system(memory_end: usize, is_first_cpu: bool) { if is_first_cpu { - frame::init_frame_allocator(eheap as usize + HEAP_SIZE, memory_end); + frame::init_frame_allocator(sheap as usize + HEAP_SIZE, memory_end); println!("Frame allocator init success"); #[cfg(feature = "initrd")] data::relocate_removable_data(); #[cfg(feature = "buddy")] - HEAP_ALLOCATOR.init(eheap as usize, HEAP_SIZE); + HEAP_ALLOCATOR.init(sheap as usize, HEAP_SIZE); #[cfg(feature = "talloc")] println!("Talloc allocator init success"); #[cfg(feature = "buddy")] diff --git a/subsystems/mem/src/talc_wrapper.rs b/subsystems/mem/src/talc_wrapper.rs index be2bb7cf..e22d5197 100644 --- a/subsystems/mem/src/talc_wrapper.rs +++ b/subsystems/mem/src/talc_wrapper.rs @@ -10,7 +10,7 @@ use platform::config::HEAP_SIZE; use spin::Lazy; use talc::{ErrOnOom, Talc, Talck}; -use crate::{alloc_frames, eheap, free_frames}; +use crate::{alloc_frames, free_frames, sheap}; static HEAP_ALLOCATOR: Lazy = Lazy::new(|| MyAllocator::new()); @@ -43,7 +43,7 @@ impl MyAllocator { fn new() -> Self { let talck = Talc::new(ErrOnOom).lock::>(); unsafe { - let heap = core::slice::from_raw_parts_mut(eheap as usize as *mut u8, HEAP_SIZE); + let heap = core::slice::from_raw_parts_mut(sheap as usize as *mut u8, HEAP_SIZE); let _res = talck.lock().claim(heap.as_mut().into()).unwrap(); } diff --git a/subsystems/mem/src/vmm.rs b/subsystems/mem/src/vmm.rs index c4927fca..1ccc163c 100644 --- a/subsystems/mem/src/vmm.rs +++ b/subsystems/mem/src/vmm.rs @@ -17,7 +17,7 @@ extern "C" { fn srodata(); fn sdata(); fn sbss(); - fn eheap(); + fn sheap(); fn strampoline(); fn sinit(); fn einit(); @@ -46,13 +46,13 @@ fn kernel_info(memory_end: usize) { ); println!( "kernel bss: {:#x}-{:#x}", - sbss as usize, eheap as usize + sbss as usize, sheap as usize ); // println!("kernel eh_frame: {:#x}-{:#x}", kernel_eh_frame as usize, kernel_eh_frame_end as usize); // println!("kernel eh_frame_hdr: {:#x}-{:#x}", kernel_eh_frame_hdr as usize, kernel_eh_frame_hdr_end as usize); println!( "kernel heap: {:#x}-{:#x}", - eheap as usize, memory_end + sheap as usize, memory_end ); } @@ -96,16 +96,16 @@ pub fn build_kernel_address_space(memory_end: usize) { .map_region( VirtAddr::from(sbss as usize), PhysAddr::from(sbss as usize), - eheap as usize - sbss as usize, + sheap as usize - sbss as usize, "RWVAD".into(), true, ) .unwrap(); kernel_space .map_region( - VirtAddr::from(eheap as usize), - PhysAddr::from(eheap as usize), - memory_end - eheap as usize, + VirtAddr::from(sheap as usize), + PhysAddr::from(sheap as usize), + memory_end - sheap as usize, "RWVAD".into(), true, ) diff --git a/tools/link.ld b/tools/link.ld index 4bcdf266..95cea7e1 100644 --- a/tools/link.ld +++ b/tools/link.ld @@ -60,7 +60,7 @@ SECTIONS /* . = ALIGN(4K);*/ /* kernel_eh_frame_hdr_end = .;*/ /* }*/ - eheap = .; + sheap = .; /* ekernel = .;*/ PROVIDE(end = .); } \ No newline at end of file