copy_to_user.S 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2005-2017 Andes Technology Corporation
  3. #include <linux/linkage.h>
  4. #include <asm/assembler.h>
  5. #include <asm/errno.h>
  6. .macro lbi1 dst, addr, adj
  7. lbi.bi \dst, [\addr], \adj
  8. .endm
  9. .macro sbi1 src, addr, adj
  10. USER( sbi.bi, \src, [\addr], \adj)
  11. .endm
  12. .macro lmw1 start_reg, addr, end_reg
  13. lmw.bim \start_reg, [\addr], \end_reg
  14. .endm
  15. .macro smw1 start_reg, addr, end_reg
  16. USER( smw.bim, \start_reg, [\addr], \end_reg)
  17. .endm
  18. /* Prototype: int __arch_copy_to_user(void *to, const char *from, size_t n)
  19. * Purpose : copy a block to user memory from kernel memory
  20. * Params : to - user memory
  21. * : from - kernel memory
  22. * : n - number of bytes to copy
  23. * Returns : Number of bytes NOT copied.
  24. */
  25. .text
  26. ENTRY(__arch_copy_to_user)
  27. add $r5, $r0, $r2
  28. #include "copy_template.S"
  29. move $r0, $r2
  30. ret
  31. .section .fixup,"ax"
  32. .align 2
  33. 9001:
  34. sub $r0, $r5, $r0
  35. ret
  36. .previous
  37. ENDPROC(__arch_copy_to_user)