1ae2c6ca6SDavid S. Miller/* NG4copy_to_user.S: Niagara-4 optimized copy to userspace. 2ae2c6ca6SDavid S. Miller * 3ae2c6ca6SDavid S. Miller * Copyright (C) 2012 David S. Miller (davem@davemloft.net) 4ae2c6ca6SDavid S. Miller */ 5ae2c6ca6SDavid S. Miller 695707704SDavid S. Miller#define EX_ST(x,y) \ 7ae2c6ca6SDavid S. Miller98: x; \ 8ae2c6ca6SDavid S. Miller .section __ex_table,"a";\ 9ae2c6ca6SDavid S. Miller .align 4; \ 1095707704SDavid S. Miller .word 98b, y; \ 11ae2c6ca6SDavid S. Miller .text; \ 12ae2c6ca6SDavid S. Miller .align 4; 13ae2c6ca6SDavid S. Miller 1495707704SDavid S. Miller#define EX_ST_FP(x,y) \ 15a7c5724bSRob Gardner98: x; \ 16a7c5724bSRob Gardner .section __ex_table,"a";\ 17a7c5724bSRob Gardner .align 4; \ 1895707704SDavid S. Miller .word 98b, y##_fp; \ 19a7c5724bSRob Gardner .text; \ 20a7c5724bSRob Gardner .align 4; 21a7c5724bSRob Gardner 22ae2c6ca6SDavid S. Miller#ifndef ASI_AIUS 23ae2c6ca6SDavid S. Miller#define ASI_AIUS 0x11 24ae2c6ca6SDavid S. Miller#endif 25ae2c6ca6SDavid S. Miller 26ae2c6ca6SDavid S. Miller#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS 27ae2c6ca6SDavid S. Miller#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23 28ae2c6ca6SDavid S. Miller#endif 29ae2c6ca6SDavid S. Miller 30ae2c6ca6SDavid S. Miller#define FUNC_NAME NG4copy_to_user 31ae2c6ca6SDavid S. Miller#define STORE(type,src,addr) type##a src, [addr] %asi 32ae2c6ca6SDavid S. Miller#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS 33ae2c6ca6SDavid S. Miller#define EX_RETVAL(x) 0 34ae2c6ca6SDavid S. Miller 35ae2c6ca6SDavid S. Miller#ifdef __KERNEL__ 36ae2c6ca6SDavid S. Miller /* Writing to %asi is _expensive_ so we hardcode it. 37ae2c6ca6SDavid S. Miller * Reading %asi to check for KERNEL_DS is comparatively 38ae2c6ca6SDavid S. Miller * cheap. 39ae2c6ca6SDavid S. Miller */ 40ae2c6ca6SDavid S. Miller#define PREAMBLE \ 41ae2c6ca6SDavid S. Miller rd %asi, %g1; \ 42ae2c6ca6SDavid S. Miller cmp %g1, ASI_AIUS; \ 43*31af2f36SAl Viro bne,pn %icc, raw_copy_in_user; \ 44ae2c6ca6SDavid S. Miller nop 45ae2c6ca6SDavid S. Miller#endif 46ae2c6ca6SDavid S. Miller 47ae2c6ca6SDavid S. Miller#include "NG4memcpy.S" 48