annotate src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 89152779163c 7f77d17d0f13
children 7848fc12602b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
1 /*
14223
de6a9e811145 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 11153
diff changeset
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
4 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
7 * published by the Free Software Foundation.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
8 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
13 * accompanied this code).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
14 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1490
diff changeset
21 * questions.
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
22 *
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
23 */
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
25 // no precompiled headers
7204
f0c2369fda5a 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 6842
diff changeset
26 #include "asm/macroAssembler.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
27 #include "classfile/classLoader.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
28 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
29 #include "classfile/vmSymbols.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
30 #include "code/icBuffer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
31 #include "code/vtableStubs.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
32 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
33 #include "jvm_linux.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
34 #include "memory/allocation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
35 #include "mutex_linux.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
36 #include "nativeInst_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
37 #include "os_share_linux.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
38 #include "prims/jniFastGetField.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
39 #include "prims/jvm.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
40 #include "prims/jvm_misc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
41 #include "runtime/arguments.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
42 #include "runtime/extendedPC.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
43 #include "runtime/frame.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
44 #include "runtime/interfaceSupport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
45 #include "runtime/java.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
46 #include "runtime/javaCalls.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
47 #include "runtime/mutexLocker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
48 #include "runtime/osThread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
49 #include "runtime/sharedRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
50 #include "runtime/stubRoutines.hpp"
7180
f34d701e952e 8003935: Simplify the needed includes for using Thread::current()
stefank
parents: 6842
diff changeset
51 #include "runtime/thread.inline.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
52 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
53 #include "utilities/events.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1907
diff changeset
54 #include "utilities/vmError.hpp"
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
55
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
56 // Linux/Sparc has rather obscure naming of registers in sigcontext
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
57 // different between 32 and 64 bits
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
58 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
59 #define SIG_PC(x) ((x)->sigc_regs.tpc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
60 #define SIG_NPC(x) ((x)->sigc_regs.tnpc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
61 #define SIG_REGS(x) ((x)->sigc_regs)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
62 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
63 #define SIG_PC(x) ((x)->si_regs.pc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
64 #define SIG_NPC(x) ((x)->si_regs.npc)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
65 #define SIG_REGS(x) ((x)->si_regs)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
66 #endif
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
67
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
68 // those are to reference registers in sigcontext
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
69 enum {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
70 CON_G0 = 0,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
71 CON_G1,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
72 CON_G2,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
73 CON_G3,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
74 CON_G4,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
75 CON_G5,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
76 CON_G6,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
77 CON_G7,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
78 CON_O0,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
79 CON_O1,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
80 CON_O2,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
81 CON_O3,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
82 CON_O4,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
83 CON_O5,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
84 CON_O6,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
85 CON_O7,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
86 };
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
87
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
88 static inline void set_cont_address(sigcontext* ctx, address addr) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
89 SIG_PC(ctx) = (intptr_t)addr;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
90 SIG_NPC(ctx) = (intptr_t)(addr+4);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
91 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
92
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
93 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
94 // currently interrupted by SIGPROF.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
95 // os::Solaris::fetch_frame_from_ucontext() tries to skip nested
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
96 // signal frames. Currently we don't do that on Linux, so it's the
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
97 // same as os::fetch_frame_from_context().
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
98 ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
99 ucontext_t* uc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
100 intptr_t** ret_sp,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
101 intptr_t** ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
102 assert(thread != NULL, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
103 assert(ret_sp != NULL, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
104 assert(ret_fp != NULL, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
105
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
106 return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
107 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
108
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
109 ExtendedPC os::fetch_frame_from_context(void* ucVoid,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
110 intptr_t** ret_sp,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
111 intptr_t** ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
112 ucontext_t* uc = (ucontext_t*) ucVoid;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
113 ExtendedPC epc;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
114
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
115 if (uc != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
116 epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
117 if (ret_sp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
118 *ret_sp = os::Linux::ucontext_get_sp(uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
119 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
120 if (ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
121 *ret_fp = os::Linux::ucontext_get_fp(uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
122 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
123 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
124 // construct empty ExtendedPC for return value checking
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
125 epc = ExtendedPC(NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
126 if (ret_sp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
127 *ret_sp = (intptr_t*) NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
128 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
129 if (ret_fp) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
130 *ret_fp = (intptr_t*) NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
131 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
132 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
134 return epc;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
135 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
136
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
137 frame os::fetch_frame_from_context(void* ucVoid) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
138 intptr_t* sp;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
139 intptr_t* fp;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
140 ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
141 return frame(sp, fp, epc.pc());
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
142 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
143
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
144 frame os::get_sender_for_C_frame(frame* fr) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
145 return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
146 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
147
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
148 frame os::current_frame() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
149 fprintf(stderr, "current_frame()");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
150
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
151 intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
152 frame myframe(sp, frame::unpatchable,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
153 CAST_FROM_FN_PTR(address, os::current_frame));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
154 if (os::is_first_C_frame(&myframe)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
155 // stack is not walkable
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
156 return frame(NULL, frame::unpatchable, NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
157 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
158 return os::get_sender_for_C_frame(&myframe);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
159 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
160 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
161
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
162 address os::current_stack_pointer() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
163 register void *sp __asm__ ("sp");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
164 return (address)sp;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
165 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
166
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
167 static void current_stack_region(address* bottom, size_t* size) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
168 if (os::Linux::is_initial_thread()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
169 // initial thread needs special handling because pthread_getattr_np()
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
170 // may return bogus value.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
171 *bottom = os::Linux::initial_thread_stack_bottom();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
172 *size = os::Linux::initial_thread_stack_size();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
173 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
174 pthread_attr_t attr;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
175
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
176 int rslt = pthread_getattr_np(pthread_self(), &attr);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
177
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
178 // JVM needs to know exact stack location, abort if it fails
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
179 if (rslt != 0) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
180 if (rslt == ENOMEM) {
10161
746b070f5022 8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents: 8710
diff changeset
181 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
182 } else {
1490
f03d0a26bf83 6888954: argument formatting for assert() and friends
jcoomes
parents: 196
diff changeset
183 fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
184 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
185 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
186
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
187 if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
188 fatal("Can not locate current stack attributes!");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
189 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
190
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
191 pthread_attr_destroy(&attr);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
192 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
193 assert(os::current_stack_pointer() >= *bottom &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
194 os::current_stack_pointer() < *bottom + *size, "just checking");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
195 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
196
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
197 address os::current_stack_base() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
198 address bottom;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
199 size_t size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
200 current_stack_region(&bottom, &size);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
201 return bottom + size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
202 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
203
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
204 size_t os::current_stack_size() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
205 // stack size includes normal stack and HotSpot guard pages
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
206 address bottom;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
207 size_t size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
208 current_stack_region(&bottom, &size);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
209 return size;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
210 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
211
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
212 char* os::non_memory_address_word() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
213 // Must never look like an address returned by reserve_memory,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
214 // even in its subfields (as defined by the CPU immediate fields,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
215 // if the CPU splits constants across multiple instructions).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
216 // On SPARC, 0 != %hi(any real address), because there is no
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
217 // allocation in the first 1Kb of the virtual address space.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
218 return (char*) 0;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
219 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
220
6768
716e6ef4482a 7190089: NMT ON: NMT failed assertion on thread's stack base address
zgu
parents: 5903
diff changeset
221 void os::initialize_thread(Thread* thr) {}
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
222
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
223 void os::print_context(outputStream *st, void *context) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
224 if (context == NULL) return;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
225
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
226 ucontext_t* uc = (ucontext_t*)context;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
227 sigcontext* sc = (sigcontext*)context;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
228 st->print_cr("Registers:");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
229
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
230 st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
231 " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
232 SIG_REGS(sc).u_regs[CON_G1],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
233 SIG_REGS(sc).u_regs[CON_G2],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
234 SIG_REGS(sc).u_regs[CON_G3],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
235 SIG_REGS(sc).u_regs[CON_G4]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
236 st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
237 " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
238 SIG_REGS(sc).u_regs[CON_G5],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
239 SIG_REGS(sc).u_regs[CON_G6],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
240 SIG_REGS(sc).u_regs[CON_G7],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
241 SIG_REGS(sc).y);
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
242 st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
243 " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
244 SIG_REGS(sc).u_regs[CON_O0],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
245 SIG_REGS(sc).u_regs[CON_O1],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
246 SIG_REGS(sc).u_regs[CON_O2],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
247 SIG_REGS(sc).u_regs[CON_O3]);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
248 st->print_cr(" O4=" INTPTR_FORMAT " O5=" INTPTR_FORMAT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
249 " O6=" INTPTR_FORMAT " O7=" INTPTR_FORMAT,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
250 SIG_REGS(sc).u_regs[CON_O4],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
251 SIG_REGS(sc).u_regs[CON_O5],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
252 SIG_REGS(sc).u_regs[CON_O6],
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
253 SIG_REGS(sc).u_regs[CON_O7]);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
254
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
255
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
256 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
257 st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
258 " L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
259 sp[L0->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
260 sp[L1->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
261 sp[L2->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
262 sp[L3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
263 st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
264 " L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
265 sp[L4->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
266 sp[L5->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
267 sp[L6->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
268 sp[L7->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
269 st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
270 " I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
271 sp[I0->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
272 sp[I1->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
273 sp[I2->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
274 sp[I3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
275 st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
276 " I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT,
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
277 sp[I4->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
278 sp[I5->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
279 sp[I6->sp_offset_in_saved_window()],
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
280 sp[I7->sp_offset_in_saved_window()]);
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
281
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
282 st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
283 SIG_PC(sc),
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
284 SIG_NPC(sc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
285 st->cr();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
286 st->cr();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
287
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
288 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
289 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
290 st->cr();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
291
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
292 // Note: it may be unsafe to inspect memory near pc. For example, pc may
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
293 // point to garbage if entry point in an nmethod is corrupted. Leave
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
294 // this at the end, and hope for the best.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
295 address pc = os::Linux::ucontext_get_pc(uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
296 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
297 print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
298 }
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
299
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
300
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
301 void os::print_register_info(outputStream *st, void *context) {
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
302 if (context == NULL) return;
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
303
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
304 ucontext_t *uc = (ucontext_t*)context;
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
305 sigcontext* sc = (sigcontext*)context;
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
306 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
307
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
308 st->print_cr("Register to memory mapping:");
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
309 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
310
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
311 // this is only for the "general purpose" registers
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
312 st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON_G1]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
313 st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON_G2]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
314 st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON_G3]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
315 st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON_G4]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
316 st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON_G5]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
317 st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON_G6]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
318 st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON_G7]);
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
319 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
320
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
321 st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON_O0]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
322 st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON_O1]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
323 st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON_O2]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
324 st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON_O3]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
325 st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON_O4]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
326 st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON_O5]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
327 st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON_O6]);
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
328 st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON_O7]);
1907
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
329 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
330
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
331 st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
332 st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
333 st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
334 st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
335 st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
336 st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
337 st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
338 st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
339 st->cr();
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
340
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
341 st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
342 st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
343 st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
344 st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
345 st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
346 st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
347 st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
348 st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]);
1e9a9d2e6509 6970683: improvements to hs_err output
never
parents: 1552
diff changeset
349 st->cr();
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
350 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
351
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
352
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
353 address os::Linux::ucontext_get_pc(ucontext_t* uc) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
354 return (address) SIG_PC((sigcontext*)uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
355 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
356
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
357 intptr_t* os::Linux::ucontext_get_sp(ucontext_t *uc) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
358 return (intptr_t*)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
359 ((intptr_t)SIG_REGS((sigcontext*)uc).u_regs[CON_O6] + STACK_BIAS);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
360 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
361
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
362 // not used on Sparc
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
363 intptr_t* os::Linux::ucontext_get_fp(ucontext_t *uc) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
364 ShouldNotReachHere();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
365 return NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
366 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
367
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
368 // Utility functions
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
369
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
370 inline static bool checkPrefetch(sigcontext* uc, address pc) {
11127
980532a806a5 8016697: Use stubs to implement safefetch
goetz
parents: 10161
diff changeset
371 if (StubRoutines::is_safefetch_fault(pc)) {
980532a806a5 8016697: Use stubs to implement safefetch
goetz
parents: 10161
diff changeset
372 set_cont_address(uc, address(StubRoutines::continuation_for_safefetch_fault(pc)));
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
373 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
374 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
375 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
376 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
377
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
378 inline static bool checkOverflow(sigcontext* uc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
379 address pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
380 address addr,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
381 JavaThread* thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
382 address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
383 // check if fault address is within thread stack
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
384 if (addr < thread->stack_base() &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
385 addr >= thread->stack_base() - thread->stack_size()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
386 // stack overflow
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
387 if (thread->in_stack_yellow_zone(addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
388 thread->disable_stack_yellow_zone();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
389 if (thread->thread_state() == _thread_in_Java) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
390 // Throw a stack overflow exception. Guard pages will be reenabled
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
391 // while unwinding the stack.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
392 *stub =
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
393 SharedRuntime::continuation_for_implicit_exception(thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
394 pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
395 SharedRuntime::STACK_OVERFLOW);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
396 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
397 // Thread was in the vm or native code. Return and try to finish.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
398 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
399 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
400 } else if (thread->in_stack_red_zone(addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
401 // Fatal red zone violation. Disable the guard pages and fall through
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
402 // to handle_unexpected_exception way down below.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
403 thread->disable_stack_red_zone();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
404 tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
8710
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
405
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
406 // This is a likely cause, but hard to verify. Let's just print
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
407 // it as a hint.
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
408 tty->print_raw_cr("Please check if any of your loaded .so files has "
9058789475af 7107135: Stack guard pages are no more protected after loading a shared library with executable stack
iklam
parents: 7206
diff changeset
409 "enabled executable stack (see man page execstack(8))");
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
410 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
411 // Accessing stack address below sp may cause SEGV if current
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
412 // thread has MAP_GROWSDOWN stack. This should only happen when
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
413 // current thread was created by user code with MAP_GROWSDOWN flag
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
414 // and then attached to VM. See notes in os_linux.cpp.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
415 if (thread->osthread()->expanding_stack() == 0) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
416 thread->osthread()->set_expanding_stack();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
417 if (os::Linux::manually_expand_stack(thread, addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
418 thread->osthread()->clear_expanding_stack();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
419 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
420 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
421 thread->osthread()->clear_expanding_stack();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
422 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
423 fatal("recursive segv. expanding stack.");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
424 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
425 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
426 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
427 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
428 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
429
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
430 inline static bool checkPollingPage(address pc, address fault, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
431 if (fault == os::get_polling_page()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
432 *stub = SharedRuntime::get_poll_stub(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
433 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
434 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
435 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
436 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
437
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
438 inline static bool checkByteBuffer(address pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
439 // BugId 4454115: A read from a MappedByteBuffer can fault
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
440 // here if the underlying file has been truncated.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
441 // Do not crash the VM in such a case.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
442 CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
443 nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
444 if (nm != NULL && nm->has_unsafe_access()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
445 *stub = StubRoutines::handler_for_unsafe_access();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
446 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
447 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
448 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
449 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
450
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
451 inline static bool checkVerifyOops(address pc, address fault, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
452 if (pc >= MacroAssembler::_verify_oop_implicit_branch[0]
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
453 && pc < MacroAssembler::_verify_oop_implicit_branch[1] ) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
454 *stub = MacroAssembler::_verify_oop_implicit_branch[2];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
455 warning("fixed up memory fault in +VerifyOops at address "
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
456 INTPTR_FORMAT, fault);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
457 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
458 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
459 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
460 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
461
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
462 inline static bool checkFPFault(address pc, int code,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
463 JavaThread* thread, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
464 if (code == FPE_INTDIV || code == FPE_FLTDIV) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
465 *stub =
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
466 SharedRuntime::
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
467 continuation_for_implicit_exception(thread,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
468 pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
469 SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
470 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
471 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
472 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
473 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
474
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
475 inline static bool checkNullPointer(address pc, intptr_t fault,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
476 JavaThread* thread, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
477 if (!MacroAssembler::needs_explicit_null_check(fault)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
478 // Determination of interpreter/vtable stub/compiled code null
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
479 // exception
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
480 *stub =
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
481 SharedRuntime::
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
482 continuation_for_implicit_exception(thread, pc,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
483 SharedRuntime::IMPLICIT_NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
484 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
485 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
486 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
487 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
488
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
489 inline static bool checkFastJNIAccess(address pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
490 address addr = JNI_FastGetField::find_slowcase_pc(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
491 if (addr != (address)-1) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
492 *stub = addr;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
493 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
494 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
495 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
496 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
497
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
498 inline static bool checkSerializePage(JavaThread* thread, address addr) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
499 return os::is_memory_serialize_page(thread, addr);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
500 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
501
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
502 inline static bool checkZombie(sigcontext* uc, address* pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
503 if (nativeInstruction_at(*pc)->is_zombie()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
504 // zombie method (ld [%g0],%o7 instruction)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
505 *stub = SharedRuntime::get_handle_wrong_method_stub();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
506
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
507 // At the stub it needs to look like a call from the caller of this
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
508 // method (not a call from the segv site).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
509 *pc = (address)SIG_REGS(uc).u_regs[CON_O7];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
510 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
511 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
512 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
513 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
514
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
515 inline static bool checkICMiss(sigcontext* uc, address* pc, address* stub) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
516 #ifdef COMPILER2
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
517 if (nativeInstruction_at(*pc)->is_ic_miss_trap()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
518 #ifdef ASSERT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
519 #ifdef TIERED
17940
7f77d17d0f13 8042059: Various fixes to linux/sparc
mikael
parents: 14223
diff changeset
520 CodeBlob* cb = CodeCache::find_blob_unsafe(*pc);
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
521 assert(cb->is_compiled_by_c2(), "Wrong compiler");
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
522 #endif // TIERED
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
523 #endif // ASSERT
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
524 // Inline cache missed and user trap "Tne G0+ST_RESERVED_FOR_USER_0+2" taken.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
525 *stub = SharedRuntime::get_ic_miss_stub();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
526 // At the stub it needs to look like a call from the caller of this
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
527 // method (not a call from the segv site).
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
528 *pc = (address)SIG_REGS(uc).u_regs[CON_O7];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
529 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
530 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
531 #endif // COMPILER2
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
532 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
533 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
534
2191
d70fe6ab4436 6588413: Use -fvisibility=hidden for gcc compiles
coleenp
parents: 1980
diff changeset
535 extern "C" JNIEXPORT int
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
536 JVM_handle_linux_signal(int sig,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
537 siginfo_t* info,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
538 void* ucVoid,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
539 int abort_if_unrecognized) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
540 // in fact this isn't ucontext_t* at all, but struct sigcontext*
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
541 // but Linux porting layer uses ucontext_t, so to minimize code change
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
542 // we cast as needed
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
543 ucontext_t* ucFake = (ucontext_t*) ucVoid;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
544 sigcontext* uc = (sigcontext*)ucVoid;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
545
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
546 Thread* t = ThreadLocalStorage::get_thread_slow();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
547
11151
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
548 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
549 // (no destructors can be run)
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
550 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 10161
diff changeset
551
133
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
552 SignalHandlerMark shm(t);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
553
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
554 // Note: it's not uncommon that JNI code uses signal/sigset to install
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
555 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
556 // or have a SIGILL handler when detecting CPU type). When that happens,
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
557 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
558 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
559 // that do not require siginfo/ucontext first.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
560
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
561 if (sig == SIGPIPE || sig == SIGXFSZ) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
562 // allow chained handler to go first
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
563 if (os::Linux::chained_handler(sig, info, ucVoid)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
564 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
565 } else {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
566 if (PrintMiscellaneous && (WizardMode || Verbose)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
567 char buf[64];
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
568 warning("Ignoring %s - see bugs 4229104 or 646499219",
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
569 os::exception_name(sig, buf, sizeof(buf)));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
570 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
571 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
572 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
573 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
574
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
575 JavaThread* thread = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
576 VMThread* vmthread = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
577 if (os::Linux::signal_handlers_are_installed) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
578 if (t != NULL ){
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
579 if(t->is_Java_thread()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
580 thread = (JavaThread*)t;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
581 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
582 else if(t->is_VM_thread()){
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
583 vmthread = (VMThread *)t;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
584 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
585 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
586 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
587
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
588 // decide if this trap can be handled by a stub
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
589 address stub = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
590 address pc = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
591 address npc = NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
592
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
593 //%note os_trap_1
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
594 if (info != NULL && uc != NULL && thread != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
595 pc = address(SIG_PC(uc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
596 npc = address(SIG_NPC(uc));
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
597
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
598 // Check to see if we caught the safepoint code in the
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
599 // process of write protecting the memory serialization page.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
600 // It write enables the page immediately after protecting it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
601 // so we can just return to retry the write.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
602 if ((sig == SIGSEGV) && checkSerializePage(thread, (address)info->si_addr)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
603 // Block current thread until the memory serialize page permission restored.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
604 os::block_on_serialize_page_trap();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
605 return 1;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
606 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
607
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
608 if (checkPrefetch(uc, pc)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
609 return 1;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
610 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
611
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
612 // Handle ALL stack overflow variations here
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
613 if (sig == SIGSEGV) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
614 if (checkOverflow(uc, pc, (address)info->si_addr, thread, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
615 return 1;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
616 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
617 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
618
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
619 if (sig == SIGBUS &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
620 thread->thread_state() == _thread_in_vm &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
621 thread->doing_unsafe_access()) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
622 stub = StubRoutines::handler_for_unsafe_access();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
623 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
624
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
625 if (thread->thread_state() == _thread_in_Java) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
626 do {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
627 // Java thread running in Java code => find exception handler if any
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
628 // a fault inside compiled code, the interpreter, or a stub
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
629
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
630 if ((sig == SIGSEGV) && checkPollingPage(pc, (address)info->si_addr, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
631 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
632 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
633
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
634 if ((sig == SIGBUS) && checkByteBuffer(pc, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
635 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
636 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
637
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
638 if ((sig == SIGSEGV || sig == SIGBUS) &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
639 checkVerifyOops(pc, (address)info->si_addr, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
640 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
641 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
642
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
643 if ((sig == SIGSEGV) && checkZombie(uc, &pc, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
644 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
645 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
646
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
647 if ((sig == SIGILL) && checkICMiss(uc, &pc, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
648 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
649 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
650
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
651 if ((sig == SIGFPE) && checkFPFault(pc, info->si_code, thread, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
652 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
653 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
654
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
655 if ((sig == SIGSEGV) &&
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
656 checkNullPointer(pc, (intptr_t)info->si_addr, thread, &stub)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
657 break;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
658 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
659 } while (0);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
660
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
661 // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
662 // and the heap gets shrunk before the field access.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
663 if ((sig == SIGSEGV) || (sig == SIGBUS)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
664 checkFastJNIAccess(pc, &stub);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
665 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
666 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
667
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
668 if (stub != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
669 // save all thread context in case we need to restore it
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
670 thread->set_saved_exception_pc(pc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
671 thread->set_saved_exception_npc(npc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
672 set_cont_address(uc, stub);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
673 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
674 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
675 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
676
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
677 // signal-chaining
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
678 if (os::Linux::chained_handler(sig, info, ucVoid)) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
679 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
680 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
681
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
682 if (!abort_if_unrecognized) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
683 // caller wants another chance, so give it to him
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
684 return false;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
685 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
686
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
687 if (pc == NULL && uc != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
688 pc = os::Linux::ucontext_get_pc((ucontext_t*)uc);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
689 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
690
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
691 // unmask current signal
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
692 sigset_t newset;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
693 sigemptyset(&newset);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
694 sigaddset(&newset, sig);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
695 sigprocmask(SIG_UNBLOCK, &newset, NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
696
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
697 VMError err(t, sig, pc, info, ucVoid);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
698 err.report_and_die();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
699
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
700 ShouldNotReachHere();
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
701 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
702
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
703 void os::Linux::init_thread_fpu_state(void) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
704 // Nothing to do
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
705 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
706
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
707 int os::Linux::get_fpu_control_word() {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
708 return 0;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
709 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
710
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
711 void os::Linux::set_fpu_control_word(int fpu) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
712 // nothing
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
713 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
714
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
715 bool os::is_allocatable(size_t bytes) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
716 #ifdef _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
717 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
718 #else
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
719 if (bytes < 2 * G) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
720 return true;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
721 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
722
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
723 char* addr = reserve_memory(bytes, NULL);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
724
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
725 if (addr != NULL) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
726 release_memory(addr, bytes);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
727 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
728
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
729 return addr != NULL;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
730 #endif // _LP64
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
731 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
732
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
733 ///////////////////////////////////////////////////////////////////////////////
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
734 // thread stack
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
735
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
736 size_t os::Linux::min_stack_allowed = 128 * K;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
737
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
738 // pthread on Ubuntu is always in floating stack mode
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
739 bool os::Linux::supports_variable_stack_size() { return true; }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
740
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
741 // return default stack size for thr_type
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
742 size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
743 // default stack size (compiler thread needs larger stack)
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
744 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
745 return s;
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
746 }
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
747
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
748 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
749 // Creating guard page is very expensive. Java thread has HotSpot
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
750 // guard page, only enable glibc guard page for non-Java threads.
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
751 return (thr_type == java_thread ? 0 : page_size());
435e64505015 6693457: Open-source hotspot linux-sparc support
phh
parents:
diff changeset
752 }
5903
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
753
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
754 #ifndef PRODUCT
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
755 void os::verify_stack_alignment() {
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
756 }
da4be62fb889 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 2426
diff changeset
757 #endif