src/os_cpu/bsd_x86/vm/bsd_x86_64.s

Fri, 08 Feb 2013 12:48:24 +0100

author
sla
date
Fri, 08 Feb 2013 12:48:24 +0100
changeset 4564
758935f7c23f
parent 3156
f08d439fab8c
child 5400
980532a806a5
permissions
-rw-r--r--

8006423: SA: NullPointerException in sun.jvm.hotspot.debugger.bsd.BsdThread.getContext(BsdThread.java:67)
Summary: Do not rely on mach thread port names to identify threads from SA
Reviewed-by: dholmes, minqi, rbackman

never@3156 1 #
never@3156 2 # Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
never@3156 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@3156 4 #
never@3156 5 # This code is free software; you can redistribute it and/or modify it
never@3156 6 # under the terms of the GNU General Public License version 2 only, as
never@3156 7 # published by the Free Software Foundation.
never@3156 8 #
never@3156 9 # This code is distributed in the hope that it will be useful, but WITHOUT
never@3156 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@3156 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@3156 12 # version 2 for more details (a copy is included in the LICENSE file that
never@3156 13 # accompanied this code).
never@3156 14 #
never@3156 15 # You should have received a copy of the GNU General Public License version
never@3156 16 # 2 along with this work; if not, write to the Free Software Foundation,
never@3156 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@3156 18 #
never@3156 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
never@3156 20 # or visit www.oracle.com if you need additional information or have any
never@3156 21 # questions.
never@3156 22 #
never@3156 23
never@3156 24 #ifdef __APPLE__
never@3156 25 # Darwin uses _ prefixed global symbols
never@3156 26 #define SYMBOL(s) _ ## s
never@3156 27 #define ELF_TYPE(name, description)
never@3156 28 #else
never@3156 29 #define SYMBOL(s) s
never@3156 30 #define ELF_TYPE(name, description) .type name,description
never@3156 31 #endif
never@3156 32
never@3156 33 # NOTE WELL! The _Copy functions are called directly
never@3156 34 # from server-compiler-generated code via CallLeafNoFP,
never@3156 35 # which means that they *must* either not use floating
never@3156 36 # point or use it in the same manner as does the server
never@3156 37 # compiler.
never@3156 38
never@3156 39 .globl SYMBOL(_Copy_arrayof_conjoint_bytes)
never@3156 40 .globl SYMBOL(_Copy_arrayof_conjoint_jshorts)
never@3156 41 .globl SYMBOL(_Copy_conjoint_jshorts_atomic)
never@3156 42 .globl SYMBOL(_Copy_arrayof_conjoint_jints)
never@3156 43 .globl SYMBOL(_Copy_conjoint_jints_atomic)
never@3156 44 .globl SYMBOL(_Copy_arrayof_conjoint_jlongs)
never@3156 45 .globl SYMBOL(_Copy_conjoint_jlongs_atomic)
never@3156 46
never@3156 47 .text
never@3156 48
never@3156 49 .globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume)
never@3156 50 .p2align 4,,15
never@3156 51 ELF_TYPE(SafeFetch32,@function)
never@3156 52 // Prototype: int SafeFetch32 (int * Adr, int ErrValue)
never@3156 53 SYMBOL(SafeFetch32):
never@3156 54 movl %esi, %eax
never@3156 55 SYMBOL(Fetch32PFI):
never@3156 56 movl (%rdi), %eax
never@3156 57 SYMBOL(Fetch32Resume):
never@3156 58 ret
never@3156 59
never@3156 60 .globl SYMBOL(SafeFetchN), SYMBOL(FetchNPFI), SYMBOL(FetchNResume)
never@3156 61 .p2align 4,,15
never@3156 62 ELF_TYPE(SafeFetchN,@function)
never@3156 63 // Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue)
never@3156 64 SYMBOL(SafeFetchN):
never@3156 65 movq %rsi, %rax
never@3156 66 SYMBOL(FetchNPFI):
never@3156 67 movq (%rdi), %rax
never@3156 68 SYMBOL(FetchNResume):
never@3156 69 ret
never@3156 70
never@3156 71 .globl SYMBOL(SpinPause)
never@3156 72 .p2align 4,,15
never@3156 73 ELF_TYPE(SpinPause,@function)
never@3156 74 SYMBOL(SpinPause):
never@3156 75 rep
never@3156 76 nop
never@3156 77 movq $1, %rax
never@3156 78 ret
never@3156 79
never@3156 80 # Support for void Copy::arrayof_conjoint_bytes(void* from,
never@3156 81 # void* to,
never@3156 82 # size_t count)
never@3156 83 # rdi - from
never@3156 84 # rsi - to
never@3156 85 # rdx - count, treated as ssize_t
never@3156 86 #
never@3156 87 .p2align 4,,15
never@3156 88 ELF_TYPE(_Copy_arrayof_conjoint_bytes,@function)
never@3156 89 SYMBOL(_Copy_arrayof_conjoint_bytes):
never@3156 90 movq %rdx,%r8 # byte count
never@3156 91 shrq $3,%rdx # qword count
never@3156 92 cmpq %rdi,%rsi
never@3156 93 leaq -1(%rdi,%r8,1),%rax # from + bcount*1 - 1
never@3156 94 jbe acb_CopyRight
never@3156 95 cmpq %rax,%rsi
never@3156 96 jbe acb_CopyLeft
never@3156 97 acb_CopyRight:
never@3156 98 leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8
never@3156 99 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8
never@3156 100 negq %rdx
never@3156 101 jmp 7f
never@3156 102 .p2align 4,,15
never@3156 103 1: movq 8(%rax,%rdx,8),%rsi
never@3156 104 movq %rsi,8(%rcx,%rdx,8)
never@3156 105 addq $1,%rdx
never@3156 106 jnz 1b
never@3156 107 2: testq $4,%r8 # check for trailing dword
never@3156 108 jz 3f
never@3156 109 movl 8(%rax),%esi # copy trailing dword
never@3156 110 movl %esi,8(%rcx)
never@3156 111 addq $4,%rax
never@3156 112 addq $4,%rcx # original %rsi is trashed, so we
never@3156 113 # can't use it as a base register
never@3156 114 3: testq $2,%r8 # check for trailing word
never@3156 115 jz 4f
never@3156 116 movw 8(%rax),%si # copy trailing word
never@3156 117 movw %si,8(%rcx)
never@3156 118 addq $2,%rcx
never@3156 119 4: testq $1,%r8 # check for trailing byte
never@3156 120 jz 5f
never@3156 121 movb -1(%rdi,%r8,1),%al # copy trailing byte
never@3156 122 movb %al,8(%rcx)
never@3156 123 5: ret
never@3156 124 .p2align 4,,15
never@3156 125 6: movq -24(%rax,%rdx,8),%rsi
never@3156 126 movq %rsi,-24(%rcx,%rdx,8)
never@3156 127 movq -16(%rax,%rdx,8),%rsi
never@3156 128 movq %rsi,-16(%rcx,%rdx,8)
never@3156 129 movq -8(%rax,%rdx,8),%rsi
never@3156 130 movq %rsi,-8(%rcx,%rdx,8)
never@3156 131 movq (%rax,%rdx,8),%rsi
never@3156 132 movq %rsi,(%rcx,%rdx,8)
never@3156 133 7: addq $4,%rdx
never@3156 134 jle 6b
never@3156 135 subq $4,%rdx
never@3156 136 jl 1b
never@3156 137 jmp 2b
never@3156 138 acb_CopyLeft:
never@3156 139 testq $1,%r8 # check for trailing byte
never@3156 140 jz 1f
never@3156 141 movb -1(%rdi,%r8,1),%cl # copy trailing byte
never@3156 142 movb %cl,-1(%rsi,%r8,1)
never@3156 143 subq $1,%r8 # adjust for possible trailing word
never@3156 144 1: testq $2,%r8 # check for trailing word
never@3156 145 jz 2f
never@3156 146 movw -2(%rdi,%r8,1),%cx # copy trailing word
never@3156 147 movw %cx,-2(%rsi,%r8,1)
never@3156 148 2: testq $4,%r8 # check for trailing dword
never@3156 149 jz 5f
never@3156 150 movl (%rdi,%rdx,8),%ecx # copy trailing dword
never@3156 151 movl %ecx,(%rsi,%rdx,8)
never@3156 152 jmp 5f
never@3156 153 .p2align 4,,15
never@3156 154 3: movq -8(%rdi,%rdx,8),%rcx
never@3156 155 movq %rcx,-8(%rsi,%rdx,8)
never@3156 156 subq $1,%rdx
never@3156 157 jnz 3b
never@3156 158 ret
never@3156 159 .p2align 4,,15
never@3156 160 4: movq 24(%rdi,%rdx,8),%rcx
never@3156 161 movq %rcx,24(%rsi,%rdx,8)
never@3156 162 movq 16(%rdi,%rdx,8),%rcx
never@3156 163 movq %rcx,16(%rsi,%rdx,8)
never@3156 164 movq 8(%rdi,%rdx,8),%rcx
never@3156 165 movq %rcx,8(%rsi,%rdx,8)
never@3156 166 movq (%rdi,%rdx,8),%rcx
never@3156 167 movq %rcx,(%rsi,%rdx,8)
never@3156 168 5: subq $4,%rdx
never@3156 169 jge 4b
never@3156 170 addq $4,%rdx
never@3156 171 jg 3b
never@3156 172 ret
never@3156 173
never@3156 174 # Support for void Copy::arrayof_conjoint_jshorts(void* from,
never@3156 175 # void* to,
never@3156 176 # size_t count)
never@3156 177 # Equivalent to
never@3156 178 # conjoint_jshorts_atomic
never@3156 179 #
never@3156 180 # If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
never@3156 181 # let the hardware handle it. The tow or four words within dwords
never@3156 182 # or qwords that span cache line boundaries will still be loaded
never@3156 183 # and stored atomically.
never@3156 184 #
never@3156 185 # rdi - from
never@3156 186 # rsi - to
never@3156 187 # rdx - count, treated as ssize_t
never@3156 188 #
never@3156 189 .p2align 4,,15
never@3156 190 ELF_TYPE(_Copy_arrayof_conjoint_jshorts,@function)
never@3156 191 ELF_TYPE(_Copy_conjoint_jshorts_atomic,@function)
never@3156 192 SYMBOL(_Copy_arrayof_conjoint_jshorts):
never@3156 193 SYMBOL(_Copy_conjoint_jshorts_atomic):
never@3156 194 movq %rdx,%r8 # word count
never@3156 195 shrq $2,%rdx # qword count
never@3156 196 cmpq %rdi,%rsi
never@3156 197 leaq -2(%rdi,%r8,2),%rax # from + wcount*2 - 2
never@3156 198 jbe acs_CopyRight
never@3156 199 cmpq %rax,%rsi
never@3156 200 jbe acs_CopyLeft
never@3156 201 acs_CopyRight:
never@3156 202 leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8
never@3156 203 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8
never@3156 204 negq %rdx
never@3156 205 jmp 6f
never@3156 206 1: movq 8(%rax,%rdx,8),%rsi
never@3156 207 movq %rsi,8(%rcx,%rdx,8)
never@3156 208 addq $1,%rdx
never@3156 209 jnz 1b
never@3156 210 2: testq $2,%r8 # check for trailing dword
never@3156 211 jz 3f
never@3156 212 movl 8(%rax),%esi # copy trailing dword
never@3156 213 movl %esi,8(%rcx)
never@3156 214 addq $4,%rcx # original %rsi is trashed, so we
never@3156 215 # can't use it as a base register
never@3156 216 3: testq $1,%r8 # check for trailing word
never@3156 217 jz 4f
never@3156 218 movw -2(%rdi,%r8,2),%si # copy trailing word
never@3156 219 movw %si,8(%rcx)
never@3156 220 4: ret
never@3156 221 .p2align 4,,15
never@3156 222 5: movq -24(%rax,%rdx,8),%rsi
never@3156 223 movq %rsi,-24(%rcx,%rdx,8)
never@3156 224 movq -16(%rax,%rdx,8),%rsi
never@3156 225 movq %rsi,-16(%rcx,%rdx,8)
never@3156 226 movq -8(%rax,%rdx,8),%rsi
never@3156 227 movq %rsi,-8(%rcx,%rdx,8)
never@3156 228 movq (%rax,%rdx,8),%rsi
never@3156 229 movq %rsi,(%rcx,%rdx,8)
never@3156 230 6: addq $4,%rdx
never@3156 231 jle 5b
never@3156 232 subq $4,%rdx
never@3156 233 jl 1b
never@3156 234 jmp 2b
never@3156 235 acs_CopyLeft:
never@3156 236 testq $1,%r8 # check for trailing word
never@3156 237 jz 1f
never@3156 238 movw -2(%rdi,%r8,2),%cx # copy trailing word
never@3156 239 movw %cx,-2(%rsi,%r8,2)
never@3156 240 1: testq $2,%r8 # check for trailing dword
never@3156 241 jz 4f
never@3156 242 movl (%rdi,%rdx,8),%ecx # copy trailing dword
never@3156 243 movl %ecx,(%rsi,%rdx,8)
never@3156 244 jmp 4f
never@3156 245 2: movq -8(%rdi,%rdx,8),%rcx
never@3156 246 movq %rcx,-8(%rsi,%rdx,8)
never@3156 247 subq $1,%rdx
never@3156 248 jnz 2b
never@3156 249 ret
never@3156 250 .p2align 4,,15
never@3156 251 3: movq 24(%rdi,%rdx,8),%rcx
never@3156 252 movq %rcx,24(%rsi,%rdx,8)
never@3156 253 movq 16(%rdi,%rdx,8),%rcx
never@3156 254 movq %rcx,16(%rsi,%rdx,8)
never@3156 255 movq 8(%rdi,%rdx,8),%rcx
never@3156 256 movq %rcx,8(%rsi,%rdx,8)
never@3156 257 movq (%rdi,%rdx,8),%rcx
never@3156 258 movq %rcx,(%rsi,%rdx,8)
never@3156 259 4: subq $4,%rdx
never@3156 260 jge 3b
never@3156 261 addq $4,%rdx
never@3156 262 jg 2b
never@3156 263 ret
never@3156 264
never@3156 265 # Support for void Copy::arrayof_conjoint_jints(jint* from,
never@3156 266 # jint* to,
never@3156 267 # size_t count)
never@3156 268 # Equivalent to
never@3156 269 # conjoint_jints_atomic
never@3156 270 #
never@3156 271 # If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
never@3156 272 # the hardware handle it. The two dwords within qwords that span
never@3156 273 # cache line boundaries will still be loaded and stored atomically.
never@3156 274 #
never@3156 275 # rdi - from
never@3156 276 # rsi - to
never@3156 277 # rdx - count, treated as ssize_t
never@3156 278 #
never@3156 279 .p2align 4,,15
never@3156 280 ELF_TYPE(_Copy_arrayof_conjoint_jints,@function)
never@3156 281 ELF_TYPE(_Copy_conjoint_jints_atomic,@function)
never@3156 282 SYMBOL(_Copy_arrayof_conjoint_jints):
never@3156 283 SYMBOL(_Copy_conjoint_jints_atomic):
never@3156 284 movq %rdx,%r8 # dword count
never@3156 285 shrq %rdx # qword count
never@3156 286 cmpq %rdi,%rsi
never@3156 287 leaq -4(%rdi,%r8,4),%rax # from + dcount*4 - 4
never@3156 288 jbe aci_CopyRight
never@3156 289 cmpq %rax,%rsi
never@3156 290 jbe aci_CopyLeft
never@3156 291 aci_CopyRight:
never@3156 292 leaq -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8
never@3156 293 leaq -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8
never@3156 294 negq %rdx
never@3156 295 jmp 5f
never@3156 296 .p2align 4,,15
never@3156 297 1: movq 8(%rax,%rdx,8),%rsi
never@3156 298 movq %rsi,8(%rcx,%rdx,8)
never@3156 299 addq $1,%rdx
never@3156 300 jnz 1b
never@3156 301 2: testq $1,%r8 # check for trailing dword
never@3156 302 jz 3f
never@3156 303 movl 8(%rax),%esi # copy trailing dword
never@3156 304 movl %esi,8(%rcx)
never@3156 305 3: ret
never@3156 306 .p2align 4,,15
never@3156 307 4: movq -24(%rax,%rdx,8),%rsi
never@3156 308 movq %rsi,-24(%rcx,%rdx,8)
never@3156 309 movq -16(%rax,%rdx,8),%rsi
never@3156 310 movq %rsi,-16(%rcx,%rdx,8)
never@3156 311 movq -8(%rax,%rdx,8),%rsi
never@3156 312 movq %rsi,-8(%rcx,%rdx,8)
never@3156 313 movq (%rax,%rdx,8),%rsi
never@3156 314 movq %rsi,(%rcx,%rdx,8)
never@3156 315 5: addq $4,%rdx
never@3156 316 jle 4b
never@3156 317 subq $4,%rdx
never@3156 318 jl 1b
never@3156 319 jmp 2b
never@3156 320 aci_CopyLeft:
never@3156 321 testq $1,%r8 # check for trailing dword
never@3156 322 jz 3f
never@3156 323 movl -4(%rdi,%r8,4),%ecx # copy trailing dword
never@3156 324 movl %ecx,-4(%rsi,%r8,4)
never@3156 325 jmp 3f
never@3156 326 1: movq -8(%rdi,%rdx,8),%rcx
never@3156 327 movq %rcx,-8(%rsi,%rdx,8)
never@3156 328 subq $1,%rdx
never@3156 329 jnz 1b
never@3156 330 ret
never@3156 331 .p2align 4,,15
never@3156 332 2: movq 24(%rdi,%rdx,8),%rcx
never@3156 333 movq %rcx,24(%rsi,%rdx,8)
never@3156 334 movq 16(%rdi,%rdx,8),%rcx
never@3156 335 movq %rcx,16(%rsi,%rdx,8)
never@3156 336 movq 8(%rdi,%rdx,8),%rcx
never@3156 337 movq %rcx,8(%rsi,%rdx,8)
never@3156 338 movq (%rdi,%rdx,8),%rcx
never@3156 339 movq %rcx,(%rsi,%rdx,8)
never@3156 340 3: subq $4,%rdx
never@3156 341 jge 2b
never@3156 342 addq $4,%rdx
never@3156 343 jg 1b
never@3156 344 ret
never@3156 345
never@3156 346 # Support for void Copy::arrayof_conjoint_jlongs(jlong* from,
never@3156 347 # jlong* to,
never@3156 348 # size_t count)
never@3156 349 # Equivalent to
never@3156 350 # conjoint_jlongs_atomic
never@3156 351 # arrayof_conjoint_oops
never@3156 352 # conjoint_oops_atomic
never@3156 353 #
never@3156 354 # rdi - from
never@3156 355 # rsi - to
never@3156 356 # rdx - count, treated as ssize_t
never@3156 357 #
never@3156 358 .p2align 4,,15
never@3156 359 ELF_TYPE(_Copy_arrayof_conjoint_jlongs,@function)
never@3156 360 ELF_TYPE(_Copy_conjoint_jlongs_atomic,@function)
never@3156 361 SYMBOL(_Copy_arrayof_conjoint_jlongs):
never@3156 362 SYMBOL(_Copy_conjoint_jlongs_atomic):
never@3156 363 cmpq %rdi,%rsi
never@3156 364 leaq -8(%rdi,%rdx,8),%rax # from + count*8 - 8
never@3156 365 jbe acl_CopyRight
never@3156 366 cmpq %rax,%rsi
never@3156 367 jbe acl_CopyLeft
never@3156 368 acl_CopyRight:
never@3156 369 leaq -8(%rsi,%rdx,8),%rcx # to + count*8 - 8
never@3156 370 negq %rdx
never@3156 371 jmp 3f
never@3156 372 1: movq 8(%rax,%rdx,8),%rsi
never@3156 373 movq %rsi,8(%rcx,%rdx,8)
never@3156 374 addq $1,%rdx
never@3156 375 jnz 1b
never@3156 376 ret
never@3156 377 .p2align 4,,15
never@3156 378 2: movq -24(%rax,%rdx,8),%rsi
never@3156 379 movq %rsi,-24(%rcx,%rdx,8)
never@3156 380 movq -16(%rax,%rdx,8),%rsi
never@3156 381 movq %rsi,-16(%rcx,%rdx,8)
never@3156 382 movq -8(%rax,%rdx,8),%rsi
never@3156 383 movq %rsi,-8(%rcx,%rdx,8)
never@3156 384 movq (%rax,%rdx,8),%rsi
never@3156 385 movq %rsi,(%rcx,%rdx,8)
never@3156 386 3: addq $4,%rdx
never@3156 387 jle 2b
never@3156 388 subq $4,%rdx
never@3156 389 jl 1b
never@3156 390 ret
never@3156 391 4: movq -8(%rdi,%rdx,8),%rcx
never@3156 392 movq %rcx,-8(%rsi,%rdx,8)
never@3156 393 subq $1,%rdx
never@3156 394 jnz 4b
never@3156 395 ret
never@3156 396 .p2align 4,,15
never@3156 397 5: movq 24(%rdi,%rdx,8),%rcx
never@3156 398 movq %rcx,24(%rsi,%rdx,8)
never@3156 399 movq 16(%rdi,%rdx,8),%rcx
never@3156 400 movq %rcx,16(%rsi,%rdx,8)
never@3156 401 movq 8(%rdi,%rdx,8),%rcx
never@3156 402 movq %rcx,8(%rsi,%rdx,8)
never@3156 403 movq (%rdi,%rdx,8),%rcx
never@3156 404 movq %rcx,(%rsi,%rdx,8)
never@3156 405 acl_CopyLeft:
never@3156 406 subq $4,%rdx
never@3156 407 jge 5b
never@3156 408 addq $4,%rdx
never@3156 409 jg 4b
never@3156 410 ret

mercurial