Mercurial > hg > graal-jvmci-8
comparison src/os_cpu/linux_x86/vm/os_linux_x86.cpp @ 11173:6b0fd0964b87
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 31 Jul 2013 11:00:54 +0200 |
parents | 836a62f43af9 af21010d1062 |
children | cefad50507d8 |
comparison
equal
deleted
inserted
replaced
10912:4ea54634f03e | 11173:6b0fd0964b87 |
---|---|
207 // From IA32 System Programming Guide | 207 // From IA32 System Programming Guide |
208 enum { | 208 enum { |
209 trap_page_fault = 0xE | 209 trap_page_fault = 0xE |
210 }; | 210 }; |
211 | 211 |
212 extern "C" void Fetch32PFI () ; | |
213 extern "C" void Fetch32Resume () ; | |
214 #ifdef AMD64 | |
215 extern "C" void FetchNPFI () ; | |
216 extern "C" void FetchNResume () ; | |
217 #endif // AMD64 | |
218 | |
219 extern "C" JNIEXPORT int | 212 extern "C" JNIEXPORT int |
220 JVM_handle_linux_signal(int sig, | 213 JVM_handle_linux_signal(int sig, |
221 siginfo_t* info, | 214 siginfo_t* info, |
222 void* ucVoid, | 215 void* ucVoid, |
223 int abort_if_unrecognized) { | 216 int abort_if_unrecognized) { |
224 ucontext_t* uc = (ucontext_t*) ucVoid; | 217 ucontext_t* uc = (ucontext_t*) ucVoid; |
225 | 218 |
226 Thread* t = ThreadLocalStorage::get_thread_slow(); | 219 Thread* t = ThreadLocalStorage::get_thread_slow(); |
220 | |
221 // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away | |
222 // (no destructors can be run) | |
223 os::WatcherThreadCrashProtection::check_crash_protection(sig, t); | |
227 | 224 |
228 SignalHandlerMark shm(t); | 225 SignalHandlerMark shm(t); |
229 | 226 |
230 // Note: it's not uncommon that JNI code uses signal/sigset to install | 227 // Note: it's not uncommon that JNI code uses signal/sigset to install |
231 // then restore certain signal handler (e.g. to temporarily block SIGPIPE, | 228 // then restore certain signal handler (e.g. to temporarily block SIGPIPE, |
276 | 273 |
277 //%note os_trap_1 | 274 //%note os_trap_1 |
278 if (info != NULL && uc != NULL && thread != NULL) { | 275 if (info != NULL && uc != NULL && thread != NULL) { |
279 pc = (address) os::Linux::ucontext_get_pc(uc); | 276 pc = (address) os::Linux::ucontext_get_pc(uc); |
280 | 277 |
281 if (pc == (address) Fetch32PFI) { | 278 if (StubRoutines::is_safefetch_fault(pc)) { |
282 uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; | 279 uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc)); |
283 return 1 ; | 280 return 1; |
284 } | 281 } |
285 #ifdef AMD64 | 282 |
286 if (pc == (address) FetchNPFI) { | 283 #ifndef AMD64 |
287 uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; | 284 // Halt if SI_KERNEL before more crashes get misdiagnosed as Java bugs |
288 return 1 ; | 285 // This can happen in any running code (currently more frequently in |
286 // interpreter code but has been seen in compiled code) | |
287 if (sig == SIGSEGV && info->si_addr == 0 && info->si_code == SI_KERNEL) { | |
288 fatal("An irrecoverable SI_KERNEL SIGSEGV has occurred due " | |
289 "to unstable signal handling in this distribution."); | |
289 } | 290 } |
290 #endif // AMD64 | 291 #endif // AMD64 |
291 | 292 |
292 // Handle ALL stack overflow variations here | 293 // Handle ALL stack overflow variations here |
293 if (sig == SIGSEGV) { | 294 if (sig == SIGSEGV) { |