]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/s390/s390-64/bcopy.S
Update.
[thirdparty/glibc.git] / sysdeps / s390 / s390-64 / bcopy.S
1 /* bcopy -- copy a block from source to destination. 64 bit S/390 version.
2 This file is part of the GNU C Library.
3 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
5
6 The GNU C Library is free software ; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation ; either version 2 of the
9 License, or (at your option) any later version.
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
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* INPUT PARAMETERS
22 %r2 = address of source
23 %r3 = address of destination
24 %r4 = number of bytes to copy. */
25
26 #include "sysdep.h"
27 #include "asm-syntax.h"
28
29 .text
30 ENTRY(__bcopy)
31 ltgr %r1,%r4 # zero bcopy ?
32 jz .L4
33 clgr %r2,%r3 # check against destructive overlap
34 jnl .L0
35 algr %r1,%r2
36 clgr %r1,%r3
37 jh .L5
38 .L0: aghi %r4,-1 # length - 1
39 srlg %r1,%r4,8
40 ltgr %r1,%r1
41 jz .L2
42 .L1: mvc 0(256,%r3),0(%r2) # move in 256 byte chunks
43 la %r2,256(%r2)
44 la %r3,256(%r3)
45 brctg %r1,.L1
46 .L2: bras %r1,.L3 # setup base pointer for execute
47 mvc 0(1,%r3),0(%r2) # instruction for execute
48 .L3: ex %r4,0(%r1) # execute mvc with length ((%r4)&255)+1
49 .L4: br %r14
50
51 .L5: # destructive overlay, can not use mvcle
52 lgr %r1,%r2 # bcopy is called with source,dest
53 lgr %r2,%r3 # memmove with dest,source! Oh, well...
54 lgr %r3,%r1
55 #ifdef PIC
56 jg memmove@PLT
57 #else
58 jg memmove
59 #endif
60
61 END(__bcopy)
62
63 #ifndef NO_WEAK_ALIAS
64 weak_alias (__bcopy, bcopy)
65 #endif
66