< prev index next >

src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp

Print this page




 714   // signal-chaining
 715   if (os::Bsd::chained_handler(sig, info, ucVoid)) {
 716      return true;
 717   }
 718 
 719   if (!abort_if_unrecognized) {
 720     // caller wants another chance, so give it to him
 721     return false;
 722   }
 723 
 724   if (pc == NULL && uc != NULL) {
 725     pc = os::Bsd::ucontext_get_pc(uc);
 726   }
 727 
 728   // unmask current signal
 729   sigset_t newset;
 730   sigemptyset(&newset);
 731   sigaddset(&newset, sig);
 732   sigprocmask(SIG_UNBLOCK, &newset, NULL);
 733 
 734   VMError err(t, sig, pc, info, ucVoid);
 735   err.report_and_die();
 736 
 737   ShouldNotReachHere();
 738   return false;
 739 }
 740 
 741 // From solaris_i486.s ported to bsd_i486.s
 742 extern "C" void fixcw();
 743 
 744 void os::Bsd::init_thread_fpu_state(void) {
 745 #ifndef AMD64
 746   // Set fpu to 53 bit precision. This happens too early to use a stub.
 747   fixcw();
 748 #endif // !AMD64
 749 }
 750 
 751 
 752 // Check that the bsd kernel version is 2.4 or higher since earlier
 753 // versions do not support SSE without patches.
 754 bool os::supports_sse() {
 755   return true;


 848   // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages
 849   if (pthread_main_np() == 1) {
 850     if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) {
 851       char kern_osrelease[256];
 852       size_t kern_osrelease_size = sizeof(kern_osrelease);
 853       int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0);
 854       if (ret == 0) {
 855         // get the major number, atoi will ignore the minor amd micro portions of the version string
 856         if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) {
 857           *size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize());
 858         }
 859       }
 860     }
 861   }
 862   *bottom = (address) stacktop - *size;
 863 #elif defined(__OpenBSD__)
 864   stack_t ss;
 865   int rslt = pthread_stackseg_np(pthread_self(), &ss);
 866 
 867   if (rslt != 0)
 868     fatal(err_msg("pthread_stackseg_np failed with err = %d", rslt));
 869 
 870   *bottom = (address)((char *)ss.ss_sp - ss.ss_size);
 871   *size   = ss.ss_size;
 872 #else
 873   pthread_attr_t attr;
 874 
 875   int rslt = pthread_attr_init(&attr);
 876 
 877   // JVM needs to know exact stack location, abort if it fails
 878   if (rslt != 0)
 879     fatal(err_msg("pthread_attr_init failed with err = %d", rslt));
 880 
 881   rslt = pthread_attr_get_np(pthread_self(), &attr);
 882 
 883   if (rslt != 0)
 884     fatal(err_msg("pthread_attr_get_np failed with err = %d", rslt));
 885 
 886   if (pthread_attr_getstackaddr(&attr, (void **)bottom) != 0 ||
 887     pthread_attr_getstacksize(&attr, size) != 0) {
 888     fatal("Can not locate current stack attributes!");
 889   }
 890 
 891   pthread_attr_destroy(&attr);
 892 #endif
 893   assert(os::current_stack_pointer() >= *bottom &&
 894          os::current_stack_pointer() < *bottom + *size, "just checking");
 895 }
 896 
 897 address os::current_stack_base() {
 898   address bottom;
 899   size_t size;
 900   current_stack_region(&bottom, &size);
 901   return (bottom + size);
 902 }
 903 
 904 size_t os::current_stack_size() {




 714   // signal-chaining
 715   if (os::Bsd::chained_handler(sig, info, ucVoid)) {
 716      return true;
 717   }
 718 
 719   if (!abort_if_unrecognized) {
 720     // caller wants another chance, so give it to him
 721     return false;
 722   }
 723 
 724   if (pc == NULL && uc != NULL) {
 725     pc = os::Bsd::ucontext_get_pc(uc);
 726   }
 727 
 728   // unmask current signal
 729   sigset_t newset;
 730   sigemptyset(&newset);
 731   sigaddset(&newset, sig);
 732   sigprocmask(SIG_UNBLOCK, &newset, NULL);
 733 
 734   VMError::report_and_die(t, sig, pc, info, ucVoid);

 735 
 736   ShouldNotReachHere();
 737   return false;
 738 }
 739 
 740 // From solaris_i486.s ported to bsd_i486.s
 741 extern "C" void fixcw();
 742 
 743 void os::Bsd::init_thread_fpu_state(void) {
 744 #ifndef AMD64
 745   // Set fpu to 53 bit precision. This happens too early to use a stub.
 746   fixcw();
 747 #endif // !AMD64
 748 }
 749 
 750 
 751 // Check that the bsd kernel version is 2.4 or higher since earlier
 752 // versions do not support SSE without patches.
 753 bool os::supports_sse() {
 754   return true;


 847   // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages
 848   if (pthread_main_np() == 1) {
 849     if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) {
 850       char kern_osrelease[256];
 851       size_t kern_osrelease_size = sizeof(kern_osrelease);
 852       int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0);
 853       if (ret == 0) {
 854         // get the major number, atoi will ignore the minor amd micro portions of the version string
 855         if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) {
 856           *size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize());
 857         }
 858       }
 859     }
 860   }
 861   *bottom = (address) stacktop - *size;
 862 #elif defined(__OpenBSD__)
 863   stack_t ss;
 864   int rslt = pthread_stackseg_np(pthread_self(), &ss);
 865 
 866   if (rslt != 0)
 867     fatal("pthread_stackseg_np failed with err = %d", rslt);
 868 
 869   *bottom = (address)((char *)ss.ss_sp - ss.ss_size);
 870   *size   = ss.ss_size;
 871 #else
 872   pthread_attr_t attr;
 873 
 874   int rslt = pthread_attr_init(&attr);
 875 
 876   // JVM needs to know exact stack location, abort if it fails
 877   if (rslt != 0)
 878     fatal("pthread_attr_init failed with err = %d", rslt);
 879 
 880   rslt = pthread_attr_get_np(pthread_self(), &attr);
 881 
 882   if (rslt != 0)
 883     fatal("pthread_attr_get_np failed with err = %d", rslt);
 884 
 885   if (pthread_attr_getstackaddr(&attr, (void **)bottom) != 0 ||
 886     pthread_attr_getstacksize(&attr, size) != 0) {
 887     fatal("Can not locate current stack attributes!");
 888   }
 889 
 890   pthread_attr_destroy(&attr);
 891 #endif
 892   assert(os::current_stack_pointer() >= *bottom &&
 893          os::current_stack_pointer() < *bottom + *size, "just checking");
 894 }
 895 
 896 address os::current_stack_base() {
 897   address bottom;
 898   size_t size;
 899   current_stack_region(&bottom, &size);
 900   return (bottom + size);
 901 }
 902 
 903 size_t os::current_stack_size() {


< prev index next >