< prev index next >
src/os_cpu/solaris_sparc/vm/os_solaris_sparc.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
@@ -182,10 +182,15 @@
address pc = (address)uc->uc_mcontext.gregs[REG_PC];
// set npc to zero to avoid using it for safepoint, good for profiling only
return ExtendedPC(pc);
}
+void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) {
+ uc->uc_mcontext.gregs [REG_PC] = (greg_t) pc;
+ uc->uc_mcontext.gregs [REG_nPC] = (greg_t) (pc + 4);
+}
+
// Assumes ucontext is valid
intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
return (intptr_t*)((intptr_t)uc->uc_mcontext.gregs[REG_SP] + STACK_BIAS);
}
@@ -353,12 +358,11 @@
pc = (address) uc->uc_mcontext.gregs[REG_PC];
npc = (address) uc->uc_mcontext.gregs[REG_nPC];
// SafeFetch() support
if (StubRoutines::is_safefetch_fault(pc)) {
- uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
- uc->uc_mcontext.gregs[REG_nPC] = uc->uc_mcontext.gregs[REG_PC] + 4;
+ os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return 1;
}
// Handle ALL stack overflow variations here
if (sig == SIGSEGV && info->si_code == SEGV_ACCERR) {
@@ -492,12 +496,11 @@
thread->set_saved_exception_pc(pc);
thread->set_saved_exception_npc(npc);
// simulate a branch to the stub (a "call" in the safepoint stub case)
// factor me: setPC
- uc->uc_mcontext.gregs[REG_PC ] = (greg_t)stub;
- uc->uc_mcontext.gregs[REG_nPC] = (greg_t)(stub + 4);
+ os::Solaris::ucontext_set_pc(uc, stub);
#ifndef PRODUCT
if (TraceJumps) thread->record_jump(stub, NULL, __FILE__, __LINE__);
#endif /* PRODUCT */
< prev index next >