diff options
author | dzwdz | 2022-08-30 11:01:28 +0200 |
---|---|---|
committer | dzwdz | 2022-08-30 11:01:28 +0200 |
commit | 7cccc1fb9951f91d91fe72114b39585e5b428384 (patch) | |
tree | b6d68254978c26ec341f047b3312a86935faebac /src/kernel/syscalls.c | |
parent | 69d7da4945448f4a6901b085e746e977359f465c (diff) |
set up the stack in user/bootstrap instead of the kernel
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 9f77679..37a0ce3 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -317,17 +317,18 @@ void __user *_syscall_memflag(void __user *addr, size_t len, int flags) { } - for (userptr_t iter = addr; iter < addr + len; iter += PAGE_SIZE) { - if (pagedir_iskern(pages, iter)) { + for (size_t off = 0; off < len; off += PAGE_SIZE) { + userptr_t page = addr + off; + if (pagedir_iskern(pages, page)) { // TODO reflect failure in return value continue; } - phys = pagedir_virt2phys(pages, iter, false, false); + phys = pagedir_virt2phys(pages, page, false, false); if (!phys) { // TODO test zeroing of user pages phys = page_zalloc(1); - pagedir_map(pages, iter, phys, true, true); + pagedir_map(pages, page, phys, true, true); } } SYSCALL_RETURN((uintptr_t)addr); |