aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/mm.c
diff options
context:
space:
mode:
authorMarvin Borner2021-04-16 23:22:02 +0200
committerMarvin Borner2021-04-16 23:22:02 +0200
commit7485f7e441ca892876d9401380aa77610eb85f76 (patch)
tree065f910effe33f5c9d71cd9619dd25216282a13d /kernel/features/mm.c
parent4d4e784770b576199b18f22100689125a18bfd9a (diff)
New elegant I/O blocking solution
This is done using an internal scheduler syscall (127). Very nice!
Diffstat (limited to 'kernel/features/mm.c')
-rw-r--r--kernel/features/mm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/features/mm.c b/kernel/features/mm.c
index d9e4577..9f0bd07 100644
--- a/kernel/features/mm.c
+++ b/kernel/features/mm.c
@@ -602,11 +602,17 @@ void memory_bypass_disable(void)
u8 memory_is_user(const void *addr)
{
+ if (!addr)
+ return 0;
+
return PDI((u32)addr) >= PAGE_KERNEL_COUNT;
}
u8 memory_readable(const void *addr)
{
+ if (!addr)
+ return 0;
+
struct proc *proc = proc_current();
if (proc && !memory_bypass_validity)
return memory_is_user(addr) && virtual_user_readable(proc->page_dir, (u32)addr);
@@ -616,6 +622,9 @@ u8 memory_readable(const void *addr)
u8 memory_writable(const void *addr)
{
+ if (!addr)
+ return 0;
+
struct proc *proc = proc_current();
if (proc && !memory_bypass_validity)
return memory_is_user(addr) && virtual_user_writable(proc->page_dir, (u32)addr);