VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmapi.h@ 52664

Last change on this file since 52664 was 49549, checked in by vboxsync, 11 years ago

VMM/CPUM/MSRs: when returning the APIC base, don't rely upon the CPUID feature bits but check if a Local APIC is present

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Core API.
3 *
4 * The 'Core API' has been put in a different header because everyone
5 * is currently including pdm.h. So, pdm.h is for including all of the
6 * PDM stuff, while pdmapi.h is for the core stuff.
7 */
8
9/*
10 * Copyright (C) 2006-2013 Oracle Corporation
11 *
12 * This file is part of VirtualBox Open Source Edition (OSE), as
13 * available from http://www.virtualbox.org. This file is free software;
14 * you can redistribute it and/or modify it under the terms of the GNU
15 * General Public License (GPL) as published by the Free Software
16 * Foundation, in version 2 as it comes in the "COPYING" file of the
17 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19 *
20 * The contents of this file may alternatively be used under the terms
21 * of the Common Development and Distribution License Version 1.0
22 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
23 * VirtualBox OSE distribution, in which case the provisions of the
24 * CDDL are applicable instead of those of the GPL.
25 *
26 * You may elect to license modified versions of this file under the
27 * terms and conditions of either the GPL or the CDDL or both.
28 */
29
30#ifndef ___VBox_vmm_pdmapi_h
31#define ___VBox_vmm_pdmapi_h
32
33#include <VBox/vmm/pdmcommon.h>
34#include <VBox/sup.h>
35
36
37RT_C_DECLS_BEGIN
38
39/** @defgroup grp_pdm The Pluggable Device Manager API
40 * @{
41 */
42
43VMMDECL(int) PDMGetInterrupt(PVMCPU pVCpu, uint8_t *pu8Interrupt);
44VMMDECL(int) PDMIsaSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
45VMM_INT_DECL(bool) PDMHasIoApic(PVM pVM);
46VMM_INT_DECL(int) PDMIoApicSetIrq(PVM pVM, uint8_t u8Irq, uint8_t u8Level, uint32_t uTagSrc);
47VMM_INT_DECL(int) PDMIoApicSendMsi(PVM pVM, RTGCPHYS GCAddr, uint32_t uValue, uint32_t uTagSrc);
48VMM_INT_DECL(bool) PDMHasApic(PVM pVM);
49VMM_INT_DECL(int) PDMApicHasPendingIrq(PVM pVM, bool *pfPending);
50VMMDECL(int) PDMApicSetBase(PVMCPU pVCpu, uint64_t u64Base);
51VMMDECL(int) PDMApicGetBase(PVMCPU pVCpu, uint64_t *pu64Base);
52VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR);
53VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIrq);
54VMM_INT_DECL(int) PDMApicWriteMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t u64Value);
55VMM_INT_DECL(int) PDMApicReadMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t *pu64Value);
56VMM_INT_DECL(int) PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys);
57VMM_INT_DECL(bool) PDMVmmDevHeapIsEnabled(PVM pVM);
58
59
60/** @defgroup grp_pdm_r3 The PDM Host Context Ring-3 API
61 * @ingroup grp_pdm
62 * @{
63 */
64
65VMMR3_INT_DECL(int) PDMR3InitUVM(PUVM pUVM);
66VMMR3_INT_DECL(int) PDMR3LdrLoadVMMR0U(PUVM pUVM);
67VMMR3_INT_DECL(int) PDMR3Init(PVM pVM);
68VMMR3DECL(void) PDMR3PowerOn(PVM pVM);
69VMMR3_INT_DECL(void) PDMR3ResetCpu(PVMCPU pVCpu);
70VMMR3_INT_DECL(void) PDMR3Reset(PVM pVM);
71VMMR3_INT_DECL(void) PDMR3MemSetup(PVM pVM, bool fAtReset);
72VMMR3_INT_DECL(void) PDMR3Suspend(PVM pVM);
73VMMR3_INT_DECL(void) PDMR3Resume(PVM pVM);
74VMMR3DECL(void) PDMR3PowerOff(PVM pVM);
75VMMR3_INT_DECL(void) PDMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
76VMMR3_INT_DECL(int) PDMR3Term(PVM pVM);
77VMMR3_INT_DECL(void) PDMR3TermUVM(PUVM pUVM);
78
79/** PDM loader context indicator. */
80typedef enum PDMLDRCTX
81{
82 /** Invalid zero value. */
83 PDMLDRCTX_INVALID = 0,
84 /** Ring-0 context. */
85 PDMLDRCTX_RING_0,
86 /** Ring-3 context. */
87 PDMLDRCTX_RING_3,
88 /** Raw-mode context. */
89 PDMLDRCTX_RAW_MODE,
90 /** End of valid context values. */
91 PDMLDRCTX_END,
92 /** 32-bit type hack. */
93 PDMLDRCTX_32BIT_HACK = 0x7fffffff
94} PDMLDRCTX;
95
96/**
97 * Module enumeration callback function.
98 *
99 * @returns VBox status.
100 * Failure will stop the search and return the return code.
101 * Warnings will be ignored and not returned.
102 * @param pVM VM Handle.
103 * @param pszFilename Module filename.
104 * @param pszName Module name. (short and unique)
105 * @param ImageBase Address where to executable image is loaded.
106 * @param cbImage Size of the executable image.
107 * @param enmCtx The context the module is loaded into.
108 * @param pvArg User argument.
109 */
110typedef DECLCALLBACK(int) FNPDMR3ENUM(PVM pVM, const char *pszFilename, const char *pszName,
111 RTUINTPTR ImageBase, size_t cbImage, PDMLDRCTX enmCtx, void *pvArg);
112/** Pointer to a FNPDMR3ENUM() function. */
113typedef FNPDMR3ENUM *PFNPDMR3ENUM;
114VMMR3DECL(int) PDMR3LdrEnumModules(PVM pVM, PFNPDMR3ENUM pfnCallback, void *pvArg);
115VMMR3_INT_DECL(void) PDMR3LdrRelocateU(PUVM pUVM, RTGCINTPTR offDelta);
116VMMR3_INT_DECL(int) PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const char *pszSymbol, void **ppvValue);
117VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *pszSymbol, PRTR0PTR ppvValue);
118VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol, PRTR0PTR ppvValue);
119VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszName);
120VMMR3DECL(int) PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *pszSymbol, PRTRCPTR pRCPtrValue);
121VMMR3DECL(int) PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, const char *pszSearchPath, const char *pszSymbol,
122 PRTRCPTR pRCPtrValue);
123VMMR3_INT_DECL(int) PDMR3LdrQueryRCModFromPC(PVM pVM, RTRCPTR uPC,
124 char *pszModName, size_t cchModName, PRTRCPTR pMod,
125 char *pszNearSym1, size_t cchNearSym1, PRTRCPTR pNearSym1,
126 char *pszNearSym2, size_t cchNearSym2, PRTRCPTR pNearSym2);
127VMMR3_INT_DECL(int) PDMR3LdrQueryR0ModFromPC(PVM pVM, RTR0PTR uPC,
128 char *pszModName, size_t cchModName, PRTR0PTR pMod,
129 char *pszNearSym1, size_t cchNearSym1, PRTR0PTR pNearSym1,
130 char *pszNearSym2, size_t cchNearSym2, PRTR0PTR pNearSym2);
131VMMR3_INT_DECL(int) PDMR3LdrGetInterfaceSymbols(PVM pVM, void *pvInterface, size_t cbInterface,
132 const char *pszModule, const char *pszSearchPath,
133 const char *pszSymPrefix, const char *pszSymList,
134 bool fRing0OrRC);
135
136VMMR3DECL(int) PDMR3QueryDevice(PUVM pUVM, const char *pszDevice, unsigned iInstance, PPPDMIBASE ppBase);
137VMMR3DECL(int) PDMR3QueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
138VMMR3DECL(int) PDMR3QueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMIBASE ppBase);
139VMMR3DECL(int) PDMR3QueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
140 const char *pszDriver, PPPDMIBASE ppBase);
141VMMR3DECL(int) PDMR3DeviceAttach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags,
142 PPDMIBASE *ppBase);
143VMMR3DECL(int) PDMR3DeviceDetach(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
144VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns);
145VMMR3DECL(int) PDMR3DriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
146 PPPDMIBASE ppBase);
147VMMR3DECL(int) PDMR3DriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
148 const char *pszDriver, unsigned iOccurance, uint32_t fFlags);
149VMMR3DECL(int) PDMR3DriverReattach(PUVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
150 const char *pszDriver, unsigned iOccurance, uint32_t fFlags, PCFGMNODE pCfg,
151 PPPDMIBASE ppBase);
152VMMR3DECL(void) PDMR3DmaRun(PVM pVM);
153VMMR3_INT_DECL(int) PDMR3LockCall(PVM pVM);
154VMMR3_INT_DECL(int) PDMR3VmmDevHeapRegister(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize);
155VMMR3_INT_DECL(int) PDMR3VmmDevHeapUnregister(PVM pVM, RTGCPHYS GCPhys);
156VMMR3_INT_DECL(int) PDMR3VmmDevHeapAlloc(PVM pVM, size_t cbSize, RTR3PTR *ppv);
157VMMR3_INT_DECL(int) PDMR3VmmDevHeapFree(PVM pVM, RTR3PTR pv);
158VMMR3_INT_DECL(int) PDMR3TracingConfig(PVM pVM, const char *pszName, size_t cchName, bool fEnable, bool fApply);
159VMMR3_INT_DECL(bool) PDMR3TracingAreAll(PVM pVM, bool fEnabled);
160VMMR3_INT_DECL(int) PDMR3TracingQueryConfig(PVM pVM, char *pszConfig, size_t cbConfig);
161/** @} */
162
163
164
165/** @defgroup grp_pdm_rc The PDM Raw-Mode Context API
166 * @ingroup grp_pdm
167 * @{
168 */
169/** @} */
170
171
172
173/** @defgroup grp_pdm_r0 The PDM Ring-0 Context API
174 * @ingroup grp_pdm
175 * @{
176 */
177
178/**
179 * Request buffer for PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER.
180 * @see PDMR0DriverCallReqHandler.
181 */
182typedef struct PDMDRIVERCALLREQHANDLERREQ
183{
184 /** The header. */
185 SUPVMMR0REQHDR Hdr;
186 /** The driver instance. */
187 PPDMDRVINSR0 pDrvInsR0;
188 /** The operation. */
189 uint32_t uOperation;
190 /** Explicit alignment padding. */
191 uint32_t u32Alignment;
192 /** Optional 64-bit integer argument. */
193 uint64_t u64Arg;
194} PDMDRIVERCALLREQHANDLERREQ;
195/** Pointer to a PDMR0DriverCallReqHandler / VMMR0_DO_PDM_DRIVER_CALL_REQ_HANDLER
196 * request buffer. */
197typedef PDMDRIVERCALLREQHANDLERREQ *PPDMDRIVERCALLREQHANDLERREQ;
198
199VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq);
200
201/**
202 * Request buffer for PDMR0DeviceCallReqHandler / VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER.
203 * @see PDMR0DeviceCallReqHandler.
204 */
205typedef struct PDMDEVICECALLREQHANDLERREQ
206{
207 /** The header. */
208 SUPVMMR0REQHDR Hdr;
209 /** The device instance. */
210 PPDMDEVINSR0 pDevInsR0;
211 /** The request handler for the device. */
212 PFNPDMDEVREQHANDLERR0 pfnReqHandlerR0;
213 /** The operation. */
214 uint32_t uOperation;
215 /** Explicit alignment padding. */
216 uint32_t u32Alignment;
217 /** Optional 64-bit integer argument. */
218 uint64_t u64Arg;
219} PDMDEVICECALLREQHANDLERREQ;
220/** Pointer to a PDMR0DeviceCallReqHandler /
221 * VMMR0_DO_PDM_DEVICE_CALL_REQ_HANDLER request buffer. */
222typedef PDMDEVICECALLREQHANDLERREQ *PPDMDEVICECALLREQHANDLERREQ;
223
224VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq);
225
226/** @} */
227
228RT_C_DECLS_END
229
230/** @} */
231
232#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