From: Jiri Slaby <jirislaby@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
jirislaby@gmail.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:x86/fpu] x86: unify restore_fpu_checking
Date: Wed, 8 Apr 2009 11:54:44 GMT [thread overview]
Message-ID: <tip-34ba476a01e128aad51e02f9be854584e9ec73cf@git.kernel.org> (raw)
In-Reply-To: <1239190320-23952-2-git-send-email-jirislaby@gmail.com>
Commit-ID: 34ba476a01e128aad51e02f9be854584e9ec73cf
Gitweb: http://git.kernel.org/tip/34ba476a01e128aad51e02f9be854584e9ec73cf
Author: Jiri Slaby <jirislaby@gmail.com>
AuthorDate: Wed, 8 Apr 2009 13:31:59 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 8 Apr 2009 13:46:01 +0200
x86: unify restore_fpu_checking
Impact: cleanup
On x86_32, separate f*rstor to an inline function which makes
restore_fpu_checking the same on both platforms -> move it
outside the ifdefs.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
LKML-Reference: <1239190320-23952-2-git-send-email-jirislaby@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/include/asm/i387.h | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index 09a2d6d..7a6f21d 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -75,14 +75,6 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
return err;
}
-static inline int restore_fpu_checking(struct task_struct *tsk)
-{
- if (task_thread_info(tsk)->status & TS_XSAVE)
- return xrstor_checking(&tsk->thread.xstate->xsave);
- else
- return fxrstor_checking(&tsk->thread.xstate->fxsave);
-}
-
/* AMD CPUs don't save/restore FDP/FIP/FOP unless an exception
is pending. Clear the x87 state here by setting it to fixed
values. The kernel data segment can be sometimes 0 and sometimes
@@ -185,10 +177,9 @@ static inline void tolerant_fwait(void)
asm volatile("fnclex ; fwait");
}
-static inline int restore_fpu_checking(struct task_struct *tsk)
+/* perform fxrstor iff the processor has extended states, otherwise frstor */
+static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
{
- if (task_thread_info(tsk)->status & TS_XSAVE)
- return xrstor_checking(&tsk->thread.xstate->xsave);
/*
* The "nop" is needed to make the instructions the same
* length.
@@ -197,7 +188,8 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
"nop ; frstor %1",
"fxrstor %1",
X86_FEATURE_FXSR,
- "m" (tsk->thread.xstate->fxsave));
+ "m" (*fx));
+
return 0;
}
@@ -261,6 +253,14 @@ end:
#endif /* CONFIG_X86_64 */
+static inline int restore_fpu_checking(struct task_struct *tsk)
+{
+ if (task_thread_info(tsk)->status & TS_XSAVE)
+ return xrstor_checking(&tsk->thread.xstate->xsave);
+ else
+ return fxrstor_checking(&tsk->thread.xstate->fxsave);
+}
+
/*
* Signal frame handlers...
*/
next prev parent reply other threads:[~2009-04-08 12:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 11:31 [PATCH 1/3] x86_32: make restore_fpu ckecking Jiri Slaby
2009-04-08 11:31 ` [PATCH 2/3] x86: unify restore_fpu_checking Jiri Slaby
2009-04-08 11:32 ` [PATCH 3/3] x86_64: fix wrong comments Jiri Slaby
2009-04-08 11:54 ` [tip:x86/fpu] x86_64: fix incorrect comments Jiri Slaby
2009-04-08 11:54 ` Jiri Slaby [this message]
2009-04-08 11:54 ` [tip:x86/fpu] x86_32: introduce restore_fpu_checking() Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-34ba476a01e128aad51e02f9be854584e9ec73cf@git.kernel.org \
--to=jirislaby@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox