aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common/sim-signal.c')
-rw-r--r--sim/common/sim-signal.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/sim/common/sim-signal.c b/sim/common/sim-signal.c
index 77709b1..e8fd10c 100644
--- a/sim/common/sim-signal.c
+++ b/sim/common/sim-signal.c
@@ -77,7 +77,7 @@ sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
break;
case SIM_SIGFPE:
-#ifdef SIGXCPU
+#ifdef SIGFPE
return SIGFPE;
#endif
break;
@@ -94,3 +94,42 @@ sim_signal_to_host (SIM_DESC sd, SIM_SIGNAL sig)
return 1;
#endif
}
+
+int
+sim_signal_to_target (SIM_DESC sd, SIM_SIGNAL sig)
+{
+ switch (sig)
+ {
+ case SIM_SIGINT :
+ return TARGET_SIGNAL_INT;
+
+ case SIM_SIGABRT :
+ return TARGET_SIGNAL_ABRT;
+
+ case SIM_SIGILL :
+ return TARGET_SIGNAL_ILL;
+
+ case SIM_SIGTRAP :
+ return TARGET_SIGNAL_TRAP;
+
+ case SIM_SIGBUS :
+ return TARGET_SIGNAL_BUS;
+
+ case SIM_SIGSEGV
+ return TARGET_SIGNAL_SEGV;
+
+ case SIM_SIGXCPU :
+ return TARGET_SIGNAL_XCPU;
+
+ case SIM_SIGFPE:
+ return TARGET_SIGNAL_FPE;
+ break;
+
+ case SIM_SIGNONE:
+ return TARGET_SIGNAL_0;
+ break;
+ }
+
+ sim_io_eprintf (sd, "sim_signal_to_host: unknown signal: %d\n", sig);
+ return TARGET_SIGNAL_HUP;
+}