Skip to content

Commit

Permalink
[mm] Create new uspace with parameters passed by user
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-stars committed Oct 22, 2024
1 parent a2e8311 commit 19304fe
Showing 1 changed file with 2 additions and 5 deletions.
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

0 comments on commit 19304fe

Please sign in to comment.