]>
Commit | Line | Data |
---|---|---|
08f43f9b | 1 | /* Set a block of memory to some byte value. 32 bit S/390 version. |
688903eb | 2 | Copyright (C) 2012-2018 Free Software Foundation, Inc. |
08f43f9b AK |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
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 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
17 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | ||
20 | #include "sysdep.h" | |
21 | #include "asm-syntax.h" | |
22 | ||
23 | /* INPUT PARAMETERS | |
24 | %r2 = address of memory area | |
25 | %r3 = byte to fill memory with | |
26 | %r4 = number of bytes to fill. */ | |
27 | ||
28 | .text | |
29 | ||
4f41c682 | 30 | #if IS_IN (libc) |
08f43f9b | 31 | |
1d532483 | 32 | ENTRY(__memset_z196) |
08f43f9b | 33 | .machine "z196" |
14c996c8 | 34 | .machinemode "zarch_nohighgprs" |
31556246 SL |
35 | llgfr %r4,%r4 |
36 | ltgr %r4,%r4 | |
37 | je .L_Z196_4 | |
38 | stc %r3,0(%r2) | |
39 | lr %r1,%r2 | |
40 | cghi %r4,1 | |
41 | je .L_Z196_4 | |
42 | aghi %r4,-2 | |
43 | srlg %r5,%r4,8 | |
44 | ltgr %r5,%r5 | |
45 | jne .L_Z196_1 | |
08f43f9b | 46 | .L_Z196_3: |
31556246 | 47 | exrl %r4,.L_Z196_17 |
08f43f9b | 48 | .L_Z196_4: |
31556246 | 49 | br %r14 |
08f43f9b AK |
50 | .L_Z196_1: |
51 | cgfi %r5,1048576 | |
1d532483 | 52 | jh __memset_mvcle # Switch to mvcle for >256MB |
08f43f9b | 53 | .L_Z196_2: |
31556246 SL |
54 | pfd 2,1024(%r1) |
55 | mvc 1(256,%r1),0(%r1) | |
56 | aghi %r5,-1 | |
57 | la %r1,256(%r1) | |
58 | jne .L_Z196_2 | |
59 | j .L_Z196_3 | |
08f43f9b | 60 | .L_Z196_17: |
31556246 | 61 | mvc 1(1,%r1),0(%r1) |
1d532483 | 62 | END(__memset_z196) |
08f43f9b | 63 | |
1d532483 | 64 | ENTRY(__memset_z10) |
08f43f9b | 65 | .machine "z10" |
14c996c8 | 66 | .machinemode "zarch_nohighgprs" |
31556246 SL |
67 | llgfr %r4,%r4 |
68 | cgije %r4,0,.L_Z10_4 | |
69 | stc %r3,0(%r2) | |
70 | lr %r1,%r2 | |
71 | cgije %r4,1,.L_Z10_4 | |
72 | aghi %r4,-2 | |
73 | srlg %r5,%r4,8 | |
74 | cgijlh %r5,0,.L_Z10_15 | |
08f43f9b | 75 | .L_Z10_3: |
31556246 | 76 | exrl %r4,.L_Z10_18 |
08f43f9b | 77 | .L_Z10_4: |
31556246 | 78 | br %r14 |
08f43f9b AK |
79 | .L_Z10_15: |
80 | cgfi %r5,163840 # Switch to mvcle for >40MB | |
1d532483 | 81 | jh __memset_mvcle |
08f43f9b | 82 | .L_Z10_14: |
31556246 SL |
83 | pfd 2,1024(%r1) |
84 | mvc 1(256,%r1),0(%r1) | |
85 | la %r1,256(%r1) | |
86 | brctg %r5,.L_Z10_14 | |
87 | j .L_Z10_3 | |
08f43f9b | 88 | .L_Z10_18: |
31556246 | 89 | mvc 1(1,%r1),0(%r1) |
1d532483 | 90 | END(__memset_z10) |
08f43f9b | 91 | |
1d532483 | 92 | ENTRY(__memset_mvcle) |
08f43f9b AK |
93 | ahi %r4,2 # take back the change done by the caller |
94 | lr %r0,%r2 # save source address | |
95 | lr %r1,%r3 # move pad byte to R1 | |
96 | lr %r3,%r4 | |
97 | sr %r4,%r4 # no source for MVCLE, only a pad byte | |
98 | sr %r5,%r5 | |
99 | .L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend | |
100 | jo .L0 | |
101 | lr %r2,%r0 # return value is source address | |
102 | .L1: | |
103 | br %r14 | |
1d532483 | 104 | END(__memset_mvcle) |
08f43f9b | 105 | |
31556246 | 106 | #endif /* IS_IN (libc) */ |
08f43f9b AK |
107 | |
108 | #include "../memset.S" | |
109 | ||
4f41c682 | 110 | #if !IS_IN (libc) |
08f43f9b | 111 | .globl memset |
31556246 | 112 | .set memset,__memset_default |
71655832 SL |
113 | #elif defined SHARED && IS_IN (libc) |
114 | .globl __GI_memset | |
115 | .set __GI_memset,__memset_default | |
08f43f9b | 116 | #endif |