mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 04:42:12 +00:00
x86: signal: cosmetic unification of setup_sigcontext()
Impact: cleanup Make setup_sigcontext() 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
8735b7d0a2
commit
15002fa9bf
@ -279,14 +279,20 @@ static int
|
|||||||
setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
||||||
struct pt_regs *regs, unsigned long mask)
|
struct pt_regs *regs, unsigned long mask)
|
||||||
{
|
{
|
||||||
int tmp, err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
{
|
||||||
|
unsigned int tmp;
|
||||||
|
|
||||||
|
savesegment(gs, tmp);
|
||||||
|
err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
|
||||||
|
}
|
||||||
err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs);
|
err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs);
|
||||||
savesegment(gs, tmp);
|
|
||||||
err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
|
|
||||||
|
|
||||||
err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
|
err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
|
||||||
err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
|
err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
err |= __put_user(regs->di, &sc->di);
|
err |= __put_user(regs->di, &sc->di);
|
||||||
err |= __put_user(regs->si, &sc->si);
|
err |= __put_user(regs->si, &sc->si);
|
||||||
err |= __put_user(regs->bp, &sc->bp);
|
err |= __put_user(regs->bp, &sc->bp);
|
||||||
@ -295,13 +301,31 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
|||||||
err |= __put_user(regs->dx, &sc->dx);
|
err |= __put_user(regs->dx, &sc->dx);
|
||||||
err |= __put_user(regs->cx, &sc->cx);
|
err |= __put_user(regs->cx, &sc->cx);
|
||||||
err |= __put_user(regs->ax, &sc->ax);
|
err |= __put_user(regs->ax, &sc->ax);
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
|
err |= __put_user(regs->r8, &sc->r8);
|
||||||
|
err |= __put_user(regs->r9, &sc->r9);
|
||||||
|
err |= __put_user(regs->r10, &sc->r10);
|
||||||
|
err |= __put_user(regs->r11, &sc->r11);
|
||||||
|
err |= __put_user(regs->r12, &sc->r12);
|
||||||
|
err |= __put_user(regs->r13, &sc->r13);
|
||||||
|
err |= __put_user(regs->r14, &sc->r14);
|
||||||
|
err |= __put_user(regs->r15, &sc->r15);
|
||||||
|
#endif /* CONFIG_X86_64 */
|
||||||
|
|
||||||
err |= __put_user(current->thread.trap_no, &sc->trapno);
|
err |= __put_user(current->thread.trap_no, &sc->trapno);
|
||||||
err |= __put_user(current->thread.error_code, &sc->err);
|
err |= __put_user(current->thread.error_code, &sc->err);
|
||||||
err |= __put_user(regs->ip, &sc->ip);
|
err |= __put_user(regs->ip, &sc->ip);
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
|
err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
|
||||||
err |= __put_user(regs->flags, &sc->flags);
|
err |= __put_user(regs->flags, &sc->flags);
|
||||||
err |= __put_user(regs->sp, &sc->sp_at_signal);
|
err |= __put_user(regs->sp, &sc->sp_at_signal);
|
||||||
err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
|
err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
|
||||||
|
#else /* !CONFIG_X86_32 */
|
||||||
|
err |= __put_user(regs->flags, &sc->flags);
|
||||||
|
err |= __put_user(regs->cs, &sc->cs);
|
||||||
|
err |= __put_user(0, &sc->gs);
|
||||||
|
err |= __put_user(0, &sc->fs);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
err |= __put_user(fpstate, &sc->fpstate);
|
err |= __put_user(fpstate, &sc->fpstate);
|
||||||
|
|
||||||
|
@ -157,16 +157,23 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
|
|||||||
/*
|
/*
|
||||||
* Set up a signal frame.
|
* Set up a signal frame.
|
||||||
*/
|
*/
|
||||||
|
static int
|
||||||
static inline int
|
|
||||||
setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
||||||
struct pt_regs *regs, unsigned long mask)
|
struct pt_regs *regs, unsigned long mask)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
err |= __put_user(regs->cs, &sc->cs);
|
#ifdef CONFIG_X86_32
|
||||||
err |= __put_user(0, &sc->gs);
|
{
|
||||||
err |= __put_user(0, &sc->fs);
|
unsigned int tmp;
|
||||||
|
|
||||||
|
savesegment(gs, tmp);
|
||||||
|
err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
|
||||||
|
}
|
||||||
|
err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs);
|
||||||
|
err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
|
||||||
|
err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
err |= __put_user(regs->di, &sc->di);
|
err |= __put_user(regs->di, &sc->di);
|
||||||
err |= __put_user(regs->si, &sc->si);
|
err |= __put_user(regs->si, &sc->si);
|
||||||
@ -176,6 +183,7 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
|||||||
err |= __put_user(regs->dx, &sc->dx);
|
err |= __put_user(regs->dx, &sc->dx);
|
||||||
err |= __put_user(regs->cx, &sc->cx);
|
err |= __put_user(regs->cx, &sc->cx);
|
||||||
err |= __put_user(regs->ax, &sc->ax);
|
err |= __put_user(regs->ax, &sc->ax);
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
err |= __put_user(regs->r8, &sc->r8);
|
err |= __put_user(regs->r8, &sc->r8);
|
||||||
err |= __put_user(regs->r9, &sc->r9);
|
err |= __put_user(regs->r9, &sc->r9);
|
||||||
err |= __put_user(regs->r10, &sc->r10);
|
err |= __put_user(regs->r10, &sc->r10);
|
||||||
@ -184,11 +192,26 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
|
|||||||
err |= __put_user(regs->r13, &sc->r13);
|
err |= __put_user(regs->r13, &sc->r13);
|
||||||
err |= __put_user(regs->r14, &sc->r14);
|
err |= __put_user(regs->r14, &sc->r14);
|
||||||
err |= __put_user(regs->r15, &sc->r15);
|
err |= __put_user(regs->r15, &sc->r15);
|
||||||
|
#endif /* CONFIG_X86_64 */
|
||||||
|
|
||||||
err |= __put_user(current->thread.trap_no, &sc->trapno);
|
err |= __put_user(current->thread.trap_no, &sc->trapno);
|
||||||
err |= __put_user(current->thread.error_code, &sc->err);
|
err |= __put_user(current->thread.error_code, &sc->err);
|
||||||
err |= __put_user(regs->ip, &sc->ip);
|
err |= __put_user(regs->ip, &sc->ip);
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
|
||||||
err |= __put_user(regs->flags, &sc->flags);
|
err |= __put_user(regs->flags, &sc->flags);
|
||||||
|
err |= __put_user(regs->sp, &sc->sp_at_signal);
|
||||||
|
err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
|
||||||
|
#else /* !CONFIG_X86_32 */
|
||||||
|
err |= __put_user(regs->flags, &sc->flags);
|
||||||
|
err |= __put_user(regs->cs, &sc->cs);
|
||||||
|
err |= __put_user(0, &sc->gs);
|
||||||
|
err |= __put_user(0, &sc->fs);
|
||||||
|
#endif /* CONFIG_X86_32 */
|
||||||
|
|
||||||
err |= __put_user(fpstate, &sc->fpstate);
|
err |= __put_user(fpstate, &sc->fpstate);
|
||||||
|
|
||||||
|
/* non-iBCS2 extensions.. */
|
||||||
err |= __put_user(mask, &sc->oldmask);
|
err |= __put_user(mask, &sc->oldmask);
|
||||||
err |= __put_user(current->thread.cr2, &sc->cr2);
|
err |= __put_user(current->thread.cr2, &sc->cr2);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user