Linux 3.12
[linux/fpc-iii.git] / arch / um / kernel / maccess.c
blob1f3d5c4910d10f109f13d7c8361da8e66a3bc8b9
1 /*
2 * Copyright (C) 2013 Richard Weinberger <richrd@nod.at>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #include <linux/uaccess.h>
10 #include <linux/kernel.h>
11 #include <os.h>
13 long probe_kernel_read(void *dst, const void *src, size_t size)
15 void *psrc = (void *)rounddown((unsigned long)src, PAGE_SIZE);
17 if ((unsigned long)src < PAGE_SIZE || size <= 0)
18 return -EFAULT;
20 if (os_mincore(psrc, size + src - psrc) <= 0)
21 return -EFAULT;
23 return __probe_kernel_read(dst, src, size);