-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Richter
authored and
Ingo Molnar
committed
Jul 21, 2011
1 parent
432e01a
commit 644f660
Showing
6 changed files
with
49 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 9985c20f9e4aee6857c08246b273a3695a52b929 | ||
refs/heads/master: 1ac2e6ca44e13a087eb7438d284f887097ee7e84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* User address space access functions. | ||
* | ||
* For licencing details see kernel-base/COPYING | ||
*/ | ||
|
||
#include <linux/highmem.h> | ||
#include <linux/module.h> | ||
|
||
/* | ||
* best effort, GUP based copy_from_user() that is NMI-safe | ||
*/ | ||
unsigned long | ||
copy_from_user_nmi(void *to, const void __user *from, unsigned long n) | ||
{ | ||
unsigned long offset, addr = (unsigned long)from; | ||
unsigned long size, len = 0; | ||
struct page *page; | ||
void *map; | ||
int ret; | ||
|
||
do { | ||
ret = __get_user_pages_fast(addr, 1, 0, &page); | ||
if (!ret) | ||
break; | ||
|
||
offset = addr & (PAGE_SIZE - 1); | ||
size = min(PAGE_SIZE - offset, n - len); | ||
|
||
map = kmap_atomic(page); | ||
memcpy(to, map+offset, size); | ||
kunmap_atomic(map); | ||
put_page(page); | ||
|
||
len += size; | ||
to += size; | ||
addr += size; | ||
|
||
} while (len < n); | ||
|
||
return len; | ||
} | ||
EXPORT_SYMBOL_GPL(copy_from_user_nmi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters