[1] | 1 | /** @file
|
---|
| 2 | * VMM - The Virtual Machine Monitor.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[2981] | 6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
[1] | 7 | *
|
---|
| 8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
[5999] | 11 | * General Public License (GPL) as published by the Free Software
|
---|
| 12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
| 15 | *
|
---|
| 16 | * The contents of this file may alternatively be used under the terms
|
---|
| 17 | * of the Common Development and Distribution License Version 1.0
|
---|
| 18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
| 19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
| 20 | * CDDL are applicable instead of those of the GPL.
|
---|
| 21 | *
|
---|
| 22 | * You may elect to license modified versions of this file under the
|
---|
| 23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[1] | 24 | */
|
---|
| 25 |
|
---|
[3632] | 26 | #ifndef ___VBox_vmm_h
|
---|
| 27 | #define ___VBox_vmm_h
|
---|
[1] | 28 |
|
---|
| 29 | #include <VBox/cdefs.h>
|
---|
| 30 | #include <VBox/types.h>
|
---|
| 31 | #include <VBox/vmapi.h>
|
---|
[4811] | 32 | #include <VBox/sup.h>
|
---|
[321] | 33 | #include <iprt/stdarg.h>
|
---|
[1] | 34 |
|
---|
| 35 | __BEGIN_DECLS
|
---|
| 36 |
|
---|
| 37 | /** @defgroup grp_vmm The Virtual Machine Monitor API
|
---|
| 38 | * @{
|
---|
| 39 | */
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * World switcher identifiers.
|
---|
| 43 | */
|
---|
| 44 | typedef enum VMMSWITCHER
|
---|
| 45 | {
|
---|
| 46 | /** The usual invalid 0. */
|
---|
| 47 | VMMSWITCHER_INVALID = 0,
|
---|
| 48 | /** Switcher for 32-bit host to 32-bit shadow paging. */
|
---|
| 49 | VMMSWITCHER_32_TO_32,
|
---|
| 50 | /** Switcher for 32-bit host paging to PAE shadow paging. */
|
---|
| 51 | VMMSWITCHER_32_TO_PAE,
|
---|
| 52 | /** Switcher for 32-bit host paging to AMD64 shadow paging. */
|
---|
| 53 | VMMSWITCHER_32_TO_AMD64,
|
---|
| 54 | /** Switcher for PAE host to 32-bit shadow paging. */
|
---|
| 55 | VMMSWITCHER_PAE_TO_32,
|
---|
| 56 | /** Switcher for PAE host to PAE shadow paging. */
|
---|
| 57 | VMMSWITCHER_PAE_TO_PAE,
|
---|
| 58 | /** Switcher for PAE host paging to AMD64 shadow paging. */
|
---|
| 59 | VMMSWITCHER_PAE_TO_AMD64,
|
---|
| 60 | /** Switcher for AMD64 host paging to PAE shadow paging. */
|
---|
| 61 | VMMSWITCHER_AMD64_TO_PAE,
|
---|
| 62 | /** Switcher for AMD64 host paging to AMD64 shadow paging. */
|
---|
| 63 | VMMSWITCHER_AMD64_TO_AMD64,
|
---|
| 64 | /** Used to make a count for array declarations and suchlike. */
|
---|
| 65 | VMMSWITCHER_MAX,
|
---|
| 66 | /** The usual 32-bit paranoia. */
|
---|
| 67 | VMMSWITCHER_32BIT_HACK = 0x7fffffff
|
---|
| 68 | } VMMSWITCHER;
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | /**
|
---|
| 72 | * VMMGCCallHost operations.
|
---|
| 73 | */
|
---|
| 74 | typedef enum VMMCALLHOST
|
---|
| 75 | {
|
---|
| 76 | /** Invalid operation. */
|
---|
| 77 | VMMCALLHOST_INVALID = 0,
|
---|
| 78 | /** Acquire the PDM lock. */
|
---|
| 79 | VMMCALLHOST_PDM_LOCK,
|
---|
| 80 | /** Call PDMR3QueueFlushWorker. */
|
---|
| 81 | VMMCALLHOST_PDM_QUEUE_FLUSH,
|
---|
| 82 | /** Acquire the PGM lock. */
|
---|
| 83 | VMMCALLHOST_PGM_LOCK,
|
---|
| 84 | /** Grow the PGM shadow page pool. */
|
---|
| 85 | VMMCALLHOST_PGM_POOL_GROW,
|
---|
[4689] | 86 | /** Maps a chunk into ring-3. */
|
---|
| 87 | VMMCALLHOST_PGM_MAP_CHUNK,
|
---|
[4738] | 88 | /** Allocates more handy pages. */
|
---|
| 89 | VMMCALLHOST_PGM_ALLOCATE_HANDY_PAGES,
|
---|
[6528] | 90 | #ifndef VBOX_WITH_NEW_PHYS_CODE
|
---|
[1] | 91 | /** Dynamically allocate physical guest RAM. */
|
---|
| 92 | VMMCALLHOST_PGM_RAM_GROW_RANGE,
|
---|
[4799] | 93 | #endif
|
---|
[1] | 94 | /** Replay the REM handler notifications. */
|
---|
| 95 | VMMCALLHOST_REM_REPLAY_HANDLER_NOTIFICATIONS,
|
---|
| 96 | /** Flush the GC/R0 logger. */
|
---|
| 97 | VMMCALLHOST_VMM_LOGGER_FLUSH,
|
---|
| 98 | /** Set the VM error message. */
|
---|
| 99 | VMMCALLHOST_VM_SET_ERROR,
|
---|
[234] | 100 | /** Set the VM runtime error message. */
|
---|
| 101 | VMMCALLHOST_VM_SET_RUNTIME_ERROR,
|
---|
[4917] | 102 | /** Signal a ring 0 hypervisor assertion. */
|
---|
| 103 | VMMCALLHOST_VM_R0_HYPER_ASSERTION,
|
---|
[1] | 104 | /** The usual 32-bit hack. */
|
---|
| 105 | VMMCALLHOST_32BIT_HACK = 0x7fffffff
|
---|
| 106 | } VMMCALLHOST;
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | /**
|
---|
| 111 | * Gets the bottom of the hypervisor stack - GC Ptr.
|
---|
| 112 | * I.e. the returned address is not actually writable.
|
---|
| 113 | *
|
---|
| 114 | * @returns bottom of the stack.
|
---|
| 115 | * @param pVM The VM handle.
|
---|
| 116 | */
|
---|
| 117 | RTGCPTR VMMGetStackGC(PVM pVM);
|
---|
| 118 |
|
---|
| 119 | /**
|
---|
| 120 | * Gets the bottom of the hypervisor stack - HC Ptr.
|
---|
| 121 | * I.e. the returned address is not actually writable.
|
---|
| 122 | *
|
---|
| 123 | * @returns bottom of the stack.
|
---|
| 124 | * @param pVM The VM handle.
|
---|
| 125 | */
|
---|
| 126 | RTHCPTR VMMGetHCStack(PVM pVM);
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 | #ifdef IN_RING3
|
---|
| 131 | /** @defgroup grp_vmm_r3 The VMM Host Context Ring 3 API
|
---|
| 132 | * @ingroup grp_vmm
|
---|
| 133 | * @{
|
---|
| 134 | */
|
---|
| 135 |
|
---|
| 136 | /**
|
---|
| 137 | * Initializes the VMM.
|
---|
| 138 | *
|
---|
| 139 | * @returns VBox status code.
|
---|
| 140 | * @param pVM The VM to operate on.
|
---|
| 141 | */
|
---|
| 142 | VMMR3DECL(int) VMMR3Init(PVM pVM);
|
---|
| 143 |
|
---|
| 144 | /**
|
---|
| 145 | * Ring-3 init finalizing.
|
---|
| 146 | *
|
---|
| 147 | * @returns VBox status code.
|
---|
| 148 | * @param pVM The VM handle.
|
---|
| 149 | */
|
---|
| 150 | VMMR3DECL(int) VMMR3InitFinalize(PVM pVM);
|
---|
| 151 |
|
---|
| 152 | /**
|
---|
| 153 | * Initializes the R0 VMM.
|
---|
| 154 | *
|
---|
| 155 | * @returns VBox status code.
|
---|
| 156 | * @param pVM The VM to operate on.
|
---|
| 157 | */
|
---|
| 158 | VMMR3DECL(int) VMMR3InitR0(PVM pVM);
|
---|
| 159 |
|
---|
| 160 | /**
|
---|
| 161 | * Initializes the GC VMM.
|
---|
| 162 | *
|
---|
| 163 | * @returns VBox status code.
|
---|
| 164 | * @param pVM The VM to operate on.
|
---|
| 165 | */
|
---|
| 166 | VMMR3DECL(int) VMMR3InitGC(PVM pVM);
|
---|
| 167 |
|
---|
| 168 | /**
|
---|
| 169 | * Destroy the VMM bits.
|
---|
| 170 | *
|
---|
| 171 | * @returns VINF_SUCCESS.
|
---|
| 172 | * @param pVM The VM handle.
|
---|
| 173 | */
|
---|
| 174 | VMMR3DECL(int) VMMR3Term(PVM pVM);
|
---|
| 175 |
|
---|
| 176 | /**
|
---|
| 177 | * Applies relocations to data and code managed by this
|
---|
| 178 | * component. This function will be called at init and
|
---|
| 179 | * whenever the VMM need to relocate it self inside the GC.
|
---|
| 180 | *
|
---|
| 181 | * The VMM will need to apply relocations to the core code.
|
---|
| 182 | *
|
---|
| 183 | * @param pVM The VM handle.
|
---|
| 184 | * @param offDelta The relocation delta.
|
---|
| 185 | */
|
---|
| 186 | VMMR3DECL(void) VMMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
| 187 |
|
---|
| 188 | /**
|
---|
| 189 | * Updates the settings for the GC (and R0?) loggers.
|
---|
| 190 | *
|
---|
| 191 | * @returns VBox status code.
|
---|
| 192 | * @param pVM The VM handle.
|
---|
| 193 | */
|
---|
| 194 | VMMR3DECL(int) VMMR3UpdateLoggers(PVM pVM);
|
---|
| 195 |
|
---|
| 196 | /**
|
---|
| 197 | * Gets the pointer to g_szRTAssertMsg1 in GC.
|
---|
| 198 | * @returns Pointer to VMMGC::g_szRTAssertMsg1.
|
---|
| 199 | * Returns NULL if not present.
|
---|
| 200 | * @param pVM The VM handle.
|
---|
| 201 | */
|
---|
| 202 | VMMR3DECL(const char *) VMMR3GetGCAssertMsg1(PVM pVM);
|
---|
| 203 |
|
---|
| 204 | /**
|
---|
| 205 | * Gets the pointer to g_szRTAssertMsg2 in GC.
|
---|
| 206 | * @returns Pointer to VMMGC::g_szRTAssertMsg2.
|
---|
| 207 | * Returns NULL if not present.
|
---|
| 208 | * @param pVM The VM handle.
|
---|
| 209 | */
|
---|
| 210 | VMMR3DECL(const char *) VMMR3GetGCAssertMsg2(PVM pVM);
|
---|
| 211 |
|
---|
| 212 | /**
|
---|
| 213 | * Resolve a builtin GC symbol.
|
---|
| 214 | * Called by PDM when loading or relocating GC modules.
|
---|
| 215 | *
|
---|
| 216 | * @returns VBox status.
|
---|
| 217 | * @param pVM VM Handle.
|
---|
| 218 | * @param pszSymbol Symbol to resolv
|
---|
| 219 | * @param pGCPtrValue Where to store the symbol value.
|
---|
| 220 | * @remark This has to work before VMMR3Relocate() is called.
|
---|
| 221 | */
|
---|
| 222 | VMMR3DECL(int) VMMR3GetImportGC(PVM pVM, const char *pszSymbol, PRTGCPTR pGCPtrValue);
|
---|
| 223 |
|
---|
| 224 | /**
|
---|
| 225 | * Selects the switcher to be used for switching to GC.
|
---|
| 226 | *
|
---|
| 227 | * @returns VBox status code.
|
---|
| 228 | * @param pVM VM handle.
|
---|
| 229 | * @param enmSwitcher The new switcher.
|
---|
| 230 | * @remark This function may be called before the VMM is initialized.
|
---|
| 231 | */
|
---|
| 232 | VMMR3DECL(int) VMMR3SelectSwitcher(PVM pVM, VMMSWITCHER enmSwitcher);
|
---|
| 233 |
|
---|
| 234 | /**
|
---|
| 235 | * Disable the switcher logic permanently.
|
---|
| 236 | *
|
---|
| 237 | * @returns VBox status code.
|
---|
| 238 | * @param pVM VM handle.
|
---|
| 239 | */
|
---|
| 240 | VMMR3DECL(int) VMMR3DisableSwitcher(PVM pVM);
|
---|
| 241 |
|
---|
| 242 | /**
|
---|
| 243 | * Executes guest code.
|
---|
| 244 | *
|
---|
| 245 | * @param pVM VM handle.
|
---|
| 246 | */
|
---|
| 247 | VMMR3DECL(int) VMMR3RawRunGC(PVM pVM);
|
---|
| 248 |
|
---|
| 249 | /**
|
---|
| 250 | * Executes guest code (Intel VMX and AMD SVM).
|
---|
| 251 | *
|
---|
| 252 | * @param pVM VM handle.
|
---|
| 253 | */
|
---|
| 254 | VMMR3DECL(int) VMMR3HwAccRunGC(PVM pVM);
|
---|
| 255 |
|
---|
| 256 | /**
|
---|
| 257 | * Calls GC a function.
|
---|
| 258 | *
|
---|
| 259 | * @param pVM The VM handle.
|
---|
| 260 | * @param GCPtrEntry The GC function address.
|
---|
| 261 | * @param cArgs The number of arguments in the ....
|
---|
| 262 | * @param ... Arguments to the function.
|
---|
| 263 | */
|
---|
| 264 | VMMR3DECL(int) VMMR3CallGC(PVM pVM, RTGCPTR GCPtrEntry, unsigned cArgs, ...);
|
---|
| 265 |
|
---|
| 266 | /**
|
---|
| 267 | * Calls GC a function.
|
---|
| 268 | *
|
---|
| 269 | * @param pVM The VM handle.
|
---|
| 270 | * @param GCPtrEntry The GC function address.
|
---|
| 271 | * @param cArgs The number of arguments in the ....
|
---|
| 272 | * @param args Arguments to the function.
|
---|
| 273 | */
|
---|
| 274 | VMMR3DECL(int) VMMR3CallGCV(PVM pVM, RTGCPTR GCPtrEntry, unsigned cArgs, va_list args);
|
---|
| 275 |
|
---|
| 276 | /**
|
---|
| 277 | * Resumes executing hypervisor code when interrupted
|
---|
| 278 | * by a queue flush or a debug event.
|
---|
| 279 | *
|
---|
| 280 | * @returns VBox status code.
|
---|
| 281 | * @param pVM VM handle.
|
---|
| 282 | */
|
---|
| 283 | VMMR3DECL(int) VMMR3ResumeHyper(PVM pVM);
|
---|
| 284 |
|
---|
| 285 | /**
|
---|
| 286 | * Dumps the VM state on a fatal error.
|
---|
| 287 | *
|
---|
| 288 | * @param pVM VM Handle.
|
---|
| 289 | * @param rcErr VBox status code.
|
---|
| 290 | */
|
---|
| 291 | VMMR3DECL(void) VMMR3FatalDump(PVM pVM, int rcErr);
|
---|
| 292 |
|
---|
| 293 | /**
|
---|
| 294 | * Acquire global VM lock
|
---|
| 295 | *
|
---|
| 296 | * @returns VBox status code
|
---|
| 297 | * @param pVM The VM to operate on.
|
---|
| 298 | */
|
---|
| 299 | VMMR3DECL(int) VMMR3Lock(PVM pVM);
|
---|
| 300 |
|
---|
| 301 | /**
|
---|
| 302 | * Release global VM lock
|
---|
| 303 | *
|
---|
| 304 | * @returns VBox status code
|
---|
| 305 | * @param pVM The VM to operate on.
|
---|
| 306 | */
|
---|
| 307 | VMMR3DECL(int) VMMR3Unlock(PVM pVM);
|
---|
| 308 |
|
---|
| 309 | /**
|
---|
| 310 | * Return global VM lock owner
|
---|
| 311 | *
|
---|
| 312 | * @returns NIL_RTNATIVETHREAD -> no owner, otherwise thread id of owner
|
---|
| 313 | * @param pVM The VM to operate on.
|
---|
| 314 | */
|
---|
| 315 | VMMR3DECL(RTNATIVETHREAD) VMMR3LockGetOwner(PVM pVM);
|
---|
| 316 |
|
---|
| 317 | /**
|
---|
| 318 | * Checks if the current thread is the owner of the global VM lock.
|
---|
| 319 | *
|
---|
| 320 | * @returns true if owner.
|
---|
| 321 | * @returns false if not owner.
|
---|
| 322 | * @param pVM The VM to operate on.
|
---|
| 323 | */
|
---|
| 324 | VMMR3DECL(bool) VMMR3LockIsOwner(PVM pVM);
|
---|
| 325 |
|
---|
| 326 | /**
|
---|
| 327 | * Suspends the the CPU yielder.
|
---|
| 328 | *
|
---|
| 329 | * @param pVM The VM handle.
|
---|
| 330 | */
|
---|
| 331 | VMMR3DECL(void) VMMR3YieldSuspend(PVM pVM);
|
---|
| 332 |
|
---|
| 333 | /**
|
---|
| 334 | * Stops the the CPU yielder.
|
---|
| 335 | *
|
---|
| 336 | * @param pVM The VM handle.
|
---|
| 337 | */
|
---|
| 338 | VMMR3DECL(void) VMMR3YieldStop(PVM pVM);
|
---|
| 339 |
|
---|
| 340 | /**
|
---|
| 341 | * Resumes the CPU yielder when it has been a suspended or stopped.
|
---|
| 342 | *
|
---|
| 343 | * @param pVM The VM handle.
|
---|
| 344 | */
|
---|
| 345 | VMMR3DECL(void) VMMR3YieldResume(PVM pVM);
|
---|
| 346 |
|
---|
| 347 | /** @} */
|
---|
| 348 | #endif
|
---|
| 349 |
|
---|
| 350 | /** @defgroup grp_vmm_r0 The VMM Host Context Ring 0 API
|
---|
| 351 | * @ingroup grp_vmm
|
---|
| 352 | * @{
|
---|
| 353 | */
|
---|
| 354 |
|
---|
| 355 | /**
|
---|
| 356 | * The VMMR0Entry() codes.
|
---|
| 357 | */
|
---|
| 358 | typedef enum VMMR0OPERATION
|
---|
| 359 | {
|
---|
| 360 | /** Run guest context. */
|
---|
[4811] | 361 | VMMR0_DO_RAW_RUN = SUP_VMMR0_DO_RAW_RUN,
|
---|
[1] | 362 | /** Run guest code using the available hardware acceleration technology. */
|
---|
[4811] | 363 | VMMR0_DO_HWACC_RUN = SUP_VMMR0_DO_HWACC_RUN,
|
---|
| 364 | /** Official NOP that we use for profiling. */
|
---|
| 365 | VMMR0_DO_NOP = SUP_VMMR0_DO_NOP,
|
---|
| 366 |
|
---|
[5167] | 367 | /** Ask the GVMM to create a new VM. */
|
---|
[5031] | 368 | VMMR0_DO_GVMM_CREATE_VM,
|
---|
[5167] | 369 | /** Ask the GVMM to destroy the VM. */
|
---|
[5031] | 370 | VMMR0_DO_GVMM_DESTROY_VM,
|
---|
[5167] | 371 | /** Call GVMMR0SchedHalt(). */
|
---|
| 372 | VMMR0_DO_GVMM_SCHED_HALT,
|
---|
| 373 | /** Call GVMMR0SchedWakeUp(). */
|
---|
| 374 | VMMR0_DO_GVMM_SCHED_WAKE_UP,
|
---|
| 375 | /** Call GVMMR0SchedPoll(). */
|
---|
| 376 | VMMR0_DO_GVMM_SCHED_POLL,
|
---|
[5211] | 377 | /** Call GVMMR0QueryStatistics(). */
|
---|
| 378 | VMMR0_DO_GVMM_QUERY_STATISTICS,
|
---|
[5233] | 379 | /** Call GVMMR0ResetStatistics(). */
|
---|
| 380 | VMMR0_DO_GVMM_RESET_STATISTICS,
|
---|
[5167] | 381 |
|
---|
[1] | 382 | /** Call VMMR0 Per VM Init. */
|
---|
| 383 | VMMR0_DO_VMMR0_INIT,
|
---|
| 384 | /** Call VMMR0 Per VM Termination. */
|
---|
| 385 | VMMR0_DO_VMMR0_TERM,
|
---|
| 386 | /** Setup the hardware accelerated raw-mode session. */
|
---|
[397] | 387 | VMMR0_DO_HWACC_SETUP_VM,
|
---|
[7416] | 388 | /** Attempt to enable or disable hardware accelerated raw-mode. */
|
---|
| 389 | VMMR0_DO_HWACC_ENABLE,
|
---|
[1] | 390 | /** Calls function in the hypervisor.
|
---|
| 391 | * The caller must setup the hypervisor context so the call will be performed.
|
---|
| 392 | * The difference between VMMR0_DO_RUN_GC and this one is the handling of
|
---|
| 393 | * the return GC code. The return code will not be interpreted by this operation.
|
---|
| 394 | */
|
---|
| 395 | VMMR0_DO_CALL_HYPERVISOR,
|
---|
| 396 |
|
---|
[4738] | 397 | /** Call PGMR0PhysAllocateHandyPages(). */
|
---|
| 398 | VMMR0_DO_PGM_ALLOCATE_HANDY_PAGES,
|
---|
[5106] | 399 |
|
---|
| 400 | /** Call GMMR0InitialReservation(). */
|
---|
| 401 | VMMR0_DO_GMM_INITIAL_RESERVATION,
|
---|
| 402 | /** Call GMMR0UpdateReservation(). */
|
---|
| 403 | VMMR0_DO_GMM_UPDATE_RESERVATION,
|
---|
[4738] | 404 | /** Call GMMR0AllocatePages(). */
|
---|
| 405 | VMMR0_DO_GMM_ALLOCATE_PAGES,
|
---|
| 406 | /** Call GMMR0FreePages(). */
|
---|
| 407 | VMMR0_DO_GMM_FREE_PAGES,
|
---|
[5106] | 408 | /** Call GMMR0BalloonedPages(). */
|
---|
| 409 | VMMR0_DO_GMM_BALLOONED_PAGES,
|
---|
[5135] | 410 | /** Call GMMR0DeflatedBalloon(). */
|
---|
| 411 | VMMR0_DO_GMM_DEFLATED_BALLOON,
|
---|
[4738] | 412 | /** Call GMMR0MapUnmapChunk(). */
|
---|
| 413 | VMMR0_DO_GMM_MAP_UNMAP_CHUNK,
|
---|
| 414 | /** Call GMMR0SeedChunk(). */
|
---|
| 415 | VMMR0_DO_GMM_SEED_CHUNK,
|
---|
| 416 |
|
---|
[5240] | 417 | /** Set a GVMM or GMM configuration value. */
|
---|
| 418 | VMMR0_DO_GCFGM_SET_VALUE,
|
---|
| 419 | /** Query a GVMM or GMM configuration value. */
|
---|
| 420 | VMMR0_DO_GCFGM_QUERY_VALUE,
|
---|
[5211] | 421 |
|
---|
[1] | 422 | /** The start of the R0 service operations. */
|
---|
| 423 | VMMR0_DO_SRV_START,
|
---|
| 424 | /** Call INTNETR0Open(). */
|
---|
| 425 | VMMR0_DO_INTNET_OPEN,
|
---|
| 426 | /** Call INTNETR0IfClose(). */
|
---|
| 427 | VMMR0_DO_INTNET_IF_CLOSE,
|
---|
| 428 | /** Call INTNETR0IfGetRing3Buffer(). */
|
---|
| 429 | VMMR0_DO_INTNET_IF_GET_RING3_BUFFER,
|
---|
| 430 | /** Call INTNETR0IfSetPromiscuousMode(). */
|
---|
| 431 | VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE,
|
---|
| 432 | /** Call INTNETR0IfSend(). */
|
---|
| 433 | VMMR0_DO_INTNET_IF_SEND,
|
---|
| 434 | /** Call INTNETR0IfWait(). */
|
---|
| 435 | VMMR0_DO_INTNET_IF_WAIT,
|
---|
| 436 | /** The end of the R0 service operations. */
|
---|
| 437 | VMMR0_DO_SRV_END,
|
---|
| 438 |
|
---|
[397] | 439 | /** Official call we use for testing Ring-0 APIs. */
|
---|
| 440 | VMMR0_DO_TESTS,
|
---|
| 441 |
|
---|
[1] | 442 | /** The usual 32-bit type blow up. */
|
---|
| 443 | VMMR0_DO_32BIT_HACK = 0x7fffffff
|
---|
| 444 | } VMMR0OPERATION;
|
---|
| 445 |
|
---|
[5240] | 446 |
|
---|
[1] | 447 | /**
|
---|
[5240] | 448 | * Request buffer for VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE.
|
---|
| 449 | * @todo Move got GCFGM.h when it's implemented.
|
---|
| 450 | */
|
---|
| 451 | typedef struct GCFGMVALUEREQ
|
---|
| 452 | {
|
---|
| 453 | /** The request header.*/
|
---|
| 454 | SUPVMMR0REQHDR Hdr;
|
---|
| 455 | /** The support driver session handle. */
|
---|
| 456 | PSUPDRVSESSION pSession;
|
---|
| 457 | /** The value.
|
---|
| 458 | * This is input for the set request and output for the query. */
|
---|
| 459 | uint64_t u64Value;
|
---|
| 460 | /** The variable name.
|
---|
| 461 | * This is fixed sized just to make things simple for the mock-up. */
|
---|
| 462 | char szName[48];
|
---|
| 463 | } GCFGMVALUEREQ;
|
---|
| 464 | /** Pointer to a VMMR0_DO_GCFGM_SET_VALUE and VMMR0_DO_GCFGM_QUERY_VALUE request buffer.
|
---|
| 465 | * @todo Move got GCFGM.h when it's implemented.
|
---|
| 466 | */
|
---|
| 467 | typedef GCFGMVALUEREQ *PGCFGMVALUEREQ;
|
---|
| 468 |
|
---|
| 469 |
|
---|
| 470 | /**
|
---|
[4811] | 471 | * The Ring 0 entry point, called by the interrupt gate.
|
---|
| 472 | *
|
---|
| 473 | * @returns VBox status code.
|
---|
| 474 | * @param pVM The VM to operate on.
|
---|
| 475 | * @param enmOperation Which operation to execute.
|
---|
| 476 | * @param pvArg Argument to the operation.
|
---|
| 477 | * @remarks Assume called with interrupts disabled.
|
---|
| 478 | */
|
---|
| 479 | VMMR0DECL(int) VMMR0EntryInt(PVM pVM, VMMR0OPERATION enmOperation, void *pvArg);
|
---|
| 480 |
|
---|
| 481 | /**
|
---|
| 482 | * The Ring 0 entry point, called by the fast-ioctl path.
|
---|
| 483 | *
|
---|
| 484 | * @returns VBox status code.
|
---|
| 485 | * @param pVM The VM to operate on.
|
---|
| 486 | * @param enmOperation Which operation to execute.
|
---|
[4970] | 487 | * @remarks Assume called with interrupts _enabled_.
|
---|
[4811] | 488 | */
|
---|
| 489 | VMMR0DECL(int) VMMR0EntryFast(PVM pVM, VMMR0OPERATION enmOperation);
|
---|
| 490 |
|
---|
| 491 | /**
|
---|
[1] | 492 | * The Ring 0 entry point, called by the support library (SUP).
|
---|
| 493 | *
|
---|
| 494 | * @returns VBox status code.
|
---|
[4811] | 495 | * @param pVM The VM to operate on.
|
---|
| 496 | * @param enmOperation Which operation to execute.
|
---|
| 497 | * @param pReq This points to a SUPVMMR0REQHDR packet. Optional.
|
---|
| 498 | * @param u64Arg Some simple constant argument.
|
---|
| 499 | * @remarks Assume called with interrupts _enabled_.
|
---|
[1] | 500 | */
|
---|
[4811] | 501 | VMMR0DECL(int) VMMR0EntryEx(PVM pVM, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg);
|
---|
[1] | 502 |
|
---|
| 503 | /**
|
---|
| 504 | * Calls the ring-3 host code.
|
---|
| 505 | *
|
---|
| 506 | * @returns VBox status code of the ring-3 call.
|
---|
| 507 | * @param pVM The VM handle.
|
---|
| 508 | * @param enmOperation The operation.
|
---|
| 509 | * @param uArg The argument to the operation.
|
---|
| 510 | */
|
---|
| 511 | VMMR0DECL(int) VMMR0CallHost(PVM pVM, VMMCALLHOST enmOperation, uint64_t uArg);
|
---|
| 512 |
|
---|
| 513 | /** @} */
|
---|
| 514 |
|
---|
| 515 |
|
---|
| 516 | #ifdef IN_GC
|
---|
| 517 | /** @defgroup grp_vmm_gc The VMM Guest Context API
|
---|
| 518 | * @ingroup grp_vmm
|
---|
| 519 | * @{
|
---|
| 520 | */
|
---|
| 521 |
|
---|
| 522 | /**
|
---|
| 523 | * The GC entry point.
|
---|
| 524 | *
|
---|
| 525 | * @returns VBox status code.
|
---|
| 526 | * @param pVM The VM to operate on.
|
---|
| 527 | * @param uOperation Which operation to execute (VMMGCOPERATION).
|
---|
| 528 | * @param uArg Argument to that operation.
|
---|
[3123] | 529 | * @param ... Additional arguments.
|
---|
[1] | 530 | */
|
---|
[3123] | 531 | VMMGCDECL(int) VMMGCEntry(PVM pVM, unsigned uOperation, unsigned uArg, ...);
|
---|
[1] | 532 |
|
---|
| 533 | /**
|
---|
| 534 | * Switches from guest context to host context.
|
---|
| 535 | *
|
---|
| 536 | * @param pVM The VM handle.
|
---|
| 537 | * @param rc The status code.
|
---|
| 538 | */
|
---|
| 539 | VMMGCDECL(void) VMMGCGuestToHost(PVM pVM, int rc);
|
---|
| 540 |
|
---|
| 541 | /**
|
---|
| 542 | * Calls the ring-3 host code.
|
---|
| 543 | *
|
---|
| 544 | * @returns VBox status code of the ring-3 call.
|
---|
| 545 | * @param pVM The VM handle.
|
---|
| 546 | * @param enmOperation The operation.
|
---|
| 547 | * @param uArg The argument to the operation.
|
---|
| 548 | */
|
---|
| 549 | VMMGCDECL(int) VMMGCCallHost(PVM pVM, VMMCALLHOST enmOperation, uint64_t uArg);
|
---|
| 550 |
|
---|
| 551 | /** @} */
|
---|
| 552 | #endif
|
---|
| 553 |
|
---|
| 554 |
|
---|
| 555 | /** @} */
|
---|
| 556 | __END_DECLS
|
---|
| 557 |
|
---|
| 558 |
|
---|
| 559 | #endif
|
---|