1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 2478b8fecSSam Ravnborg/* NG2copy_to_user.S: Niagara-2 optimized copy to userspace. 3478b8fecSSam Ravnborg * 4478b8fecSSam Ravnborg * Copyright (C) 2007 David S. Miller (davem@davemloft.net) 5478b8fecSSam Ravnborg */ 6478b8fecSSam Ravnborg 7e93704e4SDavid S. Miller#define EX_ST(x,y) \ 8478b8fecSSam Ravnborg98: x; \ 9478b8fecSSam Ravnborg .section __ex_table,"a";\ 10478b8fecSSam Ravnborg .align 4; \ 11e93704e4SDavid S. Miller .word 98b, y; \ 12478b8fecSSam Ravnborg .text; \ 13478b8fecSSam Ravnborg .align 4; 14478b8fecSSam Ravnborg 15e93704e4SDavid S. Miller#define EX_ST_FP(x,y) \ 16a7c5724bSRob Gardner98: x; \ 17a7c5724bSRob Gardner .section __ex_table,"a";\ 18a7c5724bSRob Gardner .align 4; \ 19e93704e4SDavid S. Miller .word 98b, y##_fp; \ 20a7c5724bSRob Gardner .text; \ 21a7c5724bSRob Gardner .align 4; 22a7c5724bSRob Gardner 23478b8fecSSam Ravnborg#ifndef ASI_AIUS 24478b8fecSSam Ravnborg#define ASI_AIUS 0x11 25478b8fecSSam Ravnborg#endif 26478b8fecSSam Ravnborg 27478b8fecSSam Ravnborg#ifndef ASI_BLK_AIUS_4V 28478b8fecSSam Ravnborg#define ASI_BLK_AIUS_4V 0x17 29478b8fecSSam Ravnborg#endif 30478b8fecSSam Ravnborg 31478b8fecSSam Ravnborg#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS 32478b8fecSSam Ravnborg#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23 33478b8fecSSam Ravnborg#endif 34478b8fecSSam Ravnborg 35478b8fecSSam Ravnborg#define FUNC_NAME NG2copy_to_user 36478b8fecSSam Ravnborg#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS 37478b8fecSSam Ravnborg#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS 38478b8fecSSam Ravnborg#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V 39478b8fecSSam Ravnborg#define EX_RETVAL(x) 0 40478b8fecSSam Ravnborg 41478b8fecSSam Ravnborg#ifdef __KERNEL__ 42478b8fecSSam Ravnborg /* Writing to %asi is _expensive_ so we hardcode it. 43478b8fecSSam Ravnborg * Reading %asi to check for KERNEL_DS is comparatively 44478b8fecSSam Ravnborg * cheap. 45478b8fecSSam Ravnborg */ 46478b8fecSSam Ravnborg#define PREAMBLE \ 47478b8fecSSam Ravnborg rd %asi, %g1; \ 48478b8fecSSam Ravnborg cmp %g1, ASI_AIUS; \ 4931af2f36SAl Viro bne,pn %icc, raw_copy_in_user; \ 50478b8fecSSam Ravnborg nop 51478b8fecSSam Ravnborg#endif 52478b8fecSSam Ravnborg 53478b8fecSSam Ravnborg#include "NG2memcpy.S" 54