aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-06-15 15:23:02 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-06-18 11:17:44 -0400
commit680714844fd1dcc6f03b22353103985be9d58db6 (patch)
tree9e0a0b1835690c4f796bdad5ca4e9eca720256f5 /arch/arm/kernel
parentcb3504e8fa84870aabcf51c67e29675817e30836 (diff)
[ARM] Gather common sigframe restoration code into restore_sigframe()
Gather the sigmask restoration code inside restore_sigcontext(), and rename the function restore_sigframe(). Pass it a sigframe structure. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/signal.c76
1 files changed, 33 insertions, 43 deletions
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 652bb1a33c06..1e2b54d32172 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -203,39 +203,47 @@ struct rt_sigframe {
203 struct sigframe sig; 203 struct sigframe sig;
204}; 204};
205 205
206static int 206static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
207restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
208 struct aux_sigframe __user *aux)
209{ 207{
210 int err = 0; 208 sigset_t set;
209 int err;
211 210
212 __get_user_error(regs->ARM_r0, &sc->arm_r0, err); 211 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
213 __get_user_error(regs->ARM_r1, &sc->arm_r1, err); 212 if (err == 0) {
214 __get_user_error(regs->ARM_r2, &sc->arm_r2, err); 213 sigdelsetmask(&set, ~_BLOCKABLE);
215 __get_user_error(regs->ARM_r3, &sc->arm_r3, err); 214 spin_lock_irq(&current->sighand->siglock);
216 __get_user_error(regs->ARM_r4, &sc->arm_r4, err); 215 current->blocked = set;
217 __get_user_error(regs->ARM_r5, &sc->arm_r5, err); 216 recalc_sigpending();
218 __get_user_error(regs->ARM_r6, &sc->arm_r6, err); 217 spin_unlock_irq(&current->sighand->siglock);
219 __get_user_error(regs->ARM_r7, &sc->arm_r7, err); 218 }
220 __get_user_error(regs->ARM_r8, &sc->arm_r8, err); 219
221 __get_user_error(regs->ARM_r9, &sc->arm_r9, err); 220 __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err);
222 __get_user_error(regs->ARM_r10, &sc->arm_r10, err); 221 __get_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err);
223 __get_user_error(regs->ARM_fp, &sc->arm_fp, err); 222 __get_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err);
224 __get_user_error(regs->ARM_ip, &sc->arm_ip, err); 223 __get_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err);
225 __get_user_error(regs->ARM_sp, &sc->arm_sp, err); 224 __get_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err);
226 __get_user_error(regs->ARM_lr, &sc->arm_lr, err); 225 __get_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err);
227 __get_user_error(regs->ARM_pc, &sc->arm_pc, err); 226 __get_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err);
228 __get_user_error(regs->ARM_cpsr, &sc->arm_cpsr, err); 227 __get_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err);
228 __get_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err);
229 __get_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err);
230 __get_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err);
231 __get_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err);
232 __get_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err);
233 __get_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err);
234 __get_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err);
235 __get_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err);
236 __get_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err);
229 237
230 err |= !valid_user_regs(regs); 238 err |= !valid_user_regs(regs);
231 239
232#ifdef CONFIG_IWMMXT 240#ifdef CONFIG_IWMMXT
233 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 241 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT))
234 err |= restore_iwmmxt_context(&aux->iwmmxt); 242 err |= restore_iwmmxt_context(&sf->aux.iwmmxt);
235#endif 243#endif
236#ifdef CONFIG_VFP 244#ifdef CONFIG_VFP
237// if (err == 0) 245// if (err == 0)
238// err |= vfp_restore_state(&aux->vfp); 246// err |= vfp_restore_state(&sf->aux.vfp);
239#endif 247#endif
240 248
241 return err; 249 return err;
@@ -244,7 +252,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
244asmlinkage int sys_sigreturn(struct pt_regs *regs) 252asmlinkage int sys_sigreturn(struct pt_regs *regs)
245{ 253{
246 struct sigframe __user *frame; 254 struct sigframe __user *frame;
247 sigset_t set;
248 255
249 /* Always make any pending restarted system calls return -EINTR */ 256 /* Always make any pending restarted system calls return -EINTR */
250 current_thread_info()->restart_block.fn = do_no_restart_syscall; 257 current_thread_info()->restart_block.fn = do_no_restart_syscall;
@@ -261,16 +268,8 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
261 268
262 if (!access_ok(VERIFY_READ, frame, sizeof (*frame))) 269 if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
263 goto badframe; 270 goto badframe;
264 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
265 goto badframe;
266
267 sigdelsetmask(&set, ~_BLOCKABLE);
268 spin_lock_irq(&current->sighand->siglock);
269 current->blocked = set;
270 recalc_sigpending();
271 spin_unlock_irq(&current->sighand->siglock);
272 271
273 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &frame->aux)) 272 if (restore_sigframe(regs, frame))
274 goto badframe; 273 goto badframe;
275 274
276 /* Send SIGTRAP if we're single-stepping */ 275 /* Send SIGTRAP if we're single-stepping */
@@ -289,7 +288,6 @@ badframe:
289asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) 288asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
290{ 289{
291 struct rt_sigframe __user *frame; 290 struct rt_sigframe __user *frame;
292 sigset_t set;
293 291
294 /* Always make any pending restarted system calls return -EINTR */ 292 /* Always make any pending restarted system calls return -EINTR */
295 current_thread_info()->restart_block.fn = do_no_restart_syscall; 293 current_thread_info()->restart_block.fn = do_no_restart_syscall;
@@ -306,16 +304,8 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
306 304
307 if (!access_ok(VERIFY_READ, frame, sizeof (*frame))) 305 if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
308 goto badframe; 306 goto badframe;
309 if (__copy_from_user(&set, &frame->sig.uc.uc_sigmask, sizeof(set)))
310 goto badframe;
311
312 sigdelsetmask(&set, ~_BLOCKABLE);
313 spin_lock_irq(&current->sighand->siglock);
314 current->blocked = set;
315 recalc_sigpending();
316 spin_unlock_irq(&current->sighand->siglock);
317 307
318 if (restore_sigcontext(regs, &frame->sig.uc.uc_mcontext, &frame->sig.aux)) 308 if (restore_sigframe(regs, &frame->sig))
319 goto badframe; 309 goto badframe;
320 310
321 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT) 311 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT)