Skip to content

Commit

Permalink
rename eheap to sheap
Browse files Browse the repository at this point in the history
  • Loading branch information
Godones committed Aug 26, 2024
1 parent b7c3ee5 commit 61510e2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions kernel/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub fn syslog(log_type: u32, buf: usize, len: usize) -> isize {
}

extern "C" {
fn eheap();
fn sheap();
}

/// 一个系统调用函数,用于获取系统相关信息。信息包括系统的自启动经过的时间、对于内存的使用情况、共享存储区的大小、
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions subsystems/mem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions subsystems/mem/src/talc_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MyAllocator> = Lazy::new(|| MyAllocator::new());

Expand Down Expand Up @@ -43,7 +43,7 @@ impl MyAllocator {
fn new() -> Self {
let talck = Talc::new(ErrOnOom).lock::<Mutex<()>>();
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();
}

Expand Down
14 changes: 7 additions & 7 deletions subsystems/mem/src/vmm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extern "C" {
fn srodata();
fn sdata();
fn sbss();
fn eheap();
fn sheap();
fn strampoline();
fn sinit();
fn einit();
Expand Down Expand Up @@ -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
);
}

Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tools/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SECTIONS
/* . = ALIGN(4K);*/
/* kernel_eh_frame_hdr_end = .;*/
/* }*/
eheap = .;
sheap = .;
/* ekernel = .;*/
PROVIDE(end = .);
}

0 comments on commit 61510e2

Please sign in to comment.