440 // BugId 4454115: A read from a MappedByteBuffer can fault here if the
441 // underlying file has been truncated. Do not crash the VM in such a case.
442 CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
443 CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
444 if (nm != NULL && nm->has_unsafe_access()) {
445 address next_pc = pc + 4;
446 next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
447 os::Linux::ucontext_set_pc(uc, next_pc);
448 return true;
449 }
450 }
451 }
452
453 else { // thread->thread_state() != _thread_in_Java
454 if (sig == SIGILL && VM_Version::is_determine_features_test_running()) {
455 // SIGILL must be caused by VM_Version::determine_features().
456 *(int *)pc = 0; // patch instruction to 0 to indicate that it causes a SIGILL,
457 // flushing of icache is not necessary.
458 stub = pc + 4; // continue with next instruction.
459 }
460 else if (thread->thread_state() == _thread_in_vm &&
461 sig == SIGBUS && thread->doing_unsafe_access()) {
462 address next_pc = pc + 4;
463 next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
464 os::Linux::ucontext_set_pc(uc, pc + 4);
465 return true;
466 }
467 }
468
469 // Check to see if we caught the safepoint code in the
470 // process of write protecting the memory serialization page.
471 // It write enables the page immediately after protecting it
472 // so we can just return to retry the write.
473 if ((sig == SIGSEGV) &&
474 // Si_addr may not be valid due to a bug in the linux-ppc64 kernel (see comment above).
475 // Use is_memory_serialization instead of si_addr.
476 ((NativeInstruction*)pc)->is_memory_serialization(thread, ucVoid)) {
477 // Synchronization problem in the pseudo memory barrier code (bug id 6546278)
478 // Block current thread until the memory serialize page permission restored.
479 os::block_on_serialize_page_trap();
480 return true;
481 }
|
440 // BugId 4454115: A read from a MappedByteBuffer can fault here if the
441 // underlying file has been truncated. Do not crash the VM in such a case.
442 CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
443 CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
444 if (nm != NULL && nm->has_unsafe_access()) {
445 address next_pc = pc + 4;
446 next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
447 os::Linux::ucontext_set_pc(uc, next_pc);
448 return true;
449 }
450 }
451 }
452
453 else { // thread->thread_state() != _thread_in_Java
454 if (sig == SIGILL && VM_Version::is_determine_features_test_running()) {
455 // SIGILL must be caused by VM_Version::determine_features().
456 *(int *)pc = 0; // patch instruction to 0 to indicate that it causes a SIGILL,
457 // flushing of icache is not necessary.
458 stub = pc + 4; // continue with next instruction.
459 }
460 else if (sig == SIGBUS && thread->doing_unsafe_access()) {
461 address next_pc = pc + 4;
462 next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
463 os::Linux::ucontext_set_pc(uc, pc + 4);
464 return true;
465 }
466 }
467
468 // Check to see if we caught the safepoint code in the
469 // process of write protecting the memory serialization page.
470 // It write enables the page immediately after protecting it
471 // so we can just return to retry the write.
472 if ((sig == SIGSEGV) &&
473 // Si_addr may not be valid due to a bug in the linux-ppc64 kernel (see comment above).
474 // Use is_memory_serialization instead of si_addr.
475 ((NativeInstruction*)pc)->is_memory_serialization(thread, ucVoid)) {
476 // Synchronization problem in the pseudo memory barrier code (bug id 6546278)
477 // Block current thread until the memory serialize page permission restored.
478 os::block_on_serialize_page_trap();
479 return true;
480 }
|