diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 11:24:56 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 11:24:56 +0800 |
| commit | 1767d390fbf3d0c65389de46caf0b6d43ef3b6ad (patch) | |
| tree | 0f5e01cd7c7a05abb6b1c7472d7f00f49caf02cc /na/kernel/uaccess.cc | |
| parent | 63dc025705f6533b91fb1a7d26e6ed864efd9900 (diff) | |
| download | lume-1767d390fbf3d0c65389de46caf0b6d43ef3b6ad.tar.gz lume-1767d390fbf3d0c65389de46caf0b6d43ef3b6ad.tar.xz | |
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.
Diffstat (limited to 'na/kernel/uaccess.cc')
| -rw-r--r-- | na/kernel/uaccess.cc | 22 |
1 files changed, 4 insertions, 18 deletions
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 <lume/task.h> #include <lume/errno.h> #include <lume/config.h> - -/* Kernel VA base — addresses at or above this are kernel space */ -inline constexpr uint64 kKernelVABase = 0xFFFFFFC000000000ULL; +#include <lume/mm_layout.h> 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; } |
