mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 05:04:00 +08:00
x86: add memory barriers to wrmsr
wrmsr is a special instruction which can have arbitrary system-wide effects. We don't want the compiler to reorder it with respect to memory operations, so make it a memory barrier. 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>
This commit is contained in:
parent
d338c73c39
commit
af2b1c609f
@ -66,7 +66,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
|
||||
static inline void native_write_msr(unsigned int msr,
|
||||
unsigned low, unsigned high)
|
||||
{
|
||||
asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high));
|
||||
asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory");
|
||||
}
|
||||
|
||||
static inline int native_write_msr_safe(unsigned int msr,
|
||||
@ -81,7 +81,8 @@ static inline int native_write_msr_safe(unsigned int msr,
|
||||
_ASM_EXTABLE(2b, 3b)
|
||||
: "=a" (err)
|
||||
: "c" (msr), "0" (low), "d" (high),
|
||||
"i" (-EFAULT));
|
||||
"i" (-EFAULT)
|
||||
: "memory");
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user