Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
uaccess_64.h File Reference
#include <asm/processor.h>

Go to the source code of this file.

Data Structures

struct  exception_table_entry
 
struct  __large_struct
 

Macros

#define KERNEL_DS   ((mm_segment_t) { ASI_P })
 
#define USER_DS   ((mm_segment_t) { ASI_AIUS }) /* har har har */
 
#define VERIFY_READ   0
 
#define VERIFY_WRITE   1
 
#define get_fs()   ((mm_segment_t) { get_thread_current_ds() })
 
#define get_ds()   (KERNEL_DS)
 
#define segment_eq(a, b)   ((a).seg == (b).seg)
 
#define set_fs(val)
 
#define put_user(x, ptr)
 
#define get_user(x, ptr)
 
#define __put_user(x, ptr)   put_user(x,ptr)
 
#define __get_user(x, ptr)   get_user(x,ptr)
 
#define __m(x)   ((struct __large_struct *)(x))
 
#define __put_user_nocheck(data, addr, size)
 
#define __put_user_asm(x, size, addr, ret)
 
#define __get_user_nocheck(data, addr, size, type)
 
#define __get_user_nocheck_ret(data, addr, size, type, retval)
 
#define __get_user_asm(x, size, addr, ret)
 
#define __get_user_asm_ret(x, size, addr, retval)
 
#define __copy_from_user   copy_from_user
 
#define __copy_to_user   copy_to_user
 
#define __copy_in_user   copy_in_user
 
#define clear_user   __clear_user
 
#define __copy_to_user_inatomic   ___copy_to_user
 
#define __copy_from_user_inatomic   ___copy_from_user
 

Functions

void __ret_efault (void)
 
void __retl_efault (void)
 
int __put_user_bad (void)
 
int __get_user_bad (void)
 
unsigned long __must_check ___copy_from_user (void *to, const void __user *from, unsigned long size)
 
unsigned long copy_from_user_fixup (void *to, const void __user *from, unsigned long size)
 
unsigned long __must_check ___copy_to_user (void __user *to, const void *from, unsigned long size)
 
unsigned long copy_to_user_fixup (void __user *to, const void *from, unsigned long size)
 
unsigned long __must_check ___copy_in_user (void __user *to, const void __user *from, unsigned long size)
 
unsigned long copy_in_user_fixup (void __user *to, void __user *from, unsigned long size)
 
unsigned long __must_check __clear_user (void __user *, unsigned long)
 
__must_check long strlen_user (const char __user *str)
 
__must_check long strnlen_user (const char __user *str, long n)
 
unsigned long compute_effective_address (struct pt_regs *, unsigned int insn, unsigned int rd)
 

Macro Definition Documentation

#define __copy_from_user   copy_from_user

Definition at line 224 of file uaccess_64.h.

#define __copy_from_user_inatomic   ___copy_from_user

Definition at line 266 of file uaccess_64.h.

#define __copy_in_user   copy_in_user

Definition at line 256 of file uaccess_64.h.

#define __copy_to_user   copy_to_user

Definition at line 240 of file uaccess_64.h.

#define __copy_to_user_inatomic   ___copy_to_user

Definition at line 265 of file uaccess_64.h.

#define __get_user (   x,
  ptr 
)    get_user(x,ptr)

Definition at line 102 of file uaccess_64.h.

#define __get_user_asm (   x,
  size,
  addr,
  ret 
)
Value:
__asm__ __volatile__( \
"/* Get user asm, inline. */\n" \
"1:\t" "ld"#size "a [%2] %%asi, %1\n\t" \
"clr %0\n" \
"2:\n\n\t" \
".section .fixup,#alloc,#execinstr\n\t" \
".align 4\n" \
"3:\n\t" \
"sethi %%hi(2b), %0\n\t" \
"clr %1\n\t" \
"jmpl %0 + %%lo(2b), %%g0\n\t" \
" mov %3, %0\n\n\t" \
".previous\n\t" \
".section __ex_table,\"a\"\n\t" \
".align 4\n\t" \
".word 1b, 3b\n\n\t" \
".previous\n\t" \
: "=r" (ret), "=r" (x) : "r" (__m(addr)), \
"i" (-EFAULT))

