This patch adds alternative_output() for altinstructions that
have output. Only one output is allowed.
It also cleans up the comments for alternative_input().
With this patch in place, I cleaned up the i387 save/restore in
my local copy so it now looks like this:
===================================================================
static inline void restore_fpu( struct task_struct *tsk )
{
alternative_input(
"frstor %1 ; nop",
"fxrstor %1",
X86_FEATURE_FXSR,
"m" (tsk->thread.i387.fxsave));
}
static inline void __save_init_fpu( struct task_struct *tsk )
{
alternative_output(
"fnsave %0 ; nop ; fwait ; nop",
"fxsave %0 ; fnclex",
X86_FEATURE_FXSR,
"=m" (tsk->thread.i387.fxsave));
tsk->thread_info->status &= ~TS_USEDFPU;
}
===================================================================
Signed-off-by: Chuck Ebbert <[email protected]>
Index: 2.6.13-rc3a/include/asm-i386/system.h
===================================================================
--- 2.6.13-rc3a.orig/include/asm-i386/system.h 2005-06-24 00:50:33.000000000 -0400
+++ 2.6.13-rc3a/include/asm-i386/system.h 2005-07-23 15:36:02.000000000 -0400
@@ -313,13 +313,13 @@
/*
* Alternative inline assembly with input.
- *
- * Pecularities:
- * No memory clobber here.
+ *
+ * Peculiarities:
+ * No memory clobber here.
* Argument numbers start with 1.
* Best is to use constraints that are fixed size (like (%1) ... "r")
- * If you use variable sized constraints like "m" or "g" in the
- * replacement maake sure to pad to the worst case length.
+ * If you use variable sized constraints like "m" or "g" in the
+ * replacement make sure to pad to the worst case length.
*/
#define alternative_input(oldinstr, newinstr, feature, input...) \
asm volatile ("661:\n\t" oldinstr "\n662:\n" \
@@ -336,6 +336,27 @@
".previous" :: "i" (feature), ##input)
/*
+ * Alternative inline assembly with output.
+ *
+ * Same as alternative_input, except:
+ * No inputs.
+ * Only one output: 0.
+ */
+#define alternative_output(oldinstr, newinstr, feature, output...) \
+ asm volatile ("661:\n\t" oldinstr "\n662:\n" \
+ ".section .altinstructions,\"a\"\n" \
+ " .align 4\n" \
+ " .long 661b\n" /* label */ \
+ " .long 663f\n" /* new instruction */ \
+ " .byte %c1\n" /* feature bit */ \
+ " .byte 662b-661b\n" /* sourcelen */ \
+ " .byte 664f-663f\n" /* replacementlen */ \
+ ".previous\n" \
+ ".section .altinstr_replacement,\"ax\"\n" \
+ "663:\n\t" newinstr "\n664:\n" /* replacement */ \
+ ".previous" : output : "i" (feature))
+
+/*
* Force strict CPU ordering.
* And yes, this is required on UP too when we're talking
* to devices.
__
Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|