518
519 void os::Linux::init_thread_fpu_state(void) {
520 // Disable FP exceptions.
521 __asm__ __volatile__ ("mtfsfi 6,0");
522 }
523
524 int os::Linux::get_fpu_control_word(void) {
525 // x86 has problems with FPU precision after pthread_cond_timedwait().
526 // nothing to do on ppc64.
527 return 0;
528 }
529
530 void os::Linux::set_fpu_control_word(int fpu_control) {
531 // x86 has problems with FPU precision after pthread_cond_timedwait().
532 // nothing to do on ppc64.
533 }
534
535 ////////////////////////////////////////////////////////////////////////////////
536 // thread stack
537
538 size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K;
539 size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
540 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
541
542 // return default stack size for thr_type
543 size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
544 // default stack size (compiler thread needs larger stack)
545 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K);
546 return s;
547 }
548
549 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
550 return 2 * page_size();
551 }
552
553 // Java thread:
554 //
555 // Low memory addresses
556 // +------------------------+
557 // | |\ JavaThread created by VM does not have glibc
558 // | glibc guard page | - guard, attached Java thread usually has
559 // | |/ 1 page glibc guard.
560 // P1 +------------------------+ Thread::stack_base() - Thread::stack_size()
561 // | |\
562 // | HotSpot Guard Pages | - red and yellow pages
563 // | |/
564 // +------------------------+ JavaThread::stack_yellow_zone_base()
565 // | |\
566 // | Normal Stack | -
567 // | |/
568 // P2 +------------------------+ Thread::stack_base()
569 //
570 // Non-Java thread:
|
518
519 void os::Linux::init_thread_fpu_state(void) {
520 // Disable FP exceptions.
521 __asm__ __volatile__ ("mtfsfi 6,0");
522 }
523
524 int os::Linux::get_fpu_control_word(void) {
525 // x86 has problems with FPU precision after pthread_cond_timedwait().
526 // nothing to do on ppc64.
527 return 0;
528 }
529
530 void os::Linux::set_fpu_control_word(int fpu_control) {
531 // x86 has problems with FPU precision after pthread_cond_timedwait().
532 // nothing to do on ppc64.
533 }
534
535 ////////////////////////////////////////////////////////////////////////////////
536 // thread stack
537
538 // These sizes exclude OS stack guard pages, but include
539 // the VM guard pages.
540 size_t os::Posix::_compiler_thread_min_stack_allowed = 192 * K;
541 size_t os::Posix::_java_thread_min_stack_allowed = 128 * K;
542 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
543
544 // return default stack size for thr_type
545 size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
546 // default stack size (compiler thread needs larger stack)
547 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K);
548 return s;
549 }
550
551 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
552 // Creating guard page is very expensive. Java thread has HotSpot
553 // guard page, only enable glibc guard page for non-Java threads.
554 return (thr_type == java_thread ? 0 : page_size());
555 }
556
557 // Java thread:
558 //
559 // Low memory addresses
560 // +------------------------+
561 // | |\ JavaThread created by VM does not have glibc
562 // | glibc guard page | - guard, attached Java thread usually has
563 // | |/ 1 page glibc guard.
564 // P1 +------------------------+ Thread::stack_base() - Thread::stack_size()
565 // | |\
566 // | HotSpot Guard Pages | - red and yellow pages
567 // | |/
568 // +------------------------+ JavaThread::stack_yellow_zone_base()
569 // | |\
570 // | Normal Stack | -
571 // | |/
572 // P2 +------------------------+ Thread::stack_base()
573 //
574 // Non-Java thread:
|