author | jcoomes |
Wed, 06 Jul 2011 12:22:29 -0700 | |
changeset 10021 | 7a7afd351444 |
parent 7397 | 5b173b4ca846 |
child 14626 | 0cf4eccf130f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1066
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1066
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1066
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "asm/assembler.hpp" |
|
27 |
#include "assembler_x86.inline.hpp" |
|
28 |
#include "runtime/os.hpp" |
|
29 |
#include "runtime/threadLocalStorage.hpp" |
|
1 | 30 |
|
1066 | 31 |
#ifndef _LP64 |
1 | 32 |
void MacroAssembler::int3() { |
33 |
call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint))); |
|
34 |
} |
|
35 |
||
10021
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
36 |
#ifdef MINIMIZE_RAM_USAGE |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
37 |
|
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
38 |
void MacroAssembler::get_thread(Register thread) { |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
39 |
// call pthread_getspecific |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
40 |
// void * pthread_getspecific(pthread_key_t key); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
41 |
if (thread != rax) push(rax); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
42 |
push(rcx); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
43 |
push(rdx); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
44 |
|
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
45 |
push(ThreadLocalStorage::thread_index()); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
46 |
call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific))); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
47 |
increment(rsp, wordSize); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
48 |
|
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
49 |
pop(rdx); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
50 |
pop(rcx); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
51 |
if (thread != rax) { |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
52 |
mov(thread, rax); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
53 |
pop(rax); |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
54 |
} |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
55 |
} |
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
56 |
|
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
57 |
#else |
1 | 58 |
void MacroAssembler::get_thread(Register thread) { |
59 |
movl(thread, rsp); |
|
60 |
shrl(thread, PAGE_SHIFT); |
|
61 |
||
62 |
ExternalAddress tls_base((address)ThreadLocalStorage::sp_map_addr()); |
|
63 |
Address index(noreg, thread, Address::times_4); |
|
64 |
ArrayAddress tls(tls_base, index); |
|
65 |
||
66 |
movptr(thread, tls); |
|
67 |
} |
|
10021
7a7afd351444
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
7397
diff
changeset
|
68 |
#endif // MINIMIZE_RAM_USAGE |
1066 | 69 |
#else |
70 |
void MacroAssembler::int3() { |
|
71 |
call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint))); |
|
72 |
} |
|
73 |
||
74 |
void MacroAssembler::get_thread(Register thread) { |
|
75 |
// call pthread_getspecific |
|
76 |
// void * pthread_getspecific(pthread_key_t key); |
|
77 |
if (thread != rax) { |
|
78 |
push(rax); |
|
79 |
} |
|
80 |
push(rdi); |
|
81 |
push(rsi); |
|
82 |
push(rdx); |
|
83 |
push(rcx); |
|
84 |
push(r8); |
|
85 |
push(r9); |
|
86 |
push(r10); |
|
87 |
// XXX |
|
88 |
mov(r10, rsp); |
|
89 |
andq(rsp, -16); |
|
90 |
push(r10); |
|
91 |
push(r11); |
|
92 |
||
93 |
movl(rdi, ThreadLocalStorage::thread_index()); |
|
94 |
call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific))); |
|
95 |
||
96 |
pop(r11); |
|
97 |
pop(rsp); |
|
98 |
pop(r10); |
|
99 |
pop(r9); |
|
100 |
pop(r8); |
|
101 |
pop(rcx); |
|
102 |
pop(rdx); |
|
103 |
pop(rsi); |
|
104 |
pop(rdi); |
|
105 |
if (thread != rax) { |
|
106 |
mov(thread, rax); |
|
107 |
pop(rax); |
|
108 |
} |
|
109 |
} |
|
110 |
#endif |