< prev index next >

src/os_cpu/linux_x86/vm/os_linux_x86.cpp

Print this page




 525   // signal-chaining
 526   if (os::Linux::chained_handler(sig, info, ucVoid)) {
 527      return true;
 528   }
 529 
 530   if (!abort_if_unrecognized) {
 531     // caller wants another chance, so give it to him
 532     return false;
 533   }
 534 
 535   if (pc == NULL && uc != NULL) {
 536     pc = os::Linux::ucontext_get_pc(uc);
 537   }
 538 
 539   // unmask current signal
 540   sigset_t newset;
 541   sigemptyset(&newset);
 542   sigaddset(&newset, sig);
 543   sigprocmask(SIG_UNBLOCK, &newset, NULL);
 544 
 545   VMError err(t, sig, pc, info, ucVoid);
 546   err.report_and_die();
 547 
 548   ShouldNotReachHere();
 549   return true; // Mute compiler
 550 }
 551 
 552 void os::Linux::init_thread_fpu_state(void) {
 553 #ifndef AMD64
 554   // set fpu to 53 bit precision
 555   set_fpu_control_word(0x27f);
 556 #endif // !AMD64
 557 }
 558 
 559 int os::Linux::get_fpu_control_word(void) {
 560 #ifdef AMD64
 561   return 0;
 562 #else
 563   int fpu_control;
 564   _FPU_GETCW(fpu_control);
 565   return fpu_control & 0xffff;
 566 #endif // AMD64


 672 //
 673 // ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from
 674 //    pthread_attr_getstack()
 675 
 676 static void current_stack_region(address * bottom, size_t * size) {
 677   if (os::Linux::is_initial_thread()) {
 678      // initial thread needs special handling because pthread_getattr_np()
 679      // may return bogus value.
 680      *bottom = os::Linux::initial_thread_stack_bottom();
 681      *size   = os::Linux::initial_thread_stack_size();
 682   } else {
 683      pthread_attr_t attr;
 684 
 685      int rslt = pthread_getattr_np(pthread_self(), &attr);
 686 
 687      // JVM needs to know exact stack location, abort if it fails
 688      if (rslt != 0) {
 689        if (rslt == ENOMEM) {
 690          vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 691        } else {
 692          fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
 693        }
 694      }
 695 
 696      if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
 697          fatal("Can not locate current stack attributes!");
 698      }
 699 
 700      pthread_attr_destroy(&attr);
 701 
 702   }
 703   assert(os::current_stack_pointer() >= *bottom &&
 704          os::current_stack_pointer() < *bottom + *size, "just checking");
 705 }
 706 
 707 address os::current_stack_base() {
 708   address bottom;
 709   size_t size;
 710   current_stack_region(&bottom, &size);
 711   return (bottom + size);
 712 }




 525   // signal-chaining
 526   if (os::Linux::chained_handler(sig, info, ucVoid)) {
 527      return true;
 528   }
 529 
 530   if (!abort_if_unrecognized) {
 531     // caller wants another chance, so give it to him
 532     return false;
 533   }
 534 
 535   if (pc == NULL && uc != NULL) {
 536     pc = os::Linux::ucontext_get_pc(uc);
 537   }
 538 
 539   // unmask current signal
 540   sigset_t newset;
 541   sigemptyset(&newset);
 542   sigaddset(&newset, sig);
 543   sigprocmask(SIG_UNBLOCK, &newset, NULL);
 544 
 545   VMError::report_and_die(t, sig, pc, info, ucVoid);

 546 
 547   ShouldNotReachHere();
 548   return true; // Mute compiler
 549 }
 550 
 551 void os::Linux::init_thread_fpu_state(void) {
 552 #ifndef AMD64
 553   // set fpu to 53 bit precision
 554   set_fpu_control_word(0x27f);
 555 #endif // !AMD64
 556 }
 557 
 558 int os::Linux::get_fpu_control_word(void) {
 559 #ifdef AMD64
 560   return 0;
 561 #else
 562   int fpu_control;
 563   _FPU_GETCW(fpu_control);
 564   return fpu_control & 0xffff;
 565 #endif // AMD64


 671 //
 672 // ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from
 673 //    pthread_attr_getstack()
 674 
 675 static void current_stack_region(address * bottom, size_t * size) {
 676   if (os::Linux::is_initial_thread()) {
 677      // initial thread needs special handling because pthread_getattr_np()
 678      // may return bogus value.
 679      *bottom = os::Linux::initial_thread_stack_bottom();
 680      *size   = os::Linux::initial_thread_stack_size();
 681   } else {
 682      pthread_attr_t attr;
 683 
 684      int rslt = pthread_getattr_np(pthread_self(), &attr);
 685 
 686      // JVM needs to know exact stack location, abort if it fails
 687      if (rslt != 0) {
 688        if (rslt == ENOMEM) {
 689          vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 690        } else {
 691          fatal("pthread_getattr_np failed with errno = %d", rslt);
 692        }
 693      }
 694 
 695      if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
 696          fatal("Can not locate current stack attributes!");
 697      }
 698 
 699      pthread_attr_destroy(&attr);
 700 
 701   }
 702   assert(os::current_stack_pointer() >= *bottom &&
 703          os::current_stack_pointer() < *bottom + *size, "just checking");
 704 }
 705 
 706 address os::current_stack_base() {
 707   address bottom;
 708   size_t size;
 709   current_stack_region(&bottom, &size);
 710   return (bottom + size);
 711 }


< prev index next >