diff options
author | jdike <jdike> | 2004-04-07 20:43:48 +0000 |
---|---|---|
committer | jdike <jdike> | 2004-04-07 20:43:48 +0000 |
commit | 6a7a2f74418628bcf9ba8021ccc6ac53ee16ff0e (patch) | |
tree | 65d99720fdfa3216f696a3325d430d6f0ec43aa2 | |
parent | 138d6507b0641da8aa34943fac8ffb3f85e5ff6d (diff) | |
download | uml-history-6a7a2f74418628bcf9ba8021ccc6ac53ee16ff0e.tar.gz |
Updated a couple of mmap interfaces.
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 12 | ||||
-rw-r--r-- | arch/um/include/mem.h | 2 | ||||
-rw-r--r-- | arch/um/include/mem_kern.h | 2 | ||||
-rw-r--r-- | arch/um/kernel/trap_kern.c | 6 |
4 files changed, 15 insertions, 7 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index cbd1996..55a2531 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1043,7 +1043,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req) * to write the data to disk first, then we can map the disk * page in and continue normally from there. */ - if((req->cmd == WRITE) && !is_remapped(req->buffer)){ + if((req->cmd == WRITE) && !is_remapped(req->buffer, dev->fd, io_req->offset + dev->cow.data_offset)){ io_req->map_fd = dev->fd; io_req->map_offset = io_req->offset + dev->cow.data_offset; @@ -1249,12 +1249,20 @@ static int ubd_revalidate(kdev_t rdev) } static int ubd_check_remapped(int fd, unsigned long address, int is_write, - __u64 offset) + __u64 offset, int is_user) { __u64 bitmap_offset; unsigned long new_bitmap[2]; int i, err, n; + /* This can only fix kernelspace faults */ + if(is_user) + return(0); + + /* ubd-mmap is only enabled in skas mode */ + if(CHOOSE_MODE(1, 0)) + return(0); + /* If it's not a write access, we can't do anything about it */ if(!is_write) return(0); diff --git a/arch/um/include/mem.h b/arch/um/include/mem.h index 7706ede..5ae9e5f 100644 --- a/arch/um/include/mem.h +++ b/arch/um/include/mem.h @@ -11,7 +11,7 @@ extern void set_kmem_end(unsigned long new); extern int phys_mapping(unsigned long phys, __u64 *offset_out); extern int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w); -extern int is_remapped(void *virt); +extern int is_remapped(const void *virt, int fd, __u64 offset); extern int physmem_remove_mapping(void *virt); extern void physmem_forget_descriptor(int fd); diff --git a/arch/um/include/mem_kern.h b/arch/um/include/mem_kern.h index b39f03d..699d46d 100644 --- a/arch/um/include/mem_kern.h +++ b/arch/um/include/mem_kern.h @@ -11,7 +11,7 @@ struct remapper { struct list_head list; - int (*proc)(int, unsigned long, int, __u64); + int (*proc)(int, unsigned long, int, __u64, int); }; extern void register_remapper(struct remapper *info); diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 2a45005..4b3d56e 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c @@ -94,7 +94,7 @@ void register_remapper(struct remapper *info) list_add(&info->list, &physmem_remappers); } -static int check_remapped_addr(unsigned long address, int is_write) +static int check_remapped_addr(unsigned long address, int is_write, int is_user) { struct remapper *remapper; struct list_head *ele; @@ -107,7 +107,7 @@ static int check_remapped_addr(unsigned long address, int is_write) list_for_each(ele, &physmem_remappers){ remapper = list_entry(ele, struct remapper, list); - if((*remapper->proc)(fd, address, is_write, offset)) + if((*remapper->proc)(fd, address, is_write, offset, is_user)) return(1); } @@ -125,7 +125,7 @@ unsigned long segv(unsigned long address, unsigned long ip, int is_write, flush_tlb_kernel_vm(); return(0); } - else if(check_remapped_addr(address & PAGE_MASK, is_write)) + else if(check_remapped_addr(address & PAGE_MASK, is_write, is_user)) return(0); else if(current->mm == NULL) panic("Segfault with no mm"); |