aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/lib/putuser.S
blob: 62d4a42adb9b6d3cef08a0fd9e4ac47e9cf620c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Based on arch/arm/lib/putuser.S
 *
 * Copyright (C) 2012 ARM Ltd.
 * Idea from x86 version, (C) Copyright 1998 Linus Torvalds
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * These functions have a non-standard call interface to make
 * them more efficient, especially as they return an error
 * value in addition to the "real" return value.
 *
 * __put_user_X
 *
 * Inputs:	x0 contains the address
 *		x2, x3 contains the value
 * Outputs:	x0 is the error code
 *		lr corrupted
 *
 * No other registers must be altered.  (see <asm/uaccess.h>
 * for specific ASM register usage).
 *
 * Note that it is intended that __put_user_bad is not global.
 */

#include <linux/linkage.h>
#include <asm/errno.h>

ENTRY(__put_user_1)
1:	strb	w2, [x0]
	mov	x0, #0
	ret
ENDPROC(__put_user_1)

ENTRY(__put_user_2)
2:	strh	w2, [x0]
	mov	x0, #0
	ret
ENDPROC(__put_user_2)

ENTRY(__put_user_4)
3:	str	w2, [x0]
	mov	x0, #0
	ret
ENDPROC(__put_user_4)

ENTRY(__put_user_8)
4:	str	x2, [x0]
	mov	x0, #0
	ret
ENDPROC(__put_user_8)

__put_user_bad:
	mov	x0, #-EFAULT
	ret
ENDPROC(__put_user_bad)

.section __ex_table, "a"
	.quad	1b, __put_user_bad
	.quad	2b, __put_user_bad
	.quad	3b, __put_user_bad
	.quad	4b, __put_user_bad
.previous