summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kern/error.h1
-rw-r--r--vm/vm_map.c23
2 files changed, 22 insertions, 2 deletions
diff --git a/kern/error.h b/kern/error.h
index bdb6bda1..f80e5a94 100644
--- a/kern/error.h
+++ b/kern/error.h
@@ -22,5 +22,6 @@
#define ERROR_AGAIN 2
#define ERROR_INVAL 3
#define ERROR_BUSY 4
+#define ERROR_FAULT 5
#endif /* _KERN_ERROR_H */
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 0a94b351..f65ce5e5 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -900,13 +900,32 @@ out:
mutex_unlock(&map->lock);
}
+static struct vm_map_entry *
+vm_map_fault_lookup(struct vm_map *map, unsigned long addr)
+{
+ struct vm_map_entry *entry;
+
+ entry = vm_map_lookup_nearest(map, addr);
+
+ if ((entry == NULL) || (addr < entry->start))
+ return NULL;
+
+ return entry;
+}
+
int
vm_map_fault(struct vm_map *map, unsigned long addr, int access)
{
- (void)map;
- (void)addr;
+ struct vm_map_entry *entry;
+
(void)access;
+ entry = vm_map_fault_lookup(map, addr);
+
+ if (entry == NULL)
+ return ERROR_FAULT;
+
+ printk("vm_map: fault on entry %p\n", entry);
return ERROR_AGAIN;
}