VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/HWSVMR0.h@ 847

Last change on this file since 847 was 23, checked in by vboxsync, 18 years ago

string.h & stdio.h + header cleanups.

  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1/* $Id: HWSVMR0.h 23 2007-01-15 14:08:28Z vboxsync $ */
2/** @file
3 * HWACCM SVM - Internal header file.
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#ifndef __HWSVMR0_h__
23#define __HWSVMR0_h__
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <VBox/em.h>
28#include <VBox/stam.h>
29#include <VBox/dis.h>
30#include <VBox/hwaccm.h>
31#include <VBox/pgm.h>
32#include <VBox/hwacc_svm.h>
33
34__BEGIN_DECLS
35
36/** @defgroup grp_svm Internal
37 * @ingroup grp_svm
38 * @internal
39 * @{
40 */
41
42#ifdef IN_RING0
43
44/**
45 * Enable SVM
46 *
47 * @returns VBox status code.
48 * @param pVM The VM to operate on.
49 */
50HWACCMR0DECL(int) SVMR0Enable(PVM pVM);
51
52/**
53 * Disable SVM
54 *
55 * @returns VBox status code.
56 * @param pVM The VM to operate on.
57 */
58HWACCMR0DECL(int) SVMR0Disable(PVM pVM);
59
60/**
61 * Sets up and activates SVM
62 *
63 * @returns VBox status code.
64 * @param pVM The VM to operate on.
65 */
66HWACCMR0DECL(int) SVMR0Setup(PVM pVM);
67
68
69/**
70 * Runs guest code in a SVM VM.
71 *
72 * @note NEVER EVER turn on interrupts here. Due to our illegal entry into the kernel, it might mess things up. (XP kernel traps have been frequently observed)
73 *
74 * @returns VBox status code.
75 * @param pVM The VM to operate on.
76 * @param pCtx Guest context
77 */
78HWACCMR0DECL(int) SVMR0RunGuestCode(PVM pVM, CPUMCTX *pCtx);
79
80
81/**
82 * Loads the guest state
83 *
84 * @returns VBox status code.
85 * @param pVM The VM to operate on.
86 * @param pCtx Guest context
87 */
88HWACCMR0DECL(int) SVMR0LoadGuestState(PVM pVM, CPUMCTX *pCtx);
89
90
91/* Convert hidden selector attribute word between VMX and SVM formats. */
92#define SVM_HIDSEGATTR_VMX2SVM(a) (a & 0xFF) | ((a & 0xF000) >> 4)
93#define SVM_HIDSEGATTR_SVM2VMX(a) (a & 0xFF) | ((a & 0x0F00) << 4)
94
95#define SVM_WRITE_SELREG(REG, reg) \
96 pVMCB->guest.REG.u16Sel = pCtx->reg; \
97 pVMCB->guest.REG.u32Limit = pCtx->reg##Hid.u32Limit; \
98 pVMCB->guest.REG.u64Base = pCtx->reg##Hid.u32Base; \
99 if (pCtx->reg) \
100 pVMCB->guest.REG.u16Attr = SVM_HIDSEGATTR_VMX2SVM(pCtx->reg##Hid.Attr.u); \
101 else \
102 pVMCB->guest.REG.u16Attr = 0;
103
104#define SVM_READ_SELREG(REG, reg) \
105 pCtx->reg = pVMCB->guest.REG.u16Sel; \
106 pCtx->reg##Hid.u32Limit = pVMCB->guest.REG.u32Limit; \
107 pCtx->reg##Hid.u32Base = pVMCB->guest.REG.u64Base; \
108 pCtx->reg##Hid.Attr.u = SVM_HIDSEGATTR_SVM2VMX(pVMCB->guest.REG.u16Attr);
109
110#endif /* IN_RING0 */
111
112/** @} */
113
114__END_DECLS
115
116#endif
117
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