Merge tag 'io_uring-20190323' of git://git.kernel.dk/linux-block
[linux-2.6-block.git] / arch / arm / lib / putuser.S
CommitLineData
1da177e4
LT
1/*
2 * linux/arch/arm/lib/putuser.S
3 *
4 * Copyright (C) 2001 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Idea from x86 version, (C) Copyright 1998 Linus Torvalds
11 *
12 * These functions have a non-standard call interface to make
13 * them more efficient, especially as they return an error
14 * value in addition to the "real" return value.
15 *
16 * __put_user_X
17 *
18 * Inputs: r0 contains the address
8404663f 19 * r1 contains the address limit, which must be preserved
1da177e4
LT
20 * r2, r3 contains the value
21 * Outputs: r0 is the error code
22 * lr corrupted
23 *
4baa9922 24 * No other registers must be altered. (see <asm/uaccess.h>
1da177e4
LT
25 * for specific ASM register usage).
26 *
27 * Note that ADDR_LIMIT is either 0 or 0xc0000000
28 * Note also that it is intended that __put_user_bad is not global.
29 */
93ed3970 30#include <linux/linkage.h>
8404663f 31#include <asm/assembler.h>
1da177e4 32#include <asm/errno.h>
247055aa 33#include <asm/domain.h>
1da177e4 34
93ed3970 35ENTRY(__put_user_1)
8404663f 36 check_uaccess r0, 1, r1, ip, __put_user_bad
4e7682d0 371: TUSER(strb) r2, [r0]
1da177e4 38 mov r0, #0
6ebbf2ce 39 ret lr
93ed3970 40ENDPROC(__put_user_1)
1da177e4 41
93ed3970 42ENTRY(__put_user_2)
8404663f 43 check_uaccess r0, 2, r1, ip, __put_user_bad
344eb553
VW
44#if __LINUX_ARM_ARCH__ >= 6
45
462: TUSER(strh) r2, [r0]
47
8b592783 48#else
344eb553
VW
49
50 mov ip, r2, lsr #8
1da177e4 51#ifndef __ARMEB__
4e7682d0
CM
522: TUSER(strb) r2, [r0], #1
533: TUSER(strb) ip, [r0]
1da177e4 54#else
4e7682d0
CM
552: TUSER(strb) ip, [r0], #1
563: TUSER(strb) r2, [r0]
1da177e4 57#endif
344eb553
VW
58
59#endif /* __LINUX_ARM_ARCH__ >= 6 */
1da177e4 60 mov r0, #0
6ebbf2ce 61 ret lr
93ed3970 62ENDPROC(__put_user_2)
1da177e4 63
93ed3970 64ENTRY(__put_user_4)
8404663f 65 check_uaccess r0, 4, r1, ip, __put_user_bad
4e7682d0 664: TUSER(str) r2, [r0]
1da177e4 67 mov r0, #0
6ebbf2ce 68 ret lr
93ed3970 69ENDPROC(__put_user_4)
1da177e4 70
93ed3970 71ENTRY(__put_user_8)
8404663f 72 check_uaccess r0, 8, r1, ip, __put_user_bad
8b592783 73#ifdef CONFIG_THUMB2_KERNEL
4e7682d0
CM
745: TUSER(str) r2, [r0]
756: TUSER(str) r3, [r0, #4]
8b592783 76#else
4e7682d0
CM
775: TUSER(str) r2, [r0], #4
786: TUSER(str) r3, [r0]
8b592783 79#endif
1da177e4 80 mov r0, #0
6ebbf2ce 81 ret lr
93ed3970 82ENDPROC(__put_user_8)
1da177e4
LT
83
84__put_user_bad:
85 mov r0, #-EFAULT
6ebbf2ce 86 ret lr
93ed3970 87ENDPROC(__put_user_bad)
1da177e4 88
4260415f 89.pushsection __ex_table, "a"
1da177e4
LT
90 .long 1b, __put_user_bad
91 .long 2b, __put_user_bad
344eb553 92#if __LINUX_ARM_ARCH__ < 6
1da177e4 93 .long 3b, __put_user_bad
344eb553 94#endif
1da177e4
LT
95 .long 4b, __put_user_bad
96 .long 5b, __put_user_bad
97 .long 6b, __put_user_bad
4260415f 98.popsection