diff options
author | jhb <jhb@FreeBSD.org> | 2014-02-23 01:34:40 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-02-23 01:34:40 +0000 |
commit | 92ff5e5bfb4b3cca97831c9db2df85e24b5f7c8b (patch) | |
tree | 7e585f641712c5bb91a81b6d0869e84cf1a0bf77 /sys/amd64/vmm/intel/vmcs.h | |
parent | 69d17427cae2b573203a13c2fe8cac0865c3cfdc (diff) | |
download | FreeBSD-src-92ff5e5bfb4b3cca97831c9db2df85e24b5f7c8b.zip FreeBSD-src-92ff5e5bfb4b3cca97831c9db2df85e24b5f7c8b.tar.gz |
MFC 259542:
Use vmcs_read() and vmcs_write() in preference to vmread() and vmwrite()
respectively. The vmcs_xxx() functions provide inline error checking of
all accesses to the VMCS.
Diffstat (limited to 'sys/amd64/vmm/intel/vmcs.h')
-rw-r--r-- | sys/amd64/vmm/intel/vmcs.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/amd64/vmm/intel/vmcs.h b/sys/amd64/vmm/intel/vmcs.h index a915c40..b1e2883 100644 --- a/sys/amd64/vmm/intel/vmcs.h +++ b/sys/amd64/vmm/intel/vmcs.h @@ -58,7 +58,26 @@ int vmcs_getdesc(struct vmcs *vmcs, int ident, struct seg_desc *desc); int vmcs_setdesc(struct vmcs *vmcs, int ident, struct seg_desc *desc); -uint64_t vmcs_read(uint32_t encoding); + +static __inline uint64_t +vmcs_read(uint32_t encoding) +{ + int error; + uint64_t val; + + error = vmread(encoding, &val); + KASSERT(error == 0, ("vmcs_read(%u) error %d", encoding, error)); + return (val); +} + +static __inline void +vmcs_write(uint32_t encoding, uint64_t val) +{ + int error; + + error = vmwrite(encoding, val); + KASSERT(error == 0, ("vmcs_write(%u) error %d", encoding, error)); +} #define vmexit_instruction_length() vmcs_read(VMCS_EXIT_INSTRUCTION_LENGTH) #define vmcs_guest_rip() vmcs_read(VMCS_GUEST_RIP) |