comparison src/os_cpu/solaris_x86/vm/assembler_solaris_x86_64.cpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 7793bd37a336
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 #include "incls/_precompiled.incl"
26 #include "incls/_assembler_solaris_x86_64.cpp.incl"
27
28 void MacroAssembler::int3() {
29 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
30 }
31
32 void MacroAssembler::get_thread(Register thread) {
33 // Try to emit a Solaris-specific fast TSD/TLS accessor.
34 ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode();
35 if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) { // T1
36 // Use thread as a temporary: mov r, fs:[0]; mov r, [r+tlsOffset]
37 emit_byte(Assembler::FS_segment);
38 movq(thread, Address(NULL, relocInfo::none));
39 movq(thread, Address(thread, ThreadLocalStorage::pd_getTlsOffset()));
40 return;
41 } else if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) { // T2
42 // mov r, fs:[tlsOffset]
43 emit_byte(Assembler::FS_segment);
44 ExternalAddress tls_off((address) ThreadLocalStorage::pd_getTlsOffset());
45 movptr(thread, tls_off);
46 return;
47 }
48
49 // slow call to of thr_getspecific
50 // int thr_getspecific(thread_key_t key, void **value);
51 // Consider using pthread_getspecific instead.
52
53 if (thread != rax) {
54 pushq(rax);
55 }
56 pushq(0); // space for return value
57 pushq(rdi);
58 pushq(rsi);
59 leaq(rsi, Address(rsp, 16)); // pass return value address
60 pushq(rdx);
61 pushq(rcx);
62 pushq(r8);
63 pushq(r9);
64 pushq(r10);
65 // XXX
66 movq(r10, rsp);
67 andq(rsp, -16);
68 pushq(r10);
69 pushq(r11);
70
71 movl(rdi, ThreadLocalStorage::thread_index());
72 call(RuntimeAddress(CAST_FROM_FN_PTR(address, thr_getspecific)));
73
74 popq(r11);
75 popq(rsp);
76 popq(r10);
77 popq(r9);
78 popq(r8);
79 popq(rcx);
80 popq(rdx);
81 popq(rsi);
82 popq(rdi);
83 popq(thread); // load return value
84 if (thread != rax) {
85 popq(rax);
86 }
87 }
88
89 bool MacroAssembler::needs_explicit_null_check(int offset) {
90 // Identical to Sparc/Solaris code
91 bool offset_in_first_page = 0 <= offset && offset < os::vm_page_size();
92 return !offset_in_first_page;
93 }