copy_from_user.S 978 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. USER( lbi.bi, \dst, [\addr], \adj)
  8. .endm
  9. .macro sbi1 src, addr, adj
  10. sbi.bi \src, [\addr], \adj
  11. .endm
  12. .macro lmw1 start_reg, addr, end_reg
  13. USER( lmw.bim, \start_reg, [\addr], \end_reg)
  14. .endm
  15. .macro smw1 start_reg, addr, end_reg
  16. smw.bim \start_reg, [\addr], \end_reg
  17. .endm
  18. /* Prototype: int __arch_copy_from_user(void *to, const char *from, size_t n)
  19. * Purpose : copy a block from user memory to kernel memory
  20. * Params : to - kernel memory
  21. * : from - user memory
  22. * : n - number of bytes to copy
  23. * Returns : Number of bytes NOT copied.
  24. */
  25. .text
  26. ENTRY(__arch_copy_from_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_from_user)