155 register void *sp __asm__ ("sp");
156 return (address)sp;
157 }
158
159 static void current_stack_region(address* bottom, size_t* size) {
160 if (os::Linux::is_initial_thread()) {
161 // initial thread needs special handling because pthread_getattr_np()
162 // may return bogus value.
163 *bottom = os::Linux::initial_thread_stack_bottom();
164 *size = os::Linux::initial_thread_stack_size();
165 } else {
166 pthread_attr_t attr;
167
168 int rslt = pthread_getattr_np(pthread_self(), &attr);
169
170 // JVM needs to know exact stack location, abort if it fails
171 if (rslt != 0) {
172 if (rslt == ENOMEM) {
173 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
174 } else {
175 fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
176 }
177 }
178
179 if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) {
180 fatal("Can not locate current stack attributes!");
181 }
182
183 pthread_attr_destroy(&attr);
184 }
185 assert(os::current_stack_pointer() >= *bottom &&
186 os::current_stack_pointer() < *bottom + *size, "just checking");
187 }
188
189 address os::current_stack_base() {
190 address bottom;
191 size_t size;
192 current_stack_region(&bottom, &size);
193 return bottom + size;
194 }
195
675 // signal-chaining
676 if (os::Linux::chained_handler(sig, info, ucVoid)) {
677 return true;
678 }
679
680 if (!abort_if_unrecognized) {
681 // caller wants another chance, so give it to him
682 return false;
683 }
684
685 if (pc == NULL && uc != NULL) {
686 pc = os::Linux::ucontext_get_pc((ucontext_t*)uc);
687 }
688
689 // unmask current signal
690 sigset_t newset;
691 sigemptyset(&newset);
692 sigaddset(&newset, sig);
693 sigprocmask(SIG_UNBLOCK, &newset, NULL);
694
695 VMError err(t, sig, pc, info, ucVoid);
696 err.report_and_die();
697
698 ShouldNotReachHere();
699 }
700
701 void os::Linux::init_thread_fpu_state(void) {
702 // Nothing to do
703 }
704
705 int os::Linux::get_fpu_control_word() {
706 return 0;
707 }
708
709 void os::Linux::set_fpu_control_word(int fpu) {
710 // nothing
711 }
712
713 bool os::is_allocatable(size_t bytes) {
714 #ifdef _LP64
715 return true;
716 #else
|
155 register void *sp __asm__ ("sp");
156 return (address)sp;
157 }
158
159 static void current_stack_region(address* bottom, size_t* size) {
160 if (os::Linux::is_initial_thread()) {
161 // initial thread needs special handling because pthread_getattr_np()
162 // may return bogus value.
163 *bottom = os::Linux::initial_thread_stack_bottom();
164 *size = os::Linux::initial_thread_stack_size();
165 } else {
166 pthread_attr_t attr;
167
168 int rslt = pthread_getattr_np(pthread_self(), &attr);
169
170 // JVM needs to know exact stack location, abort if it fails
171 if (rslt != 0) {
172 if (rslt == ENOMEM) {
173 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
174 } else {
175 fatal("pthread_getattr_np failed with errno = %d", rslt);
176 }
177 }
178
179 if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) {
180 fatal("Can not locate current stack attributes!");
181 }
182
183 pthread_attr_destroy(&attr);
184 }
185 assert(os::current_stack_pointer() >= *bottom &&
186 os::current_stack_pointer() < *bottom + *size, "just checking");
187 }
188
189 address os::current_stack_base() {
190 address bottom;
191 size_t size;
192 current_stack_region(&bottom, &size);
193 return bottom + size;
194 }
195
675 // signal-chaining
676 if (os::Linux::chained_handler(sig, info, ucVoid)) {
677 return true;
678 }
679
680 if (!abort_if_unrecognized) {
681 // caller wants another chance, so give it to him
682 return false;
683 }
684
685 if (pc == NULL && uc != NULL) {
686 pc = os::Linux::ucontext_get_pc((ucontext_t*)uc);
687 }
688
689 // unmask current signal
690 sigset_t newset;
691 sigemptyset(&newset);
692 sigaddset(&newset, sig);
693 sigprocmask(SIG_UNBLOCK, &newset, NULL);
694
695 VMError::report_and_die(t, sig, pc, info, ucVoid);
696
697 ShouldNotReachHere();
698 }
699
700 void os::Linux::init_thread_fpu_state(void) {
701 // Nothing to do
702 }
703
704 int os::Linux::get_fpu_control_word() {
705 return 0;
706 }
707
708 void os::Linux::set_fpu_control_word(int fpu) {
709 // nothing
710 }
711
712 bool os::is_allocatable(size_t bytes) {
713 #ifdef _LP64
714 return true;
715 #else
|