aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-10-07 16:55:48 -0400
committerRichard Weinberger <richard@sigma-star.at>2014-08-06 07:02:15 -0400
commit0d97500d393012690f3579056629bea0369e6554 (patch)
tree9b2cf97628733296699a8638712a483cdc101e6c /arch/m68k
parent0f5bef660a7c3b030eb60ceb29e3b2d89f894f56 (diff)
m68k: Use get_signal() signal_setup_done()
Use the more generic functions get_signal() signal_setup_done() for signal delivery. Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/kernel/signal.c63
1 files changed, 24 insertions, 39 deletions
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 57fd286e4b0b..c8e6fa865996 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -850,23 +850,23 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
850 return (void __user *)((usp - frame_size) & -8UL); 850 return (void __user *)((usp - frame_size) & -8UL);
851} 851}
852 852
853static int setup_frame (int sig, struct k_sigaction *ka, 853static int setup_frame(struct ksignal *ksig, sigset_t *set,
854 sigset_t *set, struct pt_regs *regs) 854 struct pt_regs *regs)
855{ 855{
856 struct sigframe __user *frame; 856 struct sigframe __user *frame;
857 int fsize = frame_extra_sizes(regs->format); 857 int fsize = frame_extra_sizes(regs->format);
858 struct sigcontext context; 858 struct sigcontext context;
859 int err = 0; 859 int err = 0, sig = ksig->sig;
860 860
861 if (fsize < 0) { 861 if (fsize < 0) {
862#ifdef DEBUG 862#ifdef DEBUG
863 printk ("setup_frame: Unknown frame format %#x\n", 863 printk ("setup_frame: Unknown frame format %#x\n",
864 regs->format); 864 regs->format);
865#endif 865#endif
866 goto give_sigsegv; 866 return -EFAULT;
867 } 867 }
868 868
869 frame = get_sigframe(ka, regs, sizeof(*frame) + fsize); 869 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame) + fsize);
870 870
871 if (fsize) 871 if (fsize)
872 err |= copy_to_user (frame + 1, regs + 1, fsize); 872 err |= copy_to_user (frame + 1, regs + 1, fsize);
@@ -899,7 +899,7 @@ static int setup_frame (int sig, struct k_sigaction *ka,
899#endif 899#endif
900 900
901 if (err) 901 if (err)
902 goto give_sigsegv; 902 return -EFAULT;
903 903
904 push_cache ((unsigned long) &frame->retcode); 904 push_cache ((unsigned long) &frame->retcode);
905 905
@@ -908,7 +908,7 @@ static int setup_frame (int sig, struct k_sigaction *ka,
908 * to destroy is successfully copied to sigframe. 908 * to destroy is successfully copied to sigframe.
909 */ 909 */
910 wrusp ((unsigned long) frame); 910 wrusp ((unsigned long) frame);
911 regs->pc = (unsigned long) ka->sa.sa_handler; 911 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
912 adjustformat(regs); 912 adjustformat(regs);
913 913
914 /* 914 /*
@@ -934,28 +934,24 @@ static int setup_frame (int sig, struct k_sigaction *ka,
934 tregs->sr = regs->sr; 934 tregs->sr = regs->sr;
935 } 935 }
936 return 0; 936 return 0;
937
938give_sigsegv:
939 force_sigsegv(sig, current);
940 return err;
941} 937}
942 938
943static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, 939static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
944 sigset_t *set, struct pt_regs *regs) 940 struct pt_regs *regs)
945{ 941{
946 struct rt_sigframe __user *frame; 942 struct rt_sigframe __user *frame;
947 int fsize = frame_extra_sizes(regs->format); 943 int fsize = frame_extra_sizes(regs->format);
948 int err = 0; 944 int err = 0, sig = ksig->sig;
949 945
950 if (fsize < 0) { 946 if (fsize < 0) {
951#ifdef DEBUG 947#ifdef DEBUG
952 printk ("setup_frame: Unknown frame format %#x\n", 948 printk ("setup_frame: Unknown frame format %#x\n",
953 regs->format); 949 regs->format);
954#endif 950#endif
955 goto give_sigsegv; 951 return -EFAULT;
956 } 952 }
957 953
958 frame = get_sigframe(ka, regs, sizeof(*frame)); 954 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
959 955
960 if (fsize) 956 if (fsize)
961 err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize); 957 err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);
@@ -968,7 +964,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
968 &frame->sig); 964 &frame->sig);
969 err |= __put_user(&frame->info, &frame->pinfo); 965 err |= __put_user(&frame->info, &frame->pinfo);
970 err |= __put_user(&frame->uc, &frame->puc); 966 err |= __put_user(&frame->uc, &frame->puc);
971 err |= copy_siginfo_to_user(&frame->info, info); 967 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
972 968
973 /* Create the ucontext. */ 969 /* Create the ucontext. */
974 err |= __put_user(0, &frame->uc.uc_flags); 970 err |= __put_user(0, &frame->uc.uc_flags);
@@ -996,7 +992,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
996#endif /* CONFIG_MMU */ 992#endif /* CONFIG_MMU */
997 993
998 if (err) 994 if (err)
999 goto give_sigsegv; 995 return -EFAULT;
1000 996
1001 push_cache ((unsigned long) &frame->retcode); 997 push_cache ((unsigned long) &frame->retcode);
1002 998
@@ -1005,7 +1001,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
1005 * to destroy is successfully copied to sigframe. 1001 * to destroy is successfully copied to sigframe.
1006 */ 1002 */
1007 wrusp ((unsigned long) frame); 1003 wrusp ((unsigned long) frame);
1008 regs->pc = (unsigned long) ka->sa.sa_handler; 1004 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
1009 adjustformat(regs); 1005 adjustformat(regs);
1010 1006
1011 /* 1007 /*
@@ -1031,10 +1027,6 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
1031 tregs->sr = regs->sr; 1027 tregs->sr = regs->sr;
1032 } 1028 }
1033 return 0; 1029 return 0;
1034
1035give_sigsegv:
1036 force_sigsegv(sig, current);
1037 return err;
1038} 1030}
1039 1031
1040static inline void 1032static inline void
@@ -1074,26 +1066,22 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
1074 * OK, we're invoking a handler 1066 * OK, we're invoking a handler
1075 */ 1067 */
1076static void 1068static void
1077handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, 1069handle_signal(struct ksignal *ksig, struct pt_regs *regs)
1078 struct pt_regs *regs)
1079{ 1070{
1080 sigset_t *oldset = sigmask_to_save(); 1071 sigset_t *oldset = sigmask_to_save();
1081 int err; 1072 int err;
1082 /* are we from a system call? */ 1073 /* are we from a system call? */
1083 if (regs->orig_d0 >= 0) 1074 if (regs->orig_d0 >= 0)
1084 /* If so, check system call restarting.. */ 1075 /* If so, check system call restarting.. */
1085 handle_restart(regs, ka, 1); 1076 handle_restart(regs, &ksig->ka, 1);
1086 1077
1087 /* set up the stack frame */ 1078 /* set up the stack frame */
1088 if (ka->sa.sa_flags & SA_SIGINFO) 1079 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
1089 err = setup_rt_frame(sig, ka, info, oldset, regs); 1080 err = setup_rt_frame(ksig, oldset, regs);
1090 else 1081 else
1091 err = setup_frame(sig, ka, oldset, regs); 1082 err = setup_frame(ksig, oldset, regs);
1092
1093 if (err)
1094 return;
1095 1083
1096 signal_delivered(sig, info, ka, regs, 0); 1084 signal_setup_done(err, ksig, 0);
1097 1085
1098 if (test_thread_flag(TIF_DELAYED_TRACE)) { 1086 if (test_thread_flag(TIF_DELAYED_TRACE)) {
1099 regs->sr &= ~0x8000; 1087 regs->sr &= ~0x8000;
@@ -1108,16 +1096,13 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
1108 */ 1096 */
1109static void do_signal(struct pt_regs *regs) 1097static void do_signal(struct pt_regs *regs)
1110{ 1098{
1111 siginfo_t info; 1099 struct ksignal ksig;
1112 struct k_sigaction ka;
1113 int signr;
1114 1100
1115 current->thread.esp0 = (unsigned long) regs; 1101 current->thread.esp0 = (unsigned long) regs;
1116 1102
1117 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 1103 if (get_signal(&ksig)) {
1118 if (signr > 0) {
1119 /* Whee! Actually deliver the signal. */ 1104 /* Whee! Actually deliver the signal. */
1120 handle_signal(signr, &ka, &info, regs); 1105 handle_signal(&ksig, regs);
1121 return; 1106 return;
1122 } 1107 }
1123 1108