summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/proc.c5
-rw-r--r--src/kernel/syscalls.c9
2 files changed, 5 insertions, 9 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 7b8e659..71d1f44 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -29,11 +29,6 @@ struct process *process_seed(void *data, size_t datalen) {
process_first->id = next_pid++;
process_first->_handles = kzalloc(sizeof(struct handle) * HANDLE_MAX);
- // map the stack to the last page in memory
- // TODO move to user bootstrap
- pagedir_map(process_first->pages, (userptr_t)~PAGE_MASK, page_zalloc(1), true, true);
- process_first->regs.rsp = (userptr_t) ~0xF;
-
// map .shared
extern char _shared_len;
for (size_t p = 0; p < (size_t)&_shared_len; p += PAGE_SIZE)
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);