VirtualBox

Changeset 17459 in vbox for trunk


Ignore:
Timestamp:
Mar 6, 2009 12:30:58 PM (16 years ago)
Author:
vboxsync
Message:

REM: prototype of physical ram registration cide update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler_new/VBoxRecompiler.c

    r17426 r17459  
    26942694    pVM->rem.s.fIgnoreAll = false;
    26952695}
     2696
     2697#if 0
     2698/** Prototype code for > 4G RAM physical memory registration */
     2699typedef struct {
     2700    RTGCPHYS GCBase;
     2701    RTGCPHYS cbSize;
     2702    uint32_t fFlags;
     2703} PhysRamRegion;
     2704
     2705static PhysRamRegion g_aRegions[4];
     2706static uint32_t      g_iLastRegion = 0;
     2707
     2708/**
     2709 * Notification about a successful MMR3PhysRegister() call.
     2710 *
     2711 * @param   pVM         VM handle.
     2712 * @param   GCPhys      The physical address the RAM.
     2713 * @param   cb          Size of the memory.
     2714 * @param   fFlags      Flags of the MM_RAM_FLAGS_* defines.
     2715 */
     2716REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, unsigned fFlags)
     2717{
     2718    uint32_t cbBitmap;
     2719    int rc;
     2720    Log(("REMR3NotifyPhysRamRegister: GCPhys=%RGp cb=%d fFlags=%d\n", GCPhys, cb, fFlags));
     2721    VM_ASSERT_EMT(pVM);
     2722
     2723    /*
     2724     * Validate input - we trust the caller.
     2725     */
     2726    Assert(RT_ALIGN_T(GCPhys, PAGE_SIZE, RTGCPHYS) == GCPhys);
     2727    Assert(cb);
     2728    Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb);
     2729
     2730
     2731    AssertReleaseMsg(g_iLastRegion < RT_ELEMENTS(g_aRegions), "registering too many physical memory regions\n");
     2732    g_aRegions[g_iLastRegion].GCBase = GCBase;
     2733    g_aRegions[g_iLastRegion].cbSize = cb;
     2734    /** @todo: Flag names are just wildly invented for purposes of cleanness */
     2735    g_aRegions[g_iLastRegion].fFlags = fFlags & ~(MM_RAM_FLAGS_LAST_CHUNK);
     2736    g_iLastRegion++;
     2737
     2738    if (fFlags & MM_RAM_FLAGS_LAST_CHUNK)
     2739    {
     2740        int i;
     2741        for (i = 0; i < g_iLastRegion; i++)
     2742        {
     2743            if ((g_aRegions[i].fFlags & MM_RAM_FLAGS_MMIO) == 0)
     2744            {
     2745                phys_ram_size += g_aRegions[i].cbSize;
     2746                RTGCPHYS GCRegionEnd = g_aRegions[i].GCBase + g_aRegions[i].cbSize;
     2747                if (phys_ram_dirty_size < (GCRegionEnd >> PAGE_SHIFT))
     2748                    phys_ram_dirty_size = (GCRegionEnd >> PAGE_SHIFT);
     2749            }
     2750        }
     2751        phys_ram_dirty_size = cb >> PAGE_SHIFT;
     2752        phys_ram_dirty = MMR3HeapAlloc(pVM, MM_TAG_REM, phys_ram_dirty_size);
     2753        AssertReleaseMsg(phys_ram_dirty, ("failed to allocate %d bytes of dirty bytes\n", phys_ram_dirty_size));
     2754        memset(phys_ram_dirty, 0xff, phys_ram_dirty_size);
     2755    }
     2756
     2757    /*
     2758     * Register the ram.
     2759     */
     2760    Assert(!pVM->rem.s.fIgnoreAll);
     2761    pVM->rem.s.fIgnoreAll = true;
     2762
     2763#ifdef VBOX_WITH_NEW_PHYS_CODE
     2764    cpu_register_physical_memory(GCPhys, cb, GCPhys);
     2765#else
     2766    /** @todo: most likely wrong */
     2767    if (fFlags & MM_RAM_FLAGS_BASE_RAM)
     2768        cpu_register_physical_memory(GCPhys, cb, GCPhys | IO_MEM_RAM_MISSING);
     2769    else if (fFlags & MM_RAM_FLAGS_RESERVED)
     2770        cpu_register_physical_memory(GCPhys, cb, IO_MEM_UNASSIGNED);
     2771    else
     2772        cpu_register_physical_memory(GCPhys, cb, GCPhys);
     2773#endif
     2774    Assert(pVM->rem.s.fIgnoreAll);
     2775    pVM->rem.s.fIgnoreAll = false;
     2776}
     2777#endif /* 0 */
     2778
    26962779
    26972780#ifndef VBOX_WITH_NEW_PHYS_CODE
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette