530 *bottom = os::Linux::initial_thread_stack_bottom();
531 *size = os::Linux::initial_thread_stack_size();
532 } else {
533 pthread_attr_t attr;
534
535 int rslt = pthread_getattr_np(pthread_self(), &attr);
536
537 // JVM needs to know exact stack location, abort if it fails
538 if (rslt != 0) {
539 if (rslt == ENOMEM) {
540 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
541 } else {
542 fatal("pthread_getattr_np failed with errno = %d", rslt);
543 }
544 }
545
546 if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
547 fatal("Can not locate current stack attributes!");
548 }
549
550 pthread_attr_destroy(&attr);
551
552 }
553 assert(os::current_stack_pointer() >= *bottom &&
554 os::current_stack_pointer() < *bottom + *size, "just checking");
555 }
556
557 address os::current_stack_base() {
558 address bottom;
559 size_t size;
560 current_stack_region(&bottom, &size);
561 return (bottom + size);
562 }
563
564 size_t os::current_stack_size() {
565 // stack size includes normal stack and HotSpot guard pages
566 address bottom;
567 size_t size;
568 current_stack_region(&bottom, &size);
569 return size;
|
530 *bottom = os::Linux::initial_thread_stack_bottom();
531 *size = os::Linux::initial_thread_stack_size();
532 } else {
533 pthread_attr_t attr;
534
535 int rslt = pthread_getattr_np(pthread_self(), &attr);
536
537 // JVM needs to know exact stack location, abort if it fails
538 if (rslt != 0) {
539 if (rslt == ENOMEM) {
540 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
541 } else {
542 fatal("pthread_getattr_np failed with errno = %d", rslt);
543 }
544 }
545
546 if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
547 fatal("Can not locate current stack attributes!");
548 }
549
550 // Work around NPTL stack guard error.
551 size_t guard_size = 0;
552 pthread_attr_getguardsize(&attr, &guard_size);
553 *bottom += guard_size;
554 *size -= guard_size;
555
556 pthread_attr_destroy(&attr);
557
558 }
559 assert(os::current_stack_pointer() >= *bottom &&
560 os::current_stack_pointer() < *bottom + *size, "just checking");
561 }
562
563 address os::current_stack_base() {
564 address bottom;
565 size_t size;
566 current_stack_region(&bottom, &size);
567 return (bottom + size);
568 }
569
570 size_t os::current_stack_size() {
571 // stack size includes normal stack and HotSpot guard pages
572 address bottom;
573 size_t size;
574 current_stack_region(&bottom, &size);
575 return size;
|