VirtualBox

source: vbox/trunk/include/VBox/uvm.h@ 32287

Last change on this file since 32287 was 32190, checked in by vboxsync, 14 years ago

PDMDevHlpVMSuspendSaveAndPowerOff: More code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1/* $Id: uvm.h 32190 2010-09-02 12:20:06Z vboxsync $ */
2/** @file
3 * GVM - The Global VM Data. (VMM)
4 */
5
6/*
7 * Copyright (C) 2007 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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28#ifndef ___VBox_uvm_h
29#define ___VBox_uvm_h
30
31#include <VBox/types.h>
32#include <iprt/assert.h>
33
34
35/**
36 * Per virtual CPU ring-3 (user mode) data.
37 */
38typedef struct UVMCPU
39{
40 /** Pointer to the UVM structure. */
41 PUVM pUVM;
42 /** Pointer to the VM structure. */
43 PVM pVM;
44 /** Pointer to the VMCPU structure. */
45 PVMCPU pVCpu;
46 /** The virtual CPU ID. */
47 RTCPUID idCpu;
48 /** Alignment padding. */
49 uint8_t abAlignment0[HC_ARCH_BITS == 32 ? 16 : 4];
50
51 /** The VM internal data. */
52 union
53 {
54#ifdef ___VMInternal_h
55 struct VMINTUSERPERVMCPU s;
56#endif
57 uint8_t padding[512];
58 } vm;
59} UVMCPU;
60AssertCompileMemberAlignment(UVMCPU, vm, 32);
61
62
63/**
64 * The ring-3 (user mode) VM structure.
65 *
66 * This structure is similar to VM and GVM except that it resides in swappable
67 * user memory. The main purpose is to assist bootstrapping, where it allows us
68 * to start EMT much earlier and gives PDMLdr somewhere to put it's VMMR0 data.
69 * It is also a nice place to put big things that are user mode only.
70 */
71typedef struct UVM
72{
73 /** Magic / eye-catcher (UVM_MAGIC). */
74 uint32_t u32Magic;
75 /** The number of virtual CPUs. */
76 uint32_t cCpus;
77 /** The ring-3 mapping of the shared VM structure. */
78 PVM pVM;
79 /** Pointer to the next VM.
80 * We keep a per process list of VM for the event that a process could
81 * contain more than one VM.
82 * @todo move this into vm.s!
83 */
84 struct UVM *pNext;
85
86 /** Pointer to the optional method table provided by the VMM user. */
87 PCVMM2USERMETHODS pVmm2UserMethods;
88
89#if HC_ARCH_BITS == 32
90 /** Align the next member on a 32 byte boundrary. */
91 uint8_t abAlignment0[HC_ARCH_BITS == 32 ? 12 : 0];
92#endif
93
94 /** The VM internal data. */
95 union
96 {
97#ifdef ___VMInternal_h
98 struct VMINTUSERPERVM s;
99#endif
100 uint8_t padding[512];
101 } vm;
102
103 /** The MM data. */
104 union
105 {
106#ifdef ___MMInternal_h
107 struct MMUSERPERVM s;
108#endif
109 uint8_t padding[32];
110 } mm;
111
112 /** The PDM data. */
113 union
114 {
115#ifdef ___PDMInternal_h
116 struct PDMUSERPERVM s;
117#endif
118 uint8_t padding[128];
119 } pdm;
120
121 /** The STAM data. */
122 union
123 {
124#ifdef ___STAMInternal_h
125 struct STAMUSERPERVM s;
126#endif
127 uint8_t padding[256];
128 } stam;
129
130 /** Per virtual CPU data. */
131 UVMCPU aCpus[1];
132} UVM;
133AssertCompileMemberAlignment(UVM, vm, 32);
134AssertCompileMemberAlignment(UVM, mm, 32);
135AssertCompileMemberAlignment(UVM, pdm, 32);
136AssertCompileMemberAlignment(UVM, stam, 32);
137AssertCompileMemberAlignment(UVM, aCpus, 32);
138
139/** The UVM::u32Magic value (Brad Mehldau). */
140#define UVM_MAGIC 0x19700823
141
142/** @def UVM_ASSERT_VALID_EXT_RETURN
143 * Asserts a the VM handle is valid for external access, i.e. not being
144 * destroy or terminated.
145 */
146#define UVM_ASSERT_VALID_EXT_RETURN(pVM, rc) \
147 AssertMsgReturn( RT_VALID_ALIGNED_PTR(pVM, PAGE_SIZE) \
148 && (pUVM)->u32Magic == UVM_MAGIC, \
149 ("pUVM=%p u32Magic=%#x\n", (pUVM), \
150 RT_VALID_ALIGNED_PTR(pVM, PAGE_SIZE) ? (pUVM)->u32Magic : 0), \
151 (rc))
152
153#endif
154
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