Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@ axns = { git = "https://github.com/oscomp/arceos.git", features = [
axsync = { git = "https://github.com/oscomp/arceos.git" }
axtask = { git = "https://github.com/oscomp/arceos.git" }

axprocess = { git = "https://github.com/Starry-OS/axprocess.git" }

axerrno = "0.1"
bitflags = "2.6"
linkme = "0.3"
linux-raw-sys = { version = "0.9.3", default-features = false, features = [
"no_std",
"general",
"net",
"prctl",
"system",
] }
memory_addr = "0.3"

starry-core = { path = "./core" }
Expand All @@ -60,12 +69,18 @@ lwext4_rs = ["axfeat/lwext4_rs"]
[dependencies]
axfeat.workspace = true

axfs.workspace = true
axhal.workspace = true
axlog.workspace = true
axsync.workspace = true
axtask.workspace = true
arceos_posix_api.workspace = true

axprocess.workspace = true

axerrno.workspace = true
linkme.workspace = true
linux-raw-sys.workspace = true

starry-core.workspace = true
starry-api.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ axsync.workspace = true
axtask.workspace = true
arceos_posix_api.workspace = true

axprocess.workspace = true

axerrno.workspace = true
bitflags.workspace = true
linux-raw-sys.workspace = true
memory_addr.workspace = true

starry-core.workspace = true
Expand Down
9 changes: 5 additions & 4 deletions api/src/imp/mm/brk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use crate::syscall_instrument;

#[apply(syscall_instrument)]
pub fn sys_brk(addr: usize) -> LinuxResult<isize> {
let current_task = current();
let mut return_val: isize = current_task.task_ext().get_heap_top() as isize;
let heap_bottom = current_task.task_ext().get_heap_bottom() as usize;
let task = current();
let process_data = task.task_ext().process_data();
let mut return_val: isize = process_data.get_heap_top() as isize;
let heap_bottom = process_data.get_heap_bottom() as usize;
if addr != 0 && addr >= heap_bottom && addr <= heap_bottom + axconfig::plat::USER_HEAP_SIZE {
current_task.task_ext().set_heap_top(addr as u64);
process_data.set_heap_top(addr);
return_val = addr as isize;
}
Ok(return_val)
Expand Down
12 changes: 6 additions & 6 deletions api/src/imp/mm/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ pub fn sys_mmap(
let mut addr = unsafe { addr.into_inner() };

let curr = current();
let curr_ext = curr.task_ext();
let mut aspace = curr_ext.aspace.lock();
let process_data = curr.task_ext().process_data();
let mut aspace = process_data.aspace.lock();
let permission_flags = MmapProt::from_bits_truncate(prot);
// TODO: check illegal flags for mmap
// An example is the flags contained none of MAP_PRIVATE, MAP_SHARED, or MAP_SHARED_VALIDATE.
Expand Down Expand Up @@ -163,8 +163,8 @@ pub fn sys_munmap(addr: UserPtr<usize>, length: usize) -> LinuxResult<isize> {
let addr = unsafe { addr.into_inner() };

let curr = current();
let curr_ext = curr.task_ext();
let mut aspace = curr_ext.aspace.lock();
let process_data = curr.task_ext().process_data();
let mut aspace = process_data.aspace.lock();
let length = memory_addr::align_up_4k(length);
let start_addr = VirtAddr::from(addr as usize);
aspace.unmap(start_addr, length)?;
Expand All @@ -186,8 +186,8 @@ pub fn sys_mprotect(addr: UserPtr<usize>, length: usize, prot: i32) -> LinuxResu
}

let curr = current();
let curr_ext = curr.task_ext();
let mut aspace = curr_ext.aspace.lock();
let process_data = curr.task_ext().process_data();
let mut aspace = process_data.aspace.lock();
let length = memory_addr::align_up_4k(length);
let start_addr = VirtAddr::from(addr as usize);
aspace.protect(start_addr, length, permission_flags.into())?;
Expand Down
Loading