Thu, 16 Feb 2012 17:12:49 -0800
7145346: VerifyStackAtCalls is broken
Summary: Replace call_epilog() encoding with macroassembler use. Moved duplicated code to x86.ad. Fixed return_addr() definition.
Reviewed-by: never
duke@435 | 1 | // |
kvn@2434 | 2 | // Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | // |
duke@435 | 5 | // This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | // under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | // published by the Free Software Foundation. |
duke@435 | 8 | // |
duke@435 | 9 | // This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | // version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | // accompanied this code). |
duke@435 | 14 | // |
duke@435 | 15 | // You should have received a copy of the GNU General Public License version |
duke@435 | 16 | // 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | // |
trims@1907 | 19 | // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | // or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | // questions. |
duke@435 | 22 | // |
duke@435 | 23 | // |
duke@435 | 24 | |
duke@435 | 25 | |
duke@435 | 26 | // Support for u8 os::setup_fpu() |
duke@435 | 27 | .inline _solaris_raw_setup_fpu,1 |
duke@435 | 28 | movl 0(%esp), %eax |
duke@435 | 29 | fldcw (%eax) |
duke@435 | 30 | .end |
duke@435 | 31 | |
duke@435 | 32 | // The argument size of each inline directive is ignored by the compiler |
duke@435 | 33 | // and is set to 0 for compatibility reason. |
duke@435 | 34 | |
duke@435 | 35 | // Get the raw thread ID from %gs:0 |
duke@435 | 36 | .inline _raw_thread_id,0 |
duke@435 | 37 | movl %gs:0, %eax |
duke@435 | 38 | .end |
duke@435 | 39 | |
coleenp@907 | 40 | // Get current fp |
coleenp@907 | 41 | .inline _get_current_fp,0 |
coleenp@907 | 42 | .volatile |
duke@435 | 43 | movl %ebp, %eax |
duke@435 | 44 | .end |
duke@435 | 45 | |
phh@3378 | 46 | // Support for os::rdtsc() |
phh@3378 | 47 | .inline _raw_rdtsc,0 |
phh@3378 | 48 | rdtsc |
phh@3378 | 49 | .end |
phh@3378 | 50 | |
duke@435 | 51 | // Support for jint Atomic::add(jint inc, volatile jint* dest) |
duke@435 | 52 | // An additional bool (os::is_MP()) is passed as the last argument. |
duke@435 | 53 | .inline _Atomic_add,3 |
duke@435 | 54 | movl 0(%esp), %eax // inc |
duke@435 | 55 | movl 4(%esp), %edx // dest |
duke@435 | 56 | movl %eax, %ecx |
duke@435 | 57 | cmpl $0, 8(%esp) // MP test |
jcoomes@1902 | 58 | jne 1f |
jcoomes@1902 | 59 | xaddl %eax, (%edx) |
jcoomes@1902 | 60 | jmp 2f |
jcoomes@1902 | 61 | 1: lock |
jcoomes@1902 | 62 | xaddl %eax, (%edx) |
jcoomes@1902 | 63 | 2: addl %ecx, %eax |
duke@435 | 64 | .end |
duke@435 | 65 | |
duke@435 | 66 | // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest). |
duke@435 | 67 | .inline _Atomic_xchg,2 |
duke@435 | 68 | movl 0(%esp), %eax // exchange_value |
duke@435 | 69 | movl 4(%esp), %ecx // dest |
duke@435 | 70 | xchgl (%ecx), %eax |
duke@435 | 71 | .end |
duke@435 | 72 | |
duke@435 | 73 | // Support for jint Atomic::cmpxchg(jint exchange_value, |
duke@435 | 74 | // volatile jint *dest, |
duke@435 | 75 | // jint compare_value) |
duke@435 | 76 | // An additional bool (os::is_MP()) is passed as the last argument. |
duke@435 | 77 | .inline _Atomic_cmpxchg,4 |
duke@435 | 78 | movl 8(%esp), %eax // compare_value |
duke@435 | 79 | movl 0(%esp), %ecx // exchange_value |
duke@435 | 80 | movl 4(%esp), %edx // dest |
duke@435 | 81 | cmp $0, 12(%esp) // MP test |
jcoomes@1902 | 82 | jne 1f |
jcoomes@1902 | 83 | cmpxchgl %ecx, (%edx) |
jcoomes@1902 | 84 | jmp 2f |
jcoomes@1902 | 85 | 1: lock |
jcoomes@1902 | 86 | cmpxchgl %ecx, (%edx) |
jcoomes@1902 | 87 | 2: |
duke@435 | 88 | .end |
duke@435 | 89 | |
duke@435 | 90 | // Support for jlong Atomic::cmpxchg(jlong exchange_value, |
duke@435 | 91 | // volatile jlong* dest, |
duke@435 | 92 | // jlong compare_value) |
duke@435 | 93 | // An additional bool (os::is_MP()) is passed as the last argument. |
duke@435 | 94 | .inline _Atomic_cmpxchg_long,6 |
duke@435 | 95 | pushl %ebx |
duke@435 | 96 | pushl %edi |
duke@435 | 97 | movl 20(%esp), %eax // compare_value (low) |
duke@435 | 98 | movl 24(%esp), %edx // compare_value (high) |
duke@435 | 99 | movl 16(%esp), %edi // dest |
duke@435 | 100 | movl 8(%esp), %ebx // exchange_value (low) |
duke@435 | 101 | movl 12(%esp), %ecx // exchange_high (high) |
duke@435 | 102 | cmp $0, 28(%esp) // MP test |
jcoomes@1902 | 103 | jne 1f |
jcoomes@1902 | 104 | cmpxchg8b (%edi) |
jcoomes@1902 | 105 | jmp 2f |
jcoomes@1902 | 106 | 1: lock |
jcoomes@1902 | 107 | cmpxchg8b (%edi) |
jcoomes@1902 | 108 | 2: popl %edi |
duke@435 | 109 | popl %ebx |
duke@435 | 110 | .end |
duke@435 | 111 | |
kvn@2434 | 112 | // Support for jlong Atomic::load and Atomic::store. |
kvn@2434 | 113 | // void _Atomic_move_long(volatile jlong* src, volatile jlong* dst) |
kvn@2434 | 114 | .inline _Atomic_move_long,2 |
kvn@1329 | 115 | movl 0(%esp), %eax // src |
kvn@1329 | 116 | fildll (%eax) |
kvn@1329 | 117 | movl 4(%esp), %eax // dest |
kvn@1329 | 118 | fistpll (%eax) |
kvn@1329 | 119 | .end |
kvn@1329 | 120 | |
duke@435 | 121 | // Support for OrderAccess::acquire() |
duke@435 | 122 | .inline _OrderAccess_acquire,0 |
duke@435 | 123 | movl 0(%esp), %eax |
duke@435 | 124 | .end |
duke@435 | 125 | |
duke@435 | 126 | // Support for OrderAccess::fence() |
duke@435 | 127 | .inline _OrderAccess_fence,0 |
duke@435 | 128 | lock |
duke@435 | 129 | addl $0, (%esp) |
duke@435 | 130 | .end |
duke@435 | 131 | |
duke@435 | 132 | // Support for u2 Bytes::swap_u2(u2 x) |
duke@435 | 133 | .inline _raw_swap_u2,1 |
duke@435 | 134 | movl 0(%esp), %eax |
duke@435 | 135 | xchgb %al, %ah |
duke@435 | 136 | .end |
duke@435 | 137 | |
duke@435 | 138 | // Support for u4 Bytes::swap_u4(u4 x) |
duke@435 | 139 | .inline _raw_swap_u4,1 |
duke@435 | 140 | movl 0(%esp), %eax |
duke@435 | 141 | bswap %eax |
duke@435 | 142 | .end |
duke@435 | 143 | |
duke@435 | 144 | // Support for u8 Bytes::swap_u8_base(u4 x, u4 y) |
duke@435 | 145 | .inline _raw_swap_u8,2 |
duke@435 | 146 | movl 4(%esp), %eax // y |
duke@435 | 147 | movl 0(%esp), %edx // x |
duke@435 | 148 | bswap %eax |
duke@435 | 149 | bswap %edx |
duke@435 | 150 | .end |