diff options
author | dzwdz | 2021-08-24 19:05:46 +0200 |
---|---|---|
committer | dzwdz | 2021-08-24 19:05:46 +0200 |
commit | b988b821372466ed58eb1d2116bcbb158f70346c (patch) | |
tree | 669bb9331082848277031632e818e8293fb6e44c /src/kernel/proc.c | |
parent | 04878a07e587f26fe6d5a1044b69651406e3aa1c (diff) |
switch to using user_ptr for pointers coming from userland
this avoid accidental dereferences, and now it's easy to tell apart
which pointers are safe to directly read and which aren't.
cons:
- const is completely discarded
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r-- | src/kernel/proc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c index cc6e599..c7963f0 100644 --- a/src/kernel/proc.c +++ b/src/kernel/proc.c @@ -27,14 +27,14 @@ struct process *process_seed(void) { proc->fds[FD_STDOUT].type = FD_SPECIAL_TTY; // map the stack to the last page in memory - pagedir_map(proc->pages, (void*)~PAGE_MASK, page_alloc(1), true, true); - proc->stack_top = (void*) (proc->regs.esp = ~0xF); + pagedir_map(proc->pages, ~PAGE_MASK, page_alloc(1), true, true); + proc->stack_top = proc->regs.esp = ~0xF; // map the kernel // yup, .text is writeable too. the plan is to not map the kernel // into user memory at all, but i'll implement that later. TODO for (size_t p = 0x100000; p < (size_t)&_bss_end; p += PAGE_SIZE) - pagedir_map(proc->pages, (void*)p, (void*)p, false, true); + pagedir_map(proc->pages, p, (void*)p, false, true); // the kernel still has to load the executable code and set EIP return proc; |