annotate src/os_cpu/linux_x86/vm/linux_x86_32.s @ 1603:d93949c5bdcc

6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86 Summary: Modify assembler code to check for 0 count for all copy routines. Reviewed-by: never, ysr, jcoomes
author kvn
date Thu, 10 Jun 2010 13:04:20 -0700
parents c18cbe5936b8
children 0a8e0d4345b3 4fc084dac61e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 #
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 # Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 #
a61af66fc99e Initial load
duke
parents:
diff changeset
5 # This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 # under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 # published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 #
a61af66fc99e Initial load
duke
parents:
diff changeset
9 # This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 # version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 # accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 #
a61af66fc99e Initial load
duke
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 # 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 #
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 # or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 # questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 #
a61af66fc99e Initial load
duke
parents:
diff changeset
23
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # NOTE WELL! The _Copy functions are called directly
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # from server-compiler-generated code via CallLeafNoFP,
a61af66fc99e Initial load
duke
parents:
diff changeset
27 # which means that they *must* either not use floating
a61af66fc99e Initial load
duke
parents:
diff changeset
28 # point or use it in the same manner as does the server
a61af66fc99e Initial load
duke
parents:
diff changeset
29 # compiler.
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 .globl _Copy_conjoint_bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
32 .globl _Copy_arrayof_conjoint_bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
33 .globl _Copy_conjoint_jshorts_atomic
a61af66fc99e Initial load
duke
parents:
diff changeset
34 .globl _Copy_arrayof_conjoint_jshorts
a61af66fc99e Initial load
duke
parents:
diff changeset
35 .globl _Copy_conjoint_jints_atomic
a61af66fc99e Initial load
duke
parents:
diff changeset
36 .globl _Copy_arrayof_conjoint_jints
a61af66fc99e Initial load
duke
parents:
diff changeset
37 .globl _Copy_conjoint_jlongs_atomic
a61af66fc99e Initial load
duke
parents:
diff changeset
38 .globl _mmx_Copy_arrayof_conjoint_jshorts
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 .globl _Atomic_cmpxchg_long
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 .text
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 .globl SafeFetch32, Fetch32PFI, Fetch32Resume
a61af66fc99e Initial load
duke
parents:
diff changeset
45 .globl SafeFetchN
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ## TODO: avoid exposing Fetch32PFI and Fetch32Resume.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 ## Instead, the signal handler would call a new SafeFetchTriage(FaultingEIP)
a61af66fc99e Initial load
duke
parents:
diff changeset
48 ## routine to vet the address. If the address is the faulting LD then
a61af66fc99e Initial load
duke
parents:
diff changeset
49 ## SafeFetchTriage() would return the resume-at EIP, otherwise null.
a61af66fc99e Initial load
duke
parents:
diff changeset
50 .type SafeFetch32,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
51 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
52 SafeFetch32:
a61af66fc99e Initial load
duke
parents:
diff changeset
53 SafeFetchN:
a61af66fc99e Initial load
duke
parents:
diff changeset
54 movl 0x8(%esp), %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
55 movl 0x4(%esp), %ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
56 Fetch32PFI:
a61af66fc99e Initial load
duke
parents:
diff changeset
57 movl (%ecx), %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
58 Fetch32Resume:
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 .globl SpinPause
a61af66fc99e Initial load
duke
parents:
diff changeset
63 .type SpinPause,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
64 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
65 SpinPause:
a61af66fc99e Initial load
duke
parents:
diff changeset
66 rep
a61af66fc99e Initial load
duke
parents:
diff changeset
67 nop
a61af66fc99e Initial load
duke
parents:
diff changeset
68 movl $1, %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
69 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 # Support for void Copy::conjoint_bytes(void* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
72 # void* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
73 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
74 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
75 .type _Copy_conjoint_bytes,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
76 _Copy_conjoint_bytes:
a61af66fc99e Initial load
duke
parents:
diff changeset
77 pushl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
78 movl 4+12(%esp),%ecx # count
a61af66fc99e Initial load
duke
parents:
diff changeset
79 pushl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
80 movl 8+ 4(%esp),%esi # from
a61af66fc99e Initial load
duke
parents:
diff changeset
81 movl 8+ 8(%esp),%edi # to
a61af66fc99e Initial load
duke
parents:
diff changeset
82 cmpl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
83 leal -1(%esi,%ecx),%eax # from + count - 1
a61af66fc99e Initial load
duke
parents:
diff changeset
84 jbe cb_CopyRight
a61af66fc99e Initial load
duke
parents:
diff changeset
85 cmpl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
86 jbe cb_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
87 # copy from low to high
a61af66fc99e Initial load
duke
parents:
diff changeset
88 cb_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
89 cmpl $3,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
90 jbe 5f # <= 3 bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
91 # align source address at dword address boundary
a61af66fc99e Initial load
duke
parents:
diff changeset
92 movl %ecx,%eax # original count
a61af66fc99e Initial load
duke
parents:
diff changeset
93 movl $4,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
94 subl %esi,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
95 andl $3,%ecx # prefix byte count
a61af66fc99e Initial load
duke
parents:
diff changeset
96 jz 1f # no prefix
a61af66fc99e Initial load
duke
parents:
diff changeset
97 subl %ecx,%eax # byte count less prefix
a61af66fc99e Initial load
duke
parents:
diff changeset
98 # copy prefix
a61af66fc99e Initial load
duke
parents:
diff changeset
99 subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
100 0: movb (%esi),%dl
a61af66fc99e Initial load
duke
parents:
diff changeset
101 movb %dl,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
102 addl $1,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
103 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
104 jnz 0b
a61af66fc99e Initial load
duke
parents:
diff changeset
105 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
106 1: movl %eax,%ecx # byte count less prefix
a61af66fc99e Initial load
duke
parents:
diff changeset
107 shrl $2,%ecx # dword count
a61af66fc99e Initial load
duke
parents:
diff changeset
108 jz 4f # no dwords to move
a61af66fc99e Initial load
duke
parents:
diff changeset
109 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
110 jbe 2f # <= 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
111 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
112 rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
113 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
114 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
115 2: subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
116 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
117 3: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
118 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
119 addl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
120 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
121 jnz 3b
a61af66fc99e Initial load
duke
parents:
diff changeset
122 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
123 4: movl %eax,%ecx # byte count less prefix
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
124 5: andl $3,%ecx # suffix byte count
0
a61af66fc99e Initial load
duke
parents:
diff changeset
125 jz 7f # no suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
126 # copy suffix
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
127 xorl %eax,%eax
0
a61af66fc99e Initial load
duke
parents:
diff changeset
128 6: movb (%esi,%eax,1),%dl
a61af66fc99e Initial load
duke
parents:
diff changeset
129 movb %dl,(%edi,%eax,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
130 addl $1,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
131 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
132 jnz 6b
a61af66fc99e Initial load
duke
parents:
diff changeset
133 7: popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
134 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
135 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
136 # copy from high to low
a61af66fc99e Initial load
duke
parents:
diff changeset
137 cb_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
138 std
a61af66fc99e Initial load
duke
parents:
diff changeset
139 leal -4(%edi,%ecx),%edi # to + count - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
140 movl %eax,%esi # from + count - 1
a61af66fc99e Initial load
duke
parents:
diff changeset
141 movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
142 subl $3,%esi # from + count - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
143 cmpl $3,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
144 jbe 5f # <= 3 bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
145 1: shrl $2,%ecx # dword count
a61af66fc99e Initial load
duke
parents:
diff changeset
146 jz 4f # no dwords to move
a61af66fc99e Initial load
duke
parents:
diff changeset
147 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
148 ja 3f # > 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
149 # copy dwords, aligned or not
a61af66fc99e Initial load
duke
parents:
diff changeset
150 subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
151 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
152 2: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
153 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
154 subl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
155 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
156 jnz 2b
a61af66fc99e Initial load
duke
parents:
diff changeset
157 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
158 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
159 # copy dwords, aligned or not
a61af66fc99e Initial load
duke
parents:
diff changeset
160 3: rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
161 4: movl %eax,%ecx # byte count
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
162 5: andl $3,%ecx # suffix byte count
0
a61af66fc99e Initial load
duke
parents:
diff changeset
163 jz 7f # no suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
164 # copy suffix
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
165 subl %esi,%edi
0
a61af66fc99e Initial load
duke
parents:
diff changeset
166 addl $3,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
167 6: movb (%esi),%dl
a61af66fc99e Initial load
duke
parents:
diff changeset
168 movb %dl,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
169 subl $1,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
170 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
171 jnz 6b
a61af66fc99e Initial load
duke
parents:
diff changeset
172 7: cld
a61af66fc99e Initial load
duke
parents:
diff changeset
173 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
174 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
175 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 # Support for void Copy::arrayof_conjoint_bytes(void* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
178 # void* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
179 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
180 #
a61af66fc99e Initial load
duke
parents:
diff changeset
181 # Same as _Copy_conjoint_bytes, except no source alignment check.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
183 .type _Copy_arrayof_conjoint_bytes,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
184 _Copy_arrayof_conjoint_bytes:
a61af66fc99e Initial load
duke
parents:
diff changeset
185 pushl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
186 movl 4+12(%esp),%ecx # count
a61af66fc99e Initial load
duke
parents:
diff changeset
187 pushl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
188 movl 8+ 4(%esp),%esi # from
a61af66fc99e Initial load
duke
parents:
diff changeset
189 movl 8+ 8(%esp),%edi # to
a61af66fc99e Initial load
duke
parents:
diff changeset
190 cmpl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
191 leal -1(%esi,%ecx),%eax # from + count - 1
a61af66fc99e Initial load
duke
parents:
diff changeset
192 jbe acb_CopyRight
a61af66fc99e Initial load
duke
parents:
diff changeset
193 cmpl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
194 jbe acb_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
195 # copy from low to high
a61af66fc99e Initial load
duke
parents:
diff changeset
196 acb_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
197 cmpl $3,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
198 jbe 5f
a61af66fc99e Initial load
duke
parents:
diff changeset
199 1: movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
200 shrl $2,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
201 jz 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
202 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
203 ja 3f
a61af66fc99e Initial load
duke
parents:
diff changeset
204 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
205 subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
206 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
207 2: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
208 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
209 addl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
210 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
211 jnz 2b
a61af66fc99e Initial load
duke
parents:
diff changeset
212 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
213 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
214 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
215 3: rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
216 4: movl %eax,%ecx
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
217 5: andl $3,%ecx
0
a61af66fc99e Initial load
duke
parents:
diff changeset
218 jz 7f
a61af66fc99e Initial load
duke
parents:
diff changeset
219 # copy suffix
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
220 xorl %eax,%eax
0
a61af66fc99e Initial load
duke
parents:
diff changeset
221 6: movb (%esi,%eax,1),%dl
a61af66fc99e Initial load
duke
parents:
diff changeset
222 movb %dl,(%edi,%eax,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
223 addl $1,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
224 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
225 jnz 6b
a61af66fc99e Initial load
duke
parents:
diff changeset
226 7: popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
227 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
228 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
229 acb_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
230 std
a61af66fc99e Initial load
duke
parents:
diff changeset
231 leal -4(%edi,%ecx),%edi # to + count - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
232 movl %eax,%esi # from + count - 1
a61af66fc99e Initial load
duke
parents:
diff changeset
233 movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
234 subl $3,%esi # from + count - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
235 cmpl $3,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
236 jbe 5f
a61af66fc99e Initial load
duke
parents:
diff changeset
237 1: shrl $2,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
238 jz 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
239 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
240 jbe 2f # <= 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
241 rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
242 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
243 .=.+8
a61af66fc99e Initial load
duke
parents:
diff changeset
244 2: subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
245 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
246 3: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
247 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
248 subl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
249 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
250 jnz 3b
a61af66fc99e Initial load
duke
parents:
diff changeset
251 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
252 4: movl %eax,%ecx
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
253 5: andl $3,%ecx
0
a61af66fc99e Initial load
duke
parents:
diff changeset
254 jz 7f
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
255 subl %esi,%edi
0
a61af66fc99e Initial load
duke
parents:
diff changeset
256 addl $3,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
257 6: movb (%esi),%dl
a61af66fc99e Initial load
duke
parents:
diff changeset
258 movb %dl,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
259 subl $1,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
260 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
261 jnz 6b
a61af66fc99e Initial load
duke
parents:
diff changeset
262 7: cld
a61af66fc99e Initial load
duke
parents:
diff changeset
263 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
264 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
265 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 # Support for void Copy::conjoint_jshorts_atomic(void* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
268 # void* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
269 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
270 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
271 .type _Copy_conjoint_jshorts_atomic,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
272 _Copy_conjoint_jshorts_atomic:
a61af66fc99e Initial load
duke
parents:
diff changeset
273 pushl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
274 movl 4+12(%esp),%ecx # count
a61af66fc99e Initial load
duke
parents:
diff changeset
275 pushl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
276 movl 8+ 4(%esp),%esi # from
a61af66fc99e Initial load
duke
parents:
diff changeset
277 movl 8+ 8(%esp),%edi # to
a61af66fc99e Initial load
duke
parents:
diff changeset
278 cmpl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
279 leal -2(%esi,%ecx,2),%eax # from + count*2 - 2
a61af66fc99e Initial load
duke
parents:
diff changeset
280 jbe cs_CopyRight
a61af66fc99e Initial load
duke
parents:
diff changeset
281 cmpl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
282 jbe cs_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
283 # copy from low to high
a61af66fc99e Initial load
duke
parents:
diff changeset
284 cs_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
285 # align source address at dword address boundary
a61af66fc99e Initial load
duke
parents:
diff changeset
286 movl %esi,%eax # original from
a61af66fc99e Initial load
duke
parents:
diff changeset
287 andl $3,%eax # either 0 or 2
a61af66fc99e Initial load
duke
parents:
diff changeset
288 jz 1f # no prefix
a61af66fc99e Initial load
duke
parents:
diff changeset
289 # copy prefix
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
290 subl $1,%ecx
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
291 jl 5f # zero count
0
a61af66fc99e Initial load
duke
parents:
diff changeset
292 movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
293 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
294 addl %eax,%esi # %eax == 2
a61af66fc99e Initial load
duke
parents:
diff changeset
295 addl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
296 1: movl %ecx,%eax # word count less prefix
a61af66fc99e Initial load
duke
parents:
diff changeset
297 sarl %ecx # dword count
a61af66fc99e Initial load
duke
parents:
diff changeset
298 jz 4f # no dwords to move
a61af66fc99e Initial load
duke
parents:
diff changeset
299 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
300 jbe 2f # <= 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
301 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
302 rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
303 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
304 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
305 2: subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
306 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
307 3: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
308 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
309 addl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
310 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
311 jnz 3b
a61af66fc99e Initial load
duke
parents:
diff changeset
312 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
313 4: andl $1,%eax # suffix count
a61af66fc99e Initial load
duke
parents:
diff changeset
314 jz 5f # no suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
315 # copy suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
316 movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
317 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
318 5: popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
319 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
320 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
321 # copy from high to low
a61af66fc99e Initial load
duke
parents:
diff changeset
322 cs_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
323 std
a61af66fc99e Initial load
duke
parents:
diff changeset
324 leal -4(%edi,%ecx,2),%edi # to + count*2 - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
325 movl %eax,%esi # from + count*2 - 2
a61af66fc99e Initial load
duke
parents:
diff changeset
326 movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
327 subl $2,%esi # from + count*2 - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
328 1: sarl %ecx # dword count
a61af66fc99e Initial load
duke
parents:
diff changeset
329 jz 4f # no dwords to move
a61af66fc99e Initial load
duke
parents:
diff changeset
330 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
331 ja 3f # > 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
332 subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
333 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
334 2: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
335 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
336 subl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
337 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
338 jnz 2b
a61af66fc99e Initial load
duke
parents:
diff changeset
339 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
340 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
341 3: rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
342 4: andl $1,%eax # suffix count
a61af66fc99e Initial load
duke
parents:
diff changeset
343 jz 5f # no suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
344 # copy suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
345 addl $2,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
346 addl $2,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
347 movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
348 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
349 5: cld
a61af66fc99e Initial load
duke
parents:
diff changeset
350 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
351 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
352 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
353
a61af66fc99e Initial load
duke
parents:
diff changeset
354 # Support for void Copy::arrayof_conjoint_jshorts(void* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
355 # void* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
356 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
357 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
358 .type _Copy_arrayof_conjoint_jshorts,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
359 _Copy_arrayof_conjoint_jshorts:
a61af66fc99e Initial load
duke
parents:
diff changeset
360 pushl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
361 movl 4+12(%esp),%ecx # count
a61af66fc99e Initial load
duke
parents:
diff changeset
362 pushl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
363 movl 8+ 4(%esp),%esi # from
a61af66fc99e Initial load
duke
parents:
diff changeset
364 movl 8+ 8(%esp),%edi # to
a61af66fc99e Initial load
duke
parents:
diff changeset
365 cmpl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
366 leal -2(%esi,%ecx,2),%eax # from + count*2 - 2
a61af66fc99e Initial load
duke
parents:
diff changeset
367 jbe acs_CopyRight
a61af66fc99e Initial load
duke
parents:
diff changeset
368 cmpl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
369 jbe acs_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
370 acs_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
371 movl %ecx,%eax # word count
a61af66fc99e Initial load
duke
parents:
diff changeset
372 sarl %ecx # dword count
a61af66fc99e Initial load
duke
parents:
diff changeset
373 jz 4f # no dwords to move
a61af66fc99e Initial load
duke
parents:
diff changeset
374 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
375 jbe 2f # <= 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
376 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
377 rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
378 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
379 # copy aligned dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
380 .=.+5
a61af66fc99e Initial load
duke
parents:
diff changeset
381 2: subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
382 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
383 3: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
384 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
385 addl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
386 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
387 jnz 3b
a61af66fc99e Initial load
duke
parents:
diff changeset
388 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
389 4: andl $1,%eax # suffix count
a61af66fc99e Initial load
duke
parents:
diff changeset
390 jz 5f # no suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
391 # copy suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
392 movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
393 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
394 5: popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
395 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
396 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
397 acs_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
398 std
a61af66fc99e Initial load
duke
parents:
diff changeset
399 leal -4(%edi,%ecx,2),%edi # to + count*2 - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
400 movl %eax,%esi # from + count*2 - 2
a61af66fc99e Initial load
duke
parents:
diff changeset
401 movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
402 subl $2,%esi # from + count*2 - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
403 sarl %ecx # dword count
a61af66fc99e Initial load
duke
parents:
diff changeset
404 jz 4f # no dwords to move
a61af66fc99e Initial load
duke
parents:
diff changeset
405 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
406 ja 3f # > 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
407 subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
408 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
409 2: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
410 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
411 subl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
412 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
413 jnz 2b
a61af66fc99e Initial load
duke
parents:
diff changeset
414 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
415 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
416 3: rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
417 4: andl $1,%eax # suffix count
a61af66fc99e Initial load
duke
parents:
diff changeset
418 jz 5f # no suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
419 # copy suffix
a61af66fc99e Initial load
duke
parents:
diff changeset
420 addl $2,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
421 addl $2,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
422 movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
423 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
424 5: cld
a61af66fc99e Initial load
duke
parents:
diff changeset
425 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
426 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
427 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
428
a61af66fc99e Initial load
duke
parents:
diff changeset
429 # Support for void Copy::conjoint_jints_atomic(void* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
430 # void* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
431 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
432 # Equivalent to
a61af66fc99e Initial load
duke
parents:
diff changeset
433 # arrayof_conjoint_jints
a61af66fc99e Initial load
duke
parents:
diff changeset
434 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
435 .type _Copy_conjoint_jints_atomic,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
436 .type _Copy_arrayof_conjoint_jints,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
437 _Copy_conjoint_jints_atomic:
a61af66fc99e Initial load
duke
parents:
diff changeset
438 _Copy_arrayof_conjoint_jints:
a61af66fc99e Initial load
duke
parents:
diff changeset
439 pushl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
440 movl 4+12(%esp),%ecx # count
a61af66fc99e Initial load
duke
parents:
diff changeset
441 pushl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
442 movl 8+ 4(%esp),%esi # from
a61af66fc99e Initial load
duke
parents:
diff changeset
443 movl 8+ 8(%esp),%edi # to
a61af66fc99e Initial load
duke
parents:
diff changeset
444 cmpl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
445 leal -4(%esi,%ecx,4),%eax # from + count*4 - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
446 jbe ci_CopyRight
a61af66fc99e Initial load
duke
parents:
diff changeset
447 cmpl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
448 jbe ci_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
449 ci_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
450 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
451 jbe 2f # <= 32 dwords
a61af66fc99e Initial load
duke
parents:
diff changeset
452 rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
453 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
454 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
455 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
456 .=.+10
a61af66fc99e Initial load
duke
parents:
diff changeset
457 2: subl %esi,%edi
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
458 jmp 4f
0
a61af66fc99e Initial load
duke
parents:
diff changeset
459 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
460 3: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
461 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
462 addl $4,%esi
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
463 4: subl $1,%ecx
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
464 jge 3b
0
a61af66fc99e Initial load
duke
parents:
diff changeset
465 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
466 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
467 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
468 ci_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
469 std
a61af66fc99e Initial load
duke
parents:
diff changeset
470 leal -4(%edi,%ecx,4),%edi # to + count*4 - 4
a61af66fc99e Initial load
duke
parents:
diff changeset
471 cmpl $32,%ecx
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
472 ja 4f # > 32 dwords
0
a61af66fc99e Initial load
duke
parents:
diff changeset
473 subl %eax,%edi # eax == from + count*4 - 4
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
474 jmp 3f
0
a61af66fc99e Initial load
duke
parents:
diff changeset
475 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
476 2: movl (%eax),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
477 movl %edx,(%edi,%eax,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
478 subl $4,%eax
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
479 3: subl $1,%ecx
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
480 jge 2b
0
a61af66fc99e Initial load
duke
parents:
diff changeset
481 cld
a61af66fc99e Initial load
duke
parents:
diff changeset
482 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
483 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
484 ret
1603
d93949c5bdcc 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 1552
diff changeset
485 4: movl %eax,%esi # from + count*4 - 4
0
a61af66fc99e Initial load
duke
parents:
diff changeset
486 rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
487 cld
a61af66fc99e Initial load
duke
parents:
diff changeset
488 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
489 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
490 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
491
a61af66fc99e Initial load
duke
parents:
diff changeset
492 # Support for void Copy::conjoint_jlongs_atomic(jlong* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
493 # jlong* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
494 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
495 #
a61af66fc99e Initial load
duke
parents:
diff changeset
496 # 32-bit
a61af66fc99e Initial load
duke
parents:
diff changeset
497 #
a61af66fc99e Initial load
duke
parents:
diff changeset
498 # count treated as signed
a61af66fc99e Initial load
duke
parents:
diff changeset
499 #
a61af66fc99e Initial load
duke
parents:
diff changeset
500 # if (from > to) {
a61af66fc99e Initial load
duke
parents:
diff changeset
501 # while (--count >= 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
502 # *to++ = *from++;
a61af66fc99e Initial load
duke
parents:
diff changeset
503 # }
a61af66fc99e Initial load
duke
parents:
diff changeset
504 # } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
505 # while (--count >= 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
506 # to[count] = from[count];
a61af66fc99e Initial load
duke
parents:
diff changeset
507 # }
a61af66fc99e Initial load
duke
parents:
diff changeset
508 # }
a61af66fc99e Initial load
duke
parents:
diff changeset
509 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
510 .type _Copy_conjoint_jlongs_atomic,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
511 _Copy_conjoint_jlongs_atomic:
a61af66fc99e Initial load
duke
parents:
diff changeset
512 movl 4+8(%esp),%ecx # count
a61af66fc99e Initial load
duke
parents:
diff changeset
513 movl 4+0(%esp),%eax # from
a61af66fc99e Initial load
duke
parents:
diff changeset
514 movl 4+4(%esp),%edx # to
a61af66fc99e Initial load
duke
parents:
diff changeset
515 cmpl %eax,%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
516 jae cla_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
517 cla_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
518 subl %eax,%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
519 jmp 2f
a61af66fc99e Initial load
duke
parents:
diff changeset
520 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
521 1: fildll (%eax)
a61af66fc99e Initial load
duke
parents:
diff changeset
522 fistpll (%edx,%eax,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
523 addl $8,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
524 2: subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
525 jge 1b
a61af66fc99e Initial load
duke
parents:
diff changeset
526 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
527 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
528 3: fildll (%eax,%ecx,8)
a61af66fc99e Initial load
duke
parents:
diff changeset
529 fistpll (%edx,%ecx,8)
a61af66fc99e Initial load
duke
parents:
diff changeset
530 cla_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
531 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
532 jge 3b
a61af66fc99e Initial load
duke
parents:
diff changeset
533 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
534
a61af66fc99e Initial load
duke
parents:
diff changeset
535 # Support for void Copy::arrayof_conjoint_jshorts(void* from,
a61af66fc99e Initial load
duke
parents:
diff changeset
536 # void* to,
a61af66fc99e Initial load
duke
parents:
diff changeset
537 # size_t count)
a61af66fc99e Initial load
duke
parents:
diff changeset
538 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
539 .type _mmx_Copy_arrayof_conjoint_jshorts,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
540 _mmx_Copy_arrayof_conjoint_jshorts:
a61af66fc99e Initial load
duke
parents:
diff changeset
541 pushl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
542 movl 4+12(%esp),%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
543 pushl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
544 movl 8+ 4(%esp),%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
545 movl 8+ 8(%esp),%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
546 cmpl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
547 leal -2(%esi,%ecx,2),%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
548 jbe mmx_acs_CopyRight
a61af66fc99e Initial load
duke
parents:
diff changeset
549 cmpl %eax,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
550 jbe mmx_acs_CopyLeft
a61af66fc99e Initial load
duke
parents:
diff changeset
551 mmx_acs_CopyRight:
a61af66fc99e Initial load
duke
parents:
diff changeset
552 movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
553 sarl %ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
554 je 5f
a61af66fc99e Initial load
duke
parents:
diff changeset
555 cmpl $33,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
556 jae 3f
a61af66fc99e Initial load
duke
parents:
diff changeset
557 1: subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
558 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
559 2: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
560 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
561 addl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
562 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
563 jnz 2b
a61af66fc99e Initial load
duke
parents:
diff changeset
564 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
565 jmp 5f
a61af66fc99e Initial load
duke
parents:
diff changeset
566 3: smovl # align to 8 bytes, we know we are 4 byte aligned to start
a61af66fc99e Initial load
duke
parents:
diff changeset
567 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
568 4: .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
569 movq 0(%esi),%mm0
a61af66fc99e Initial load
duke
parents:
diff changeset
570 addl $64,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
571 movq 8(%esi),%mm1
a61af66fc99e Initial load
duke
parents:
diff changeset
572 subl $16,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
573 movq 16(%esi),%mm2
a61af66fc99e Initial load
duke
parents:
diff changeset
574 movq %mm0,-64(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
575 movq 24(%esi),%mm0
a61af66fc99e Initial load
duke
parents:
diff changeset
576 movq %mm1,-56(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
577 movq 32(%esi),%mm1
a61af66fc99e Initial load
duke
parents:
diff changeset
578 movq %mm2,-48(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
579 movq 40(%esi),%mm2
a61af66fc99e Initial load
duke
parents:
diff changeset
580 movq %mm0,-40(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
581 movq 48(%esi),%mm0
a61af66fc99e Initial load
duke
parents:
diff changeset
582 movq %mm1,-32(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
583 movq 56(%esi),%mm1
a61af66fc99e Initial load
duke
parents:
diff changeset
584 movq %mm2,-24(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
585 movq %mm0,-16(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
586 addl $64,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
587 movq %mm1,-8(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
588 cmpl $16,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
589 jge 4b
a61af66fc99e Initial load
duke
parents:
diff changeset
590 emms
a61af66fc99e Initial load
duke
parents:
diff changeset
591 testl %ecx,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
592 ja 1b
a61af66fc99e Initial load
duke
parents:
diff changeset
593 5: andl $1,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
594 je 7f
a61af66fc99e Initial load
duke
parents:
diff changeset
595 6: movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
596 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
597 7: popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
598 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
599 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
600 mmx_acs_CopyLeft:
a61af66fc99e Initial load
duke
parents:
diff changeset
601 std
a61af66fc99e Initial load
duke
parents:
diff changeset
602 leal -4(%edi,%ecx,2),%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
603 movl %eax,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
604 movl %ecx,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
605 subl $2,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
606 sarl %ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
607 je 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
608 cmpl $32,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
609 ja 3f
a61af66fc99e Initial load
duke
parents:
diff changeset
610 subl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
611 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
612 2: movl (%esi),%edx
a61af66fc99e Initial load
duke
parents:
diff changeset
613 movl %edx,(%edi,%esi,1)
a61af66fc99e Initial load
duke
parents:
diff changeset
614 subl $4,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
615 subl $1,%ecx
a61af66fc99e Initial load
duke
parents:
diff changeset
616 jnz 2b
a61af66fc99e Initial load
duke
parents:
diff changeset
617 addl %esi,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
618 jmp 4f
a61af66fc99e Initial load
duke
parents:
diff changeset
619 3: rep; smovl
a61af66fc99e Initial load
duke
parents:
diff changeset
620 4: andl $1,%eax
a61af66fc99e Initial load
duke
parents:
diff changeset
621 je 6f
a61af66fc99e Initial load
duke
parents:
diff changeset
622 addl $2,%esi
a61af66fc99e Initial load
duke
parents:
diff changeset
623 addl $2,%edi
a61af66fc99e Initial load
duke
parents:
diff changeset
624 5: movw (%esi),%dx
a61af66fc99e Initial load
duke
parents:
diff changeset
625 movw %dx,(%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
626 6: cld
a61af66fc99e Initial load
duke
parents:
diff changeset
627 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
628 popl %esi
a61af66fc99e Initial load
duke
parents:
diff changeset
629 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
630
a61af66fc99e Initial load
duke
parents:
diff changeset
631
a61af66fc99e Initial load
duke
parents:
diff changeset
632 # Support for jlong Atomic::cmpxchg(jlong exchange_value,
a61af66fc99e Initial load
duke
parents:
diff changeset
633 # volatile jlong* dest,
a61af66fc99e Initial load
duke
parents:
diff changeset
634 # jlong compare_value,
a61af66fc99e Initial load
duke
parents:
diff changeset
635 # bool is_MP)
a61af66fc99e Initial load
duke
parents:
diff changeset
636 #
a61af66fc99e Initial load
duke
parents:
diff changeset
637 .p2align 4,,15
a61af66fc99e Initial load
duke
parents:
diff changeset
638 .type _Atomic_cmpxchg_long,@function
a61af66fc99e Initial load
duke
parents:
diff changeset
639 _Atomic_cmpxchg_long:
a61af66fc99e Initial load
duke
parents:
diff changeset
640 # 8(%esp) : return PC
a61af66fc99e Initial load
duke
parents:
diff changeset
641 pushl %ebx # 4(%esp) : old %ebx
a61af66fc99e Initial load
duke
parents:
diff changeset
642 pushl %edi # 0(%esp) : old %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
643 movl 12(%esp), %ebx # 12(%esp) : exchange_value (low)
a61af66fc99e Initial load
duke
parents:
diff changeset
644 movl 16(%esp), %ecx # 16(%esp) : exchange_value (high)
a61af66fc99e Initial load
duke
parents:
diff changeset
645 movl 24(%esp), %eax # 24(%esp) : compare_value (low)
a61af66fc99e Initial load
duke
parents:
diff changeset
646 movl 28(%esp), %edx # 28(%esp) : compare_value (high)
a61af66fc99e Initial load
duke
parents:
diff changeset
647 movl 20(%esp), %edi # 20(%esp) : dest
a61af66fc99e Initial load
duke
parents:
diff changeset
648 cmpl $0, 32(%esp) # 32(%esp) : is_MP
a61af66fc99e Initial load
duke
parents:
diff changeset
649 je 1f
a61af66fc99e Initial load
duke
parents:
diff changeset
650 lock
a61af66fc99e Initial load
duke
parents:
diff changeset
651 1: cmpxchg8b (%edi)
a61af66fc99e Initial load
duke
parents:
diff changeset
652 popl %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
653 popl %ebx
a61af66fc99e Initial load
duke
parents:
diff changeset
654 ret
a61af66fc99e Initial load
duke
parents:
diff changeset
655