copy.S 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* ----------------------------------------------------------------------- *
  3. *
  4. * Copyright (C) 1991, 1992 Linus Torvalds
  5. * Copyright 2007 rPath, Inc. - All Rights Reserved
  6. *
  7. * ----------------------------------------------------------------------- */
  8. #include <linux/linkage.h>
  9. /*
  10. * Memory copy routines
  11. */
  12. .code16
  13. .text
  14. SYM_FUNC_START_NOALIGN(memcpy)
  15. pushw %si
  16. pushw %di
  17. movw %ax, %di
  18. movw %dx, %si
  19. pushw %cx
  20. shrw $2, %cx
  21. rep; movsl
  22. popw %cx
  23. andw $3, %cx
  24. rep; movsb
  25. popw %di
  26. popw %si
  27. retl
  28. SYM_FUNC_END(memcpy)
  29. SYM_FUNC_START_NOALIGN(memset)
  30. pushw %di
  31. movw %ax, %di
  32. movzbl %dl, %eax
  33. imull $0x01010101,%eax
  34. pushw %cx
  35. shrw $2, %cx
  36. rep; stosl
  37. popw %cx
  38. andw $3, %cx
  39. rep; stosb
  40. popw %di
  41. retl
  42. SYM_FUNC_END(memset)
  43. SYM_FUNC_START_NOALIGN(copy_from_fs)
  44. pushw %ds
  45. pushw %fs
  46. popw %ds
  47. calll memcpy
  48. popw %ds
  49. retl
  50. SYM_FUNC_END(copy_from_fs)
  51. SYM_FUNC_START_NOALIGN(copy_to_fs)
  52. pushw %es
  53. pushw %fs
  54. popw %es
  55. calll memcpy
  56. popw %es
  57. retl
  58. SYM_FUNC_END(copy_to_fs)