422 if (os::Linux::chained_handler(sig, info, ucVoid)) {
423 return true;
424 }
425
426 if (!abort_if_unrecognized) {
427 // caller wants another chance, so give it to him
428 return false;
429 }
430
431 if (pc == NULL && uc != NULL) {
432 pc = os::Linux::ucontext_get_pc(uc);
433 }
434
435 report_and_die:
436 // unmask current signal
437 sigset_t newset;
438 sigemptyset(&newset);
439 sigaddset(&newset, sig);
440 sigprocmask(SIG_UNBLOCK, &newset, NULL);
441
442 VMError err(t, sig, pc, info, ucVoid);
443 err.report_and_die();
444
445 ShouldNotReachHere();
446 return false;
447 }
448
449 void os::Linux::init_thread_fpu_state(void) {
450 // Disable FP exceptions.
451 __asm__ __volatile__ ("mtfsfi 6,0");
452 }
453
454 int os::Linux::get_fpu_control_word(void) {
455 // x86 has problems with FPU precision after pthread_cond_timedwait().
456 // nothing to do on ppc64.
457 return 0;
458 }
459
460 void os::Linux::set_fpu_control_word(int fpu_control) {
461 // x86 has problems with FPU precision after pthread_cond_timedwait().
462 // nothing to do on ppc64.
463 }
514 //
515 // ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from
516 // pthread_attr_getstack()
517
518 static void current_stack_region(address * bottom, size_t * size) {
519 if (os::Linux::is_initial_thread()) {
520 // initial thread needs special handling because pthread_getattr_np()
521 // may return bogus value.
522 *bottom = os::Linux::initial_thread_stack_bottom();
523 *size = os::Linux::initial_thread_stack_size();
524 } else {
525 pthread_attr_t attr;
526
527 int rslt = pthread_getattr_np(pthread_self(), &attr);
528
529 // JVM needs to know exact stack location, abort if it fails
530 if (rslt != 0) {
531 if (rslt == ENOMEM) {
532 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
533 } else {
534 fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
535 }
536 }
537
538 if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
539 fatal("Can not locate current stack attributes!");
540 }
541
542 pthread_attr_destroy(&attr);
543
544 }
545 assert(os::current_stack_pointer() >= *bottom &&
546 os::current_stack_pointer() < *bottom + *size, "just checking");
547 }
548
549 address os::current_stack_base() {
550 address bottom;
551 size_t size;
552 current_stack_region(&bottom, &size);
553 return (bottom + size);
554 }
|
422 if (os::Linux::chained_handler(sig, info, ucVoid)) {
423 return true;
424 }
425
426 if (!abort_if_unrecognized) {
427 // caller wants another chance, so give it to him
428 return false;
429 }
430
431 if (pc == NULL && uc != NULL) {
432 pc = os::Linux::ucontext_get_pc(uc);
433 }
434
435 report_and_die:
436 // unmask current signal
437 sigset_t newset;
438 sigemptyset(&newset);
439 sigaddset(&newset, sig);
440 sigprocmask(SIG_UNBLOCK, &newset, NULL);
441
442 VMError::report_and_die(t, sig, pc, info, ucVoid);
443
444 ShouldNotReachHere();
445 return false;
446 }
447
448 void os::Linux::init_thread_fpu_state(void) {
449 // Disable FP exceptions.
450 __asm__ __volatile__ ("mtfsfi 6,0");
451 }
452
453 int os::Linux::get_fpu_control_word(void) {
454 // x86 has problems with FPU precision after pthread_cond_timedwait().
455 // nothing to do on ppc64.
456 return 0;
457 }
458
459 void os::Linux::set_fpu_control_word(int fpu_control) {
460 // x86 has problems with FPU precision after pthread_cond_timedwait().
461 // nothing to do on ppc64.
462 }
513 //
514 // ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from
515 // pthread_attr_getstack()
516
517 static void current_stack_region(address * bottom, size_t * size) {
518 if (os::Linux::is_initial_thread()) {
519 // initial thread needs special handling because pthread_getattr_np()
520 // may return bogus value.
521 *bottom = os::Linux::initial_thread_stack_bottom();
522 *size = os::Linux::initial_thread_stack_size();
523 } else {
524 pthread_attr_t attr;
525
526 int rslt = pthread_getattr_np(pthread_self(), &attr);
527
528 // JVM needs to know exact stack location, abort if it fails
529 if (rslt != 0) {
530 if (rslt == ENOMEM) {
531 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
532 } else {
533 fatal("pthread_getattr_np failed with errno = %d", rslt);
534 }
535 }
536
537 if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
538 fatal("Can not locate current stack attributes!");
539 }
540
541 pthread_attr_destroy(&attr);
542
543 }
544 assert(os::current_stack_pointer() >= *bottom &&
545 os::current_stack_pointer() < *bottom + *size, "just checking");
546 }
547
548 address os::current_stack_base() {
549 address bottom;
550 size_t size;
551 current_stack_region(&bottom, &size);
552 return (bottom + size);
553 }
|