18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * M7copy_from_user.S: SPARC M7 optimized copy from userspace.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define EX_LD(x, y)			\
98c2ecf20Sopenharmony_ci98:	x;				\
108c2ecf20Sopenharmony_ci	.section __ex_table,"a";	\
118c2ecf20Sopenharmony_ci	.align 4;			\
128c2ecf20Sopenharmony_ci	.word 98b, y;			\
138c2ecf20Sopenharmony_ci	.text;				\
148c2ecf20Sopenharmony_ci	.align 4;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define EX_LD_FP(x, y)			\
178c2ecf20Sopenharmony_ci98:	x;				\
188c2ecf20Sopenharmony_ci	.section __ex_table,"a";	\
198c2ecf20Sopenharmony_ci	.align 4;			\
208c2ecf20Sopenharmony_ci	.word 98b, y##_fp;		\
218c2ecf20Sopenharmony_ci	.text;				\
228c2ecf20Sopenharmony_ci	.align 4;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#ifndef ASI_AIUS
258c2ecf20Sopenharmony_ci#define ASI_AIUS	0x11
268c2ecf20Sopenharmony_ci#endif
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define FUNC_NAME		M7copy_from_user
298c2ecf20Sopenharmony_ci#define LOAD(type,addr,dest)	type##a [addr] %asi, dest
308c2ecf20Sopenharmony_ci#define EX_RETVAL(x)		0
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifdef __KERNEL__
338c2ecf20Sopenharmony_ci#define PREAMBLE					\
348c2ecf20Sopenharmony_ci	rd		%asi, %g1;			\
358c2ecf20Sopenharmony_ci	cmp		%g1, ASI_AIUS;			\
368c2ecf20Sopenharmony_ci	bne,pn		%icc, raw_copy_in_user;		\
378c2ecf20Sopenharmony_ci	 nop
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#include "M7memcpy.S"
41