LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86: signal: cosmetic unification of restore_sigcontext()
@ 2008-10-24 0:14 Hiroshi Shimamoto
2008-10-27 13:13 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Hiroshi Shimamoto @ 2008-10-24 0:14 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Make restore_sigcontext() same.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
arch/x86/kernel/signal_32.c | 22 ++++++++++++++++++++++
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 d6dd057..85a0d37 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,
/* Always make any pending restarted system calls return -EINTR */
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(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(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);
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 a5c9627..9c469da 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,
/* Always make any pending restarted system calls return -EINTR */
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(dx); COPY(cx); COPY(ip);
+
+#ifdef CONFIG_X86_64
COPY(r8);
COPY(r9);
COPY(r10);
@@ -86,11 +95,17 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
COPY(r13);
COPY(r14);
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,
* 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);
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
--
1.5.6
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: signal: cosmetic unification of restore_sigcontext()
2008-10-24 0:14 [PATCH] x86: signal: cosmetic unification of restore_sigcontext() Hiroshi Shimamoto
@ 2008-10-27 13:13 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-10-27 13:13 UTC (permalink / raw)
To: Hiroshi Shimamoto; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel
* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> Make restore_sigcontext() same.
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
> arch/x86/kernel/signal_32.c | 22 ++++++++++++++++++++++
> arch/x86/kernel/signal_64.c | 15 +++++++++++++++
> 2 files changed, 37 insertions(+), 0 deletions(-)
applied to tip/x86/signal, thanks!
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-27 13:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-24 0:14 [PATCH] x86: signal: cosmetic unification of restore_sigcontext() Hiroshi Shimamoto
2008-10-27 13:13 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).