Skip to contentSkip to conversation

Cleanup signal code initialization

PATCH New Ralf Baechle 1 participant 1 message Nov 24, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Cleanup signal code initialization

---
Looking at the COP2 handling in traps.c I was reminded of the other uglyness in there. This is once patch to clean it up.

 arch/mips/include/asm/fpu.h |    8 ----
 arch/mips/kernel/signal.c   |   46 ++++++++++++++++++++++++++
 arch/mips/kernel/signal32.c |   24 +++++++++++++
 arch/mips/kernel/traps.c    |   76 -------------------------------------------
 4 files changed, 70 insertions(+), 84 deletions(-)
arch/mips/include/asm/fpu.h +0 -8
index 8a3ef24..7fcef8e 100644
@@ -28,15 +28,7 @@
 struct sigcontext;
 struct sigcontext32;
 
-extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
-extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
-
-extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
-extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
-
 extern void fpu_emulator_init_fpu(void);
-extern int fpu_emulator_save_context(struct sigcontext __user *sc);
-extern int fpu_emulator_restore_context(struct sigcontext __user *sc);
 extern void _init_fpu(void);
 extern void _save_fp(struct task_struct *);
 extern void _restore_fp(struct task_struct *);
arch/mips/kernel/signal.c +46 -0

55 lines not on this page · raw message

arch/mips/kernel/signal32.c +24 -0
index 2e74075..03abaf0 100644
@@ -35,6 +35,15 @@
 
 #include "signal-common.h"
 
+static int (*save_fp_context32)(struct sigcontext32 __user *sc);
+static int (*restore_fp_context32)(struct sigcontext32 __user *sc);
+
+extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc);
+extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc);
+
+extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 __user *sc);
+extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user *sc);
+
 /*
  * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
  */
@@ -828,3 +837,18 @@ SYSCALL_DEFINE5(32_waitid, int, which, compat_pid_t, pid,
 	info.si_code |= __SI_CHLD;
 	return copy_siginfo_to_user32(uinfo, &info);
 }
+
+static int signal32_init(void)
+{
+	if (cpu_has_fpu) {
+		save_fp_context32 = _save_fp_context32;
+		restore_fp_context32 = _restore_fp_context32;
+	} else {
+		save_fp_context32 = fpu_emulator_save_context32;
+		restore_fp_context32 = fpu_emulator_restore_context32;
+	}
+
+	return 0;
+}
+
+arch_initcall(signal32_init);
arch/mips/kernel/traps.c +0 -76

88 lines not on this page · raw message