Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mm] Create new uspace with parameters passed by user #192

Merged
merged 1 commit into from
Oct 22, 2024
Merged
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
7 changes: 2 additions & 5 deletions modules/axmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ use lazyinit::LazyInit;
use memory_addr::{va, PhysAddr, VirtAddr};
use memory_set::MappingError;

const USER_ASPACE_BASE: usize = 0x1000;
const USER_ASPACE_SIZE: usize = 0x7fff_ffff_f000;

static KERNEL_ASPACE: LazyInit<SpinNoIrq<AddrSpace>> = LazyInit::new();

fn mapping_err_to_ax_err(err: MappingError) -> AxError {
Expand All @@ -46,8 +43,8 @@ pub fn new_kernel_aspace() -> AxResult<AddrSpace> {
}

/// Creates a new address space for user processes.
pub fn new_user_aspace() -> AxResult<AddrSpace> {
let mut aspace = AddrSpace::new_empty(VirtAddr::from(USER_ASPACE_BASE), USER_ASPACE_SIZE)?;
pub fn new_user_aspace(base: VirtAddr, size: usize) -> AxResult<AddrSpace> {
let mut aspace = AddrSpace::new_empty(base, size)?;
if !cfg!(target_arch = "aarch64") {
// ARMv8 use a separate page table (TTBR0_EL1) for user space, it
// doesn't need to copy the kernel portion to the user page table.
Expand Down
Loading