From 19304fe66a168f06403a4529639c9a6111200c5f Mon Sep 17 00:00:00 2001 From: Youjie Zheng Date: Tue, 22 Oct 2024 18:08:21 +0800 Subject: [PATCH] [mm] Create new uspace with parameters passed by user --- modules/axmm/src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/axmm/src/lib.rs b/modules/axmm/src/lib.rs index 3772b1b64b..32cc0819f9 100644 --- a/modules/axmm/src/lib.rs +++ b/modules/axmm/src/lib.rs @@ -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> = LazyInit::new(); fn mapping_err_to_ax_err(err: MappingError) -> AxError { @@ -46,8 +43,8 @@ pub fn new_kernel_aspace() -> AxResult { } /// Creates a new address space for user processes. -pub fn new_user_aspace() -> AxResult { - let mut aspace = AddrSpace::new_empty(VirtAddr::from(USER_ASPACE_BASE), USER_ASPACE_SIZE)?; +pub fn new_user_aspace(base: VirtAddr, size: usize) -> AxResult { + 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.