diff options
-rw-r--r-- | sys/arch/amd64/amd64/vmm.c | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/vmm.c | 13 |
2 files changed, 12 insertions, 15 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c index 7fe8bbcbd6f..0eedcb17d2b 100644 --- a/sys/arch/amd64/amd64/vmm.c +++ b/sys/arch/amd64/amd64/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.101 2017/01/07 23:01:27 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.102 2017/01/08 22:16:04 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -1215,13 +1215,11 @@ vcpu_reload_vmcs_vmx(uint64_t *vmcs) { uint64_t old; - /* Flush any old state */ - if (vmptrst(&old)) - return (EINVAL); - - if (old != 0xFFFFFFFFFFFFFFFFULL) { - if (vmclear(&old)) - return (EINVAL); + if (!vmptrst(&old)) { + if (old != 0xFFFFFFFFFFFFFFFFULL) { + if (vmclear(&old)) + return (EINVAL); + } } else return (EINVAL); diff --git a/sys/arch/i386/i386/vmm.c b/sys/arch/i386/i386/vmm.c index d72d9b86e69..c8d2733405e 100644 --- a/sys/arch/i386/i386/vmm.c +++ b/sys/arch/i386/i386/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.7 2017/01/07 23:01:27 mlarkin Exp $ */ +/* $OpenBSD: vmm.c,v 1.8 2017/01/08 22:16:04 mlarkin Exp $ */ /* * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org> * @@ -1220,12 +1220,11 @@ vcpu_reload_vmcs_vmx(uint64_t *vmcs) uint64_t old; /* Flush any old state */ - if (vmptrst(&old)) - return (EINVAL); - - if (old != 0xFFFFFFFFFFFFFFFFULL) { - if (vmclear(&old)) - return (EINVAL); + if (!vmptrst(&old)) { + if (old != 0xFFFFFFFFFFFFFFFFULL) { + if (vmclear(&old)) + return (EINVAL); + } } else return (EINVAL); |