1b18ac2d8SNeel Natu /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3ebc3c37cSMarcelo Araujo * 4b18ac2d8SNeel Natu * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) 5b18ac2d8SNeel Natu * All rights reserved. 6b18ac2d8SNeel Natu * 7b18ac2d8SNeel Natu * Redistribution and use in source and binary forms, with or without 8b18ac2d8SNeel Natu * modification, are permitted provided that the following conditions 9b18ac2d8SNeel Natu * are met: 10b18ac2d8SNeel Natu * 1. Redistributions of source code must retain the above copyright 11b18ac2d8SNeel Natu * notice unmodified, this list of conditions, and the following 12b18ac2d8SNeel Natu * disclaimer. 13b18ac2d8SNeel Natu * 2. Redistributions in binary form must reproduce the above copyright 14b18ac2d8SNeel Natu * notice, this list of conditions and the following disclaimer in the 15b18ac2d8SNeel Natu * documentation and/or other materials provided with the distribution. 16b18ac2d8SNeel Natu * 17b18ac2d8SNeel Natu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18b18ac2d8SNeel Natu * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19b18ac2d8SNeel Natu * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20b18ac2d8SNeel Natu * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21b18ac2d8SNeel Natu * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22b18ac2d8SNeel Natu * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23b18ac2d8SNeel Natu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24b18ac2d8SNeel Natu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25b18ac2d8SNeel Natu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26b18ac2d8SNeel Natu * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27b18ac2d8SNeel Natu */ 28b18ac2d8SNeel Natu 29b18ac2d8SNeel Natu #ifndef _SVM_H_ 30b18ac2d8SNeel Natu #define _SVM_H_ 31b18ac2d8SNeel Natu 3290e528f8SNeel Natu struct pcpu; 33483d953aSJohn Baldwin struct svm_softc; 341aa51504SJohn Baldwin struct svm_vcpu; 3590e528f8SNeel Natu 36b18ac2d8SNeel Natu /* 3730571674SNeel Natu * Guest register state that is saved outside the VMCB. 38b18ac2d8SNeel Natu */ 3930571674SNeel Natu struct svm_regctx { 4030571674SNeel Natu register_t sctx_rbp; 4130571674SNeel Natu register_t sctx_rbx; 4230571674SNeel Natu register_t sctx_rcx; 43b18ac2d8SNeel Natu register_t sctx_rdx; 44b18ac2d8SNeel Natu register_t sctx_rdi; 45b18ac2d8SNeel Natu register_t sctx_rsi; 46b18ac2d8SNeel Natu register_t sctx_r8; 47b18ac2d8SNeel Natu register_t sctx_r9; 48b18ac2d8SNeel Natu register_t sctx_r10; 49b18ac2d8SNeel Natu register_t sctx_r11; 50b18ac2d8SNeel Natu register_t sctx_r12; 51b18ac2d8SNeel Natu register_t sctx_r13; 52b18ac2d8SNeel Natu register_t sctx_r14; 53b18ac2d8SNeel Natu register_t sctx_r15; 5465eefbe4SJohn Baldwin register_t sctx_dr0; 5565eefbe4SJohn Baldwin register_t sctx_dr1; 5665eefbe4SJohn Baldwin register_t sctx_dr2; 5765eefbe4SJohn Baldwin register_t sctx_dr3; 5865eefbe4SJohn Baldwin 5965eefbe4SJohn Baldwin register_t host_dr0; 6065eefbe4SJohn Baldwin register_t host_dr1; 6165eefbe4SJohn Baldwin register_t host_dr2; 6265eefbe4SJohn Baldwin register_t host_dr3; 6365eefbe4SJohn Baldwin register_t host_dr6; 6465eefbe4SJohn Baldwin register_t host_dr7; 6565eefbe4SJohn Baldwin uint64_t host_debugctl; 66b18ac2d8SNeel Natu }; 67b18ac2d8SNeel Natu 6890e528f8SNeel Natu void svm_launch(uint64_t pa, struct svm_regctx *gctx, struct pcpu *pcpu); 69483d953aSJohn Baldwin #ifdef BHYVE_SNAPSHOT 7080cb5d84SJohn Baldwin void svm_set_tsc_offset(struct svm_vcpu *vcpu, uint64_t offset); 71483d953aSJohn Baldwin #endif 72b18ac2d8SNeel Natu 73b18ac2d8SNeel Natu #endif /* _SVM_H_ */ 74