VirtualBox

source: vbox/trunk/src/VBox/VMM/include/VMMSwitcher.h@ 45865

Last change on this file since 45865 was 45701, checked in by vboxsync, 12 years ago

VMM: SELM and VMM early HM init changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1/* $Id: VMMSwitcher.h 45701 2013-04-24 14:21:09Z vboxsync $ */
2/** @file
3 * VMM - World Switchers.
4 */
5
6/*
7 * Copyright (C) 2006-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___VMMSwitcher_h
19#define ___VMMSwitcher_h
20
21#include <VBox/vmm/vmm.h>
22
23/** @name Fixup Types.
24 * @{
25 */
26/** @todo document what arguments these take and what they do. */
27#define FIX_HC_2_GC_NEAR_REL 1
28#define FIX_HC_2_ID_NEAR_REL 2
29#define FIX_GC_2_HC_NEAR_REL 3
30#define FIX_GC_2_ID_NEAR_REL 4
31#define FIX_ID_2_HC_NEAR_REL 5
32#define FIX_ID_2_GC_NEAR_REL 6
33#define FIX_GC_FAR32 7
34#define FIX_GC_CPUM_OFF 8
35#define FIX_GC_VM_OFF 9 /** @todo cleanup fixup names GC->RC, HC->R0. */
36#define FIX_HC_CPUM_OFF 10
37#define FIX_HC_VM_OFF 11
38#define FIX_INTER_32BIT_CR3 12
39#define FIX_INTER_PAE_CR3 13
40#define FIX_INTER_AMD64_CR3 14
41#define FIX_HYPER_CS 18
42#define FIX_HYPER_DS 19
43#define FIX_HYPER_TSS 20
44#define FIX_GC_TSS_GDTE_DW2 21
45#define FIX_NO_FXSAVE_JMP 24
46#define FIX_NO_SYSENTER_JMP 25
47#define FIX_NO_SYSCALL_JMP 26
48#define FIX_HC_32BIT 27
49#define FIX_HC_64BIT 28
50#define FIX_HC_64BIT_CPUM 29
51#define FIX_HC_64BIT_CS 30
52#define FIX_ID_32BIT 31
53#define FIX_ID_64BIT 32
54#define FIX_ID_FAR32_TO_64BIT_MODE 33
55#define FIX_GC_APIC_BASE_32BIT 34
56#define FIX_HC_64BIT_NOCHECK 35
57#define FIX_GC_64_BIT_CPUM_OFF 36
58#define FIX_GC_CPUMCPU_OFF 37
59#define FIX_EFER_OR_MASK 38
60#define FIX_THE_END 255
61/** @} */
62
63
64/** Pointer to a switcher definition. */
65typedef struct VMMSWITCHERDEF *PVMMSWITCHERDEF;
66
67/**
68 * Callback function for relocating the core code belonging to a switcher.
69 *
70 * @param pVM Pointer to the VM.
71 * @param pSwitcher Pointer to the switcher structure.
72 * @param R0PtrCode Pointer to the first code byte in the ring-0 mapping.
73 * @param pu8CodeR3 Pointer to the first code byte in the ring-3 mapping.
74 * @param GCPtrCode The GC address of the first code byte.
75 * @param u32IDCode The address of the identity mapped code (first byte).
76 */
77typedef DECLCALLBACK(void) FNVMMSWITCHERRELOCATE(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3,
78 RTGCPTR GCPtrCode, uint32_t u32IDCode);
79/** Pointer to a FNVMMSWITCHERRELOCATE(). */
80typedef FNVMMSWITCHERRELOCATE *PFNVMMSWITCHERRELOCATE;
81
82/**
83 * VMM Switcher structure.
84 */
85#pragma pack(1)
86typedef struct VMMSWITCHERDEF
87{
88 /** Pointer to the code. */
89 void *pvCode;
90 /** Pointer to the fixup records. */
91 void *pvFixups;
92 /** Pointer to the description. */
93 const char *pszDesc;
94 /** Function which performs the necessary relocations. */
95 PFNVMMSWITCHERRELOCATE pfnRelocate;
96 /** The switcher type. */
97 VMMSWITCHER enmType;
98 /** Size of the entire code chunk. */
99 uint32_t cbCode;
100 /** vmmR0ToRawMode C entrypoint. */
101 uint32_t offR0ToRawMode;
102 /** vmmRCToHost C entrypoint. */
103 uint32_t offRCToHost;
104 /** vmmRCCallTrampoline address. */
105 uint32_t offRCCallTrampoline;
106 /** vmmRCToHostAsm - Assembly language entry point for switching from raw-mode
107 * context to host-context. This saves the RC register context. */
108 uint32_t offRCToHostAsm;
109 /** vmmRCToHostNoReturn - Assembly language entry point for switching from
110 * raw-mode context to host-context. This does not save any RC register
111 * context and expects the caller to have done that already. */
112 uint32_t offRCToHostAsmNoReturn;
113 /** @name Disassembly Regions.
114 * @{ */
115 uint32_t offHCCode0;
116 uint32_t cbHCCode0;
117 uint32_t offHCCode1;
118 uint32_t cbHCCode1;
119 uint32_t offIDCode0;
120 uint32_t cbIDCode0;
121 uint32_t offIDCode1;
122 uint32_t cbIDCode1;
123 uint32_t offGCCode;
124 uint32_t cbGCCode;
125 /** @} */
126} VMMSWITCHERDEF;
127#pragma pack()
128
129RT_C_DECLS_BEGIN
130extern VMMSWITCHERDEF vmmR3SwitcherX86Stub_Def;
131extern VMMSWITCHERDEF vmmR3Switcher32BitTo32Bit_Def;
132extern VMMSWITCHERDEF vmmR3Switcher32BitToPAE_Def;
133extern VMMSWITCHERDEF vmmR3Switcher32BitToAMD64_Def;
134extern VMMSWITCHERDEF vmmR3SwitcherPAETo32Bit_Def;
135extern VMMSWITCHERDEF vmmR3SwitcherPAEToPAE_Def;
136extern VMMSWITCHERDEF vmmR3SwitcherPAEToAMD64_Def;
137extern VMMSWITCHERDEF vmmR3SwitcherAMD64Stub_Def;
138extern VMMSWITCHERDEF vmmR3SwitcherAMD64To32Bit_Def;
139extern VMMSWITCHERDEF vmmR3SwitcherAMD64ToPAE_Def;
140extern VMMSWITCHERDEF vmmR3SwitcherAMD64ToAMD64_Def;
141
142extern DECLCALLBACK(void) vmmR3Switcher32BitTo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
143extern DECLCALLBACK(void) vmmR3Switcher32BitToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
144extern DECLCALLBACK(void) vmmR3Switcher32BitToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
145extern DECLCALLBACK(void) vmmR3SwitcherPAETo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
146extern DECLCALLBACK(void) vmmR3SwitcherPAEToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
147extern DECLCALLBACK(void) vmmR3SwitcherPAEToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
148extern DECLCALLBACK(void) vmmR3SwitcherAMD64To32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
149extern DECLCALLBACK(void) vmmR3SwitcherAMD64ToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
150extern DECLCALLBACK(void) vmmR3SwitcherAMD64ToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, RTR0PTR R0PtrCode, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
151RT_C_DECLS_END
152
153#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette