Handle nested signals

This allows for signals to be raised inside the ART signal handler.
This can occur when the JavaStackTraceHandler attempts to generate
a stack trace and something goes wrong.

It also fixes an issue where the fault manager was not being
correctly shut down inside the signal chaining code.  In this
case the signal handler was not restored to the original.

Bug: 17006816
Bug: 17133266

(cherry picked from commit fabe91e0d558936ac26b98d2b4ee1af08f58831d)

Change-Id: I10730ef52d5d8d34610a5293253b3be6caf4829e
diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S
index a21d672..337e5fe 100644
--- a/runtime/arch/x86/quick_entrypoints_x86.S
+++ b/runtime/arch/x86/quick_entrypoints_x86.S
@@ -1369,5 +1369,18 @@
     ret
 END_FUNCTION art_quick_string_compareto
 
+// Return from a nested signal:
+// Entry:
+//  eax: address of jmp_buf in TLS
+
+DEFINE_FUNCTION art_nested_signal_return
+    SETUP_GOT_NOSAVE                // sets %ebx for call into PLT
+    movl LITERAL(1), %ecx
+    pushl %ecx                      // second arg to longjmp (1)
+    pushl %eax                      // first arg to longjmp (jmp_buf)
+    call PLT_SYMBOL(longjmp)
+    int3                            // won't get here.
+END_FUNCTION art_nested_signal_return
+
     // TODO: implement these!
 UNIMPLEMENTED art_quick_memcmp16