Definition at line 160 of file uaccess_64.h.

#define __get_user_asm_ret (   x,
  size,
  addr,
  retval 
)
Value:
if (__builtin_constant_p(retval) && retval == -EFAULT) \
__asm__ __volatile__( \
"/* Get user asm ret, inline. */\n" \
"1:\t" "ld"#size "a [%1] %%asi, %0\n\n\t" \
".section __ex_table,\"a\"\n\t" \
".align 4\n\t" \
".word 1b,__ret_efault\n\n\t" \
".previous\n\t" \
: "=r" (x) : "r" (__m(addr))); \
else \
__asm__ __volatile__( \
"/* Get user asm ret, inline. */\n" \
"1:\t" "ld"#size "a [%1] %%asi, %0\n\n\t" \
".section .fixup,#alloc,#execinstr\n\t" \
".align 4\n" \
"3:\n\t" \
"ret\n\t" \
" restore %%g0, %2, %%o0\n\n\t" \
".previous\n\t" \
".section __ex_table,\"a\"\n\t" \
".align 4\n\t" \
".word 1b, 3b\n\n\t" \
".previous\n\t" \
: "=r" (x) : "r" (__m(addr)), "i" (retval))

Definition at line 181 of file uaccess_64.h.

#define __get_user_nocheck (   data,
  addr,
  size,
  type 
)
Value:
({ \
register int __gu_ret; \
register unsigned long __gu_val; \
switch (size) { \
case 1: __get_user_asm(__gu_val,ub,addr,__gu_ret); break; \
case 2: __get_user_asm(__gu_val,uh,addr,__gu_ret); break; \
case 4: __get_user_asm(__gu_val,uw,addr,__gu_ret); break; \
case 8: __get_user_asm(__gu_val,x,addr,__gu_ret); break; \
default: __gu_val = 0; __gu_ret = __get_user_bad(); break; \
} data = (type) __gu_val; __gu_ret; })

Definition at line 139 of file uaccess_64.h.

#define __get_user_nocheck_ret (   data,
  addr,
  size,
  type,
  retval 
)
Value:
({ \
register unsigned long __gu_val __asm__ ("l1"); \
switch (size) { \
case 1: __get_user_asm_ret(__gu_val,ub,addr,retval); break; \
case 2: __get_user_asm_ret(__gu_val,uh,addr,retval); break; \
case 4: __get_user_asm_ret(__gu_val,uw,addr,retval); break; \
case 8: __get_user_asm_ret(__gu_val,x,addr,retval); break; \
default: if (__get_user_bad()) return retval; \
} data = (type) __gu_val; })

Definition at line 150 of file uaccess_64.h.

#define __m (   x)    ((struct __large_struct *)(x))

Definition at line 105 of file uaccess_64.h.

#define __put_user (   x,
  ptr 
)    put_user(x,ptr)

Definition at line 101 of file uaccess_64.h.

#define __put_user_asm (   x,
  size,
  addr,
  ret 
)
Value:
__asm__ __volatile__( \
"/* Put user asm, inline. */\n" \
"1:\t" "st"#size "a %1, [%2] %%asi\n\t" \
"clr %0\n" \
"2:\n\n\t" \
".section .fixup,#alloc,#execinstr\n\t" \
".align 4\n" \
"3:\n\t" \
"sethi %%hi(2b), %0\n\t" \
"jmpl %0 + %%lo(2b), %%g0\n\t" \
" mov %3, %0\n\n\t" \
".previous\n\t" \
".section __ex_table,\"a\"\n\t" \
".align 4\n\t" \
".word 1b, 3b\n\t" \
".previous\n\n\t" \
: "=r" (ret) : "r" (x), "r" (__m(addr)), \
"i" (-EFAULT))

Definition at line 117 of file uaccess_64.h.

#define __put_user_nocheck (   data,
  addr,
  size 
)
Value:
({ \
register int __pu_ret; \
switch (size) { \
case 1: __put_user_asm(data,b,addr,__pu_ret); break; \
case 2: __put_user_asm(data,h,addr,__pu_ret); break; \
case 4: __put_user_asm(data,w,addr,__pu_ret); break; \
case 8: __put_user_asm(data,x,addr,__pu_ret); break; \
default: __pu_ret = __put_user_bad(); break; \
} __pu_ret; })

