copy.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* ----------------------------------------------------------------------- *
  2. *
  3. * Copyright (C) 1991, 1992 Linus Torvalds
  4. * Copyright 2007 rPath, Inc. - All Rights Reserved
  5. *
  6. * This file is part of the Linux kernel, and is made available under
  7. * the terms of the GNU General Public License version 2.
  8. *
  9. * ----------------------------------------------------------------------- */
  10. #include <linux/linkage.h>
  11. /*
  12. * Memory copy routines
  13. */
  14. .code16
  15. .text
  16. GLOBAL(memcpy)
  17. pushw %si
  18. pushw %di
  19. movw %ax, %di
  20. movw %dx, %si
  21. pushw %cx
  22. shrw $2, %cx
  23. rep; movsl
  24. popw %cx
  25. andw $3, %cx
  26. rep; movsb
  27. popw %di
  28. popw %si
  29. retl
  30. ENDPROC(memcpy)
  31. GLOBAL(memset)
  32. pushw %di
  33. movw %ax, %di
  34. movzbl %dl, %eax
  35. imull $0x01010101,%eax
  36. pushw %cx
  37. shrw $2, %cx
  38. rep; stosl
  39. popw %cx
  40. andw $3, %cx
  41. rep; stosb
  42. popw %di
  43. retl
  44. ENDPROC(memset)
  45. GLOBAL(copy_from_fs)
  46. pushw %ds
  47. pushw %fs
  48. popw %ds
  49. calll memcpy
  50. popw %ds
  51. retl
  52. ENDPROC(copy_from_fs)
  53. GLOBAL(copy_to_fs)
  54. pushw %es
  55. pushw %fs
  56. popw %es
  57. calll memcpy
  58. popw %es
  59. retl
  60. ENDPROC(copy_to_fs)
  61. #if 0 /* Not currently used, but can be enabled as needed */
  62. GLOBAL(copy_from_gs)
  63. pushw %ds
  64. pushw %gs
  65. popw %ds
  66. calll memcpy
  67. popw %ds
  68. retl
  69. ENDPROC(copy_from_gs)
  70. GLOBAL(copy_to_gs)
  71. pushw %es
  72. pushw %gs
  73. popw %es
  74. calll memcpy
  75. popw %es
  76. retl
  77. ENDPROC(copy_to_gs)
  78. #endif