From b988b821372466ed58eb1d2116bcbb158f70346c Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 24 Aug 2021 19:05:46 +0200 Subject: 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 --- src/kernel/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/kernel/main.c') diff --git a/src/kernel/main.c b/src/kernel/main.c index 7796c44..cc8e10d 100644 --- a/src/kernel/main.c +++ b/src/kernel/main.c @@ -9,13 +9,13 @@ static void run_init(struct kmain_info *info) { struct process *proc = process_seed(); - void *init_base = (void*) 0x200000; + user_ptr init_base = 0x200000; // map the module as rw for (uintptr_t off = 0; off < info->init.size; off += PAGE_SIZE) pagedir_map(proc->pages, init_base + off, info->init.at + off, true, true); - proc->regs.eip = (int) init_base; + proc->regs.eip = init_base; tty_const("switching..."); process_switch(proc); -- cgit v1.2.3