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 | #ifndef __TT_UACCESS_H |
| 7 | #define __TT_UACCESS_H |
| 8 | |
| 9 | #include "linux/string.h" |
| 10 | #include "linux/sched.h" |
| 11 | #include "asm/processor.h" |
| 12 | #include "asm/errno.h" |
| 13 | #include "asm/current.h" |
| 14 | #include "asm/a.out.h" |
| 15 | #include "uml_uaccess.h" |
| 16 | |
| 17 | #define ABOVE_KMEM (16 * 1024 * 1024) |
| 18 | |
| 19 | extern unsigned long end_vm; |
| 20 | extern unsigned long uml_physmem; |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #define is_stack(addr, size) \ |
| 23 | (((unsigned long) (addr) < STACK_TOP) && \ |
| 24 | ((unsigned long) (addr) >= STACK_TOP - ABOVE_KMEM) && \ |
| 25 | (((unsigned long) (addr) + (size)) <= STACK_TOP)) |
| 26 | |
| 27 | #define access_ok_tt(type, addr, size) \ |
Paolo 'Blaisorblade' Giarrusso | 7a59061 | 2005-11-13 16:07:13 -0800 | [diff] [blame] | 28 | (is_stack(addr, size)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | extern int __do_copy_from_user(void *to, const void *from, int n, |
| 31 | void **fault_addr, void **fault_catcher); |
| 32 | extern int __do_strncpy_from_user(char *dst, const char *src, size_t n, |
| 33 | void **fault_addr, void **fault_catcher); |
| 34 | extern int __do_clear_user(void *mem, size_t len, void **fault_addr, |
| 35 | void **fault_catcher); |
| 36 | extern int __do_strnlen_user(const char *str, unsigned long n, |
| 37 | void **fault_addr, void **fault_catcher); |
| 38 | |
viro@ZenIV.linux.org.uk | 85c3920 | 2005-09-09 17:15:13 +0100 | [diff] [blame] | 39 | extern int copy_from_user_tt(void *to, const void __user *from, int n); |
| 40 | extern int copy_to_user_tt(void __user *to, const void *from, int n); |
| 41 | extern int strncpy_from_user_tt(char *dst, const char __user *src, int count); |
| 42 | extern int __clear_user_tt(void __user *mem, int len); |
| 43 | extern int clear_user_tt(void __user *mem, int len); |
| 44 | extern int strnlen_user_tt(const void __user *str, int len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
| 46 | #endif |