From 1767d390fbf3d0c65389de46caf0b6d43ef3b6ad Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Fri, 10 Jul 2026 11:24:56 +0800 Subject: feat: establish bootable new architecture checkpoint Replace the compressed boot path with a relocatable higher-half RISC-V entry, expand memory and SMP support, and add the driver, TTY, VFS, exec, signal, syscall, initramfs, and self-test infrastructure needed for a bootable kernel checkpoint. --- na/kernel/uaccess.cc | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'na/kernel/uaccess.cc') diff --git a/na/kernel/uaccess.cc b/na/kernel/uaccess.cc index 4a5b963..14c5fb7 100644 --- a/na/kernel/uaccess.cc +++ b/na/kernel/uaccess.cc @@ -15,25 +15,11 @@ #include #include #include - -/* Kernel VA base — addresses at or above this are kernel space */ -inline constexpr uint64 kKernelVABase = 0xFFFFFFC000000000ULL; +#include extern "C" int __uaccess_memcpy(void* dst, const void* src, uint64 len); extern "C" int64 __uaccess_strncpy(char* dst, const char* src, uint64 max_len); -/* Validate that [addr, addr+len) is entirely in user space */ -static bool is_user_range(uint64 addr, uint64 len) -{ - if (addr >= kKernelVABase) - return false; - if (addr + len < addr) /* overflow */ - return false; - if (addr + len > kKernelVABase) - return false; - return true; -} - int copy_from_user(void* kernel_dst, uint64 user_src, uint64 len) { if (len == 0) return 0; @@ -56,9 +42,9 @@ int64 strncpy_from_user(char* kernel_dst, uint64 user_src, uint64 max_len) /* We must also check that the string does not cross into kernel space. This is safely handled by the assembly routine which will fault if it hits - an unmapped page. However, to strictly respect kKernelVABase, we should - restrict max_len to the distance to kKernelVABase. */ - uint64 max_allowed = kKernelVABase - user_src; + an unmapped page. However, to strictly respect kKernelVaBase, we should + restrict max_len to the distance to kKernelVaBase. */ + uint64 max_allowed = kKernelVaBase - user_src; if (max_len > max_allowed) { max_len = max_allowed; } -- cgit v1.2.3