]>
Commit | Line | Data |
---|---|---|
118bad87 UD |
1 | /* Copy memory block and return pointer to following byte. |
2 | For Intel 80x86, x>=6. | |
f21acc89 | 3 | This file is part of the GNU C Library. |
581c785b | 4 | Copyright (C) 1998-2022 Free Software Foundation, Inc. |
f21acc89 UD |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
f21acc89 UD |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
f21acc89 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 17 | License along with the GNU C Library; if not, see |
5a82c748 | 18 | <https://www.gnu.org/licenses/>. */ |
f21acc89 | 19 | |
118bad87 UD |
20 | #include <sysdep.h> |
21 | #include "asm-syntax.h" | |
f21acc89 | 22 | |
2366713d | 23 | #define PARMS 4 /* no space for saved regs */ |
3f02f778 | 24 | #define RTN PARMS |
2366713d JM |
25 | #define DEST RTN |
26 | #define SRC DEST+4 | |
27 | #define LEN SRC+4 | |
f21acc89 | 28 | |
3f02f778 | 29 | .text |
4f41c682 | 30 | #if defined PIC && IS_IN (libc) |
3af48cbd | 31 | ENTRY_CHK (__mempcpy_chk) |
b5cc329c UD |
32 | movl 12(%esp), %eax |
33 | cmpl %eax, 16(%esp) | |
34 | jb HIDDEN_JUMPTARGET (__chk_fail) | |
3af48cbd | 35 | END_CHK (__mempcpy_chk) |
b5cc329c | 36 | #endif |
2366713d | 37 | ENTRY (__mempcpy) |
3f02f778 GM |
38 | |
39 | movl LEN(%esp), %ecx | |
118bad87 | 40 | movl %edi, %eax |
1ad9da69 | 41 | cfi_register (edi, eax) |
3f02f778 | 42 | movl DEST(%esp), %edi |
118bad87 | 43 | movl %esi, %edx |
1ad9da69 | 44 | cfi_register (esi, edx) |
3f02f778 | 45 | movl SRC(%esp), %esi |
118bad87 UD |
46 | cld |
47 | shrl $1, %ecx | |
48 | jnc 1f | |
49 | movsb | |
50 | 1: shrl $1, %ecx | |
51 | jnc 2f | |
52 | movsw | |
53 | 2: rep | |
54 | movsl | |
55 | xchgl %edi, %eax | |
1ad9da69 | 56 | cfi_restore (edi) |
118bad87 | 57 | movl %edx, %esi |
1ad9da69 | 58 | cfi_restore (esi) |
3f02f778 | 59 | |
2366713d JM |
60 | ret |
61 | END (__mempcpy) | |
62 | libc_hidden_def (__mempcpy) | |
63 | weak_alias (__mempcpy, mempcpy) | |
3dbfd811 | 64 | libc_hidden_builtin_def (mempcpy) |