PGMAllMap.cpp revision d1011b3f539ad819b5e2c1c3d8152e7113725bf6
45e9809aff7304721fddb95654901b32195c9c7avboxsync * PGM - Page Manager and Monitor - All context code.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (C) 2006 InnoTek Systemberatung GmbH
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
45e9809aff7304721fddb95654901b32195c9c7avboxsync * available from http://www.virtualbox.org. This file is free software;
45e9809aff7304721fddb95654901b32195c9c7avboxsync * you can redistribute it and/or modify it under the terms of the GNU
45e9809aff7304721fddb95654901b32195c9c7avboxsync * General Public License as published by the Free Software Foundation,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
45e9809aff7304721fddb95654901b32195c9c7avboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * If you received this file as part of a commercial VirtualBox
45e9809aff7304721fddb95654901b32195c9c7avboxsync * distribution, then only the terms of your commercial VirtualBox
45e9809aff7304721fddb95654901b32195c9c7avboxsync * license agreement apply instead of the previous paragraph.
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*******************************************************************************
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Header Files *
45e9809aff7304721fddb95654901b32195c9c7avboxsync*******************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Maps a range of physical pages at a given virtual address
45e9809aff7304721fddb95654901b32195c9c7avboxsync * in the guest context.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The GC virtual address range must be within an existing mapping.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @returns VBox status code.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pVM The virtual machine.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param GCPtr Where to map the page(s). Must be page aligned.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param HCPhys Start of the range of physical pages. Must be page aligned.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param cbPages Number of bytes to map. Must be page aligned.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param fFlags Page flags (X86_PTE_*).
45e9809aff7304721fddb95654901b32195c9c7avboxsyncPGMDECL(int) PGMMap(PVM pVM, RTGCUINTPTR GCPtr, RTHCPHYS HCPhys, uint32_t cbPages, unsigned fFlags)
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Validate input.
AssertMsg(RT_ALIGN_T(GCPtr, PAGE_SIZE, RTGCUINTPTR) == GCPtr, ("Invalid alignment GCPtr=%#x\n", GCPtr));
AssertMsg(cbPages > 0 && RT_ALIGN_32(cbPages, PAGE_SIZE) == cbPages, ("Invalid cbPages=%#x\n", cbPages));
//Assert(HCPhys < _4G); --- Don't *EVER* try 32-bit shadow mode on a PAE/AMD64 box with memory above 4G !!!
if (!fFlags)
while (pCur)
return VERR_INVALID_PARAMETER;
CTXALLSUFF(pCur->aPTs[iPT].pPT)->a[iPageNo].u = (uint32_t)Pte.u; /* ASSUMES HCPhys < 4GB and/or that we're never gonna do 32-bit on a PAE host! */
if (!cbPages)
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
if (!cb)
AssertFailed();
return VERR_INVALID_PARAMETER;
while (pCur)
return VERR_INVALID_PARAMETER;
while (cb > 0)
iPTE++;
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;