VirtualBox

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

Last change on this file since 1349 was 1283, checked in by vboxsync, 18 years ago

Added support for the hybrid darwin setup where the kernel is 32-bit but the cpu *might* be running in 64-bit mode.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.2 KB
Line 
1/* $Id: VMMSwitcher.h 1283 2007-03-07 00:02:11Z vboxsync $ */
2/** @file
3 * VMM - World Switchers.
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22
23#ifndef __VMMSwitcher_h__
24#define __VMMSwitcher_h__
25
26#include <VBox/vmm.h>
27
28/** @name Fixup Types.
29 * @{
30 */
31/** @todo document what arguments these take and what they do. */
32#define FIX_HC_2_GC_NEAR_REL 1
33#define FIX_HC_2_ID_NEAR_REL 2
34#define FIX_GC_2_HC_NEAR_REL 3
35#define FIX_GC_2_ID_NEAR_REL 4
36#define FIX_ID_2_HC_NEAR_REL 5
37#define FIX_ID_2_GC_NEAR_REL 6
38#define FIX_GC_FAR32 7
39#define FIX_GC_CPUM_OFF 8
40#define FIX_GC_VM_OFF 9
41#define FIX_HC_CPUM_OFF 10
42#define FIX_HC_VM_OFF 11
43#define FIX_INTER_32BIT_CR3 12
44#define FIX_INTER_PAE_CR3 13
45#define FIX_INTER_AMD64_CR3 14
46#define FIX_HYPER_32BIT_CR3 15
47#define FIX_HYPER_PAE_CR3 16
48#define FIX_HYPER_AMD64_CR3 17
49#define FIX_HYPER_CS 18
50#define FIX_HYPER_DS 19
51#define FIX_HYPER_TSS 20
52#define FIX_GC_TSS_GDTE_DW2 21
53#define FIX_CR4_MASK 22
54#define FIX_CR4_OSFSXR 23
55#define FIX_NO_FXSAVE_JMP 24
56#define FIX_NO_SYSENTER_JMP 25
57#define FIX_NO_SYSCALL_JMP 26
58#define FIX_HC_32BIT 27
59#define FIX_HC_64BIT 28
60#define FIX_HC_64BIT_CPUM 29
61#define FIX_HC_64BIT_CS 30
62#define FIX_ID_32BIT 31
63#define FIX_ID_64BIT 32
64#define FIX_ID_FAR32_TO_64BIT_MODE 33
65#define FIX_GC_APIC_BASE_32BIT 34
66#define FIX_THE_END 255
67/** @} */
68
69
70/** Pointer to a switcher definition. */
71typedef struct VMMSWITCHERDEF *PVMMSWITCHERDEF;
72
73/**
74 * Callback function for relocating the core code belonging to a switcher.
75 *
76 * @param pVM VM handle.
77 * @param pSwitcher Pointer to the switcher structure.
78 * @param pu8CodeR0 Pointer to the first code byte in the ring-0 mapping.
79 * @param pu8CodeR3 Pointer to the first code byte in the ring-3 mapping.
80 * @param GCPtrCode The GC address of the first code byte.
81 * @param u32IDCode The address of the identity mapped code (first byte).
82 */
83typedef DECLCALLBACK(void) FNVMMSWITCHERRELOCATE(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3,
84 RTGCPTR GCPtrCode, uint32_t u32IDCode);
85/** Pointer to a FNVMMSWITCHERRELOCATE(). */
86typedef FNVMMSWITCHERRELOCATE *PFNVMMSWITCHERRELOCATE;
87
88/**
89 * VMM Switcher structure.
90 */
91#pragma pack(1)
92typedef struct VMMSWITCHERDEF
93{
94 /** Pointer to the code. */
95 void *pvCode;
96 /** Pointer to the fixup records. */
97 void *pvFixups;
98 /** Pointer to the description. */
99 const char *pszDesc;
100 /** Function which performs the necessary relocations. */
101 PFNVMMSWITCHERRELOCATE pfnRelocate;
102 /** The switcher type. */
103 VMMSWITCHER enmType;
104 /** Size of the entire code chunk. */
105 uint32_t cbCode;
106 /** vmmR0HostToGuest C entrypoint. */
107 uint32_t offR0HostToGuest;
108 /** vmmGCGuestToHost C entrypoint. */
109 uint32_t offGCGuestToHost;
110 /** vmmGCCallTrampoline address. */
111 uint32_t offGCCallTrampoline;
112 /** vmmGCGuestToHostAsm assembly entrypoint. */
113 uint32_t offGCGuestToHostAsm;
114 /** vmmGCGuestToHostAsmHyperCtx assembly entrypoint taking HyperCtx. */
115 uint32_t offGCGuestToHostAsmHyperCtx;
116 /** vmmGCGuestToHostAsmGuestCtx assembly entrypoint taking GuestCtx. */
117 uint32_t offGCGuestToHostAsmGuestCtx;
118 /** @name Disassembly Regions.
119 * @{ */
120 uint32_t offHCCode0;
121 uint32_t cbHCCode0;
122 uint32_t offHCCode1;
123 uint32_t cbHCCode1;
124 uint32_t offIDCode0;
125 uint32_t cbIDCode0;
126 uint32_t offIDCode1;
127 uint32_t cbIDCode1;
128 uint32_t offGCCode;
129 uint32_t cbGCCode;
130 /** @} */
131} VMMSWITCHERDEF;
132#pragma pack()
133
134__BEGIN_DECLS
135extern VMMSWITCHERDEF vmmR3Switcher32BitTo32Bit_Def;
136extern VMMSWITCHERDEF vmmR3Switcher32BitToPAE_Def;
137extern VMMSWITCHERDEF vmmR3Switcher32BitToAMD64_Def;
138extern VMMSWITCHERDEF vmmR3SwitcherPAETo32Bit_Def;
139extern VMMSWITCHERDEF vmmR3SwitcherPAEToPAE_Def;
140extern VMMSWITCHERDEF vmmR3SwitcherPAEToAMD64_Def;
141extern VMMSWITCHERDEF vmmR3SwitcherAMD64ToPAE_Def;
142extern VMMSWITCHERDEF vmmR3SwitcherAMD64ToAMD64_Def;
143
144extern DECLCALLBACK(void) vmmR3Switcher32BitTo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
145extern DECLCALLBACK(void) vmmR3Switcher32BitToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
146extern DECLCALLBACK(void) vmmR3Switcher32BitToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
147extern DECLCALLBACK(void) vmmR3SwitcherPAETo32Bit_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
148extern DECLCALLBACK(void) vmmR3SwitcherPAEToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
149extern DECLCALLBACK(void) vmmR3SwitcherPAEToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
150extern DECLCALLBACK(void) vmmR3SwitcherAMD64ToPAE_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
151extern DECLCALLBACK(void) vmmR3SwitcherAMD64ToAMD64_Relocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pu8CodeR0, uint8_t *pu8CodeR3, RTGCPTR GCPtrCode, uint32_t u32IdCode);
152__END_DECLS
153
154#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