|
| 1 | +#ifndef _ASM_LKL_UACCESS_H |
| 2 | +#define _ASM_LKL_UACCESS_H |
| 3 | + |
| 4 | +#include <linux/compiler.h> |
| 5 | +#include <linux/types.h> |
| 6 | +#include <linux/irqflags.h> |
| 7 | +#include <linux/string.h> |
| 8 | +#include <asm/errno.h> |
| 9 | +#include <asm/thread_info.h> |
| 10 | + |
| 11 | +#ifdef ENABLE_SYSPROXY |
| 12 | +#include <rump/rumpuser.h> |
| 13 | +#endif |
| 14 | + |
| 15 | +#define __access_ok(addr, size) (1) |
| 16 | + |
| 17 | +/* handle rump remote client */ |
| 18 | +static inline __must_check long __copy_from_user(void *to, |
| 19 | + const void __user *from, unsigned long n) |
| 20 | +{ |
| 21 | + int error = 0; |
| 22 | + struct thread_info *ti; |
| 23 | + |
| 24 | + ti = current_thread_info(); |
| 25 | + |
| 26 | + if (unlikely(from == NULL && n)) |
| 27 | + return -EFAULT; |
| 28 | + |
| 29 | + if (!ti->rump_client) { |
| 30 | + memcpy(to, from, n); |
| 31 | + } else if (n) { |
| 32 | +#ifdef ENABLE_SYSPROXY |
| 33 | + error = rumpuser_sp_copyin(ti->rump_client, from, to, n); |
| 34 | +#else |
| 35 | + ; |
| 36 | +#endif |
| 37 | + } |
| 38 | + |
| 39 | + return error; |
| 40 | +} |
| 41 | +#define __copy_from_user(to, from, n) __copy_from_user(to, from, n) |
| 42 | + |
| 43 | +static inline __must_check long __copy_to_user(void __user *to, |
| 44 | + const void *from, unsigned long n) |
| 45 | +{ |
| 46 | + int error = 0; |
| 47 | + struct thread_info *ti; |
| 48 | + |
| 49 | + ti = current_thread_info(); |
| 50 | + |
| 51 | + if (unlikely(to == NULL && n)) |
| 52 | + return -EFAULT; |
| 53 | + |
| 54 | + if (!ti->rump_client) { |
| 55 | + memcpy(to, from, n); |
| 56 | + } else if (n) { |
| 57 | +#ifdef ENABLE_SYSPROXY |
| 58 | + error = rumpuser_sp_copyout(ti->rump_client, from, to, n); |
| 59 | +#else |
| 60 | + ; |
| 61 | +#endif |
| 62 | + } |
| 63 | + |
| 64 | + return error; |
| 65 | +} |
| 66 | +#define __copy_to_user(to, from, n) __copy_to_user(to, from, n) |
| 67 | + |
| 68 | +#include <asm-generic/uaccess.h> |
| 69 | + |
| 70 | +#endif /* _ASM_LKL_UACCESS_H */ |
0 commit comments