2 * include/asm-xtensa/uaccess.h
4 * User space memory access functions
6 * These routines provide basic accessing functions to the user memory
7 * space for the kernel. This header file provides functions such as:
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
13 * Copyright (C) 2001 - 2005 Tensilica Inc.
16 #ifndef _XTENSA_ASM_UACCESS_H
17 #define _XTENSA_ASM_UACCESS_H
19 #include <linux/errno.h>
20 #include <asm/types.h>
22 #include <asm/current.h>
23 #include <asm/asm-offsets.h>
24 #include <asm/processor.h>
27 * user_ok determines whether the access to user-space memory is allowed.
28 * See the equivalent C-macro version below for clarity.
30 * On error, user_ok branches to a label indicated by parameter
31 * <error>. This implies that the macro falls through to the next
32 * instruction on success.
34 * Note that while this macro can be used independently, we designed
35 * in for optimal use in the access_ok macro below (i.e., we fall
36 * through on success).
39 * <aa> register containing memory address
40 * <as> register containing memory size
42 * <error> label to branch to on error; implies fall-through
47 * <at> destroyed (actually, (TASK_SIZE + 1 - size))
49 .macro user_ok aa
, as
, at
, error
50 movi
\at
, __XTENSA_UL_CONST(TASK_SIZE
)
57 * access_ok determines whether a memory access is allowed. See the
58 * equivalent C-macro version below for clarity.
60 * On error, access_ok branches to a label indicated by parameter
61 * <error>. This implies that the macro falls through to the next
62 * instruction on success.
64 * Note that we assume success is the common case, and we optimize the
65 * branch fall-through case on success.
68 * <aa> register containing memory address
69 * <as> register containing memory size
72 * <error> label to branch to on error; implies fall-through
79 .macro access_ok aa
, as
, at
, sp
, error
80 user_ok
\aa
, \as
, \at
, \error
84 #endif /* _XTENSA_ASM_UACCESS_H */