Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) |
| 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
| 6 | #include "linux/sched.h" |
| 7 | #include "asm/uaccess.h" |
| 8 | |
| 9 | int copy_from_user_tt(void *to, const void __user *from, int n) |
| 10 | { |
| 11 | if(!access_ok_tt(VERIFY_READ, from, n)) |
| 12 | return(n); |
| 13 | |
| 14 | return(__do_copy_from_user(to, from, n, ¤t->thread.fault_addr, |
| 15 | ¤t->thread.fault_catcher)); |
| 16 | } |
| 17 | |
| 18 | int copy_to_user_tt(void __user *to, const void *from, int n) |
| 19 | { |
| 20 | if(!access_ok_tt(VERIFY_WRITE, to, n)) |
| 21 | return(n); |
| 22 | |
| 23 | return(__do_copy_to_user(to, from, n, ¤t->thread.fault_addr, |
| 24 | ¤t->thread.fault_catcher)); |
| 25 | } |
| 26 | |
| 27 | int strncpy_from_user_tt(char *dst, const char __user *src, int count) |
| 28 | { |
| 29 | int n; |
| 30 | |
| 31 | if(!access_ok_tt(VERIFY_READ, src, 1)) |
| 32 | return(-EFAULT); |
| 33 | |
| 34 | n = __do_strncpy_from_user(dst, src, count, |
| 35 | ¤t->thread.fault_addr, |
| 36 | ¤t->thread.fault_catcher); |
| 37 | if(n < 0) return(-EFAULT); |
| 38 | return(n); |
| 39 | } |
| 40 | |
| 41 | int __clear_user_tt(void __user *mem, int len) |
| 42 | { |
| 43 | return(__do_clear_user(mem, len, |
| 44 | ¤t->thread.fault_addr, |
| 45 | ¤t->thread.fault_catcher)); |
| 46 | } |
| 47 | |
| 48 | int clear_user_tt(void __user *mem, int len) |
| 49 | { |
| 50 | if(!access_ok_tt(VERIFY_WRITE, mem, len)) |
| 51 | return(len); |
| 52 | |
| 53 | return(__do_clear_user(mem, len, ¤t->thread.fault_addr, |
| 54 | ¤t->thread.fault_catcher)); |
| 55 | } |
| 56 | |
| 57 | int strnlen_user_tt(const void __user *str, int len) |
| 58 | { |
| 59 | return(__do_strnlen_user(str, len, |
| 60 | ¤t->thread.fault_addr, |
| 61 | ¤t->thread.fault_catcher)); |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | * Overrides for Emacs so that we follow Linus's tabbing style. |
| 66 | * Emacs will notice this stuff at the end of the file and automatically |
| 67 | * adjust the settings for this buffer only. This must remain at the end |
| 68 | * of the file. |
| 69 | * --------------------------------------------------------------------------- |
| 70 | * Local variables: |
| 71 | * c-file-style: "linux" |
| 72 | * End: |
| 73 | */ |