diff options
author | Richard Weinberger <richard@nod.at> | 2013-10-07 08:37:50 -0400 |
---|---|---|
committer | Richard Weinberger <richard@sigma-star.at> | 2014-08-06 07:03:10 -0400 |
commit | 2bb12b773feb3e792145961e57ab356e6134d4a5 (patch) | |
tree | 15536b52c0794461390619c6332026bf63e440e6 /arch/score/kernel | |
parent | 067bf2d4d3a7aedc5982f6a58716054e5004b801 (diff) |
score: Use get_signal() signal_setup_done()
Use the more generic functions get_signal() signal_setup_done()
for signal delivery.
Acked-by: Lennox Wu <lennox.wu@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/score/kernel')
-rw-r--r-- | arch/score/kernel/signal.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index a00fba32b0eb..1651807774ad 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
@@ -173,15 +173,15 @@ badframe: | |||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
176 | static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | 176 | static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs, |
177 | int signr, sigset_t *set, siginfo_t *info) | 177 | sigset_t *set) |
178 | { | 178 | { |
179 | struct rt_sigframe __user *frame; | 179 | struct rt_sigframe __user *frame; |
180 | int err = 0; | 180 | int err = 0; |
181 | 181 | ||
182 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 182 | frame = get_sigframe(&ksig->ka, regs, sizeof(*frame)); |
183 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 183 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
184 | goto give_sigsegv; | 184 | return -EFAULT; |
185 | 185 | ||
186 | /* | 186 | /* |
187 | * Set up the return code ... | 187 | * Set up the return code ... |
@@ -194,7 +194,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
194 | err |= __put_user(0x80008002, frame->rs_code + 1); | 194 | err |= __put_user(0x80008002, frame->rs_code + 1); |
195 | flush_cache_sigtramp((unsigned long) frame->rs_code); | 195 | flush_cache_sigtramp((unsigned long) frame->rs_code); |
196 | 196 | ||
197 | err |= copy_siginfo_to_user(&frame->rs_info, info); | 197 | err |= copy_siginfo_to_user(&frame->rs_info, &ksig->info); |
198 | err |= __put_user(0, &frame->rs_uc.uc_flags); | 198 | err |= __put_user(0, &frame->rs_uc.uc_flags); |
199 | err |= __put_user(NULL, &frame->rs_uc.uc_link); | 199 | err |= __put_user(NULL, &frame->rs_uc.uc_link); |
200 | err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]); | 200 | err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]); |
@@ -202,26 +202,23 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
202 | err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); | 202 | err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); |
203 | 203 | ||
204 | if (err) | 204 | if (err) |
205 | goto give_sigsegv; | 205 | return -EFAULT; |
206 | 206 | ||
207 | regs->regs[0] = (unsigned long) frame; | 207 | regs->regs[0] = (unsigned long) frame; |
208 | regs->regs[3] = (unsigned long) frame->rs_code; | 208 | regs->regs[3] = (unsigned long) frame->rs_code; |
209 | regs->regs[4] = signr; | 209 | regs->regs[4] = ksig->sig; |
210 | regs->regs[5] = (unsigned long) &frame->rs_info; | 210 | regs->regs[5] = (unsigned long) &frame->rs_info; |
211 | regs->regs[6] = (unsigned long) &frame->rs_uc; | 211 | regs->regs[6] = (unsigned long) &frame->rs_uc; |
212 | regs->regs[29] = (unsigned long) ka->sa.sa_handler; | 212 | regs->regs[29] = (unsigned long) ksig->ka.sa.sa_handler; |
213 | regs->cp0_epc = (unsigned long) ka->sa.sa_handler; | 213 | regs->cp0_epc = (unsigned long) ksig->ka.sa.sa_handler; |
214 | 214 | ||
215 | return 0; | 215 | return 0; |
216 | |||
217 | give_sigsegv: | ||
218 | force_sigsegv(signr, current); | ||
219 | return -EFAULT; | ||
220 | } | 216 | } |
221 | 217 | ||
222 | static void handle_signal(unsigned long sig, siginfo_t *info, | 218 | static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
223 | struct k_sigaction *ka, struct pt_regs *regs) | ||
224 | { | 219 | { |
220 | int ret; | ||
221 | |||
225 | if (regs->is_syscall) { | 222 | if (regs->is_syscall) { |
226 | switch (regs->regs[4]) { | 223 | switch (regs->regs[4]) { |
227 | case ERESTART_RESTARTBLOCK: | 224 | case ERESTART_RESTARTBLOCK: |
@@ -229,7 +226,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
229 | regs->regs[4] = EINTR; | 226 | regs->regs[4] = EINTR; |
230 | break; | 227 | break; |
231 | case ERESTARTSYS: | 228 | case ERESTARTSYS: |
232 | if (!(ka->sa.sa_flags & SA_RESTART)) { | 229 | if (!(ksig->ka.sa.sa_flags & SA_RESTART)) { |
233 | regs->regs[4] = EINTR; | 230 | regs->regs[4] = EINTR; |
234 | break; | 231 | break; |
235 | } | 232 | } |
@@ -245,17 +242,14 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
245 | /* | 242 | /* |
246 | * Set up the stack frame | 243 | * Set up the stack frame |
247 | */ | 244 | */ |
248 | if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) | 245 | ret = setup_rt_frame(ksig, regs, sigmask_to_save()); |
249 | return; | ||
250 | 246 | ||
251 | signal_delivered(sig, info, ka, regs, 0); | 247 | signal_setup_done(ret, ksig, 0); |
252 | } | 248 | } |
253 | 249 | ||
254 | static void do_signal(struct pt_regs *regs) | 250 | static void do_signal(struct pt_regs *regs) |
255 | { | 251 | { |
256 | struct k_sigaction ka; | 252 | struct ksignal ksig; |
257 | siginfo_t info; | ||
258 | int signr; | ||
259 | 253 | ||
260 | /* | 254 | /* |
261 | * We want the common case to go fast, which is why we may in certain | 255 | * We want the common case to go fast, which is why we may in certain |
@@ -265,10 +259,9 @@ static void do_signal(struct pt_regs *regs) | |||
265 | if (!user_mode(regs)) | 259 | if (!user_mode(regs)) |
266 | return; | 260 | return; |
267 | 261 | ||
268 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 262 | if (get_signal(&ksig)) { |
269 | if (signr > 0) { | ||
270 | /* Actually deliver the signal. */ | 263 | /* Actually deliver the signal. */ |
271 | handle_signal(signr, &info, &ka, regs); | 264 | handle_signal(&ksig, regs); |
272 | return; | 265 | return; |
273 | } | 266 | } |
274 | 267 | ||