/* $Id$ */
/** @file
* VMM - World Switchers.
*/
/*
* Copyright (C) 2006-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VMMSwitcher_h
#define ___VMMSwitcher_h
/** @name Fixup Types.
* @{
*/
/** @todo document what arguments these take and what they do. */
/*#define FIX_NO_FXSAVE_JMP 24 - reusable */
/** @} */
/** Pointer to a switcher definition. */
/**
* Callback function for relocating the core code belonging to a switcher.
*
* @param pVM Pointer to the VM.
* @param pSwitcher Pointer to the switcher structure.
* @param R0PtrCode Pointer to the first code byte in the ring-0 mapping.
* @param pu8CodeR3 Pointer to the first code byte in the ring-3 mapping.
* @param GCPtrCode The GC address of the first code byte.
* @param u32IDCode The address of the identity mapped code (first byte).
*/
typedef DECLCALLBACK(void) FNVMMSWITCHERRELOCATE(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3,
/** Pointer to a FNVMMSWITCHERRELOCATE(). */
/**
* VMM Switcher structure.
*/
#pragma pack(1)
typedef struct VMMSWITCHERDEF
{
/** Pointer to the code. */
void *pvCode;
/** Pointer to the fixup records. */
void *pvFixups;
/** Pointer to the description. */
const char *pszDesc;
/** Function which performs the necessary relocations. */
/** The switcher type. */
/** Size of the entire code chunk. */
/** vmmR0ToRawMode C entrypoint. */
/** vmmRCToHost C entrypoint. */
/** vmmRCCallTrampoline address. */
/** vmmRCToHostAsm - Assembly language entry point for switching from raw-mode
* context to host-context. This saves the RC register context. */
/** vmmRCToHostNoReturn - Assembly language entry point for switching from
* raw-mode context to host-context. This does not save any RC register
* context and expects the caller to have done that already. */
/** @name Disassembly Regions.
* @{ */
/** @} */
#pragma pack()
extern DECLCALLBACK(void) vmmR3Switcher32BitTo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3Switcher32BitToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3Switcher32BitToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3SwitcherPAETo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3SwitcherPAEToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3SwitcherPAEToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3SwitcherAMD64To32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3SwitcherAMD64ToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
extern DECLCALLBACK(void) vmmR3SwitcherAMD64ToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
#endif