File: uaccess_vector.S

package info (click to toggle)
linux 6.17.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,734,348 kB
  • sloc: ansic: 26,679,111; asm: 271,215; sh: 147,319; python: 75,916; makefile: 57,295; perl: 36,942; xml: 19,562; cpp: 5,899; yacc: 4,909; lex: 2,943; awk: 1,556; sed: 29; ruby: 25
file content (61 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download | duplicates (16)
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
/* SPDX-License-Identifier: GPL-2.0-only */

#include <linux/linkage.h>
#include <asm/asm.h>
#include <asm/asm-extable.h>
#include <asm/csr.h>

#define pDst a0
#define pSrc a1
#define iNum a2

#define iVL a3

#define ELEM_LMUL_SETTING m8
#define vData v0

	.macro fixup op reg addr lbl
100:
	\op \reg, \addr
	_asm_extable	100b, \lbl
	.endm

SYM_FUNC_START(__asm_vector_usercopy)
	/* Enable access to user memory */
	li	t6, SR_SUM
	csrs	CSR_STATUS, t6
	mv	t6, ra

	call 	__asm_vector_usercopy_sum_enabled

	/* Disable access to user memory */
	mv 	ra, t6
	li 	t6, SR_SUM
	csrc	CSR_STATUS, t6
	ret
SYM_FUNC_END(__asm_vector_usercopy)

SYM_FUNC_START(__asm_vector_usercopy_sum_enabled)
loop:
	vsetvli iVL, iNum, e8, ELEM_LMUL_SETTING, ta, ma
	fixup vle8.v vData, (pSrc), 10f
	sub iNum, iNum, iVL
	add pSrc, pSrc, iVL
	fixup vse8.v vData, (pDst), 11f
	add pDst, pDst, iVL
	bnez iNum, loop

	/* Exception fixup for vector load is shared with normal exit */
10:
	mv	a0, iNum
	ret

	/* Exception fixup code for vector store. */
11:
	/* Undo the subtraction after vle8.v */
	add	iNum, iNum, iVL
	/* Make sure the scalar fallback skip already processed bytes */
	csrr	t2, CSR_VSTART
	sub	iNum, iNum, t2
	j	10b
SYM_FUNC_END(__asm_vector_usercopy_sum_enabled)