18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* NG2copy_to_user.S: Niagara-2 optimized copy to userspace. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2007 David S. Miller (davem@davemloft.net) 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define EX_ST(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#define EX_ST_FP(x,y) \ 168c2ecf20Sopenharmony_ci98: x; \ 178c2ecf20Sopenharmony_ci .section __ex_table,"a";\ 188c2ecf20Sopenharmony_ci .align 4; \ 198c2ecf20Sopenharmony_ci .word 98b, y##_fp; \ 208c2ecf20Sopenharmony_ci .text; \ 218c2ecf20Sopenharmony_ci .align 4; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#ifndef ASI_AIUS 248c2ecf20Sopenharmony_ci#define ASI_AIUS 0x11 258c2ecf20Sopenharmony_ci#endif 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#ifndef ASI_BLK_AIUS_4V 288c2ecf20Sopenharmony_ci#define ASI_BLK_AIUS_4V 0x17 298c2ecf20Sopenharmony_ci#endif 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS 328c2ecf20Sopenharmony_ci#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23 338c2ecf20Sopenharmony_ci#endif 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define FUNC_NAME NG2copy_to_user 368c2ecf20Sopenharmony_ci#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS 378c2ecf20Sopenharmony_ci#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS 388c2ecf20Sopenharmony_ci#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V 398c2ecf20Sopenharmony_ci#define EX_RETVAL(x) 0 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 428c2ecf20Sopenharmony_ci /* Writing to %asi is _expensive_ so we hardcode it. 438c2ecf20Sopenharmony_ci * Reading %asi to check for KERNEL_DS is comparatively 448c2ecf20Sopenharmony_ci * cheap. 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci#define PREAMBLE \ 478c2ecf20Sopenharmony_ci rd %asi, %g1; \ 488c2ecf20Sopenharmony_ci cmp %g1, ASI_AIUS; \ 498c2ecf20Sopenharmony_ci bne,pn %icc, raw_copy_in_user; \ 508c2ecf20Sopenharmony_ci nop 518c2ecf20Sopenharmony_ci#endif 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#include "NG2memcpy.S" 54