< prev index next >
src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
Print this page
rev 7968 : 8074552: SafeFetch32 and SafeFetchN do not work in error handling
Summary: handle SafeFetch faults in secondary signal handlers
Reviewed-by: dholmes
Contributed-by: Thomas Stuefe
*** 307,316 ****
--- 307,320 ----
address os::Bsd::ucontext_get_pc(ucontext_t * uc) {
return (address)uc->context_pc;
}
+ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
+ uc->context_pc = (intptr_t)pc ;
+ }
+
intptr_t* os::Bsd::ucontext_get_sp(ucontext_t * uc) {
return (intptr_t*)uc->context_sp;
}
intptr_t* os::Bsd::ucontext_get_fp(ucontext_t * uc) {
*** 461,471 ****
//%note os_trap_1
if (info != NULL && uc != NULL && thread != NULL) {
pc = (address) os::Bsd::ucontext_get_pc(uc);
if (StubRoutines::is_safefetch_fault(pc)) {
! uc->context_pc = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
// Handle ALL stack overflow variations here
if (sig == SIGSEGV || sig == SIGBUS) {
--- 465,475 ----
//%note os_trap_1
if (info != NULL && uc != NULL && thread != NULL) {
pc = (address) os::Bsd::ucontext_get_pc(uc);
if (StubRoutines::is_safefetch_fault(pc)) {
! os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
// Handle ALL stack overflow variations here
if (sig == SIGSEGV || sig == SIGBUS) {
*** 701,711 ****
if (stub != NULL) {
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
! uc->context_pc = (intptr_t)stub;
return true;
}
// signal-chaining
if (os::Bsd::chained_handler(sig, info, ucVoid)) {
--- 705,715 ----
if (stub != NULL) {
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
! os::Bsd::ucontext_set_pc(uc, stub);
return true;
}
// signal-chaining
if (os::Bsd::chained_handler(sig, info, ucVoid)) {
< prev index next >