summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/mips
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2006-11-04 19:44:00 +0000
committerEric Andersen <andersen@codepoet.org>2006-11-04 19:44:00 +0000
commit087ac4c88fb12c59cab81227a4f13e58b8302b8e (patch)
treeb3a5c6405ac13a8ae2ce62cac1204fd522afd558 /libc/sysdeps/linux/mips
parent2e09dbcacee815cef140612e0e27bfbc61eeed46 (diff)
mips64 patch from Atsushi Nemoto:
It seems these codes dropped when importing from glibc. This is required for mips64.
Diffstat (limited to 'libc/sysdeps/linux/mips')
-rw-r--r--libc/sysdeps/linux/mips/sigaction.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/mips/sigaction.c b/libc/sysdeps/linux/mips/sigaction.c
index e1eca78fe..f4b5167d6 100644
--- a/libc/sysdeps/linux/mips/sigaction.c
+++ b/libc/sysdeps/linux/mips/sigaction.c
@@ -33,6 +33,16 @@ extern __typeof(sigaction) __libc_sigaction;
libc_hidden_proto(memcpy)
+#if _MIPS_SIM != _ABIO32
+
+# ifdef __NR_rt_sigreturn
+static void restore_rt (void) asm ("__restore_rt");
+# endif
+# ifdef __NR_sigreturn
+static void restore (void) asm ("__restore");
+# endif
+#endif
+
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
@@ -119,3 +129,31 @@ libc_hidden_proto(sigaction)
weak_alias(__libc_sigaction,sigaction)
libc_hidden_weak(sigaction)
#endif
+
+/* NOTE: Please think twice before making any changes to the bits of
+ code below. GDB needs some intimate knowledge about it to
+ recognize them as signal trampolines, and make backtraces through
+ signal handlers work right. Important are both the names
+ (__restore_rt) and the exact instruction sequence.
+ If you ever feel the need to make any changes, please notify the
+ appropriate GDB maintainer. */
+
+#define RESTORE(name, syscall) RESTORE2 (name, syscall)
+#define RESTORE2(name, syscall) \
+asm \
+ ( \
+ ".align 4\n" \
+ "__" #name ":\n" \
+ " li $2, " #syscall "\n" \
+ " syscall\n" \
+ );
+
+/* The return code for realtime-signals. */
+#if _MIPS_SIM != _ABIO32
+# ifdef __NR_rt_sigreturn
+RESTORE (restore_rt, __NR_rt_sigreturn)
+# endif
+# ifdef __NR_sigreturn
+RESTORE (restore, __NR_sigreturn)
+# endif
+#endif