diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2008-10-23 20:14:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-27 09:14:01 -0400 |
commit | 709110bd5624094992579f5311541f2e2b7ce58a (patch) | |
tree | 8e3f93ba88f709b6e53f87a106b98b40f7b8f660 | |
parent | f8d56f1771e4867acc461146764b4feeb5245669 (diff) |
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>
-rw-r--r-- | arch/x86/kernel/signal_32.c | 22 | ||||
-rw-r--r-- | arch/x86/kernel/signal_64.c | 15 |
2 files changed, 37 insertions, 0 deletions
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c index d6dd057d0f22..85a0d37cdae9 100644 --- a/arch/x86/kernel/signal_32.c +++ b/arch/x86/kernel/signal_32.c | |||
@@ -149,14 +149,36 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
149 | /* Always make any pending restarted system calls return -EINTR */ | 149 | /* Always make any pending restarted system calls return -EINTR */ |
150 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 150 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
151 | 151 | ||
152 | #ifdef CONFIG_X86_32 | ||
152 | GET_SEG(gs); | 153 | GET_SEG(gs); |
153 | COPY_SEG(fs); | 154 | COPY_SEG(fs); |
154 | COPY_SEG(es); | 155 | COPY_SEG(es); |
155 | COPY_SEG(ds); | 156 | COPY_SEG(ds); |
157 | #endif /* CONFIG_X86_32 */ | ||
158 | |||
156 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); | 159 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
157 | COPY(dx); COPY(cx); COPY(ip); | 160 | COPY(dx); COPY(cx); COPY(ip); |
161 | |||
162 | #ifdef CONFIG_X86_64 | ||
163 | COPY(r8); | ||
164 | COPY(r9); | ||
165 | COPY(r10); | ||
166 | COPY(r11); | ||
167 | COPY(r12); | ||
168 | COPY(r13); | ||
169 | COPY(r14); | ||
170 | COPY(r15); | ||
171 | #endif /* CONFIG_X86_64 */ | ||
172 | |||
173 | #ifdef CONFIG_X86_32 | ||
158 | COPY_SEG_STRICT(cs); | 174 | COPY_SEG_STRICT(cs); |
159 | COPY_SEG_STRICT(ss); | 175 | COPY_SEG_STRICT(ss); |
176 | #else /* !CONFIG_X86_32 */ | ||
177 | /* Kernel saves and restores only the CS segment register on signals, | ||
178 | * which is the bare minimum needed to allow mixed 32/64-bit code. | ||
179 | * App's signal handler can save/restore other segments if needed. */ | ||
180 | COPY_SEG_STRICT(cs); | ||
181 | #endif /* CONFIG_X86_32 */ | ||
160 | 182 | ||
161 | err |= __get_user(tmpflags, &sc->flags); | 183 | err |= __get_user(tmpflags, &sc->flags); |
162 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 184 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c index a5c9627f4db9..9c469da7f9e8 100644 --- a/arch/x86/kernel/signal_64.c +++ b/arch/x86/kernel/signal_64.c | |||
@@ -76,8 +76,17 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
76 | /* Always make any pending restarted system calls return -EINTR */ | 76 | /* Always make any pending restarted system calls return -EINTR */ |
77 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 77 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
78 | 78 | ||
79 | #ifdef CONFIG_X86_32 | ||
80 | GET_SEG(gs); | ||
81 | COPY_SEG(fs); | ||
82 | COPY_SEG(es); | ||
83 | COPY_SEG(ds); | ||
84 | #endif /* CONFIG_X86_32 */ | ||
85 | |||
79 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); | 86 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
80 | COPY(dx); COPY(cx); COPY(ip); | 87 | COPY(dx); COPY(cx); COPY(ip); |
88 | |||
89 | #ifdef CONFIG_X86_64 | ||
81 | COPY(r8); | 90 | COPY(r8); |
82 | COPY(r9); | 91 | COPY(r9); |
83 | COPY(r10); | 92 | COPY(r10); |
@@ -86,11 +95,17 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
86 | COPY(r13); | 95 | COPY(r13); |
87 | COPY(r14); | 96 | COPY(r14); |
88 | COPY(r15); | 97 | COPY(r15); |
98 | #endif /* CONFIG_X86_64 */ | ||
89 | 99 | ||
100 | #ifdef CONFIG_X86_32 | ||
101 | COPY_SEG_STRICT(cs); | ||
102 | COPY_SEG_STRICT(ss); | ||
103 | #else /* !CONFIG_X86_32 */ | ||
90 | /* Kernel saves and restores only the CS segment register on signals, | 104 | /* Kernel saves and restores only the CS segment register on signals, |
91 | * which is the bare minimum needed to allow mixed 32/64-bit code. | 105 | * which is the bare minimum needed to allow mixed 32/64-bit code. |
92 | * App's signal handler can save/restore other segments if needed. */ | 106 | * App's signal handler can save/restore other segments if needed. */ |
93 | COPY_SEG_STRICT(cs); | 107 | COPY_SEG_STRICT(cs); |
108 | #endif /* CONFIG_X86_32 */ | ||
94 | 109 | ||
95 | err |= __get_user(tmpflags, &sc->flags); | 110 | err |= __get_user(tmpflags, &sc->flags); |
96 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 111 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |