< prev index next >

src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp

Print this page
rev 7970 : 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

@@ -172,10 +172,14 @@
 // Assumes ucontext is valid
 ExtendedPC os::Solaris::ucontext_get_ExtendedPC(ucontext_t *uc) {
   return ExtendedPC((address)uc->uc_mcontext.gregs[REG_PC]);
 }
 
+void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) {
+  uc->uc_mcontext.gregs [REG_PC]  = (greg_t) pc;
+}
+
 // Assumes ucontext is valid
 intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
   return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
 }
 

@@ -409,11 +413,11 @@
   if (info != NULL && uc != NULL && thread != NULL) {
     // factor me: getPCfromContext
     pc = (address) uc->uc_mcontext.gregs[REG_PC];
 
     if (StubRoutines::is_safefetch_fault(pc)) {
-      uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
+      os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
       return true;
     }
 
     // Handle ALL stack overflow variations here
     if (sig == SIGSEGV && info->si_code == SEGV_ACCERR) {

@@ -612,12 +616,11 @@
     // save all thread context in case we need to restore it
 
     if (thread != NULL) thread->set_saved_exception_pc(pc);
     // 12/02/99: On Sparc it appears that the full context is also saved
     // but as yet, no one looks at or restores that saved context
-    // factor me: setPC
-    uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub;
+    os::Solaris::ucontext_set_pc(uc, stub);
     return true;
   }
 
   // signal-chaining
   if (os::Solaris::chained_handler(sig, info, ucVoid)) {
< prev index next >