Path: blob/master/arch/xtensa/include/asm/asm-uaccess.h
26451 views
/*1* include/asm-xtensa/uaccess.h2*3* User space memory access functions4*5* These routines provide basic accessing functions to the user memory6* space for the kernel. This header file provides functions such as:7*8* This file is subject to the terms and conditions of the GNU General Public9* License. See the file "COPYING" in the main directory of this archive10* for more details.11*12* Copyright (C) 2001 - 2005 Tensilica Inc.13*/1415#ifndef _XTENSA_ASM_UACCESS_H16#define _XTENSA_ASM_UACCESS_H1718#include <linux/errno.h>19#include <asm/types.h>2021#include <asm/current.h>22#include <asm/asm-offsets.h>23#include <asm/processor.h>2425/*26* user_ok determines whether the access to user-space memory is allowed.27* See the equivalent C-macro version below for clarity.28*29* On error, user_ok branches to a label indicated by parameter30* <error>. This implies that the macro falls through to the next31* instruction on success.32*33* Note that while this macro can be used independently, we designed34* in for optimal use in the access_ok macro below (i.e., we fall35* through on success).36*37* On Entry:38* <aa> register containing memory address39* <as> register containing memory size40* <at> temp register41* <error> label to branch to on error; implies fall-through42* macro on success43* On Exit:44* <aa> preserved45* <as> preserved46* <at> destroyed (actually, (TASK_SIZE + 1 - size))47*/48.macro user_ok aa, as, at, error49movi \at, __XTENSA_UL_CONST(TASK_SIZE)50bgeu \as, \at, \error51sub \at, \at, \as52bgeu \aa, \at, \error53.endm5455/*56* access_ok determines whether a memory access is allowed. See the57* equivalent C-macro version below for clarity.58*59* On error, access_ok branches to a label indicated by parameter60* <error>. This implies that the macro falls through to the next61* instruction on success.62*63* Note that we assume success is the common case, and we optimize the64* branch fall-through case on success.65*66* On Entry:67* <aa> register containing memory address68* <as> register containing memory size69* <at> temp register70* <sp>71* <error> label to branch to on error; implies fall-through72* macro on success73* On Exit:74* <aa> preserved75* <as> preserved76* <at> destroyed77*/78.macro access_ok aa, as, at, sp, error79user_ok \aa, \as, \at, \error80.Laccess_ok_\@:81.endm8283#endif /* _XTENSA_ASM_UACCESS_H */848586