NG2copy_to_user.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* NG2copy_to_user.S: Niagara-2 optimized copy to userspace.
  3. *
  4. * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
  5. */
  6. #define EX_ST(x,y) \
  7. 98: x; \
  8. .section __ex_table,"a";\
  9. .align 4; \
  10. .word 98b, y; \
  11. .text; \
  12. .align 4;
  13. #define EX_ST_FP(x,y) \
  14. 98: x; \
  15. .section __ex_table,"a";\
  16. .align 4; \
  17. .word 98b, y##_fp; \
  18. .text; \
  19. .align 4;
  20. #ifndef ASI_AIUS
  21. #define ASI_AIUS 0x11
  22. #endif
  23. #ifndef ASI_BLK_AIUS_4V
  24. #define ASI_BLK_AIUS_4V 0x17
  25. #endif
  26. #ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
  27. #define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
  28. #endif
  29. #define FUNC_NAME NG2copy_to_user
  30. #define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
  31. #define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS
  32. #define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V
  33. #define EX_RETVAL(x) 0
  34. #ifdef __KERNEL__
  35. /* Writing to %asi is _expensive_ so we hardcode it.
  36. * Reading %asi to check for KERNEL_DS is comparatively
  37. * cheap.
  38. */
  39. #define PREAMBLE \
  40. rd %asi, %g1; \
  41. cmp %g1, ASI_AIUS; \
  42. bne,pn %icc, raw_copy_in_user; \
  43. nop
  44. #endif
  45. #include "NG2memcpy.S"