1 /* memcopy.h -- definitions for memory copy functions. i386 version.
2 Copyright (C) 1991 Free Software Foundation, Inc.
3 Contributed by Torbjorn Granlund (tege@sics.se).
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
20 #include <sysdeps/generic/memcopy.h>
26 #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
27 asm volatile(/* Clear the direction flag, so copying goes forward. */ \
32 "=D" (dst_bp), "=S" (src_bp) : \
33 "0" (dst_bp), "1" (src_bp), "c" (nbytes) : \
37 #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
40 asm volatile(/* Set the direction flag, so copying goes backwards. */ \
45 /* Clear the dir flag. Convention says it should be 0. */ \
47 "=D" (dst_ep), "=S" (src_ep) : \
48 "0" (dst_ep - 1), "1" (src_ep - 1), "c" (nbytes) : \
55 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
58 asm volatile(/* Clear the direction flag, so copying goes forward. */ \
60 /* Copy longwords. */ \
63 "=D" (dst_bp), "=S" (src_bp) : \
64 "0" (dst_bp), "1" (src_bp), "c" ((nbytes) / 4) : \
66 (nbytes_left) = (nbytes) % 4; \
70 #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
73 asm volatile(/* Set the direction flag, so copying goes backwards. */ \
75 /* Copy longwords. */ \
78 /* Clear the dir flag. Convention says it should be 0. */ \
80 "=D" (dst_ep), "=S" (src_ep) : \
81 "0" (dst_ep - 4), "1" (src_ep - 4), "c" ((nbytes) / 4) : \
85 (nbytes_left) = (nbytes) % 4; \