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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
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"
30
31 #ifndef _LP64
32 void MacroAssembler::int3() {
33 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
34 }
35
36 #ifdef MINIMIZE_RAM_USAGE
37
38 void MacroAssembler::get_thread(Register thread) {
39 // call pthread_getspecific
40 // void * pthread_getspecific(pthread_key_t key);
41 if (thread != rax) push(rax);
42 push(rcx);
43 push(rdx);
44
45 push(ThreadLocalStorage::thread_index());
46 call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific)));
47 increment(rsp, wordSize);
48
49 pop(rdx);
50 pop(rcx);
51 if (thread != rax) {
52 mov(thread, rax);
53 pop(rax);
54 }
55 }
56
57 #else
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 }
68 #endif // MINIMIZE_RAM_USAGE
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);
|
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
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"
30
31 #ifndef _LP64
32 void MacroAssembler::int3() {
33 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
34 }
35
36 void MacroAssembler::get_thread(Register thread) {
37 movl(thread, rsp);
38 shrl(thread, PAGE_SHIFT);
39
40 ExternalAddress tls_base((address)ThreadLocalStorage::sp_map_addr());
41 Address index(noreg, thread, Address::times_4);
42 ArrayAddress tls(tls_base, index);
43
44 movptr(thread, tls);
45 }
46 #else
47 void MacroAssembler::int3() {
48 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
49 }
50
51 void MacroAssembler::get_thread(Register thread) {
52 // call pthread_getspecific
53 // void * pthread_getspecific(pthread_key_t key);
54 if (thread != rax) {
55 push(rax);
56 }
57 push(rdi);
58 push(rsi);
59 push(rdx);
60 push(rcx);
61 push(r8);
62 push(r9);
63 push(r10);
64 // XXX
65 mov(r10, rsp);
|