Skip to contentSkip to conversation

signal handling

PATCH New Vivien Chappelier 1 participant 1 message Jan 13, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 signal handling

Hello,

This patch fixes various bugs in the 2.5 signal code (native and
mips64 32bit compatibility code):
- revert changes to ucontext.h to match the arguments of
setup_sigcontext and restore_sigcontext (which need a sigcontext struct, not mcontext struct)
- fix swapped arguments in the call to do_signal in
do_notify_resume
- cleanup and fix 32 bit compatibility code for mips64,
including making sigset_t32 and sigset_t size match.

Vivien.

asm-mips/ucontext.h +5 -26
@@ -10,33 +10,12 @@
 #ifndef _ASM_UCONTEXT_H
 #define _ASM_UCONTEXT_H
 
-typedef unsigned int greg_t;
-
-#define NGREG 36
-
-typedef greg_t gregset_t[NGREG];
-
-typedef struct fpregset {
-	union {
-		double		fp_dregs[16];
-		float		fp_fregs [32];
-		unsigned int	fp_regs[32];
-	} fp_r;
-	unsigned int fp_csr;
-	unsigned int fp_pad;
-} fpregset_t;
-
-typedef struct {
-	gregset_t gregs;
-	fpregset_t fpregs;
-} mcontext_t;
-
 struct ucontext {
-	unsigned long	uc_flags;
-	struct ucontext	*uc_link;
-	stack_t		uc_stack;
-	mcontext_t	uc_mcontext;
-	sigset_t	uc_sigmask;	/* mask last for extensibility */
+	unsigned long	  uc_flags;
+	struct ucontext  *uc_link;
+	stack_t		  uc_stack;
+	struct sigcontext uc_mcontext;
+	sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
 #endif /* _ASM_UCONTEXT_H */
asm-mips64/ucontext.h +5 -26
@@ -10,33 +10,12 @@
 #ifndef _ASM_UCONTEXT_H
 #define _ASM_UCONTEXT_H
 
-typedef unsigned int greg_t;
-
-#define NGREG 36
-
-typedef greg_t gregset_t[NGREG];
-
-typedef struct fpregset {
-	union {
-		double		fp_dregs[32];
-		float		fp_fregs [32];
-		unsigned long	fp_regs[32];
-	} fp_r;
-	unsigned int fp_csr;
-	unsigned int fp_pad;
-} fpregset_t;
-
-typedef struct {
-	gregset_t gregs;
-	fpregset_t fpregs;
-} mcontext_t;
-
 struct ucontext {
-	unsigned long	uc_flags;
-	struct ucontext	*uc_link;
-	stack_t		uc_stack;
-	mcontext_t	uc_mcontext;
-	sigset_t	uc_sigmask;	/* mask last for extensibility */
+	unsigned long	  uc_flags;
+	struct ucontext  *uc_link;
+	stack_t		  uc_stack;
+	struct sigcontext uc_mcontext;
+	sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
 #endif /* _ASM_UCONTEXT_H */
asm-mips64/signal.h +26 -4
@@ -11,25 +11,47 @@
 
 #include <linux/types.h>
 
-#define _NSIG		64
+#define _NSIG		128
 #define _NSIG_BPW	64
 #define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
 
 typedef struct {
-	long sig[_NSIG_WORDS];
+	unsigned long sig[_NSIG_WORDS];
 } sigset_t;
 
+typedef unsigned long old_sigset_t;		/* at least 32 bits */
+
+#ifdef __KERNEL__
+
 #define _NSIG32		128
 #define _NSIG_BPW32	32
 #define _NSIG_WORDS32	(_NSIG32 / _NSIG_BPW32)
 
 typedef struct {
-	long sig[_NSIG_WORDS32];
+	unsigned int sig[_NSIG_WORDS32];
 } sigset_t32;
 
-typedef unsigned long old_sigset_t;		/* at least 32 bits */
 typedef unsigned int old_sigset_t32;
 
+typedef unsigned int __sighandler_t32;
+
+struct sigaction32 {
+	unsigned int		sa_flags;
+	__sighandler_t32	sa_handler;
+	sigset_t32		sa_mask;
+	unsigned int		sa_restorer;
+	unsigned int		sa_resv[1];     /* reserved */
+};
+
+/* IRIX compatible stack_t  */
+typedef struct sigaltstack32 {
+	unsigned int ss_sp;
+	__kernel_size_t32 ss_size;
+	int ss_flags;
+} stack32_t;
+
+#endif /* __KERNEL__ */
+
 #define SIGHUP		 1	/* Hangup (POSIX).  */
 #define SIGINT		 2	/* Interrupt (ANSI).  */
 #define SIGQUIT		 3	/* Quit (POSIX).  */
mips/kernel/signal.c +1 -1
@@ -580,6 +580,6 @@
 			return;
 		}
 #endif
-		do_signal(regs,oldset);
+		do_signal(oldset, regs);
 	}
 }
mips64/kernel/signal.c +1 -1
@@ -411,6 +411,6 @@
 			return;
 		}
 #endif
-		do_signal(regs,oldset);
+		do_signal(oldset, regs);
 	}
 }
mips64/kernel/signal32.c +9 -36

95 lines not on this page · raw message