hwaccm.h revision e17bd6c32a8dd64f2d42838f9028216465e2caf0
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * HWACCM - Intel/AMD VM Hardware Support Manager
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync * available from http://www.virtualbox.org. This file is free software;
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * General Public License (GPL) as published by the Free Software
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * The contents of this file may alternatively be used under the terms
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * of the Common Development and Distribution License Version 1.0
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * VirtualBox OSE distribution, in which case the provisions of the
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * CDDL are applicable instead of those of the GPL.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * You may elect to license modified versions of this file under the
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * terms and conditions of either the GPL or the CDDL or both.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * additional information or have any questions.
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync/** @defgroup grp_hwaccm The VM Hardware Manager API
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync * HWACCM state
4651430e55b9df9726347e3e3968618e540fe729vboxsync /* Not yet set */
4651430e55b9df9726347e3e3968618e540fe729vboxsync /* Enabled */
4651430e55b9df9726347e3e3968618e540fe729vboxsync /* Disabled */
4651430e55b9df9726347e3e3968618e540fe729vboxsync /** The usual 32-bit hack. */
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Query HWACCM state (enabled/disabled)
e07acfb7f2dbb8bb40804024c79fd3139bdb3f24vboxsync * @returns 0 - disabled, 1 - enabled
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Invalidates a guest page
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns VBox status code.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param GCVirt Page to invalidate
f2490dbf97c8247439446844458461b00e50beb0vboxsyncHWACCMDECL(int) HWACCMInvalidatePage(PVM pVM, RTGCPTR GCVirt);
f2490dbf97c8247439446844458461b00e50beb0vboxsync * Checks if an interrupt event is currently pending.
f2490dbf97c8247439446844458461b00e50beb0vboxsync * @returns Interrupt event pending state.
f2490dbf97c8247439446844458461b00e50beb0vboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Flushes the guest TLB
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns VBox status code.
ee5869bb73f07de9c139dc6a608836a7b5767933vboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Invalidates a guest page by physical address
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * NOTE: Assumes the current instruction references this physical page though a virtual address!!
e52c9984c4f6b8ea141bc50a3bdaf31941d8cd7dvboxsync * @returns VBox status code.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @param pVM The VM to operate on.
dc311b529996345ea65d51c87b60b6849642d894vboxsync * @param GCPhys Page to invalidate
dc311b529996345ea65d51c87b60b6849642d894vboxsyncHWACCMDECL(int) HWACCMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Checks if nested paging is enabled
c2029891dc7fbce0f08a378d0335568cf9cbb4c5vboxsync * @returns boolean
c2029891dc7fbce0f08a378d0335568cf9cbb4c5vboxsync * @param pVM The VM to operate on.
c2029891dc7fbce0f08a378d0335568cf9cbb4c5vboxsyncHWACCMDECL(bool) HWACCMIsNestedPagingActive(PVM pVM);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Return the shadow paging mode for nested paging/ept
482a222498aae619afda0255a7edf4ebda97268cvboxsync * @returns shadow paging mode
d19316699d7f91959d88c850fd7e0d64840f39a7vboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync/* Nop in GC */
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync/** @defgroup grp_hwaccm_r0 The VM Hardware Manager API
25c5ce7baf4b227ea80250c46d427d0e9fdab4c1vboxsync * @ingroup grp_hwaccm
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * Does global Ring-0 HWACCM initialization.
59d96bafa78f7257869e30b88f2f98142ef5928evboxsync * @returns VBox status code.
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync * Does global Ring-0 HWACCM termination.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @returns VBox status code.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * Does Ring-0 per VM HWACCM initialization.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * This is mainly to check that the Host CPU mode is compatible
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * with VMX or SVM.
6b9316bfe743cc7d2ee00d925f4ab455bc224e86vboxsync * @returns VBox status code.
b8ae33177906f4130b85b7c861cae0e78ed4859bvboxsync * @param pVM The VM to operate on.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * Does Ring-0 per VM HWACCM termination.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @returns VBox status code.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param pVM The VM to operate on.
badc6d0a88e64de11285f73127a7e1651b69a00bvboxsync * Sets up HWACCM on all cpus.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @returns VBox status code.
d5bf937d132098565e18a0d1fc408fb777c5e5b6vboxsync * @param pVM The VM to operate on.
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsync * @param enmNewHwAccmState New hwaccm state
d76ca6cbea4e45aa218c74e33c784bde5e997ffcvboxsyncHWACCMR0DECL(int) HWACCMR0EnableAllCpus(PVM pVM, HWACCMSTATE enmNewHwAccmState);
badc6d0a88e64de11285f73127a7e1651b69a00bvboxsync/** @defgroup grp_hwaccm_r3 The VM Hardware Manager API
21293ca6a2967f796ed30a6c8492911619476a48vboxsync * @ingroup grp_hwaccm
badc6d0a88e64de11285f73127a7e1651b69a00bvboxsync * Checks if internal events are pending
35d8d2372afb180daa0ba01af33a1922511d6b07vboxsync * @returns boolean
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param pVM The VM to operate on.
badc6d0a88e64de11285f73127a7e1651b69a00bvboxsync * Initializes the HWACCM.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @returns VBox status code.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @param pVM The VM to operate on.
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * Initialize VT-x or AMD-V
382dd16193dd5770e53a99d3e3f3bc4e96f1ddd8vboxsync * @returns VBox status code.
badc6d0a88e64de11285f73127a7e1651b69a00bvboxsync * @param pVM The VM handle.
025f9c7729f643fb8780153dc0e6f1c76baddd69vboxsync * Applies relocations to data and code managed by this
025f9c7729f643fb8780153dc0e6f1c76baddd69vboxsync * component. This function will be called at init and
6a801286d1ede5d68a7490a9cd2a6ba0634ff18avboxsync * whenever the VMM need to relocate it self inside the GC.
f2490dbf97c8247439446844458461b00e50beb0vboxsync * The HWACCM will update the addresses used by the switcher.
f2490dbf97c8247439446844458461b00e50beb0vboxsync * @param pVM The VM.
76f5d3db08b007661ae4af93200838d24683af52vboxsync * Terminates the VMXM.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Termination means cleaning up and freeing all resources,
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * the VM it self is at this point powered off or suspended.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync * @returns VBox status code.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync * @param pVM The VM to operate on.
fbf482cad760a830bc8789ad639162019954ba80vboxsync * VMXM reset callback.
2c1d8cd8efdd4c486ff681135035d24111b03af8vboxsync * @param pVM The VM which is reset.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Checks if we can currently use hardware accelerated raw mode.
c4d6c81bd0de216d0f42db2e477b1d788fbaefb4vboxsync * @returns boolean
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pVM The VM to operate on.
e07acfb7f2dbb8bb40804024c79fd3139bdb3f24vboxsync * @param pCtx Partial VM execution context
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncHWACCMR3DECL(bool) HWACCMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Checks if we are currently using hardware accelerated raw mode.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns boolean
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pVM The VM to operate on.
c7a378ed2fbad681c0b674351d698ef20a368935vboxsync * Checks if we are currently using nested paging.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns boolean
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsyncHWACCMR3DECL(bool) HWACCMR3IsNestedPagingActive(PVM pVM);
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Checks hardware accelerated raw mode is allowed.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync * @returns boolean
40becad9511726726c5959a8ad8b62fb3e1c020cvboxsync * @param pVM The VM to operate on.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * Notification callback which is called whenever there is a chance that a CR3
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * value might have changed.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * This is called by PGM.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * @param pVM The VM to operate on.
d07e901177d22a8f66c66f155c423a524ac07776vboxsync * @param enmShadowMode New paging mode.
f48fe310f85f13db0140bef980de1f56c2007957vboxsyncHWACCMR3DECL(void) HWACCMR3PagingModeChanged(PVM pVM, PGMMODE enmShadowMode);
611af5c9fc04865215e86b6e4906c9dfdfb6a381vboxsync/** @addtogroup grp_hwaccm_r0
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Sets up a VT-x or AMD-V session
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync * @returns VBox status code.
4831e82ecaa3c813398d2f343e9d38ee34a3acf4vboxsync * @param pVM The VM to operate on.
f9cac318205d74ee5b35dabcf2bd39118f6293d7vboxsync * Runs guest code in a VMX/SVM VM.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * @returns VBox status code.
f7c0f913c4c22ee18059ff97055442566d0f14a1vboxsync * @param pVM The VM to operate on.
8184f68cdef3c26869cdebc6a18829c854d0d17dvboxsync * Enters the VT-x or AMD-V session
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync * @returns VBox status code.
3221ae1f7bf53d9cccdd578099f55f782dba1447vboxsync * @param pVM The VM to operate on.