1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _ASMARM_UACCESS_H 20 #define _ASMARM_UACCESS_H 21 #include <linux/sched.h> 22 #include <asm/errno.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #include <asm/memory.h> 25 #include <asm/domain.h> 26 #include <asm/system.h> 27 #define VERIFY_READ 0 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define VERIFY_WRITE 1 30 struct exception_table_entry 31 { 32 unsigned long insn, fixup; 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 }; 35 #define KERNEL_DS 0x00000000 36 #define get_ds() (KERNEL_DS) 37 #define USER_DS KERNEL_DS 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define segment_eq(a,b) (1) 40 #define __addr_ok(addr) (1) 41 #define __range_ok(addr,size) (0) 42 #define get_fs() (KERNEL_DS) 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 #define get_user(x,p) __get_user(x,p) 45 #define put_user(x,p) __put_user(x,p) 46 #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) 47 #define __get_user(x,ptr) ({ long __gu_err = 0; __get_user_err((x),(ptr),__gu_err); __gu_err; }) 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 #define __get_user_error(x,ptr,err) ({ __get_user_err((x),(ptr),err); (void) 0; }) 50 #define __get_user_err(x,ptr,err) do { unsigned long __gu_addr = (unsigned long)(ptr); unsigned long __gu_val; __chk_user_ptr(ptr); switch (sizeof(*(ptr))) { case 1: __get_user_asm_byte(__gu_val,__gu_addr,err); break; case 2: __get_user_asm_half(__gu_val,__gu_addr,err); break; case 4: __get_user_asm_word(__gu_val,__gu_addr,err); break; default: (__gu_val) = __get_user_bad(); } (x) = (__typeof__(*(ptr)))__gu_val; } while (0) 51 #define __get_user_asm_byte(x,addr,err) __asm__ __volatile__( "1: ldrbt %1,[%2],#0\n" "2:\n" " .section .fixup,\"ax\"\n" " .align 2\n" "3: mov %0, %3\n" " mov %1, #0\n" " b 2b\n" " .previous\n" " .section __ex_table,\"a\"\n" " .align 3\n" " .long 1b, 3b\n" " .previous" : "+r" (err), "=&r" (x) : "r" (addr), "i" (-EFAULT) : "cc") 52 #ifndef __ARMEB__ 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 #define __get_user_asm_half(x,__gu_addr,err) ({ unsigned long __b1, __b2; __get_user_asm_byte(__b1, __gu_addr, err); __get_user_asm_byte(__b2, __gu_addr + 1, err); (x) = __b1 | (__b2 << 8); }) 55 #else 56 #define __get_user_asm_half(x,__gu_addr,err) ({ unsigned long __b1, __b2; __get_user_asm_byte(__b1, __gu_addr, err); __get_user_asm_byte(__b2, __gu_addr + 1, err); (x) = (__b1 << 8) | __b2; }) 57 #endif 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 #define __get_user_asm_word(x,addr,err) __asm__ __volatile__( "1: ldrt %1,[%2],#0\n" "2:\n" " .section .fixup,\"ax\"\n" " .align 2\n" "3: mov %0, %3\n" " mov %1, #0\n" " b 2b\n" " .previous\n" " .section __ex_table,\"a\"\n" " .align 3\n" " .long 1b, 3b\n" " .previous" : "+r" (err), "=&r" (x) : "r" (addr), "i" (-EFAULT) : "cc") 60 #define __put_user(x,ptr) ({ long __pu_err = 0; __put_user_err((x),(ptr),__pu_err); __pu_err; }) 61 #define __put_user_error(x,ptr,err) ({ __put_user_err((x),(ptr),err); (void) 0; }) 62 #define __put_user_err(x,ptr,err) do { unsigned long __pu_addr = (unsigned long)(ptr); __typeof__(*(ptr)) __pu_val = (x); __chk_user_ptr(ptr); switch (sizeof(*(ptr))) { case 1: __put_user_asm_byte(__pu_val,__pu_addr,err); break; case 2: __put_user_asm_half(__pu_val,__pu_addr,err); break; case 4: __put_user_asm_word(__pu_val,__pu_addr,err); break; case 8: __put_user_asm_dword(__pu_val,__pu_addr,err); break; default: __put_user_bad(); } } while (0) 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #define __put_user_asm_byte(x,__pu_addr,err) __asm__ __volatile__( "1: strbt %1,[%2],#0\n" "2:\n" " .section .fixup,\"ax\"\n" " .align 2\n" "3: mov %0, %3\n" " b 2b\n" " .previous\n" " .section __ex_table,\"a\"\n" " .align 3\n" " .long 1b, 3b\n" " .previous" : "+r" (err) : "r" (x), "r" (__pu_addr), "i" (-EFAULT) : "cc") 65 #ifndef __ARMEB__ 66 #define __put_user_asm_half(x,__pu_addr,err) ({ unsigned long __temp = (unsigned long)(x); __put_user_asm_byte(__temp, __pu_addr, err); __put_user_asm_byte(__temp >> 8, __pu_addr + 1, err); }) 67 #else 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 #define __put_user_asm_half(x,__pu_addr,err) ({ unsigned long __temp = (unsigned long)(x); __put_user_asm_byte(__temp >> 8, __pu_addr, err); __put_user_asm_byte(__temp, __pu_addr + 1, err); }) 70 #endif 71 #define __put_user_asm_word(x,__pu_addr,err) __asm__ __volatile__( "1: strt %1,[%2],#0\n" "2:\n" " .section .fixup,\"ax\"\n" " .align 2\n" "3: mov %0, %3\n" " b 2b\n" " .previous\n" " .section __ex_table,\"a\"\n" " .align 3\n" " .long 1b, 3b\n" " .previous" : "+r" (err) : "r" (x), "r" (__pu_addr), "i" (-EFAULT) : "cc") 72 #ifndef __ARMEB__ 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 #define __reg_oper0 "%R2" 75 #define __reg_oper1 "%Q2" 76 #else 77 #define __reg_oper0 "%Q2" 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 #define __reg_oper1 "%R2" 80 #endif 81 #define __put_user_asm_dword(x,__pu_addr,err) __asm__ __volatile__( "1: strt " __reg_oper1 ", [%1], #4\n" "2: strt " __reg_oper0 ", [%1], #0\n" "3:\n" " .section .fixup,\"ax\"\n" " .align 2\n" "4: mov %0, %3\n" " b 3b\n" " .previous\n" " .section __ex_table,\"a\"\n" " .align 3\n" " .long 1b, 4b\n" " .long 2b, 4b\n" " .previous" : "+r" (err), "+r" (__pu_addr) : "r" (x), "i" (-EFAULT) : "cc") 82 #define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0) 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 #define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0) 85 #define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0) 86 #define __copy_to_user_inatomic __copy_to_user 87 #define __copy_from_user_inatomic __copy_from_user 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 #define strlen_user(s) strnlen_user(s, ~0UL >> 1) 90 #endif 91