aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-05-24 15:01:29 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-05-24 15:01:29 -0700
commitfe46f1eb45ac1ddc77c35824b13a1ed934aa2f0d (patch)
treee6078b160036bab34376a02d4591e832a4188863
parent9b8b4bd30dc7e82caccdb175203a2ce1c40d2d98 (diff)
downloadklibc-fe46f1eb45ac1ddc77c35824b13a1ed934aa2f0d.tar.gz
[klibc] sparc: deal with SA_RESTORER; sparc64 requires a restorer functionklibc-1.3.23
Fake out SA_RESTORER on sparc; sparc64 requires a restorer function, so make sure one is provided. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--usr/include/arch/sparc/klibc/archsignal.h3
-rw-r--r--usr/include/arch/sparc64/klibc/archconfig.h1
-rw-r--r--usr/include/arch/sparc64/klibc/archsignal.h3
-rw-r--r--usr/klibc/SYSCALLS.def1
-rw-r--r--usr/klibc/sigaction.c10
5 files changed, 16 insertions, 2 deletions
diff --git a/usr/include/arch/sparc/klibc/archsignal.h b/usr/include/arch/sparc/klibc/archsignal.h
index 0ff7aab684654..6e845a89f2ea6 100644
--- a/usr/include/arch/sparc/klibc/archsignal.h
+++ b/usr/include/arch/sparc/klibc/archsignal.h
@@ -18,4 +18,7 @@ struct sigaction {
sigset_t sa_mask;
};
+/* Not actually used by the kernel... */
+#define SA_RESTORER 0x80000000
+
#endif
diff --git a/usr/include/arch/sparc64/klibc/archconfig.h b/usr/include/arch/sparc64/klibc/archconfig.h
index 212f616830c2f..bb0c003ab2916 100644
--- a/usr/include/arch/sparc64/klibc/archconfig.h
+++ b/usr/include/arch/sparc64/klibc/archconfig.h
@@ -10,5 +10,6 @@
#define _KLIBC_ARCHCONFIG_H
#define _KLIBC_USE_RT_SIG 1 /* Use rt_* signals */
+#define _KLIBC_NEEDS_SA_RESTORER 1 /* Need a restorer function */
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/arch/sparc64/klibc/archsignal.h b/usr/include/arch/sparc64/klibc/archsignal.h
index 55f05500faa60..bb0a5ce9a535a 100644
--- a/usr/include/arch/sparc64/klibc/archsignal.h
+++ b/usr/include/arch/sparc64/klibc/archsignal.h
@@ -11,4 +11,7 @@
#define __WANT_POSIX1B_SIGNALS__
#include <asm/signal.h>
+/* Not actually used by the kernel... */
+#define SA_RESTORER 0x80000000
+
#endif
diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def
index 9ab685da72fee..435abd51e4669 100644
--- a/usr/klibc/SYSCALLS.def
+++ b/usr/klibc/SYSCALLS.def
@@ -186,6 +186,7 @@ int sync_file_range,fdatasync,fsync::sync_file_range(int, off_t, off_t, unsigned
int rt_sigsuspend::__rt_sigsuspend(const sigset_t *, size_t)
int rt_sigpending::__rt_sigpending(sigset_t *, size_t)
int rt_sigprocmask::__rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t)
+<sparc64> void rt_sigreturn::__sigreturn(void)
#else
int sigaction::__sigaction(int, const struct sigaction *, struct sigaction *)
int sigsuspend(const sigset_t *)
diff --git a/usr/klibc/sigaction.c b/usr/klibc/sigaction.c
index f0dbe21fbba86..658c3ad5854d1 100644
--- a/usr/klibc/sigaction.c
+++ b/usr/klibc/sigaction.c
@@ -10,7 +10,7 @@ __extern void __sigreturn(void);
__extern int __sigaction(int, const struct sigaction *, struct sigaction *);
#ifdef __sparc__
__extern int __rt_sigaction(int, const struct sigaction *, struct sigaction *,
- void *, size_t);
+ void (*)(void), size_t);
#else
__extern int __rt_sigaction(int, const struct sigaction *, struct sigaction *,
size_t);
@@ -36,7 +36,13 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
#if _KLIBC_USE_RT_SIG
# ifdef __sparc__
- rv = __rt_sigaction(sig, act, oact, NULL, sizeof(sigset_t));
+ {
+ void (*restorer)(void);
+ restorer = (act && act->sa_flags & SA_RESTORER)
+ ? (void (*)(void))((uintptr_t)act->sa_restorer - 8)
+ : NULL;
+ rv = __rt_sigaction(sig, act, oact, restorer, sizeof(sigset_t));
+ }
# else
rv = __rt_sigaction(sig, act, oact, sizeof(sigset_t));
# endif