1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
253 // point into the calling threads stack, and be no lower than the current stack
254 // pointer.
255 address os::current_stack_pointer() {
256 volatile int dummy;
257 address sp = (address)&dummy + 8; // %%%% need to confirm if this is right
258 return sp;
259 }
260
261 frame os::current_frame() {
262 intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
263 frame myframe(sp, frame::unpatchable,
264 CAST_FROM_FN_PTR(address, os::current_frame));
265 if (os::is_first_C_frame(&myframe)) {
266 // stack is not walkable
267 return frame(NULL, NULL, NULL);
268 } else {
269 return os::get_sender_for_C_frame(&myframe);
270 }
271 }
272
273 static int threadgetstate(thread_t tid, int *flags, lwpid_t *lwp, stack_t *ss, gregset_t rs, lwpstatus_t *lwpstatus) {
274 char lwpstatusfile[PROCFILE_LENGTH];
275 int lwpfd, err;
276
277 if (err = os::Solaris::thr_getstate(tid, flags, lwp, ss, rs))
278 return (err);
279 if (*flags == TRS_LWPID) {
280 sprintf(lwpstatusfile, "/proc/%d/lwp/%d/lwpstatus", getpid(),
281 *lwp);
282 if ((lwpfd = ::open(lwpstatusfile, O_RDONLY)) < 0) {
283 perror("thr_mutator_status: open lwpstatus");
284 return (EINVAL);
285 }
286 if (pread(lwpfd, lwpstatus, sizeof (lwpstatus_t), (off_t)0) !=
287 sizeof (lwpstatus_t)) {
288 perror("thr_mutator_status: read lwpstatus");
289 (void) ::close(lwpfd);
290 return (EINVAL);
291 }
292 (void) ::close(lwpfd);
293 }
294 return (0);
295 }
296
297
298 bool os::is_allocatable(size_t bytes) {
299 #ifdef _LP64
300 return true;
301 #else
302 return (bytes <= (size_t)3835*M);
303 #endif
304 }
305
306 extern "C" JNIEXPORT int
307 JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
308 int abort_if_unrecognized) {
309 ucontext_t* uc = (ucontext_t*) ucVoid;
310
311 Thread* t = ThreadLocalStorage::get_thread_slow();
312
313 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
314 // (no destructors can be run)
315 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
316
317 SignalHandlerMark shm(t);
|
1 /*
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
253 // point into the calling threads stack, and be no lower than the current stack
254 // pointer.
255 address os::current_stack_pointer() {
256 volatile int dummy;
257 address sp = (address)&dummy + 8; // %%%% need to confirm if this is right
258 return sp;
259 }
260
261 frame os::current_frame() {
262 intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
263 frame myframe(sp, frame::unpatchable,
264 CAST_FROM_FN_PTR(address, os::current_frame));
265 if (os::is_first_C_frame(&myframe)) {
266 // stack is not walkable
267 return frame(NULL, NULL, NULL);
268 } else {
269 return os::get_sender_for_C_frame(&myframe);
270 }
271 }
272
273 bool os::is_allocatable(size_t bytes) {
274 #ifdef _LP64
275 return true;
276 #else
277 return (bytes <= (size_t)3835*M);
278 #endif
279 }
280
281 extern "C" JNIEXPORT int
282 JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
283 int abort_if_unrecognized) {
284 ucontext_t* uc = (ucontext_t*) ucVoid;
285
286 Thread* t = ThreadLocalStorage::get_thread_slow();
287
288 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
289 // (no destructors can be run)
290 os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
291
292 SignalHandlerMark shm(t);
|