Definition at line 107 of file uaccess_64.h.

#define clear_user   __clear_user

Definition at line 260 of file uaccess_64.h.

#define get_ds (   void)    (KERNEL_DS)

Definition at line 42 of file uaccess_64.h.

#define get_fs (   void)    ((mm_segment_t) { get_thread_current_ds() })

Definition at line 41 of file uaccess_64.h.

#define get_user (   x,
  ptr 
)
Value:
({ \
unsigned long __gu_addr = (unsigned long)(ptr); \
__chk_user_ptr(ptr); \
__get_user_nocheck((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })

Definition at line 96 of file uaccess_64.h.

#define KERNEL_DS   ((mm_segment_t) { ASI_P })

Definition at line 35 of file uaccess_64.h.

#define put_user (   x,
  ptr 
)
Value:
({ \
unsigned long __pu_addr = (unsigned long)(ptr); \
__chk_user_ptr(ptr); \
__put_user_nocheck((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })

Definition at line 91 of file uaccess_64.h.

#define segment_eq (   a,
  b 
)    ((a).seg == (b).seg)

Definition at line 44 of file uaccess_64.h.

#define set_fs (   val)
Value:
do { \
set_thread_current_ds((val).seg); \
__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \
} while(0)

Definition at line 46 of file uaccess_64.h.

#define USER_DS   ((mm_segment_t) { ASI_AIUS }) /* har har har */

Definition at line 36 of file uaccess_64.h.

#define VERIFY_READ   0

Definition at line 38 of file uaccess_64.h.

#define VERIFY_WRITE   1

Definition at line 39 of file uaccess_64.h.

Function Documentation

unsigned long __must_check ___copy_from_user ( void to,
const void __user from,
unsigned long  size 
)
unsigned long __must_check ___copy_in_user ( void __user to,
const void __user from,
unsigned long  size 
)
unsigned long __must_check ___copy_to_user ( void __user to,
const void from,
unsigned long  size 
)
unsigned long __must_check __clear_user ( void __user addr,
unsigned long  size 
)

__clear_user: - Zero a block of memory in user space, with less checking. : Destination address, in user space.
: Number of bytes to zero.

Zero a block of memory in user space. Caller must check the specified block with access_ok() before calling this function.

Returns number of bytes that could not be cleared. On success, this will be zero.

Definition at line 158 of file uaccess_with_memcpy.c.

int __get_user_bad ( void  )
int __put_user_bad ( void  )
void __ret_efault ( void  )
void __retl_efault ( void  )
unsigned long compute_effective_address ( struct pt_regs ,
unsigned int  insn,
unsigned int  rd 
)

Definition at line 163 of file unaligned_64.c.

unsigned long copy_from_user_fixup ( void to,
const void __user from,
unsigned long  size 
)

Definition at line 35 of file user_fixup.c.

unsigned long copy_in_user_fixup ( void __user to,
void __user from,
unsigned long  size 
)

Definition at line 55 of file user_fixup.c.

unsigned long copy_to_user_fixup ( void __user to,
const void from,
unsigned long  size 
)

Definition at line 47 of file user_fixup.c.

__must_check long strlen_user ( const char __user str)

strlen_user: - Get the size of a user string INCLUDING final NUL. : The string to measure.

Context: User context only. This function may sleep.

Get the size of a NUL-terminated string in user space.

Returns the size of the string INCLUDING the terminating NUL. On exception, returns 0.

If there is a limit on the length of a valid string, you may wish to consider using strnlen_user() instead.

Definition at line 126 of file strnlen_user.c.

__must_check long strnlen_user ( const char __user str,
long  count 
)

strnlen_user: - Get the size of a user string INCLUDING final NUL. : The string to measure. : Maximum count (including NUL character)

Context: User context only. This function may sleep.

Get the size of a NUL-terminated string in user space.

Returns the size of the string INCLUDING the terminating NUL. If the string is too long, returns 'count+1'. On exception (or invalid count), returns 0.

Definition at line 72 of file uaccess.c.