aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/kernel/skas/uaccess.c15
-rw-r--r--include/asm-um/kmap_types.h20
2 files changed, 28 insertions, 7 deletions
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 5992c3257167..8912cec0fe43 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -8,6 +8,7 @@
8#include "linux/kernel.h" 8#include "linux/kernel.h"
9#include "linux/string.h" 9#include "linux/string.h"
10#include "linux/fs.h" 10#include "linux/fs.h"
11#include "linux/hardirq.h"
11#include "linux/highmem.h" 12#include "linux/highmem.h"
12#include "asm/page.h" 13#include "asm/page.h"
13#include "asm/pgtable.h" 14#include "asm/pgtable.h"
@@ -38,7 +39,7 @@ static unsigned long maybe_map(unsigned long virt, int is_write)
38 return((unsigned long) phys); 39 return((unsigned long) phys);
39} 40}
40 41
41static int do_op(unsigned long addr, int len, int is_write, 42static int do_op_one_page(unsigned long addr, int len, int is_write,
42 int (*op)(unsigned long addr, int len, void *arg), void *arg) 43 int (*op)(unsigned long addr, int len, void *arg), void *arg)
43{ 44{
44 struct page *page; 45 struct page *page;
@@ -49,9 +50,11 @@ static int do_op(unsigned long addr, int len, int is_write,
49 return(-1); 50 return(-1);
50 51
51 page = phys_to_page(addr); 52 page = phys_to_page(addr);
52 addr = (unsigned long) kmap(page) + (addr & ~PAGE_MASK); 53 addr = (unsigned long) kmap_atomic(page, KM_UML_USERCOPY) + (addr & ~PAGE_MASK);
54
53 n = (*op)(addr, len, arg); 55 n = (*op)(addr, len, arg);
54 kunmap(page); 56
57 kunmap_atomic(page, KM_UML_USERCOPY);
55 58
56 return(n); 59 return(n);
57} 60}
@@ -77,7 +80,7 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr)
77 remain = len; 80 remain = len;
78 81
79 current->thread.fault_catcher = jmpbuf; 82 current->thread.fault_catcher = jmpbuf;
80 n = do_op(addr, size, is_write, op, arg); 83 n = do_op_one_page(addr, size, is_write, op, arg);
81 if(n != 0){ 84 if(n != 0){
82 *res = (n < 0 ? remain : 0); 85 *res = (n < 0 ? remain : 0);
83 goto out; 86 goto out;
@@ -91,7 +94,7 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr)
91 } 94 }
92 95
93 while(addr < ((addr + remain) & PAGE_MASK)){ 96 while(addr < ((addr + remain) & PAGE_MASK)){
94 n = do_op(addr, PAGE_SIZE, is_write, op, arg); 97 n = do_op_one_page(addr, PAGE_SIZE, is_write, op, arg);
95 if(n != 0){ 98 if(n != 0){
96 *res = (n < 0 ? remain : 0); 99 *res = (n < 0 ? remain : 0);
97 goto out; 100 goto out;
@@ -105,7 +108,7 @@ static void do_buffer_op(void *jmpbuf, void *arg_ptr)
105 goto out; 108 goto out;
106 } 109 }
107 110
108 n = do_op(addr, remain, is_write, op, arg); 111 n = do_op_one_page(addr, remain, is_write, op, arg);
109 if(n != 0) 112 if(n != 0)
110 *res = (n < 0 ? remain : 0); 113 *res = (n < 0 ? remain : 0);
111 else *res = 0; 114 else *res = 0;
diff --git a/include/asm-um/kmap_types.h b/include/asm-um/kmap_types.h
index 0b22ad776e76..6c03acdb4405 100644
--- a/include/asm-um/kmap_types.h
+++ b/include/asm-um/kmap_types.h
@@ -6,6 +6,24 @@
6#ifndef __UM_KMAP_TYPES_H 6#ifndef __UM_KMAP_TYPES_H
7#define __UM_KMAP_TYPES_H 7#define __UM_KMAP_TYPES_H
8 8
9#include "asm/arch/kmap_types.h" 9/* No more #include "asm/arch/kmap_types.h" ! */
10
11enum km_type {
12 KM_BOUNCE_READ,
13 KM_SKB_SUNRPC_DATA,
14 KM_SKB_DATA_SOFTIRQ,
15 KM_USER0,
16 KM_USER1,
17 KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
18 KM_BIO_SRC_IRQ,
19 KM_BIO_DST_IRQ,
20 KM_PTE0,
21 KM_PTE1,
22 KM_IRQ0,
23 KM_IRQ1,
24 KM_SOFTIRQ0,
25 KM_SOFTIRQ1,
26 KM_TYPE_NR
27};
10 28
11#endif 29#endif