Changeset 17538 in vbox for trunk/src/recompiler_new
- Timestamp:
- Mar 8, 2009 5:32:49 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 43972
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler_new/VBoxRecompiler.c
r17537 r17538 2720 2720 * @param GCPhys The physical address the RAM. 2721 2721 * @param cb Size of the memory. 2722 * @param fFlags Flags of the MM_RAM_FLAGS_* defines.2722 * @param fFlags Flags of the REM_NOTIFY_PHYS_RAM_FLAGS_* defines. 2723 2723 */ 2724 2724 REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, unsigned fFlags) 2725 2725 { 2726 Log(("REMR3NotifyPhysRamRegister: GCPhys=%RGp cb=%RGp fFlags=% d\n", GCPhys, cb, fFlags));2726 Log(("REMR3NotifyPhysRamRegister: GCPhys=%RGp cb=%RGp fFlags=%#x\n", GCPhys, cb, fFlags)); 2727 2727 VM_ASSERT_EMT(pVM); 2728 2728 … … 2733 2733 Assert(cb); 2734 2734 Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb); 2735 #ifdef VBOX_WITH_NEW_PHYS_CODE 2736 AssertMsg(fFlags == REM_NOTIFY_PHYS_RAM_FLAGS_RAM || fFlags == REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2, ("#x\n", fFlags)); 2737 #endif 2735 2738 2736 2739 /* 2737 2740 * Base ram? Update GCPhysLastRam. 2738 2741 */ 2739 if (!GCPhys) /** @todo add a flag for identifying MMIO2 memory here (new phys code)*/ 2742 #ifdef VBOX_WITH_NEW_PHYS_CODE 2743 if (fFlags & REM_NOTIFY_PHYS_RAM_FLAGS_RAM) 2744 #else 2745 if (!GCPhys) 2746 #endif 2740 2747 { 2741 2748 if (GCPhys + (cb - 1) > pVM->rem.s.GCPhysLastRam) … … 2768 2775 pVM->rem.s.fIgnoreAll = false; 2769 2776 } 2770 2771 #if 02772 /** Prototype code for > 4G RAM physical memory registration */2773 typedef struct {2774 RTGCPHYS GCBase;2775 RTGCPHYS cbSize;2776 uint32_t fFlags;2777 } PhysRamRegion;2778 2779 static PhysRamRegion g_aRegions[4];2780 static uint32_t g_iLastRegion = 0;2781 2782 /**2783 * Notification about a successful MMR3PhysRegister() call.2784 *2785 * @param pVM VM handle.2786 * @param GCPhys The physical address the RAM.2787 * @param cb Size of the memory.2788 * @param fFlags Flags of the MM_RAM_FLAGS_* defines.2789 */2790 REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, unsigned fFlags)2791 {2792 uint32_t cbBitmap;2793 int rc;2794 Log(("REMR3NotifyPhysRamRegister: GCPhys=%RGp cb=%d fFlags=%d\n", GCPhys, cb, fFlags));2795 VM_ASSERT_EMT(pVM);2796 2797 /*2798 * Validate input - we trust the caller.2799 */2800 Assert(RT_ALIGN_T(GCPhys, PAGE_SIZE, RTGCPHYS) == GCPhys);2801 Assert(cb);2802 Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb);2803 2804 2805 AssertReleaseMsg(g_iLastRegion < RT_ELEMENTS(g_aRegions), "registering too many physical memory regions\n");2806 g_aRegions[g_iLastRegion].GCBase = GCBase;2807 g_aRegions[g_iLastRegion].cbSize = cb;2808 /** @todo: Flag names are just wildly invented for purposes of cleanness */2809 g_aRegions[g_iLastRegion].fFlags = fFlags & ~(MM_RAM_FLAGS_LAST_CHUNK);2810 g_iLastRegion++;2811 2812 if (fFlags & MM_RAM_FLAGS_LAST_CHUNK)2813 {2814 int i;2815 for (i = 0; i < g_iLastRegion; i++)2816 {2817 if ((g_aRegions[i].fFlags & MM_RAM_FLAGS_MMIO) == 0)2818 {2819 phys_ram_size += g_aRegions[i].cbSize;2820 RTGCPHYS GCRegionEnd = g_aRegions[i].GCBase + g_aRegions[i].cbSize;2821 if (phys_ram_dirty_size < (GCRegionEnd >> PAGE_SHIFT))2822 phys_ram_dirty_size = (GCRegionEnd >> PAGE_SHIFT);2823 }2824 }2825 phys_ram_dirty_size = cb >> PAGE_SHIFT;2826 phys_ram_dirty = MMR3HeapAlloc(pVM, MM_TAG_REM, phys_ram_dirty_size);2827 AssertReleaseMsg(phys_ram_dirty, ("failed to allocate %d bytes of dirty bytes\n", phys_ram_dirty_size));2828 memset(phys_ram_dirty, 0xff, phys_ram_dirty_size);2829 }2830 2831 /*2832 * Register the ram.2833 */2834 Assert(!pVM->rem.s.fIgnoreAll);2835 pVM->rem.s.fIgnoreAll = true;2836 2837 #ifdef VBOX_WITH_NEW_PHYS_CODE2838 cpu_register_physical_memory(GCPhys, cb, GCPhys);2839 #else2840 /** @todo: most likely wrong */2841 if (fFlags & MM_RAM_FLAGS_BASE_RAM)2842 cpu_register_physical_memory(GCPhys, cb, GCPhys | IO_MEM_RAM_MISSING);2843 else if (fFlags & MM_RAM_FLAGS_RESERVED)2844 cpu_register_physical_memory(GCPhys, cb, IO_MEM_UNASSIGNED);2845 else2846 cpu_register_physical_memory(GCPhys, cb, GCPhys);2847 #endif2848 Assert(pVM->rem.s.fIgnoreAll);2849 pVM->rem.s.fIgnoreAll = false;2850 }2851 #endif /* 0 */2852 2853 2777 2854 2778 #ifndef VBOX_WITH_NEW_PHYS_CODE
Note:
See TracChangeset
for help on using the changeset viewer.