summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-06-15 10:18:14 +0200
committerRichard Braun <rbraun@sceen.net>2013-07-06 19:02:10 +0200
commit4181989a9cf8ef2018b43ab719bb657a03296e27 (patch)
tree50d3e0240f976213755afbe77f8dfad4d058b034
parent75a1e4532166e7aeb2c0c3109851d4dd48c25183 (diff)
entry lookup
-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;
}