x86: add memory clobber in switch_to()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, October 13, 2008 - 11:07 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=33f8c4...
Commit:     33f8c40a30ae99e971d068c9ec6088e713c46f5f
Parent:     3e6de5a393661c5cdabe44115e93bcbde6a742fc
Author:     Vegard Nossum <vegard.nossum@gmail.com>
AuthorDate: Sun Sep 14 19:03:53 2008 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon Oct 13 10:21:12 2008 +0200

    x86: add memory clobber in switch_to()
    
    Segment registers are reloaded, so we should add a memory clobber. The
    generated assembly code is identical in my tests, but this doesn't mean
    it is necessarily true for all configurations/compilers.
    
    x86_64 already has the memory clobber.
    
    Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/asm-x86/system.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h
index 34505dd..b20c894 100644
--- a/include/asm-x86/system.h
+++ b/include/asm-x86/system.h
@@ -64,7 +64,10 @@ do {									\
 		       							\
 		       /* regparm parameters for __switch_to(): */	\
 		       [prev]     "a" (prev),				\
-		       [next]     "d" (next));				\
+		       [next]     "d" (next)				\
+									\
+		     : /* reloaded segment registers */			\
+			"memory");					\
 } while (0)
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
x86: add memory clobber in switch_to(), Linux Kernel Mailing ..., (Mon Oct 13, 11:07 am)