Andreas Wacknitz
2024-01-27 9a6458b68a833ac3c968ac953949a8dc833c2b77
commit | author | age
d57137 1 --- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp    Thu Nov 12 10:50:44 2020
NP 2 +++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp    Thu Nov 12 10:57:39 2020
3 @@ -354,61 +354,9 @@
4    return result;
5  }
6  
7 -extern "C" JNIEXPORT int
8 -JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
9 -                          int abort_if_unrecognized) {
10 -  ucontext_t* uc = (ucontext_t*) ucVoid;
11 +bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
12 +                                             ucontext_t* uc, JavaThread* thread) {
13  
14 -#ifndef AMD64
15 -  if (sig == SIGILL && info->si_addr == (caddr_t)sse_check) {
16 -    // the SSE instruction faulted. supports_sse() need return false.
17 -    uc->uc_mcontext.gregs[EIP] = (greg_t)sse_unavailable;
18 -    return true;
19 -  }
20 -#endif // !AMD64
21 -
22 -  Thread* t = Thread::current_or_null_safe();
23 -
24 -  // If crash protection is installed we may longjmp away and no destructors
25 -  // for objects in this scope will be run.
26 -  // So don't use any RAII utilities before crash protection is checked.
27 -  os::ThreadCrashProtection::check_crash_protection(sig, t);
28 -
29 -  if(sig == SIGPIPE || sig == SIGXFSZ) {
30 -    if (PosixSignals::chained_handler(sig, info, ucVoid)) {
31 -      return true;
32 -    } else {
33 -      // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
34 -      return true;
35 -    }
36 -  }
37 -
38 -  JavaThread* thread = NULL;
39 -  VMThread* vmthread = NULL;
40 -
41 -  if (PosixSignals::are_signal_handlers_installed()) {
42 -    if (t != NULL ){
43 -      if(t->is_Java_thread()) {
44 -        thread = (JavaThread*)t;
45 -      }
46 -      else if(t->is_VM_thread()){
47 -        vmthread = (VMThread *)t;
48 -      }
49 -    }
50 -  }
51 -
52 -  if (sig == ASYNC_SIGNAL) {
53 -    if(thread || vmthread){
54 -      return true;
55 -    } else if (PosixSignals::chained_handler(sig, info, ucVoid)) {
56 -      return true;
57 -    } else {
58 -      // If ASYNC_SIGNAL not chained, and this is a non-vm and
59 -      // non-java thread
60 -      return true;
61 -    }
62 -  }
63 -
64    if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
65      // can't decode this kind of signal
66      info = NULL;
9a6458 67 @@ -611,52 +559,6 @@
d57137 68      return true;
NP 69    }
70  
71 -  // signal-chaining
72 -  if (PosixSignals::chained_handler(sig, info, ucVoid)) {
73 -    return true;
74 -  }
75 -
76 -  if (!abort_if_unrecognized) {
77 -    // caller wants another chance, so give it to him
78 -    return false;
79 -  }
80 -
81 -  /*
82 -   * FIXME: libjsig_is_loaded has been moved to PosixSignals but is
83 -   * not visible. But what does this code do anyway? I can find no
84 -   * analogues to this code in any other os_cpu files
85 -   *
86 -  if (!PosixSignals::libjsig_is_loaded) {
87 -    struct sigaction oldAct;
88 -    sigaction(sig, (struct sigaction *)0, &oldAct);
89 -    if (oldAct.sa_sigaction != signalHandler) {
90 -      void* sighand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*,  oldAct.sa_sigaction)
91 -                                          : CAST_FROM_FN_PTR(void*, oldAct.sa_handler);
92 -      warning("Unexpected Signal %d occurred under user-defined signal handler %#lx", sig, (long)sighand);
93 -    }
94 -  }
95 -  */
96 -
97 -  if (pc == NULL && uc != NULL) {
98 -    pc = (address) uc->uc_mcontext.gregs[REG_PC];
99 -  }
100 -
101 -  // unmask current signal
102 -  sigset_t newset;
103 -  sigemptyset(&newset);
104 -  sigaddset(&newset, sig);
105 -  sigprocmask(SIG_UNBLOCK, &newset, NULL);
106 -
107 -  // Determine which sort of error to throw.  Out of swap may signal
108 -  // on the thread stack, which could get a mapping error when touched.
109 -  address addr = (address) info->si_addr;
110 -  if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) {
111 -    vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack.");
112 -  }
113 -
114 -  VMError::report_and_die(t, sig, pc, info, ucVoid);
115 -
116 -  ShouldNotReachHere();
117    return false;
118  }
119