author | naoto |
Tue, 09 Jul 2019 08:05:38 -0700 | |
changeset 55627 | 9c1885fb2a42 |
parent 53605 | 853c68ff2ed7 |
child 55490 | 3f3dc00a69a5 |
child 58678 | 9cf78a70fa4f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
52460 | 2 |
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
// no precompiled headers |
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47216
diff
changeset
|
26 |
#include "jvm.h" |
14631
526804361522
8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
13963
diff
changeset
|
27 |
#include "asm/macroAssembler.hpp" |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
29573
diff
changeset
|
28 |
#include "macroAssembler_sparc.hpp" |
7397 | 29 |
#include "classfile/classLoader.hpp" |
30 |
#include "classfile/systemDictionary.hpp" |
|
31 |
#include "classfile/vmSymbols.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
23865
diff
changeset
|
32 |
#include "code/codeCache.hpp" |
7397 | 33 |
#include "code/icBuffer.hpp" |
34 |
#include "code/vtableStubs.hpp" |
|
35 |
#include "interpreter/interpreter.hpp" |
|
36 |
#include "memory/allocation.inline.hpp" |
|
37 |
#include "nativeInst_sparc.hpp" |
|
38 |
#include "os_share_solaris.hpp" |
|
39 |
#include "prims/jniFastGetField.hpp" |
|
40 |
#include "prims/jvm_misc.hpp" |
|
41 |
#include "runtime/arguments.hpp" |
|
42 |
#include "runtime/extendedPC.hpp" |
|
43 |
#include "runtime/frame.inline.hpp" |
|
49449
ef5d5d343e2a
8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents:
47881
diff
changeset
|
44 |
#include "runtime/interfaceSupport.inline.hpp" |
7397 | 45 |
#include "runtime/java.hpp" |
46 |
#include "runtime/javaCalls.hpp" |
|
47 |
#include "runtime/mutexLocker.hpp" |
|
48 |
#include "runtime/osThread.hpp" |
|
49 |
#include "runtime/sharedRuntime.hpp" |
|
50 |
#include "runtime/stubRoutines.hpp" |
|
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
13963
diff
changeset
|
51 |
#include "runtime/thread.inline.hpp" |
7397 | 52 |
#include "runtime/timer.hpp" |
53 |
#include "utilities/events.hpp" |
|
54 |
#include "utilities/vmError.hpp" |
|
1 | 55 |
|
56 |
# include <signal.h> // needed first to avoid name collision for "std" with SC 5.0 |
|
57 |
||
58 |
// put OS-includes here |
|
59 |
# include <sys/types.h> |
|
60 |
# include <sys/mman.h> |
|
61 |
# include <pthread.h> |
|
62 |
# include <errno.h> |
|
63 |
# include <dlfcn.h> |
|
64 |
# include <stdio.h> |
|
65 |
# include <unistd.h> |
|
66 |
# include <sys/resource.h> |
|
67 |
# include <thread.h> |
|
68 |
# include <sys/stat.h> |
|
69 |
# include <sys/time.h> |
|
70 |
# include <sys/filio.h> |
|
71 |
# include <sys/utsname.h> |
|
72 |
# include <sys/systeminfo.h> |
|
73 |
# include <sys/socket.h> |
|
74 |
# include <sys/lwp.h> |
|
75 |
# include <poll.h> |
|
76 |
# include <sys/lwp.h> |
|
77 |
||
78 |
# define _STRUCTURED_PROC 1 // this gets us the new structured proc interfaces of 5.6 & later |
|
79 |
# include <sys/procfs.h> // see comment in <sys/procfs.h> |
|
80 |
||
81 |
#define MAX_PATH (2 * K) |
|
82 |
||
42906
1a8db9cf1407
8170655: [posix] Fix minimum stack size computations
goetz
parents:
41070
diff
changeset
|
83 |
// Minimum usable stack sizes required to get to user code. Space for |
1a8db9cf1407
8170655: [posix] Fix minimum stack size computations
goetz
parents:
41070
diff
changeset
|
84 |
// HotSpot guard pages is added later. |
1a8db9cf1407
8170655: [posix] Fix minimum stack size computations
goetz
parents:
41070
diff
changeset
|
85 |
size_t os::Posix::_compiler_thread_min_stack_allowed = 104 * K; |
1a8db9cf1407
8170655: [posix] Fix minimum stack size computations
goetz
parents:
41070
diff
changeset
|
86 |
size_t os::Posix::_java_thread_min_stack_allowed = 86 * K; |
41070
496463b4e206
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
40898
diff
changeset
|
87 |
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K; |
1 | 88 |
|
89 |
int os::Solaris::max_register_window_saves_before_flushing() { |
|
90 |
// We should detect this at run time. For now, filling |
|
91 |
// in with a constant. |
|
92 |
return 8; |
|
93 |
} |
|
94 |
||
95 |
static void handle_unflushed_register_windows(gwindows_t *win) { |
|
96 |
int restore_count = win->wbcnt; |
|
97 |
int i; |
|
98 |
||
99 |
for(i=0; i<restore_count; i++) { |
|
100 |
address sp = ((address)win->spbuf[i]) + STACK_BIAS; |
|
101 |
address reg_win = (address)&win->wbuf[i]; |
|
102 |
memcpy(sp,reg_win,sizeof(struct rwindow)); |
|
103 |
} |
|
104 |
} |
|
105 |
||
106 |
char* os::non_memory_address_word() { |
|
107 |
// Must never look like an address returned by reserve_memory, |
|
108 |
// even in its subfields (as defined by the CPU immediate fields, |
|
109 |
// if the CPU splits constants across multiple instructions). |
|
110 |
// On SPARC, 0 != %hi(any real address), because there is no |
|
111 |
// allocation in the first 1Kb of the virtual address space. |
|
112 |
return (char*) 0; |
|
113 |
} |
|
114 |
||
115 |
// Validate a ucontext retrieved from walking a uc_link of a ucontext. |
|
116 |
// There are issues with libthread giving out uc_links for different threads |
|
117 |
// on the same uc_link chain and bad or circular links. |
|
118 |
// |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
119 |
bool os::Solaris::valid_ucontext(Thread* thread, const ucontext_t* valid, const ucontext_t* suspect) { |
1 | 120 |
if (valid >= suspect || |
121 |
valid->uc_stack.ss_flags != suspect->uc_stack.ss_flags || |
|
122 |
valid->uc_stack.ss_sp != suspect->uc_stack.ss_sp || |
|
123 |
valid->uc_stack.ss_size != suspect->uc_stack.ss_size) { |
|
124 |
DEBUG_ONLY(tty->print_cr("valid_ucontext: failed test 1");) |
|
125 |
return false; |
|
126 |
} |
|
127 |
||
128 |
if (thread->is_Java_thread()) { |
|
129 |
if (!valid_stack_address(thread, (address)suspect)) { |
|
130 |
DEBUG_ONLY(tty->print_cr("valid_ucontext: uc_link not in thread stack");) |
|
131 |
return false; |
|
132 |
} |
|
133 |
address _sp = (address)((intptr_t)suspect->uc_mcontext.gregs[REG_SP] + STACK_BIAS); |
|
134 |
if (!valid_stack_address(thread, _sp) || |
|
135 |
!frame::is_valid_stack_pointer(((JavaThread*)thread)->base_of_stack_pointer(), (intptr_t*)_sp)) { |
|
136 |
DEBUG_ONLY(tty->print_cr("valid_ucontext: stackpointer not in thread stack");) |
|
137 |
return false; |
|
138 |
} |
|
139 |
} |
|
140 |
return true; |
|
141 |
} |
|
142 |
||
143 |
// We will only follow one level of uc_link since there are libthread |
|
144 |
// issues with ucontext linking and it is better to be safe and just |
|
145 |
// let caller retry later. |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
146 |
const ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread, |
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
147 |
const ucontext_t *uc) { |
1 | 148 |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
149 |
const ucontext_t *retuc = NULL; |
1 | 150 |
|
151 |
// Sometimes the topmost register windows are not properly flushed. |
|
152 |
// i.e., if the kernel would have needed to take a page fault |
|
153 |
if (uc != NULL && uc->uc_mcontext.gwins != NULL) { |
|
154 |
::handle_unflushed_register_windows(uc->uc_mcontext.gwins); |
|
155 |
} |
|
156 |
||
157 |
if (uc != NULL) { |
|
158 |
if (uc->uc_link == NULL) { |
|
159 |
// cannot validate without uc_link so accept current ucontext |
|
160 |
retuc = uc; |
|
161 |
} else if (os::Solaris::valid_ucontext(thread, uc, uc->uc_link)) { |
|
162 |
// first ucontext is valid so try the next one |
|
163 |
uc = uc->uc_link; |
|
164 |
if (uc->uc_link == NULL) { |
|
165 |
// cannot validate without uc_link so accept current ucontext |
|
166 |
retuc = uc; |
|
167 |
} else if (os::Solaris::valid_ucontext(thread, uc, uc->uc_link)) { |
|
168 |
// the ucontext one level down is also valid so return it |
|
169 |
retuc = uc; |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
return retuc; |
|
174 |
} |
|
175 |
||
176 |
// Assumes ucontext is valid |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
177 |
ExtendedPC os::Solaris::ucontext_get_ExtendedPC(const ucontext_t *uc) { |
1 | 178 |
address pc = (address)uc->uc_mcontext.gregs[REG_PC]; |
179 |
// set npc to zero to avoid using it for safepoint, good for profiling only |
|
180 |
return ExtendedPC(pc); |
|
181 |
} |
|
182 |
||
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
183 |
void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) { |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
184 |
uc->uc_mcontext.gregs [REG_PC] = (greg_t) pc; |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
185 |
uc->uc_mcontext.gregs [REG_nPC] = (greg_t) (pc + 4); |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
186 |
} |
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
187 |
|
1 | 188 |
// Assumes ucontext is valid |
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
189 |
intptr_t* os::Solaris::ucontext_get_sp(const ucontext_t *uc) { |
1 | 190 |
return (intptr_t*)((intptr_t)uc->uc_mcontext.gregs[REG_SP] + STACK_BIAS); |
191 |
} |
|
192 |
||
193 |
// Solaris X86 only |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
194 |
intptr_t* os::Solaris::ucontext_get_fp(const ucontext_t *uc) { |
1 | 195 |
ShouldNotReachHere(); |
196 |
return NULL; |
|
197 |
} |
|
198 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
199 |
address os::Solaris::ucontext_get_pc(const ucontext_t *uc) { |
18025 | 200 |
return (address) uc->uc_mcontext.gregs[REG_PC]; |
201 |
} |
|
202 |
||
203 |
||
1 | 204 |
// For Forte Analyzer AsyncGetCallTrace profiling support - thread |
205 |
// is currently interrupted by SIGPROF. |
|
206 |
// |
|
207 |
// ret_fp parameter is only used by Solaris X86. |
|
208 |
// |
|
209 |
// The difference between this and os::fetch_frame_from_context() is that |
|
210 |
// here we try to skip nested signal frames. |
|
35071
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
211 |
// This method is also used for stack overflow signal handling. |
1 | 212 |
ExtendedPC os::Solaris::fetch_frame_from_ucontext(Thread* thread, |
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
213 |
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) { |
1 | 214 |
|
215 |
assert(thread != NULL, "just checking"); |
|
216 |
assert(ret_sp != NULL, "just checking"); |
|
217 |
assert(ret_fp == NULL, "just checking"); |
|
218 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
219 |
const ucontext_t *luc = os::Solaris::get_valid_uc_in_signal_handler(thread, uc); |
1 | 220 |
|
221 |
return os::fetch_frame_from_context(luc, ret_sp, ret_fp); |
|
222 |
} |
|
223 |
||
224 |
||
225 |
// ret_fp parameter is only used by Solaris X86. |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
226 |
ExtendedPC os::fetch_frame_from_context(const void* ucVoid, |
1 | 227 |
intptr_t** ret_sp, intptr_t** ret_fp) { |
228 |
||
229 |
ExtendedPC epc; |
|
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
230 |
const ucontext_t *uc = (const ucontext_t*)ucVoid; |
1 | 231 |
|
232 |
if (uc != NULL) { |
|
233 |
epc = os::Solaris::ucontext_get_ExtendedPC(uc); |
|
234 |
if (ret_sp) *ret_sp = os::Solaris::ucontext_get_sp(uc); |
|
235 |
} else { |
|
236 |
// construct empty ExtendedPC for return value checking |
|
237 |
epc = ExtendedPC(NULL); |
|
238 |
if (ret_sp) *ret_sp = (intptr_t *)NULL; |
|
239 |
} |
|
240 |
||
241 |
return epc; |
|
242 |
} |
|
243 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
244 |
frame os::fetch_frame_from_context(const void* ucVoid) { |
1 | 245 |
intptr_t* sp; |
246 |
intptr_t* fp; |
|
247 |
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp); |
|
248 |
return frame(sp, frame::unpatchable, epc.pc()); |
|
249 |
} |
|
250 |
||
35071
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
251 |
frame os::fetch_frame_from_ucontext(Thread* thread, void* ucVoid) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
252 |
intptr_t* sp; |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
253 |
ExtendedPC epc = os::Solaris::fetch_frame_from_ucontext(thread, (ucontext_t*)ucVoid, &sp, NULL); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
254 |
return frame(sp, frame::unpatchable, epc.pc()); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
255 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
256 |
|
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
257 |
bool os::Solaris::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
258 |
address pc = (address) os::Solaris::ucontext_get_pc(uc); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
259 |
if (Interpreter::contains(pc)) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
260 |
*fr = os::fetch_frame_from_ucontext(thread, uc); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
261 |
if (!fr->is_first_java_frame()) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
262 |
assert(fr->safe_for_sender(thread), "Safety check"); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
263 |
*fr = fr->java_sender(); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
264 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
265 |
} else { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
266 |
// more complex code with compiled code |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
267 |
assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above"); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
268 |
CodeBlob* cb = CodeCache::find_blob(pc); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
269 |
if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
270 |
// Not sure where the pc points to, fallback to default |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
271 |
// stack overflow handling |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
272 |
return false; |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
273 |
} else { |
40649
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
274 |
// Returned frame will be the caller of the method that faults on the stack bang. |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
275 |
// Register window not yet rotated (happens at SAVE after stack bang), so there is no new |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
276 |
// frame to go with the faulting PC. Using caller SP that is still in SP, and caller PC |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
277 |
// that was written to O7 at call. |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
278 |
intptr_t* sp = os::Solaris::ucontext_get_sp(uc); |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
279 |
address pc = (address)uc->uc_mcontext.gregs[REG_O7]; |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
280 |
*fr = frame(sp, frame::unpatchable, pc); |
48c8f5272051
8156659: assert(CodeCache::find_blob_unsafe(_pc) == _cb) failed: inconsistent
neliasso
parents:
40093
diff
changeset
|
281 |
|
35071
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
282 |
if (!fr->is_java_frame()) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
283 |
assert(fr->safe_for_sender(thread), "Safety check"); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
284 |
*fr = fr->java_sender(); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
285 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
286 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
287 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
288 |
assert(fr->is_java_frame(), "Safety check"); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
289 |
return true; |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
290 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
291 |
|
1 | 292 |
frame os::get_sender_for_C_frame(frame* fr) { |
293 |
return frame(fr->sender_sp(), frame::unpatchable, fr->sender_pc()); |
|
294 |
} |
|
295 |
||
11961
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
296 |
// Returns an estimate of the current stack pointer. Result must be guaranteed to |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
297 |
// point into the calling threads stack, and be no lower than the current stack |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
298 |
// pointer. |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
299 |
address os::current_stack_pointer() { |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
300 |
volatile int dummy; |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
301 |
address sp = (address)&dummy + 8; // %%%% need to confirm if this is right |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
302 |
return sp; |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
303 |
} |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
304 |
|
1 | 305 |
frame os::current_frame() { |
306 |
intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()(); |
|
307 |
frame myframe(sp, frame::unpatchable, |
|
308 |
CAST_FROM_FN_PTR(address, os::current_frame)); |
|
309 |
if (os::is_first_C_frame(&myframe)) { |
|
310 |
// stack is not walkable |
|
26821
ce9f82507dc2
8058345: Refactor native stack printing from vmError.cpp to debug.cpp to make it available in gdb as well
simonis
parents:
26576
diff
changeset
|
311 |
return frame(NULL, NULL, false); |
1 | 312 |
} else { |
313 |
return os::get_sender_for_C_frame(&myframe); |
|
314 |
} |
|
315 |
} |
|
316 |
||
317 |
bool os::is_allocatable(size_t bytes) { |
|
318 |
return true; |
|
319 |
} |
|
320 |
||
8106 | 321 |
extern "C" JNIEXPORT int |
322 |
JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, |
|
323 |
int abort_if_unrecognized) { |
|
1 | 324 |
ucontext_t* uc = (ucontext_t*) ucVoid; |
325 |
||
34633
2a6c7c7b30a7
8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents:
33732
diff
changeset
|
326 |
Thread* t = Thread::current_or_null_safe(); |
1 | 327 |
|
18943 | 328 |
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away |
329 |
// (no destructors can be run) |
|
46644
a5813fb66270
8183925: Decouple crash protection from watcher thread
rehn
parents:
46540
diff
changeset
|
330 |
os::ThreadCrashProtection::check_crash_protection(sig, t); |
18943 | 331 |
|
1 | 332 |
SignalHandlerMark shm(t); |
333 |
||
334 |
if(sig == SIGPIPE || sig == SIGXFSZ) { |
|
335 |
if (os::Solaris::chained_handler(sig, info, ucVoid)) { |
|
336 |
return true; |
|
337 |
} else { |
|
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
35201
diff
changeset
|
338 |
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219 |
1 | 339 |
return true; |
340 |
} |
|
341 |
} |
|
342 |
||
343 |
JavaThread* thread = NULL; |
|
344 |
VMThread* vmthread = NULL; |
|
345 |
if (os::Solaris::signal_handlers_are_installed) { |
|
346 |
if (t != NULL ){ |
|
347 |
if(t->is_Java_thread()) { |
|
348 |
thread = (JavaThread*)t; |
|
349 |
} |
|
350 |
else if(t->is_VM_thread()){ |
|
351 |
vmthread = (VMThread *)t; |
|
352 |
} |
|
353 |
} |
|
354 |
} |
|
355 |
||
46337
307e52ec20cd
8175817: Clean up Solaris signal code: SIGUSR2, SIGasync, SIGJVM1/2
dholmes
parents:
42906
diff
changeset
|
356 |
if (sig == ASYNC_SIGNAL) { |
18025 | 357 |
if (thread || vmthread) { |
358 |
OSThread::SR_handler(t, uc); |
|
1 | 359 |
return true; |
360 |
} else if (os::Solaris::chained_handler(sig, info, ucVoid)) { |
|
361 |
return true; |
|
362 |
} else { |
|
46337
307e52ec20cd
8175817: Clean up Solaris signal code: SIGUSR2, SIGasync, SIGJVM1/2
dholmes
parents:
42906
diff
changeset
|
363 |
// If ASYNC_SIGNAL not chained, and this is a non-vm and |
1 | 364 |
// non-java thread |
365 |
return true; |
|
366 |
} |
|
367 |
} |
|
368 |
||
369 |
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) { |
|
370 |
// can't decode this kind of signal |
|
371 |
info = NULL; |
|
372 |
} else { |
|
373 |
assert(sig == info->si_signo, "bad siginfo"); |
|
374 |
} |
|
375 |
||
376 |
// decide if this trap can be handled by a stub |
|
377 |
address stub = NULL; |
|
378 |
||
379 |
address pc = NULL; |
|
380 |
address npc = NULL; |
|
381 |
||
382 |
//%note os_trap_1 |
|
383 |
if (info != NULL && uc != NULL && thread != NULL) { |
|
384 |
// factor me: getPCfromContext |
|
385 |
pc = (address) uc->uc_mcontext.gregs[REG_PC]; |
|
386 |
npc = (address) uc->uc_mcontext.gregs[REG_nPC]; |
|
387 |
||
388 |
// SafeFetch() support |
|
18740 | 389 |
if (StubRoutines::is_safefetch_fault(pc)) { |
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
390 |
os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); |
18740 | 391 |
return 1; |
1 | 392 |
} |
393 |
||
394 |
// Handle ALL stack overflow variations here |
|
395 |
if (sig == SIGSEGV && info->si_code == SEGV_ACCERR) { |
|
396 |
address addr = (address) info->si_addr; |
|
35201
996db89f378e
8139864: Improve handling of stack protection zones.
goetz
parents:
35077
diff
changeset
|
397 |
if (thread->in_stack_yellow_reserved_zone(addr)) { |
1 | 398 |
// Sometimes the register windows are not properly flushed. |
399 |
if(uc->uc_mcontext.gwins != NULL) { |
|
400 |
::handle_unflushed_register_windows(uc->uc_mcontext.gwins); |
|
401 |
} |
|
402 |
if (thread->thread_state() == _thread_in_Java) { |
|
35071
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
403 |
if (thread->in_stack_reserved_zone(addr)) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
404 |
frame fr; |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
405 |
if (os::Solaris::get_frame_at_stack_banging_point(thread, uc, &fr)) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
406 |
assert(fr.is_java_frame(), "Must be a Java frame"); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
407 |
frame activation = SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
408 |
if (activation.sp() != NULL) { |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
409 |
thread->disable_stack_reserved_zone(); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
410 |
RegisterMap map(thread); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
411 |
int frame_size = activation.frame_size(&map); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
412 |
thread->set_reserved_stack_activation((address)(((address)activation.sp()) - STACK_BIAS)); |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
413 |
return true; |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
414 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
415 |
} |
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34667
diff
changeset
|
416 |
} |
1 | 417 |
// Throw a stack overflow exception. Guard pages will be reenabled |
418 |
// while unwinding the stack. |
|
35201
996db89f378e
8139864: Improve handling of stack protection zones.
goetz
parents:
35077
diff
changeset
|
419 |
thread->disable_stack_yellow_reserved_zone(); |
1 | 420 |
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); |
421 |
} else { |
|
422 |
// Thread was in the vm or native code. Return and try to finish. |
|
35201
996db89f378e
8139864: Improve handling of stack protection zones.
goetz
parents:
35077
diff
changeset
|
423 |
thread->disable_stack_yellow_reserved_zone(); |
1 | 424 |
return true; |
425 |
} |
|
426 |
} else if (thread->in_stack_red_zone(addr)) { |
|
427 |
// Fatal red zone violation. Disable the guard pages and fall through |
|
428 |
// to handle_unexpected_exception way down below. |
|
429 |
thread->disable_stack_red_zone(); |
|
430 |
tty->print_raw_cr("An irrecoverable stack overflow has occurred."); |
|
431 |
// Sometimes the register windows are not properly flushed. |
|
432 |
if(uc->uc_mcontext.gwins != NULL) { |
|
433 |
::handle_unflushed_register_windows(uc->uc_mcontext.gwins); |
|
434 |
} |
|
435 |
} |
|
436 |
} |
|
437 |
||
438 |
||
439 |
if (thread->thread_state() == _thread_in_vm) { |
|
40898
1c147e5e2b71
8165014: Unaligned unsafe access should throw InternalError on Solaris
mdoerr
parents:
40649
diff
changeset
|
440 |
if (sig == SIGBUS && thread->doing_unsafe_access()) { |
38209
b2a58604e046
8156088: Reintegrate 8153892: Handle unsafe access error directly in signal handler instead of going through a stub
mikael
parents:
38190
diff
changeset
|
441 |
stub = SharedRuntime::handle_unsafe_access(thread, npc); |
1 | 442 |
} |
443 |
} |
|
444 |
||
445 |
else if (thread->thread_state() == _thread_in_Java) { |
|
446 |
// Java thread running in Java code => find exception handler if any |
|
447 |
// a fault inside compiled code, the interpreter, or a stub |
|
448 |
||
449 |
// Support Safepoint Polling |
|
47881
0ce0ac68ace7
8189941: Implementation JEP 312: Thread-local handshake
rehn
parents:
47765
diff
changeset
|
450 |
if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { |
1 | 451 |
stub = SharedRuntime::get_poll_stub(pc); |
452 |
} |
|
453 |
||
454 |
// Not needed on x86 solaris because verify_oops doesn't generate |
|
455 |
// SEGV/BUS like sparc does. |
|
456 |
if ( (sig == SIGSEGV || sig == SIGBUS) |
|
457 |
&& pc >= MacroAssembler::_verify_oop_implicit_branch[0] |
|
458 |
&& pc < MacroAssembler::_verify_oop_implicit_branch[1] ) { |
|
459 |
stub = MacroAssembler::_verify_oop_implicit_branch[2]; |
|
460 |
warning("fixed up memory fault in +VerifyOops at address " INTPTR_FORMAT, info->si_addr); |
|
461 |
} |
|
462 |
||
463 |
// This is not factored because on x86 solaris the patching for |
|
464 |
// zombies does not generate a SEGV. |
|
465 |
else if (sig == SIGSEGV && nativeInstruction_at(pc)->is_zombie()) { |
|
466 |
// zombie method (ld [%g0],%o7 instruction) |
|
467 |
stub = SharedRuntime::get_handle_wrong_method_stub(); |
|
468 |
||
469 |
// At the stub it needs to look like a call from the caller of this |
|
470 |
// method (not a call from the segv site). |
|
471 |
pc = (address)uc->uc_mcontext.gregs[REG_O7]; |
|
472 |
} |
|
473 |
else if (sig == SIGBUS && info->si_code == BUS_OBJERR) { |
|
474 |
// BugId 4454115: A read from a MappedByteBuffer can fault |
|
475 |
// here if the underlying file has been truncated. |
|
476 |
// Do not crash the VM in such a case. |
|
477 |
CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
|
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37431
diff
changeset
|
478 |
CompiledMethod* nm = cb->as_compiled_method_or_null(); |
1 | 479 |
if (nm != NULL && nm->has_unsafe_access()) { |
38209
b2a58604e046
8156088: Reintegrate 8153892: Handle unsafe access error directly in signal handler instead of going through a stub
mikael
parents:
38190
diff
changeset
|
480 |
stub = SharedRuntime::handle_unsafe_access(thread, npc); |
1 | 481 |
} |
482 |
} |
|
483 |
||
484 |
else if (sig == SIGFPE && info->si_code == FPE_INTDIV) { |
|
485 |
// integer divide by zero |
|
486 |
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO); |
|
487 |
} |
|
488 |
else if (sig == SIGFPE && info->si_code == FPE_FLTDIV) { |
|
489 |
// floating-point divide by zero |
|
490 |
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO); |
|
491 |
} |
|
492 |
#ifdef COMPILER2 |
|
493 |
else if (sig == SIGILL && nativeInstruction_at(pc)->is_ic_miss_trap()) { |
|
494 |
#ifdef ASSERT |
|
495 |
#ifdef TIERED |
|
496 |
CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
|
497 |
assert(cb->is_compiled_by_c2(), "Wrong compiler"); |
|
498 |
#endif // TIERED |
|
499 |
#endif // ASSERT |
|
500 |
// Inline cache missed and user trap "Tne G0+ST_RESERVED_FOR_USER_0+2" taken. |
|
501 |
stub = SharedRuntime::get_ic_miss_stub(); |
|
502 |
// At the stub it needs to look like a call from the caller of this |
|
503 |
// method (not a call from the segv site). |
|
504 |
pc = (address)uc->uc_mcontext.gregs[REG_O7]; |
|
505 |
} |
|
506 |
#endif // COMPILER2 |
|
507 |
||
52462
4ad404da0088
8213199: GC abstraction for Assembler::needs_explicit_null_check()
rkennke
parents:
52460
diff
changeset
|
508 |
else if (sig == SIGSEGV && info->si_code > 0 && MacroAssembler::uses_implicit_null_check(info->si_addr)) { |
1 | 509 |
// Determination of interpreter/vtable stub/compiled code null exception |
510 |
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); |
|
511 |
} |
|
512 |
} |
|
513 |
||
514 |
// jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in |
|
515 |
// and the heap gets shrunk before the field access. |
|
516 |
if ((sig == SIGSEGV) || (sig == SIGBUS)) { |
|
517 |
address addr = JNI_FastGetField::find_slowcase_pc(pc); |
|
518 |
if (addr != (address)-1) { |
|
519 |
stub = addr; |
|
520 |
} |
|
521 |
} |
|
522 |
} |
|
523 |
||
524 |
if (stub != NULL) { |
|
525 |
// save all thread context in case we need to restore it |
|
526 |
||
527 |
thread->set_saved_exception_pc(pc); |
|
528 |
thread->set_saved_exception_npc(npc); |
|
529 |
||
530 |
// simulate a branch to the stub (a "call" in the safepoint stub case) |
|
531 |
// factor me: setPC |
|
29573
2d800e5d575f
8074552: SafeFetch32 and SafeFetchN do not work in error handling
dholmes
parents:
26821
diff
changeset
|
532 |
os::Solaris::ucontext_set_pc(uc, stub); |
1 | 533 |
|
534 |
return true; |
|
535 |
} |
|
536 |
||
537 |
// signal-chaining |
|
538 |
if (os::Solaris::chained_handler(sig, info, ucVoid)) { |
|
539 |
return true; |
|
540 |
} |
|
541 |
||
542 |
if (!abort_if_unrecognized) { |
|
543 |
// caller wants another chance, so give it to him |
|
544 |
return false; |
|
545 |
} |
|
546 |
||
547 |
if (!os::Solaris::libjsig_is_loaded) { |
|
548 |
struct sigaction oldAct; |
|
549 |
sigaction(sig, (struct sigaction *)0, &oldAct); |
|
550 |
if (oldAct.sa_sigaction != signalHandler) { |
|
551 |
void* sighand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction) |
|
552 |
: CAST_FROM_FN_PTR(void*, oldAct.sa_handler); |
|
2131 | 553 |
warning("Unexpected Signal %d occurred under user-defined signal handler " INTPTR_FORMAT, sig, (intptr_t)sighand); |
1 | 554 |
} |
555 |
} |
|
556 |
||
557 |
if (pc == NULL && uc != NULL) { |
|
558 |
pc = (address) uc->uc_mcontext.gregs[REG_PC]; |
|
559 |
} |
|
560 |
||
7108 | 561 |
// Sometimes the register windows are not properly flushed. |
562 |
if(uc->uc_mcontext.gwins != NULL) { |
|
563 |
::handle_unflushed_register_windows(uc->uc_mcontext.gwins); |
|
564 |
} |
|
565 |
||
1 | 566 |
// unmask current signal |
567 |
sigset_t newset; |
|
568 |
sigemptyset(&newset); |
|
569 |
sigaddset(&newset, sig); |
|
570 |
sigprocmask(SIG_UNBLOCK, &newset, NULL); |
|
571 |
||
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7405
diff
changeset
|
572 |
// Determine which sort of error to throw. Out of swap may signal |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7405
diff
changeset
|
573 |
// on the thread stack, which could get a mapping error when touched. |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7405
diff
changeset
|
574 |
address addr = (address) info->si_addr; |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7405
diff
changeset
|
575 |
if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) { |
17087
f0b76c4c93a0
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
ccheung
parents:
14633
diff
changeset
|
576 |
vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack."); |
7719
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7405
diff
changeset
|
577 |
} |
ef138e2849eb
6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents:
7405
diff
changeset
|
578 |
|
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
29573
diff
changeset
|
579 |
VMError::report_and_die(t, sig, pc, info, ucVoid); |
1 | 580 |
|
581 |
ShouldNotReachHere(); |
|
34667 | 582 |
return false; |
1 | 583 |
} |
584 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
585 |
void os::print_context(outputStream *st, const void *context) { |
1 | 586 |
if (context == NULL) return; |
587 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
588 |
const ucontext_t *uc = (const ucontext_t*)context; |
1 | 589 |
st->print_cr("Registers:"); |
590 |
||
7108 | 591 |
st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT |
592 |
" G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT, |
|
593 |
uc->uc_mcontext.gregs[REG_G1], |
|
594 |
uc->uc_mcontext.gregs[REG_G2], |
|
595 |
uc->uc_mcontext.gregs[REG_G3], |
|
596 |
uc->uc_mcontext.gregs[REG_G4]); |
|
597 |
st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT |
|
598 |
" G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, |
|
599 |
uc->uc_mcontext.gregs[REG_G5], |
|
600 |
uc->uc_mcontext.gregs[REG_G6], |
|
601 |
uc->uc_mcontext.gregs[REG_G7], |
|
602 |
uc->uc_mcontext.gregs[REG_Y]); |
|
1 | 603 |
st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT |
604 |
" O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT, |
|
605 |
uc->uc_mcontext.gregs[REG_O0], |
|
606 |
uc->uc_mcontext.gregs[REG_O1], |
|
607 |
uc->uc_mcontext.gregs[REG_O2], |
|
608 |
uc->uc_mcontext.gregs[REG_O3]); |
|
609 |
st->print_cr(" O4=" INTPTR_FORMAT " O5=" INTPTR_FORMAT |
|
610 |
" O6=" INTPTR_FORMAT " O7=" INTPTR_FORMAT, |
|
611 |
uc->uc_mcontext.gregs[REG_O4], |
|
612 |
uc->uc_mcontext.gregs[REG_O5], |
|
613 |
uc->uc_mcontext.gregs[REG_O6], |
|
614 |
uc->uc_mcontext.gregs[REG_O7]); |
|
615 |
||
7108 | 616 |
|
617 |
intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc); |
|
618 |
st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT |
|
619 |
" L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT, |
|
620 |
sp[L0->sp_offset_in_saved_window()], |
|
621 |
sp[L1->sp_offset_in_saved_window()], |
|
622 |
sp[L2->sp_offset_in_saved_window()], |
|
623 |
sp[L3->sp_offset_in_saved_window()]); |
|
624 |
st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT |
|
625 |
" L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT, |
|
626 |
sp[L4->sp_offset_in_saved_window()], |
|
627 |
sp[L5->sp_offset_in_saved_window()], |
|
628 |
sp[L6->sp_offset_in_saved_window()], |
|
629 |
sp[L7->sp_offset_in_saved_window()]); |
|
630 |
st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT |
|
631 |
" I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT, |
|
632 |
sp[I0->sp_offset_in_saved_window()], |
|
633 |
sp[I1->sp_offset_in_saved_window()], |
|
634 |
sp[I2->sp_offset_in_saved_window()], |
|
635 |
sp[I3->sp_offset_in_saved_window()]); |
|
636 |
st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT |
|
637 |
" I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT, |
|
638 |
sp[I4->sp_offset_in_saved_window()], |
|
639 |
sp[I5->sp_offset_in_saved_window()], |
|
640 |
sp[I6->sp_offset_in_saved_window()], |
|
641 |
sp[I7->sp_offset_in_saved_window()]); |
|
1 | 642 |
|
643 |
st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT, |
|
644 |
uc->uc_mcontext.gregs[REG_PC], |
|
645 |
uc->uc_mcontext.gregs[REG_nPC]); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
646 |
st->cr(); |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
647 |
st->cr(); |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
648 |
|
1 | 649 |
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); |
650 |
print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); |
|
651 |
st->cr(); |
|
652 |
||
653 |
// Note: it may be unsafe to inspect memory near pc. For example, pc may |
|
654 |
// point to garbage if entry point in an nmethod is corrupted. Leave |
|
655 |
// this at the end, and hope for the best. |
|
656 |
ExtendedPC epc = os::Solaris::ucontext_get_ExtendedPC(uc); |
|
657 |
address pc = epc.pc(); |
|
53605
853c68ff2ed7
8217879: hs_err should print more instructions in hex dump
shade
parents:
52462
diff
changeset
|
658 |
print_instructions(st, pc, sizeof(char)); |
853c68ff2ed7
8217879: hs_err should print more instructions in hex dump
shade
parents:
52462
diff
changeset
|
659 |
st->cr(); |
7108 | 660 |
} |
661 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
662 |
void os::print_register_info(outputStream *st, const void *context) { |
7108 | 663 |
if (context == NULL) return; |
664 |
||
35077
8b86440d3bf1
8145114: const-correctness for ucontext_t* reading functions
stuefe
parents:
35071
diff
changeset
|
665 |
const ucontext_t *uc = (const ucontext_t*)context; |
7108 | 666 |
intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc); |
667 |
||
668 |
st->print_cr("Register to memory mapping:"); |
|
669 |
st->cr(); |
|
670 |
||
671 |
// this is only for the "general purpose" registers |
|
672 |
st->print("G1="); print_location(st, uc->uc_mcontext.gregs[REG_G1]); |
|
673 |
st->print("G2="); print_location(st, uc->uc_mcontext.gregs[REG_G2]); |
|
674 |
st->print("G3="); print_location(st, uc->uc_mcontext.gregs[REG_G3]); |
|
675 |
st->print("G4="); print_location(st, uc->uc_mcontext.gregs[REG_G4]); |
|
676 |
st->print("G5="); print_location(st, uc->uc_mcontext.gregs[REG_G5]); |
|
677 |
st->print("G6="); print_location(st, uc->uc_mcontext.gregs[REG_G6]); |
|
678 |
st->print("G7="); print_location(st, uc->uc_mcontext.gregs[REG_G7]); |
|
679 |
st->cr(); |
|
680 |
||
681 |
st->print("O0="); print_location(st, uc->uc_mcontext.gregs[REG_O0]); |
|
682 |
st->print("O1="); print_location(st, uc->uc_mcontext.gregs[REG_O1]); |
|
683 |
st->print("O2="); print_location(st, uc->uc_mcontext.gregs[REG_O2]); |
|
684 |
st->print("O3="); print_location(st, uc->uc_mcontext.gregs[REG_O3]); |
|
685 |
st->print("O4="); print_location(st, uc->uc_mcontext.gregs[REG_O4]); |
|
686 |
st->print("O5="); print_location(st, uc->uc_mcontext.gregs[REG_O5]); |
|
687 |
st->print("O6="); print_location(st, uc->uc_mcontext.gregs[REG_O6]); |
|
688 |
st->print("O7="); print_location(st, uc->uc_mcontext.gregs[REG_O7]); |
|
689 |
st->cr(); |
|
690 |
||
691 |
st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]); |
|
692 |
st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]); |
|
693 |
st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]); |
|
694 |
st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]); |
|
695 |
st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]); |
|
696 |
st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]); |
|
697 |
st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]); |
|
698 |
st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]); |
|
699 |
st->cr(); |
|
700 |
||
701 |
st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]); |
|
702 |
st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]); |
|
703 |
st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]); |
|
704 |
st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]); |
|
705 |
st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]); |
|
706 |
st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]); |
|
707 |
st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]); |
|
708 |
st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]); |
|
709 |
st->cr(); |
|
1 | 710 |
} |
711 |
||
712 |
void os::Solaris::init_thread_fpu_state(void) { |
|
713 |
// Nothing needed on Sparc. |
|
714 |
} |
|
715 |
||
11961
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
716 |
#ifndef PRODUCT |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
717 |
void os::verify_stack_alignment() { |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
718 |
} |
0abd4cd26e5a
7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents:
8921
diff
changeset
|
719 |
#endif |
26576
a9429d24d429
8050147: StoreLoad barrier interferes with stack usages
shade
parents:
25715
diff
changeset
|
720 |
|
a9429d24d429
8050147: StoreLoad barrier interferes with stack usages
shade
parents:
25715
diff
changeset
|
721 |
int os::extra_bang_size_in_bytes() { |
a9429d24d429
8050147: StoreLoad barrier interferes with stack usages
shade
parents:
25715
diff
changeset
|
722 |
// SPARC does not require an additional stack bang. |
a9429d24d429
8050147: StoreLoad barrier interferes with stack usages
shade
parents:
25715
diff
changeset
|
723 |
return 0; |
a9429d24d429
8050147: StoreLoad barrier interferes with stack usages
shade
parents:
25715
diff
changeset
|
724 |
} |