Skip to content

Commit

Permalink
x86: KVM guest: Add memory clobber to hypercalls
Browse files Browse the repository at this point in the history
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: Anthony Liguori <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
Anthony Liguori authored and avikivity committed Jul 6, 2008
1 parent b727946 commit ca37393
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions include/asm-x86/kvm_para.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ static inline long kvm_hypercall0(unsigned int nr)
long ret;
asm volatile(KVM_HYPERCALL
: "=a"(ret)
: "a"(nr));
: "a"(nr)
: "memory");
return ret;
}

Expand All @@ -80,7 +81,8 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
long ret;
asm volatile(KVM_HYPERCALL
: "=a"(ret)
: "a"(nr), "b"(p1));
: "a"(nr), "b"(p1)
: "memory");
return ret;
}

Expand All @@ -90,7 +92,8 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
long ret;
asm volatile(KVM_HYPERCALL
: "=a"(ret)
: "a"(nr), "b"(p1), "c"(p2));
: "a"(nr), "b"(p1), "c"(p2)
: "memory");
return ret;
}

Expand All @@ -100,7 +103,8 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
long ret;
asm volatile(KVM_HYPERCALL
: "=a"(ret)
: "a"(nr), "b"(p1), "c"(p2), "d"(p3));
: "a"(nr), "b"(p1), "c"(p2), "d"(p3)
: "memory");
return ret;
}

Expand All @@ -111,7 +115,8 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
long ret;
asm volatile(KVM_HYPERCALL
: "=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;
}

Expand Down

0 comments on commit ca37393

Please sign in to comment.