1 | /* $Id: VMMAll.cpp 12667 2008-09-23 11:25:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMM All Contexts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 | /*******************************************************************************
|
---|
24 | * Header Files *
|
---|
25 | *******************************************************************************/
|
---|
26 | #define LOG_GROUP LOG_GROUP_VMM
|
---|
27 | #include <VBox/vmm.h>
|
---|
28 | #include "VMMInternal.h"
|
---|
29 | #include <VBox/vm.h>
|
---|
30 | #include <VBox/param.h>
|
---|
31 |
|
---|
32 |
|
---|
33 | #ifndef IN_RING0
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Gets the bottom of the hypervisor stack - GC Ptr.
|
---|
37 | * I.e. the returned address is not actually writable.
|
---|
38 | *
|
---|
39 | * @returns bottom of the stack.
|
---|
40 | * @param pVM The VM handle.
|
---|
41 | */
|
---|
42 | RTGCPTR VMMGetStackGC(PVM pVM)
|
---|
43 | {
|
---|
44 | return (RTGCPTR)pVM->vmm.s.pbGCStackBottom;
|
---|
45 | }
|
---|
46 |
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Gets the bottom of the hypervisor stack - HC Ptr.
|
---|
50 | * I.e. the returned address is not actually writable.
|
---|
51 | *
|
---|
52 | * @returns bottom of the stack.
|
---|
53 | * @param pVM The VM handle.
|
---|
54 | */
|
---|
55 | RTHCPTR VMMGetHCStack(PVM pVM)
|
---|
56 | {
|
---|
57 | return pVM->vmm.s.pbHCStack + VMM_STACK_SIZE;
|
---|
58 | }
|
---|
59 |
|
---|
60 | #endif /* !IN_RING0 */
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Gets the current virtual CPU ID.
|
---|
64 | *
|
---|
65 | * @returns The CPU ID.
|
---|
66 | * @param pVM Pointer to the shared VM handle.
|
---|
67 | * @thread EMT
|
---|
68 | */
|
---|
69 | VMCPUID VMMGetCpuId(PVM pVM)
|
---|
70 | {
|
---|
71 | #ifdef VBOX_WITH_SMP_GUESTS
|
---|
72 | /* Only emulation thread(s) allowed to ask for CPU id */
|
---|
73 | VM_ASSERT_EMT(pVM);
|
---|
74 |
|
---|
75 | # if defined(IN_GC)
|
---|
76 | /* There is only one CPU if we're in GC. */
|
---|
77 | return 0;
|
---|
78 |
|
---|
79 | # elif defined(IN_RING3)
|
---|
80 | /** @todo SMP: Use TLS. */
|
---|
81 | return 0; /** @todo SMP */
|
---|
82 |
|
---|
83 | # else /* IN_RING0 */
|
---|
84 | /** @todo SMP: Get the real CPU ID and use a table in the VM structure to
|
---|
85 | * translate it. */
|
---|
86 | return 0;
|
---|
87 | # endif /* IN_RING0 */
|
---|
88 |
|
---|
89 | #else
|
---|
90 | VM_ASSERT_EMT(pVM);
|
---|
91 | return 0;
|
---|
92 | #endif
|
---|
93 | }
|
---|
94 |
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Gets the VBOX_SVN_REV.
|
---|
98 | *
|
---|
99 | * This is just to avoid having to compile a bunch of big files
|
---|
100 | * and requires less Makefile mess.
|
---|
101 | *
|
---|
102 | * @returns VBOX_SVN_REV.
|
---|
103 | */
|
---|
104 | VMMDECL(uint32_t) VMMGetSvnRev(void)
|
---|
105 | {
|
---|
106 | return VBOX_SVN_REV;
|
---|
107 | }
|
---|
108 |
|
---|