H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 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 | |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 11 | #include <linux/linkage.h> |
| 12 | |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 13 | /* |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 14 | * Memory copy routines |
| 15 | */ |
| 16 | |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 17 | .code16 |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 18 | .text |
| 19 | |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 20 | GLOBAL(memcpy) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 21 | pushw %si |
| 22 | pushw %di |
| 23 | movw %ax, %di |
| 24 | movw %dx, %si |
| 25 | pushw %cx |
| 26 | shrw $2, %cx |
| 27 | rep; movsl |
| 28 | popw %cx |
| 29 | andw $3, %cx |
| 30 | rep; movsb |
| 31 | popw %di |
| 32 | popw %si |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 33 | retl |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 34 | ENDPROC(memcpy) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 35 | |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 36 | GLOBAL(memset) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 37 | pushw %di |
| 38 | movw %ax, %di |
| 39 | movzbl %dl, %eax |
| 40 | imull $0x01010101,%eax |
| 41 | pushw %cx |
| 42 | shrw $2, %cx |
| 43 | rep; stosl |
| 44 | popw %cx |
| 45 | andw $3, %cx |
| 46 | rep; stosb |
| 47 | popw %di |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 48 | retl |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 49 | ENDPROC(memset) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 50 | |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 51 | GLOBAL(copy_from_fs) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 52 | pushw %ds |
| 53 | pushw %fs |
| 54 | popw %ds |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 55 | calll memcpy |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 56 | popw %ds |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 57 | retl |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 58 | ENDPROC(copy_from_fs) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 59 | |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 60 | GLOBAL(copy_to_fs) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 61 | pushw %es |
| 62 | pushw %fs |
| 63 | popw %es |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 64 | calll memcpy |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 65 | popw %es |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 66 | retl |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 67 | ENDPROC(copy_to_fs) |