Thomas Gleixner | 97873a3 | 2019-06-04 10:11:30 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 2 | /* ----------------------------------------------------------------------- * |
| 3 | * |
| 4 | * Copyright (C) 1991, 1992 Linus Torvalds |
| 5 | * Copyright 2007 rPath, Inc. - All Rights Reserved |
| 6 | * |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 7 | * ----------------------------------------------------------------------- */ |
| 8 | |
Cyrill Gorcunov | 2f79555 | 2009-02-14 00:50:20 +0300 | [diff] [blame] | 9 | #include <linux/linkage.h> |
| 10 | |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 11 | /* |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 12 | * Memory copy routines |
| 13 | */ |
| 14 | |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 15 | .code16 |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 16 | .text |
| 17 | |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 18 | SYM_FUNC_START_NOALIGN(memcpy) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 19 | pushw %si |
| 20 | pushw %di |
| 21 | movw %ax, %di |
| 22 | movw %dx, %si |
| 23 | pushw %cx |
| 24 | shrw $2, %cx |
| 25 | rep; movsl |
| 26 | popw %cx |
| 27 | andw $3, %cx |
| 28 | rep; movsb |
| 29 | popw %di |
| 30 | popw %si |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 31 | retl |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 32 | SYM_FUNC_END(memcpy) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 33 | |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 34 | SYM_FUNC_START_NOALIGN(memset) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 35 | pushw %di |
| 36 | movw %ax, %di |
| 37 | movzbl %dl, %eax |
| 38 | imull $0x01010101,%eax |
| 39 | pushw %cx |
| 40 | shrw $2, %cx |
| 41 | rep; stosl |
| 42 | popw %cx |
| 43 | andw $3, %cx |
| 44 | rep; stosb |
| 45 | popw %di |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 46 | retl |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 47 | SYM_FUNC_END(memset) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 48 | |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 49 | SYM_FUNC_START_NOALIGN(copy_from_fs) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 50 | pushw %ds |
| 51 | pushw %fs |
| 52 | popw %ds |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 53 | calll memcpy |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 54 | popw %ds |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 55 | retl |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 56 | SYM_FUNC_END(copy_from_fs) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 57 | |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 58 | SYM_FUNC_START_NOALIGN(copy_to_fs) |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 59 | pushw %es |
| 60 | pushw %fs |
| 61 | popw %es |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 62 | calll memcpy |
H. Peter Anvin | 5be8656 | 2007-07-11 12:18:41 -0700 | [diff] [blame] | 63 | popw %es |
David Woodhouse | e24df92 | 2014-01-03 22:30:42 +0000 | [diff] [blame] | 64 | retl |
Jiri Slaby | 37818af | 2019-10-11 13:50:56 +0200 | [diff] [blame] | 65 | SYM_FUNC_END(copy_to_fs) |