  #include <stdio.h>
  #include <stdlib.h>
  
-@@ -71,6 +78,118 @@
+@@ -71,6 +78,119 @@
  
  #define mcp_same_size(dst_ptr, src_ptr, size) memcpy_s(dst_ptr, size, src_ptr, size)
  

     CEnclaveMngr *mngr = CEnclaveMngr::get_instance();
     CEnclaveSim *ce = mngr->get_enclave(epc_lin_addr);
 
@@ -232,6 +358,11 @@
         // xbx contains the address of a TCS
         tcs = reinterpret_cast<tcs_t*>(xbx);
 

+    // Invoke the registered signal handler.
+    {
+        std::lock_guard<std::mutex> lock(registered_signal_handlers_lock);
+        const auto it = registered_signal_handlers.find(signum);
+        if (it != registered_signal_handlers.end())
+        {
+            struct sigaction *act = it->second.get();
+            if ((!(act->sa_flags & SA_SIGINFO)) && act->sa_handler)
+            {
+                act->sa_handler(signum);
