From 6b3d936933d5a68eefdc429170b7a85d3c052663 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Tue, 5 Feb 2008 17:05:36 +0000 Subject: [PATCH] Fixed the negligence in usr addr checking that pager has different vaddr range. Paging-in requests seem to work. TODO: - Remove far/fsr information in pager and abstract away these details in c0. - Add a npages field to page fault ipc so that multiple pages can be paged-in. --- src/generic/space.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/generic/space.c b/src/generic/space.c index a29a7ab..2732722 100644 --- a/src/generic/space.c +++ b/src/generic/space.c @@ -7,8 +7,10 @@ #include INC_GLUE(memlayout.h) #include INC_ARCH(exception.h) #include +#include #include #include +#include /* * Checks whether the given user address is a valid userspace address. @@ -23,10 +25,14 @@ int check_access(unsigned long vaddr, unsigned long size, unsigned int flags) /* Do not allow ridiculously big sizes */ if (size >= USER_AREA_SIZE) return -EINVAL; - /* Check if in user range, but this is more up to the pager to decide */ - if (!(vaddr >= USER_AREA_START && vaddr < USER_AREA_END)) - return -EINVAL; + if (current->tid == PAGER_TID) { + if (!(vaddr >= INITTASK_AREA_START && vaddr < INITTASK_AREA_END)) + return -EINVAL; + } else { + if (!(vaddr >= USER_AREA_START && vaddr < USER_AREA_END)) + return -EINVAL; + } /* If not mapped, ask pager whether this is possible */ if (!check_mapping(vaddr, size, flags))