VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR3/GIMHv.cpp@ 51268

Last change on this file since 51268 was 50953, checked in by vboxsync, 11 years ago

GIM: Skeleton, work in progress.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1/* $Id: GIMHv.cpp 50953 2014-04-02 14:47:00Z vboxsync $ */
2/** @file
3 * GIM - Guest Interface Manager, Hyper-V implementation.
4 */
5
6/*
7 * Copyright (C) 2014 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
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#define LOG_GROUP LOG_GROUP_GIM
22#include "GIMHvInternal.h"
23#include "GIMInternal.h"
24
25#include <iprt/assert.h>
26#include <iprt/err.h>
27
28#include <VBox/vmm/cpum.h>
29#include <VBox/vmm/vm.h>
30#include <VBox/vmm/hm.h>
31#include <VBox/vmm/pdmapi.h>
32
33/*******************************************************************************
34* Defined Constants And Macros *
35*******************************************************************************/
36#define GIMHV_HYPERCALL "GIMHvHypercall"
37
38
39VMMR3_INT_DECL(int) GIMR3HvInit(PVM pVM)
40{
41 AssertReturn(pVM, VERR_INVALID_PARAMETER);
42 AssertReturn(pVM->gim.s.enmProvider == GIMPROVIDER_HYPERV, VERR_INTERNAL_ERROR_5);
43
44 int rc;
45 pVM->gim.s.pfnHypercallR3 = &GIMHvHypercall;
46 if (!HMIsEnabled(pVM))
47 {
48 rc = PDMR3LdrGetSymbolRC(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallRC);
49 AssertRCReturn(rc, rc);
50 }
51 rc = PDMR3LdrGetSymbolR0(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallR0);
52 AssertRCReturn(rc, rc);
53
54 /*
55 * Expose HVP (Hypervisor Present) bit to the guest.
56 */
57 CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);
58
59 /** @todo Register CPUID leaves, MSR ranges with CPUM. */
60 return VINF_SUCCESS;
61}
62
63
64VMMR3_INT_DECL(void) GIMR3HvRelocate(PVM pVM, RTGCINTPTR offDelta)
65{
66 int rc = PDMR3LdrGetSymbolRC(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallRC);
67 AssertFatalRC(rc);
68}
69
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