x86: signal: cosmetic unification of restore_sigcontext()
Impact: cleanup Make restore_sigcontext() the same. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
f8d56f1771
commit
709110bd56
2 changed files with 37 additions and 0 deletions
|
@ -149,14 +149,36 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
|
||||||
/* Always make any pending restarted system calls return -EINTR */
|
/* Always make any pending restarted system calls return -EINTR */
|
||||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
GET_SEG(gs);
|
GET_SEG(gs);
|
||||||
COPY_SEG(fs);
|
COPY_SEG(fs);
|
||||||
COPY_SEG(es);
|
COPY_SEG(es);
|
||||||
COPY_SEG(ds);
|
COPY_SEG(ds);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
|
COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
|
||||||
COPY(dx); COPY(cx); COPY(ip);
|
COPY(dx); COPY(cx); COPY(ip);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
|
COPY(r8);
|
||||||
|
COPY(r9);
|
||||||
|
COPY(r10);
|
||||||
|
COPY(r11);
|
||||||
|
COPY(r12);
|
||||||
|
COPY(r13);
|
||||||
|
COPY(r14);
|
||||||
|
COPY(r15);
|
||||||
|
#endif /* CONFIG_X86_64 */
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
COPY_SEG_STRICT(cs);
|
COPY_SEG_STRICT(cs);
|
||||||
COPY_SEG_STRICT(ss);
|
COPY_SEG_STRICT(ss);
|
||||||
|
#else /* !CONFIG_X86_32 */
|
||||||
|
/* Kernel saves and restores only the CS segment register on signals,
|
||||||
|
* which is the bare minimum needed to allow mixed 32/64-bit code.
|
||||||
|
* App's signal handler can save/restore other segments if needed. */
|
||||||
|
COPY_SEG_STRICT(cs);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
err |= __get_user(tmpflags, &sc->flags);
|
err |= __get_user(tmpflags, &sc->flags);
|
||||||
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
|
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
|
||||||
|
|
|
@ -76,8 +76,17 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
|
||||||
/* Always make any pending restarted system calls return -EINTR */
|
/* Always make any pending restarted system calls return -EINTR */
|
||||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
GET_SEG(gs);
|
||||||
|
COPY_SEG(fs);
|
||||||
|
COPY_SEG(es);
|
||||||
|
COPY_SEG(ds);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
|
COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
|
||||||
COPY(dx); COPY(cx); COPY(ip);
|
COPY(dx); COPY(cx); COPY(ip);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
COPY(r8);
|
COPY(r8);
|
||||||
COPY(r9);
|
COPY(r9);
|
||||||
COPY(r10);
|
COPY(r10);
|
||||||
|
@ -86,11 +95,17 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
|
||||||
COPY(r13);
|
COPY(r13);
|
||||||
COPY(r14);
|
COPY(r14);
|
||||||
COPY(r15);
|
COPY(r15);
|
||||||
|
#endif /* CONFIG_X86_64 */
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
COPY_SEG_STRICT(cs);
|
||||||
|
COPY_SEG_STRICT(ss);
|
||||||
|
#else /* !CONFIG_X86_32 */
|
||||||
/* Kernel saves and restores only the CS segment register on signals,
|
/* Kernel saves and restores only the CS segment register on signals,
|
||||||
* which is the bare minimum needed to allow mixed 32/64-bit code.
|
* which is the bare minimum needed to allow mixed 32/64-bit code.
|
||||||
* App's signal handler can save/restore other segments if needed. */
|
* App's signal handler can save/restore other segments if needed. */
|
||||||
COPY_SEG_STRICT(cs);
|
COPY_SEG_STRICT(cs);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
err |= __get_user(tmpflags, &sc->flags);
|
err |= __get_user(tmpflags, &sc->flags);
|
||||||
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
|
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
|
||||||
|
|
Loading…
Reference in a new issue