vmcs.h (246e7a2b6494cd991b08ac669ed761ecea0cc98c) | vmcs.h (c3498942a588dda8ae4e7bd9d03d53baa2cbf39a) |
---|---|
1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 40 unchanged lines hidden (view full) --- 49int vmcs_init(struct vmcs *vmcs); 50int vmcs_getreg(struct vmcs *vmcs, int running, int ident, uint64_t *rv); 51int vmcs_setreg(struct vmcs *vmcs, int running, int ident, uint64_t val); 52int vmcs_getdesc(struct vmcs *vmcs, int running, int ident, 53 struct seg_desc *desc); 54int vmcs_setdesc(struct vmcs *vmcs, int running, int ident, 55 struct seg_desc *desc); 56 | 1/*- 2 * Copyright (c) 2011 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 40 unchanged lines hidden (view full) --- 49int vmcs_init(struct vmcs *vmcs); 50int vmcs_getreg(struct vmcs *vmcs, int running, int ident, uint64_t *rv); 51int vmcs_setreg(struct vmcs *vmcs, int running, int ident, uint64_t val); 52int vmcs_getdesc(struct vmcs *vmcs, int running, int ident, 53 struct seg_desc *desc); 54int vmcs_setdesc(struct vmcs *vmcs, int running, int ident, 55 struct seg_desc *desc); 56 |
57/* 58 * Avoid header pollution caused by inline use of 'vtophys()' in vmx_cpufunc.h 59 */ 60#ifdef _VMX_CPUFUNC_H_ |
|
57static __inline uint64_t 58vmcs_read(uint32_t encoding) 59{ 60 int error; 61 uint64_t val; 62 63 error = vmread(encoding, &val); 64 KASSERT(error == 0, ("vmcs_read(%u) error %d", encoding, error)); 65 return (val); 66} 67 68static __inline void 69vmcs_write(uint32_t encoding, uint64_t val) 70{ 71 int error; 72 73 error = vmwrite(encoding, val); 74 KASSERT(error == 0, ("vmcs_write(%u) error %d", encoding, error)); 75} | 61static __inline uint64_t 62vmcs_read(uint32_t encoding) 63{ 64 int error; 65 uint64_t val; 66 67 error = vmread(encoding, &val); 68 KASSERT(error == 0, ("vmcs_read(%u) error %d", encoding, error)); 69 return (val); 70} 71 72static __inline void 73vmcs_write(uint32_t encoding, uint64_t val) 74{ 75 int error; 76 77 error = vmwrite(encoding, val); 78 KASSERT(error == 0, ("vmcs_write(%u) error %d", encoding, error)); 79} |
80#endif /* _VMX_CPUFUNC_H_ */ |
|
76 77#define vmexit_instruction_length() vmcs_read(VMCS_EXIT_INSTRUCTION_LENGTH) 78#define vmcs_guest_rip() vmcs_read(VMCS_GUEST_RIP) 79#define vmcs_instruction_error() vmcs_read(VMCS_INSTRUCTION_ERROR) 80#define vmcs_exit_reason() (vmcs_read(VMCS_EXIT_REASON) & 0xffff) 81#define vmcs_exit_qualification() vmcs_read(VMCS_EXIT_QUALIFICATION) 82#define vmcs_guest_cr3() vmcs_read(VMCS_GUEST_CR3) 83#define vmcs_gpa() vmcs_read(VMCS_GUEST_PHYSICAL_ADDRESS) --- 313 unchanged lines hidden --- | 81 82#define vmexit_instruction_length() vmcs_read(VMCS_EXIT_INSTRUCTION_LENGTH) 83#define vmcs_guest_rip() vmcs_read(VMCS_GUEST_RIP) 84#define vmcs_instruction_error() vmcs_read(VMCS_INSTRUCTION_ERROR) 85#define vmcs_exit_reason() (vmcs_read(VMCS_EXIT_REASON) & 0xffff) 86#define vmcs_exit_qualification() vmcs_read(VMCS_EXIT_QUALIFICATION) 87#define vmcs_guest_cr3() vmcs_read(VMCS_GUEST_CR3) 88#define vmcs_gpa() vmcs_read(VMCS_GUEST_PHYSICAL_ADDRESS) --- 313 unchanged lines hidden --- |