18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* NGcopy_from_user.S: Niagara optimized copy from userspace.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2006, 2007 David S. Miller (davem@davemloft.net)
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define EX_LD(x,y)		\
88c2ecf20Sopenharmony_ci98:	x;			\
98c2ecf20Sopenharmony_ci	.section __ex_table,"a";\
108c2ecf20Sopenharmony_ci	.align 4;		\
118c2ecf20Sopenharmony_ci	.word 98b, y;		\
128c2ecf20Sopenharmony_ci	.text;			\
138c2ecf20Sopenharmony_ci	.align 4;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#ifndef ASI_AIUS
168c2ecf20Sopenharmony_ci#define ASI_AIUS	0x11
178c2ecf20Sopenharmony_ci#endif
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define FUNC_NAME		NGcopy_from_user
208c2ecf20Sopenharmony_ci#define LOAD(type,addr,dest)	type##a [addr] ASI_AIUS, dest
218c2ecf20Sopenharmony_ci#define LOAD_TWIN(addr_reg,dest0,dest1)	\
228c2ecf20Sopenharmony_ci	ldda [addr_reg] ASI_BLK_INIT_QUAD_LDD_AIUS, dest0
238c2ecf20Sopenharmony_ci#define EX_RETVAL(x)		%g0
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#ifdef __KERNEL__
268c2ecf20Sopenharmony_ci#define PREAMBLE					\
278c2ecf20Sopenharmony_ci	rd		%asi, %g1;			\
288c2ecf20Sopenharmony_ci	cmp		%g1, ASI_AIUS;			\
298c2ecf20Sopenharmony_ci	bne,pn		%icc, raw_copy_in_user;		\
308c2ecf20Sopenharmony_ci	 nop
318c2ecf20Sopenharmony_ci#endif
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#include "NGmemcpy.S"
34