aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-x86_64/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-x86_64/signal.c')
-rw-r--r--arch/um/sys-x86_64/signal.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index a8e5fd7b2adb..1778d33808f4 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2003 PathScale, Inc. 2 * Copyright (C) 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
@@ -110,7 +111,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
110 err |= PUTREG(regs, RDI, to, rdi); 111 err |= PUTREG(regs, RDI, to, rdi);
111 err |= PUTREG(regs, RSI, to, rsi); 112 err |= PUTREG(regs, RSI, to, rsi);
112 err |= PUTREG(regs, RBP, to, rbp); 113 err |= PUTREG(regs, RBP, to, rbp);
113 /* Must use orignal RSP, which is passed in, rather than what's in 114 /*
115 * Must use orignal RSP, which is passed in, rather than what's in
114 * the pt_regs, because that's already been updated to point at the 116 * the pt_regs, because that's already been updated to point at the
115 * signal frame. 117 * signal frame.
116 */ 118 */
@@ -152,7 +154,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
152 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct))) 154 if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct)))
153 return 1; 155 return 1;
154 156
155 return(err); 157 return err;
156} 158}
157 159
158struct rt_sigframe 160struct rt_sigframe
@@ -188,7 +190,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
188 goto out; 190 goto out;
189 } 191 }
190 192
191 /* Update SP now because the page fault handler refuses to extend 193 /*
194 * Update SP now because the page fault handler refuses to extend
192 * the stack if the faulting address is too far below the current 195 * the stack if the faulting address is too far below the current
193 * SP, which frame now certainly is. If there's an error, the original 196 * SP, which frame now certainly is. If there's an error, the original
194 * value is restored on the way out. 197 * value is restored on the way out.
@@ -216,8 +219,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
216 err |= __copy_to_user(&frame->uc.uc_sigmask, set, 219 err |= __copy_to_user(&frame->uc.uc_sigmask, set,
217 sizeof(*set)); 220 sizeof(*set));
218 221
219 /* Set up to return from userspace. If provided, use a stub 222 /*
220 already in userspace. */ 223 * Set up to return from userspace. If provided, use a stub
224 * already in userspace.
225 */
221 /* x86-64 should always use SA_RESTORER. */ 226 /* x86-64 should always use SA_RESTORER. */
222 if (ka->sa.sa_flags & SA_RESTORER) 227 if (ka->sa.sa_flags & SA_RESTORER)
223 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); 228 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
@@ -239,8 +244,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
239 /* In case the signal handler was declared without prototypes */ 244 /* In case the signal handler was declared without prototypes */
240 PT_REGS_RAX(regs) = 0; 245 PT_REGS_RAX(regs) = 0;
241 246
242 /* This also works for non SA_SIGINFO handlers because they expect the 247 /*
243 next argument after the signal number on the stack. */ 248 * This also works for non SA_SIGINFO handlers because they expect the
249 * next argument after the signal number on the stack.
250 */
244 PT_REGS_RSI(regs) = (unsigned long) &frame->info; 251 PT_REGS_RSI(regs) = (unsigned long) &frame->info;
245 PT_REGS_RDX(regs) = (unsigned long) &frame->uc; 252 PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
246 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; 253 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -276,7 +283,7 @@ long sys_rt_sigreturn(struct pt_regs *regs)
276 283
277 /* Avoid ERESTART handling */ 284 /* Avoid ERESTART handling */
278 PT_REGS_SYSCALL_NR(&current->thread.regs) = -1; 285 PT_REGS_SYSCALL_NR(&current->thread.regs) = -1;
279 return(PT_REGS_SYSCALL_RET(&current->thread.regs)); 286 return PT_REGS_SYSCALL_RET(&current->thread.regs);
280 287
281 segfault: 288 segfault:
282 force_sig(SIGSEGV, current); 289 force_sig(SIGSEGV, current);