MMAll.cpp revision 3ef7379d968d951ab9154926b5f6d51856c586e6
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * MM - Memory Manager - Any Context.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * available from http://www.virtualbox.org. This file is free software;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * General Public License (GPL) as published by the Free Software
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * additional information or have any questions.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/*******************************************************************************
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync* Header Files *
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync*******************************************************************************/
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Lookup a host context ring-3 address.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * @returns Pointer to the corresponding lookup record.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * @returns NULL on failure.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * @param pVM The VM handle.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * @param R3Ptr The host context ring-3 address to lookup.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * @param poff Where to store the offset into the HMA memory chunk.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncDECLINLINE(PMMLOOKUPHYPER) mmHyperLookupR3(PVM pVM, RTR3PTR R3Ptr, uint32_t *poff)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync /** @todo cache last lookup this stuff ain't cheap! */
PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap) + pVM->mm.s.offLookupHyper);
case MMLOOKUPHYPERTYPE_LOCKED:
return pLookup;
case MMLOOKUPHYPERTYPE_HCPHYS:
return pLookup;
case MMLOOKUPHYPERTYPE_MMIO2:
return NULL;
PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap) + pVM->mm.s.offLookupHyper);
case MMLOOKUPHYPERTYPE_LOCKED:
case MMLOOKUPHYPERTYPE_HCPHYS:
return pLookup;
return NULL;
return NULL;
#ifdef IN_GC
case MMLOOKUPHYPERTYPE_LOCKED:
case MMLOOKUPHYPERTYPE_HCPHYS:
return NIL_RTR3PTR;
case MMLOOKUPHYPERTYPE_LOCKED:
case MMLOOKUPHYPERTYPE_HCPHYS:
return NIL_RTR0PTR;
#ifdef IN_GC
* Converts a ring-0 host context address in the Hypervisor memory region to a ring-3 host context address.
if (pLookup)
return NIL_RTR3PTR;
* Converts a ring-0 host context address in the Hypervisor memory region to a raw-mode context address.
if (pLookup)
return NIL_RTRCPTR;
#ifndef IN_RING0
* Converts a ring-0 host context address in the Hypervisor memory region to a current context address.
if (pLookup)
return NULL;
* Converts a ring-3 host context address in the Hypervisor memory region to a ring-0 host context address.
if (pLookup)
return NIL_RTR0PTR;
* Converts a ring-3 host context address in the Hypervisor memory region to a guest context address.
if (pLookup)
return NIL_RTRCPTR;
* Converts a ring-3 host context address in the Hypervisor memory region to a current context address.
#ifndef IN_RING3
if (pLookup)
return NULL;
if (pLookup)
return NIL_RTR3PTR;
* Converts a raw-mode context address in the Hypervisor memory region to a ring-0 host context address.
if (pLookup)
return NIL_RTR0PTR;
#ifndef IN_GC
if (pLookup)
return NULL;
* Converts a current context address in the Hypervisor memory region to a ring-3 host context address.
#ifndef IN_RING3
if (pLookup)
return NIL_RTR3PTR;
* Converts a current context address in the Hypervisor memory region to a ring-0 host context address.
#ifndef IN_RING0
if (pLookup)
return NIL_RTR0PTR;
#ifndef IN_GC
if (pLookup)
return NIL_RTRCPTR;