1 /* bcopy -- copy a block from source to destination. For IBM S390
2 This file is part of the GNU C Library.
3 Copyright (C) 2000 Free Software Foundation, Inc.
4 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
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.
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.
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. */
22 * R2 = address of source
23 * R3 = address of destination
24 * R4 = number of bytes to copy
28 #include "asm-syntax.h"
32 clr %r2,%r3 # check against destructive overlap
39 lr %r5,%r4 # source length
40 lr %r4,%r2 # source address
41 sr %r1,%r1 # set pad byte to zero
42 lr %r2,%r3 # set destination
43 lr %r3,%r5 # destination length = source length
44 .L1: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend
47 .L2: # destructive overlay, can not use mvcle
48 lr %r1,%r2 # bcopy is called with source,dest
49 lr %r2,%r3 # memmove with dest,source! Oh, well...
54 al %r1,.L4-.L3(%r1) # get address of global offset table
55 # load address of memmove
56 l %r1,memmove@GOT12(%r1)
58 .L4: .long _GLOBAL_OFFSET_TABLE_-.L3
60 al %r1,.L4-.L3(%r1) # load address of memmove
61 br %r1 # jump to memmove
62 .L4: .long memmove-.L3
68 weak_alias (__bcopy, bcopy)