This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f2a4bc1e7707a33a8eb80b0c19c3e8157622973e Author: Royyan Zahir <[email protected]> AuthorDate: Thu Oct 1 03:51:55 2026 +0400 arch/x86_64: add up_addrenv_user_vaddr() arch.h declares it for an address environment; x86_64 had the same check as the private x86_64_uservaddr(), which it replaces. The syscall checks need it in every kernel build. Signed-off-by: Royyan Zahir <[email protected]> --- arch/x86_64/src/common/pgalloc.h | 24 ------------------------ arch/x86_64/src/common/x86_64_addrenv.c | 17 +++++++++++++++++ arch/x86_64/src/common/x86_64_pgalloc.c | 2 +- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/arch/x86_64/src/common/pgalloc.h b/arch/x86_64/src/common/pgalloc.h index d05e6a3990f..23636e4f717 100644 --- a/arch/x86_64/src/common/pgalloc.h +++ b/arch/x86_64/src/common/pgalloc.h @@ -95,30 +95,6 @@ static inline uintptr_t x86_64_pgpaddr(uintptr_t vaddr) return 0; } -/**************************************************************************** - * Name: x86_64_uservaddr - * - * Description: - * Return true if the virtual address, vaddr, lies in the user address - * space. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_ADDRENV -static inline bool x86_64_uservaddr(uintptr_t vaddr) -{ - /* Check if this address is within the range of the virtualized .bss/.data, - * heap, or stack regions. - */ - - return ((vaddr >= ARCH_ADDRENV_VBASE && vaddr <= ARCH_ADDRENV_VEND) -#ifdef CONFIG_ARCH_VMA_MAPPING - || (vaddr >= CONFIG_ARCH_SHM_VBASE && vaddr <= ARCH_SHM_VEND) -#endif - ); -} -#endif - /**************************************************************************** * Name: x86_64_pgwipe * diff --git a/arch/x86_64/src/common/x86_64_addrenv.c b/arch/x86_64/src/common/x86_64_addrenv.c index 933263b0155..d9c3d934dfd 100644 --- a/arch/x86_64/src/common/x86_64_addrenv.c +++ b/arch/x86_64/src/common/x86_64_addrenv.c @@ -994,3 +994,20 @@ int up_addrenv_detach(struct tcb_s *tcb) return OK; } + +/**************************************************************************** + * Name: up_addrenv_user_vaddr + * + * Description: + * Check if a virtual address is in user virtual address space. + * + ****************************************************************************/ + +bool up_addrenv_user_vaddr(uintptr_t vaddr) +{ + return (vaddr >= ARCH_ADDRENV_VBASE && vaddr <= ARCH_ADDRENV_VEND) +#ifdef CONFIG_ARCH_VMA_MAPPING + || (vaddr >= CONFIG_ARCH_SHM_VBASE && vaddr <= ARCH_SHM_VEND) +#endif + ; +} diff --git a/arch/x86_64/src/common/x86_64_pgalloc.c b/arch/x86_64/src/common/x86_64_pgalloc.c index 084bcf2cb3b..009c0fb55b5 100644 --- a/arch/x86_64/src/common/x86_64_pgalloc.c +++ b/arch/x86_64/src/common/x86_64_pgalloc.c @@ -103,7 +103,7 @@ uintptr_t x86_64_get_pgtable(arch_addrenv_t *addrenv, uintptr_t vaddr) { /* Determine page table flags */ - if (x86_64_uservaddr(vaddr)) + if (up_addrenv_user_vaddr(vaddr)) { flags = MMU_UPGT_FLAGS; }
