1 | /* $Id: MMAllPhys.cpp 2981 2007-06-01 16:01:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * MM - Memory Monitor(/Manager) - Physical Memory.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek 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 |
|
---|
23 | /*******************************************************************************
|
---|
24 | * Header Files *
|
---|
25 | *******************************************************************************/
|
---|
26 | #define LOG_GROUP LOG_GROUP_MM_PHYS
|
---|
27 | #include <VBox/mm.h>
|
---|
28 | #include <VBox/pgm.h>
|
---|
29 | #include <VBox/rem.h>
|
---|
30 | #include "MMInternal.h"
|
---|
31 | #include <VBox/vm.h>
|
---|
32 |
|
---|
33 | #include <iprt/alloc.h>
|
---|
34 | #include <iprt/assert.h>
|
---|
35 | #include <VBox/log.h>
|
---|
36 | #include <VBox/param.h>
|
---|
37 | #include <VBox/err.h>
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Convert GC physical address to HC virtual address.
|
---|
41 | *
|
---|
42 | * @returns HC virtual address.
|
---|
43 | * @param pVM VM Handle
|
---|
44 | * @param GCPhys Guest context physical address.
|
---|
45 | * @param cbRange Physical range
|
---|
46 | * @deprecated
|
---|
47 | */
|
---|
48 | MMDECL(void *) MMPhysGCPhys2HCVirt(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange)
|
---|
49 | {
|
---|
50 | void *pv;
|
---|
51 | int rc = PGMPhysGCPhys2HCPtr(pVM, GCPhys, cbRange, &pv);
|
---|
52 | if (VBOX_SUCCESS(rc))
|
---|
53 | return pv;
|
---|
54 | AssertMsgFailed(("Invalid address GCPhys=%x\n", GCPhys));
|
---|
55 | return NULL;
|
---|
56 | }
|
---|
57 |
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Convert GC virtual address to HC virtual address.
|
---|
61 | *
|
---|
62 | * This uses the current PD of the guest.
|
---|
63 | *
|
---|
64 | * @returns HC virtual address.
|
---|
65 | * @param pVM VM Handle
|
---|
66 | * @param GCPtr Guest context virtual address.
|
---|
67 | * @deprecated
|
---|
68 | */
|
---|
69 | MMDECL(void *) MMPhysGCVirt2HCVirt(PVM pVM, RTGCPTR GCPtr)
|
---|
70 | {
|
---|
71 | void *pv;
|
---|
72 | int rc = PGMPhysGCPtr2HCPtr(pVM, GCPtr, &pv);
|
---|
73 | if (VBOX_SUCCESS(rc))
|
---|
74 | return pv;
|
---|
75 | AssertMsgFailed(("%VGv, %Vrc\n", GCPtr, rc));
|
---|
76 | return NULL;
|
---|
77 | }
|
---|