249 // Catching SIGBUS here prevents the implicit SIGBUS null check below from
250 // being called, so only do so if the implicit null check is not necessary.
251 } else if (sig == SIGBUS && !MacroAssembler::uses_implicit_null_check(info->si_addr)) {
252 #else
253 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
254 #endif
255 // BugId 4454115: A read from a MappedByteBuffer can fault
256 // here if the underlying file has been truncated.
257 // Do not crash the VM in such a case.
258 CodeBlob* cb = CodeCache::find_blob(pc);
259 nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
260 bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
261 if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
262 address next_pc = pc + NativeCall::instruction_size;
263 if (is_unsafe_memory_access) {
264 next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
265 }
266 stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
267 }
268 } else if (sig == SIGILL && nativeInstruction_at(pc)->is_stop()) {
269 // Pull a pointer to the error message out of the instruction
270 // stream.
271 const uint64_t *detail_msg_ptr
272 = (uint64_t*)(pc + NativeInstruction::instruction_size);
273 const char *detail_msg = (const char *)*detail_msg_ptr;
274 const char *msg = "stop";
275 if (TraceTraps) {
276 tty->print_cr("trap: %s: (SIGILL)", msg);
277 }
278
279 // End life with a fatal error, message and detail message and the context.
280 // Note: no need to do any post-processing here (e.g. signal chaining)
281 VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
282 ShouldNotReachHere();
283
284 } else if (sig == SIGFPE &&
285 (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
286 stub =
287 SharedRuntime::
288 continuation_for_implicit_exception(thread,
289 pc,
290 SharedRuntime::
291 IMPLICIT_DIVIDE_BY_ZERO);
292 } else if ((sig == SIGSEGV || sig == SIGBUS) &&
293 MacroAssembler::uses_implicit_null_check(info->si_addr)) {
|
249 // Catching SIGBUS here prevents the implicit SIGBUS null check below from
250 // being called, so only do so if the implicit null check is not necessary.
251 } else if (sig == SIGBUS && !MacroAssembler::uses_implicit_null_check(info->si_addr)) {
252 #else
253 } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) {
254 #endif
255 // BugId 4454115: A read from a MappedByteBuffer can fault
256 // here if the underlying file has been truncated.
257 // Do not crash the VM in such a case.
258 CodeBlob* cb = CodeCache::find_blob(pc);
259 nmethod* nm = (cb != nullptr) ? cb->as_nmethod_or_null() : nullptr;
260 bool is_unsafe_memory_access = (thread->doing_unsafe_access() && UnsafeMemoryAccess::contains_pc(pc));
261 if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_memory_access) {
262 address next_pc = pc + NativeCall::instruction_size;
263 if (is_unsafe_memory_access) {
264 next_pc = UnsafeMemoryAccess::page_error_continue_pc(pc);
265 }
266 stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
267 }
268 } else if (sig == SIGILL && nativeInstruction_at(pc)->is_stop()) {
269 // A pointer to the message will have been placed in x0
270 const char *detail_msg = (const char *)(uc->uc_mcontext->DU3_PREFIX(ss,x[0]));
271 const char *msg = "stop";
272 if (TraceTraps) {
273 tty->print_cr("trap: %s: (SIGILL)", msg);
274 }
275
276 // End life with a fatal error, message and detail message and the context.
277 // Note: no need to do any post-processing here (e.g. signal chaining)
278 VMError::report_and_die(thread, uc, nullptr, 0, msg, "%s", detail_msg);
279 ShouldNotReachHere();
280
281 } else if (sig == SIGFPE &&
282 (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) {
283 stub =
284 SharedRuntime::
285 continuation_for_implicit_exception(thread,
286 pc,
287 SharedRuntime::
288 IMPLICIT_DIVIDE_BY_ZERO);
289 } else if ((sig == SIGSEGV || sig == SIGBUS) &&
290 MacroAssembler::uses_implicit_null_check(info->si_addr)) {
|