summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asmrun/alpha.asm2
-rw-r--r--asmrun/fail.c4
-rw-r--r--asmrun/hppa.asm3
-rw-r--r--asmrun/mips.asm2
-rw-r--r--asmrun/power.asm3
5 files changed, 14 insertions, 0 deletions
diff --git a/asmrun/alpha.asm b/asmrun/alpha.asm
index 274d27717..5cec8a868 100644
--- a/asmrun/alpha.asm
+++ b/asmrun/alpha.asm
@@ -195,6 +195,8 @@ $103: ldgp $gp, 0($27)
stq $24, caml_bottom_of_stack
/* Save current allocation pointer for debugging purposes */
stq $13, young_ptr
+ /* Save trap pointer in case an exception is raised (e.g. sighandler) */
+ stq $15, caml_exception_pointer
/* Save all regs used by the code generator in the arrays
/* gc_entry_regs and gc_entry_float_regs. */
SAVE_ALL_REGS
diff --git a/asmrun/fail.c b/asmrun/fail.c
index 4173daf29..f975fc5c7 100644
--- a/asmrun/fail.c
+++ b/asmrun/fail.c
@@ -13,6 +13,7 @@
/* Raising exceptions from C. */
+#include <signal.h>
#include "alloc.h"
#include "fail.h"
#include "gc.h"
@@ -40,7 +41,10 @@ extern char * caml_exception_pointer;
void mlraise(v)
value v;
{
+ sigset_t mask;
leave_blocking_section();
+ sigemptyset(&mask);
+ sigprocmask(SIG_SETMASK, &mask, NULL);
#ifndef Stack_grows_upwards
while (local_roots != NULL &&
(char *) local_roots < caml_exception_pointer) {
diff --git a/asmrun/hppa.asm b/asmrun/hppa.asm
index 16f1f1733..e91444132 100644
--- a/asmrun/hppa.asm
+++ b/asmrun/hppa.asm
@@ -50,6 +50,9 @@ _caml_call_gc:
; Record return address
ldil L`_caml_last_return_address, %r1
stw %r2, R`_caml_last_return_address(%r1)
+; Save the exception handler (if e.g. a sighandler raises)
+ ldil L`_caml_exception_pointer, %r1
+ stw %r5, R`_caml_exception_pointer(%r1)
; Save all regs used by the code generator
ldil L`_gc_entry_regs, %r1
ldo R`_gc_entry_regs(%r1), %r1
diff --git a/asmrun/mips.asm b/asmrun/mips.asm
index 272eea901..755305371 100644
--- a/asmrun/mips.asm
+++ b/asmrun/mips.asm
@@ -78,6 +78,8 @@ caml_call_gc:
sw $25, 16($sp)
/* Save current allocation pointer for debugging purposes */
sw $22, young_ptr
+ /* Save the exception handler (if e.g. a sighandler raises) */
+ sw $30, caml_exception_pointer
/* Save all regs used by the code generator in the arrays
/* gc_entry_regs and gc_entry_float_regs. */
SAVE(2)
diff --git a/asmrun/power.asm b/asmrun/power.asm
index e456e6b81..76947cf9f 100644
--- a/asmrun/power.asm
+++ b/asmrun/power.asm
@@ -41,6 +41,9 @@
# Save current allocation pointer for debugging purposes
lwz 28, L..young_ptr(2)
stw 31, 0(28)
+ # Save exception pointer (if e.g. a sighandler raises)
+ lwz 28, L..caml_exception_pointer(2)
+ stw 29, 0(28)
# Save all registers used by the code generator
lwz 28, L..gc_entry_regs(2)
addic 28, 28, -4