2 * User address space access functions.
4 * For licencing details see kernel-base/COPYING
7 #include <linux/highmem.h>
8 #include <linux/module.h>
11 * best effort, GUP based copy_from_user() that is NMI-safe
14 copy_from_user_nmi(void *to
, const void __user
*from
, unsigned long n
)
16 unsigned long offset
, addr
= (unsigned long)from
;
17 unsigned long size
, len
= 0;
23 ret
= __get_user_pages_fast(addr
, 1, 0, &page
);
27 offset
= addr
& (PAGE_SIZE
- 1);
28 size
= min(PAGE_SIZE
- offset
, n
- len
);
30 map
= kmap_atomic(page
);
31 memcpy(to
, map
+offset
, size
);
43 EXPORT_SYMBOL_GPL(copy_from_user_nmi
);