]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/kvm/vmx.c
KVM: VMX: Let gcc to choose which registers to save (x86_64)
authorLaurent Vivier <Laurent.Vivier@bull.net>
Thu, 25 Oct 2007 12:18:52 +0000 (14:18 +0200)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:52:56 +0000 (17:52 +0200)
commitc20363006af64cf397519da5e984b18e6bdffd82
tree630c69b29c57900499e291d0e01d2010812e7ae0
parentcbc9402297b9a233981f74587786364cda21c771
KVM: VMX: Let gcc to choose which registers to save (x86_64)

This patch lets GCC to determine which registers to save when we
switch to/from a VCPU in the case of intel x86_64.

* Original code saves following registers:

    rax, rbx, rcx, rdx, rsi, rdi, rbp,
    r8, r9, r10, r11, r12, r13, r14, r15

* Patched code:

  - informs GCC that we modify following registers
    using the clobber description:

    rbx, rdi, rsi,
    r8, r9, r10, r11, r12, r13, r14, r15

  - doesn't save rax because it is an output operand (vmx->fail)

  - cannot put rcx in clobber description because it is an input operand,
    but as we modify it and we want to keep its value (vcpu), we must
    save it (pop/push)

  - rbp is saved (pop/push) because GCC seems to ignore its use in the clobber
    description.

  - rdx is saved (pop/push) because it is reserved by GCC (REGPARM) and
    cannot be put in the clobber description.

  - line "mov (%%rsp), %3 \n\t" has been removed because %3
    is rcx and rcx is restored just after.

  - line ASM_VMX_VMWRITE_RSP_RDX() is moved out of the ifdef/else/endif

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/vmx.c