diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2017-01-08 22:16:05 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2017-01-08 22:16:05 +0000 |
commit | 7c157441270a4ec462b24710c0402f621e57bb5c (patch) | |
tree | 5133fdcd07fe4933977e702c6d7dd2b7968e6f25 /sys | |
parent | eb8420b39de6bf0fd95b94992f4057e19bfd2545 (diff) |
Revert previous commit as it failed to handle unset vmcs pointers properly
noticed by Josh Grosse
Diffstat (limited to 'sys')
-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); |