Commit ca373932 authored by Anthony Liguori's avatar Anthony Liguori Committed by Avi Kivity

x86: KVM guest: Add memory clobber to hypercalls

Hypercalls can modify arbitrary regions of memory.  Make sure to indicate this
in the clobber list.  This fixes a hang when using KVM_GUEST kernel built with
GCC 4.3.0.

This was originally spotted and analyzed by Marcelo.
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent b7279469
...@@ -71,7 +71,8 @@ static inline long kvm_hypercall0(unsigned int nr) ...@@ -71,7 +71,8 @@ static inline long kvm_hypercall0(unsigned int nr)
long ret; long ret;
asm volatile(KVM_HYPERCALL asm volatile(KVM_HYPERCALL
: "=a"(ret) : "=a"(ret)
: "a"(nr)); : "a"(nr)
: "memory");
return ret; return ret;
} }
...@@ -80,7 +81,8 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) ...@@ -80,7 +81,8 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
long ret; long ret;
asm volatile(KVM_HYPERCALL asm volatile(KVM_HYPERCALL
: "=a"(ret) : "=a"(ret)
: "a"(nr), "b"(p1)); : "a"(nr), "b"(p1)
: "memory");
return ret; return ret;
} }
...@@ -90,7 +92,8 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1, ...@@ -90,7 +92,8 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
long ret; long ret;
asm volatile(KVM_HYPERCALL asm volatile(KVM_HYPERCALL
: "=a"(ret) : "=a"(ret)
: "a"(nr), "b"(p1), "c"(p2)); : "a"(nr), "b"(p1), "c"(p2)
: "memory");
return ret; return ret;
} }
...@@ -100,7 +103,8 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1, ...@@ -100,7 +103,8 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
long ret; long ret;
asm volatile(KVM_HYPERCALL asm volatile(KVM_HYPERCALL
: "=a"(ret) : "=a"(ret)
: "a"(nr), "b"(p1), "c"(p2), "d"(p3)); : "a"(nr), "b"(p1), "c"(p2), "d"(p3)
: "memory");
return ret; return ret;
} }
...@@ -111,7 +115,8 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, ...@@ -111,7 +115,8 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
long ret; long ret;
asm volatile(KVM_HYPERCALL asm volatile(KVM_HYPERCALL
: "=a"(ret) : "=a"(ret)
: "a"(nr), "b"(p1), "c"(p2), "d"(p3), "S"(p4)); : "a"(nr), "b"(p1), "c"(p2), "d"(p3), "S"(p4)
: "memory");
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment