Skip to content

Commit

Permalink
x86: add memory clobber to save/loadsegment
Browse files Browse the repository at this point in the history
Add "memory" clobbers to savesegment and loadsegment, since they can
affect memory accesses and we never want the compiler to reorder them
with respect to memory references.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Jul 8, 2008
1 parent bea4180 commit d338c73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/asm-x86/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ extern void load_gs_index(unsigned);
"jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE(1b,3b) \
: :"r" (value), "r" (0))
: :"r" (value), "r" (0) : "memory")


/*
* Save a segment register away
*/
#define savesegment(seg, value) \
asm volatile("mov %%" #seg ",%0":"=rm" (value))
asm("mov %%" #seg ",%0":"=rm" (value) : : "memory")

static inline unsigned long get_limit(unsigned long segment)
{
Expand Down

0 comments on commit d338c73

Please sign in to comment.