comparison src/os_cpu/linux_x86/vm/assembler_linux_x86.cpp @ 304:dc7f315e41f7

5108146: Merge i486 and amd64 cpu directories 6459804: Want client (c1) compiler for x86_64 (amd64) for faster start-up Reviewed-by: kvn
author never
date Wed, 27 Aug 2008 00:21:55 -0700
parents src/os_cpu/linux_x86/vm/assembler_linux_x86_32.cpp@1fdb98a17101
children c18cbe5936b8
comparison
equal deleted inserted replaced
303:fa4d1d240383 304:dc7f315e41f7
1 /*
2 * Copyright 1999-2008 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_linux_x86.cpp.incl"
27
28 #ifndef _LP64
29 void MacroAssembler::int3() {
30 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
31 }
32
33 void MacroAssembler::get_thread(Register thread) {
34 movl(thread, rsp);
35 shrl(thread, PAGE_SHIFT);
36
37 ExternalAddress tls_base((address)ThreadLocalStorage::sp_map_addr());
38 Address index(noreg, thread, Address::times_4);
39 ArrayAddress tls(tls_base, index);
40
41 movptr(thread, tls);
42 }
43 #else
44 void MacroAssembler::int3() {
45 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
46 }
47
48 void MacroAssembler::get_thread(Register thread) {
49 // call pthread_getspecific
50 // void * pthread_getspecific(pthread_key_t key);
51 if (thread != rax) {
52 push(rax);
53 }
54 push(rdi);
55 push(rsi);
56 push(rdx);
57 push(rcx);
58 push(r8);
59 push(r9);
60 push(r10);
61 // XXX
62 mov(r10, rsp);
63 andq(rsp, -16);
64 push(r10);
65 push(r11);
66
67 movl(rdi, ThreadLocalStorage::thread_index());
68 call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific)));
69
70 pop(r11);
71 pop(rsp);
72 pop(r10);
73 pop(r9);
74 pop(r8);
75 pop(rcx);
76 pop(rdx);
77 pop(rsi);
78 pop(rdi);
79 if (thread != rax) {
80 mov(thread, rax);
81 pop(rax);
82 }
83 }
84 #endif