NG4copy_to_user.S 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* NG4copy_to_user.S: Niagara-4 optimized copy to userspace.
  3. *
  4. * Copyright (C) 2012 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_INIT_QUAD_LDD_AIUS
  24. #define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
  25. #endif
  26. #define FUNC_NAME NG4copy_to_user
  27. #define STORE(type,src,addr) type##a src, [addr] %asi
  28. #define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS
  29. #define EX_RETVAL(x) 0
  30. #ifdef __KERNEL__
  31. /* Writing to %asi is _expensive_ so we hardcode it.
  32. * Reading %asi to check for KERNEL_DS is comparatively
  33. * cheap.
  34. */
  35. #define PREAMBLE \
  36. rd %asi, %g1; \
  37. cmp %g1, ASI_AIUS; \
  38. bne,pn %icc, raw_copy_in_user; \
  39. nop
  40. #endif
  41. #include "NG4memcpy.S"