vmcb.h (249130) | vmcb.h (249353) |
---|---|
1/*- 2 * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h 249130 2013-04-05 06:55:19Z neel $ | 26 * $FreeBSD: projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h 249353 2013-04-11 06:52:19Z neel $ |
27 */ 28 29#ifndef _VMCB_H_ 30#define _VMCB_H_ 31 | 27 */ 28 29#ifndef _VMCB_H_ 30#define _VMCB_H_ 31 |
32#ifndef BIT 33#define BIT(bitpos) (1UL << (bitpos)) 34#endif 35 36#ifndef ERR 37#define ERR(...) 38#endif 39 |
|
32/* 33 * Secure Virtual Machine: AMD64 Programmer's Manual Vol2, Chapter 15 34 * Layout of VMCB: AMD64 Programmer's Manual Vol2, Appendix B 35 */ 36 37/* VMCB Control offset 0xC */ 38#define VMCB_INTCPT_INTR BIT(0) 39#define VMCB_INTCPT_NMI BIT(1) --- 222 unchanged lines hidden (view full) --- 262 263struct vmcb { 264 struct vmcb_ctrl ctrl; 265 struct vmcb_state state; 266} __attribute__ ((__packed__)); 267CTASSERT(sizeof(struct vmcb) == PAGE_SIZE); 268CTASSERT(offsetof(struct vmcb, state) == 0x400); 269 | 40/* 41 * Secure Virtual Machine: AMD64 Programmer's Manual Vol2, Chapter 15 42 * Layout of VMCB: AMD64 Programmer's Manual Vol2, Appendix B 43 */ 44 45/* VMCB Control offset 0xC */ 46#define VMCB_INTCPT_INTR BIT(0) 47#define VMCB_INTCPT_NMI BIT(1) --- 222 unchanged lines hidden (view full) --- 270 271struct vmcb { 272 struct vmcb_ctrl ctrl; 273 struct vmcb_state state; 274} __attribute__ ((__packed__)); 275CTASSERT(sizeof(struct vmcb) == PAGE_SIZE); 276CTASSERT(offsetof(struct vmcb, state) == 0x400); 277 |
278int svm_init_vmcb(struct vmcb *vmcb, uint64_t iopm_base_pa, 279 uint64_t msrpm_base_pa, uint64_t np_pml4); 280int svm_set_vmcb(struct vmcb *vmcb, uint8_t asid); 281int vmcb_read(struct vmcb *vmcb, int ident, uint64_t *retval); 282int vmcb_write(struct vmcb *vmcb, int ident, uint64_t val); 283struct vmcb_segment *vmcb_seg(struct vmcb *vmcb, int type); 284int vmcb_eventinject(struct vmcb_ctrl *ctrl, int type, int vector, 285 uint32_t error, boolean_t ec_valid); 286 |
|
270#endif /* _VMCB_H_ */ | 287#endif /* _VMCB_H_ */ |