summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>1999-11-15 20:04:30 +0000
committerDamien Doligez <damien.doligez-inria.fr>1999-11-15 20:04:30 +0000
commit7afdd2ae849a093effe543307e17a0cda69826db (patch)
treec91b9b675e326aea9b1fca22255465539ac3f834
parentf6795073f788e8d4c9c7ae1a0ad78a950d247142 (diff)
MAJ du portage Rhapsody pour MacOS XS
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2529 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmrun/power-rhapsody.S2
-rw-r--r--asmrun/signals.c40
-rwxr-xr-xconfigure5
3 files changed, 39 insertions, 8 deletions
diff --git a/asmrun/power-rhapsody.S b/asmrun/power-rhapsody.S
index fc2794443..7a0c5715f 100644
--- a/asmrun/power-rhapsody.S
+++ b/asmrun/power-rhapsody.S
@@ -369,7 +369,7 @@ L104:
/* Update caml_exception_pointer */
Storeglobal r29, _caml_exception_pointer, r11
/* Encode exception bucket as an exception result and return it */
- ori 3, 3, 2
+ ori r3, r3, 2
b L106
/* Callback from C to Caml */
diff --git a/asmrun/signals.c b/asmrun/signals.c
index ba7d96a56..990fb6664 100644
--- a/asmrun/signals.c
+++ b/asmrun/signals.c
@@ -30,6 +30,13 @@
#include "stack.h"
#include "sys.h"
+#if defined(TARGET_power) && defined(SYS_rhapsody)
+/* Confer machdep/ppc/unix_signal.c and mach/ppc/thread_status.h
+ in the Darwin sources */
+#define CONTEXT_GPR(ctx, regno) \
+ (((unsigned long *)((ctx)->sc_regs))[2 + (regno)])
+#endif
+
volatile int async_signal_mode = 0;
volatile int pending_signal = 0;
volatile int force_major_slice = 0;
@@ -125,6 +132,8 @@ void handle_signal(int sig, int code, struct sigcontext * context)
void handle_signal(int sig, int code, struct sigcontext * context)
#elif defined(TARGET_power) && defined(SYS_elf)
void handle_signal(int sig, struct pt_regs * context)
+#elif defined(TARGET_power) && defined(SYS_rhapsody)
+void handle_signal(int sig, int code, struct sigcontext * context)
#else
void handle_signal(int sig)
#endif
@@ -164,6 +173,10 @@ void handle_signal(int sig)
/* Cached in register 30 */
context->gpr[30] = (unsigned long) young_limit;
#endif
+#if defined(TARGET_power) && defined(SYS_rhapsody)
+ /* Cached in register 30 */
+ CONTEXT_GPR(context, 30) = (unsigned long) young_limit;
+#endif
}
}
}
@@ -251,7 +264,6 @@ int convert_signal_number(int signo)
#endif
value install_signal_handler(value signal_number, value action) /* ML */
-
{
int sig;
void (*act)(int signo), (*oldact)(int signo);
@@ -316,6 +328,11 @@ static void trap_handler(int sig, int code,
fprintf(stderr, "Fatal error: illegal instruction, code 0x%x\n", code);
exit(100);
}
+ /* Unblock SIGILL */
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGILL);
+ sigprocmask(SIG_UNBLOCK, &mask, NULL);
/* Recover young_ptr and caml_exception_pointer from the %l5 and %l6 regs */
sp = (int *) context->sc_sp;
caml_exception_pointer = (char *) sp[5];
@@ -372,6 +389,21 @@ static void trap_handler(int sig, struct pt_regs * context)
}
#endif
+#if defined(TARGET_power) && defined(SYS_rhapsody)
+static void trap_handler(int sig, int code, struct sigcontext * context)
+{
+ /* Unblock SIGTRAP */
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGTRAP);
+ sigprocmask(SIG_UNBLOCK, &mask, NULL);
+ /* Recover young_ptr and caml_exception_pointer from registers 31 and 29 */
+ caml_exception_pointer = (char *) CONTEXT_GPR(context, 29);
+ young_ptr = (char *) CONTEXT_GPR(context, 31);
+ array_bound_error();
+}
+#endif
+
/* Initialization of signal stuff */
void init_signals(void)
@@ -388,14 +420,18 @@ void init_signals(void)
struct sigaction act;
act.sa_sigaction = trap_handler;
sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO;
+ act.sa_flags = SA_SIGINFO | SA_NODEFER;
sigaction(SIGILL, &act, NULL);
#endif
#if defined(TARGET_power)
struct sigaction act;
act.sa_handler = (void (*)(int)) trap_handler;
sigemptyset(&act.sa_mask);
+#if defined(SYS_rhapsody)
act.sa_flags = 0;
+#else
+ act.sa_flags = SA_NODEFER:;
+#endif
sigaction(SIGTRAP, &act, NULL);
#endif
}
diff --git a/configure b/configure
index 6a859741d..ecca7fc75 100755
--- a/configure
+++ b/configure
@@ -414,11 +414,6 @@ fi
if sh ./hasgot sigaction sigprocmask; then
echo "POSIX signal handling found."
- case $host in
- *-*-rhapsody*) echo "But it doesn't work properly."
- echo "#define BSD_SIGNALS" >> s.h;;
- *) echo "#define POSIX_SIGNALS" >> s.h;;
- esac
else
if sh ./runtest signals.c; then
echo "Signals have the BSD semantics."