Changeset 18661 in vbox for trunk/src/recompiler
- Timestamp:
- Apr 2, 2009 6:29:09 PM (16 years ago)
- Location:
- trunk/src/recompiler
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/VBoxREMWrapper.cpp
r17537 r18661 348 348 static DECLCALLBACKPTR(void, pfnREMR3ReplayHandlerNotifications)(PVM pVM); 349 349 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamRegister)(PVM, RTGCPHYS, RTGCPHYS, unsigned); 350 #ifndef VBOX_WITH_NEW_PHYS_CODE351 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamChunkRegister)(PVM, RTGCPHYS, RTUINT, RTHCUINTPTR, unsigned);352 #endif353 350 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamDeregister)(PVM, RTGCPHYS, RTUINT); 354 351 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRomRegister)(PVM, RTGCPHYS, RTUINT, void *, bool); … … 1029 1026 { "REMR3ReplayHandlerNotifications", (void *)&pfnREMR3ReplayHandlerNotifications, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1030 1027 { "REMR3NotifyPhysRamRegister", (void *)&pfnREMR3NotifyPhysRamRegister, &g_aArgsNotifyPhysRamRegister[0], RT_ELEMENTS(g_aArgsNotifyPhysRamRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1031 #ifndef VBOX_WITH_NEW_PHYS_CODE1032 { "REMR3NotifyPhysRamChunkRegister", (void *)&pfnREMR3NotifyPhysRamChunkRegister, &g_aArgsNotifyPhysRamChunkRegister[0], RT_ELEMENTS(g_aArgsNotifyPhysRamChunkRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL },1033 #endif1034 1028 { "REMR3NotifyPhysRamDeregister", (void *)&pfnREMR3NotifyPhysRamDeregister, &g_aArgsNotifyPhysRamDeregister[0], RT_ELEMENTS(g_aArgsNotifyPhysRamDeregister), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1035 1029 { "REMR3NotifyPhysRomRegister", (void *)&pfnREMR3NotifyPhysRomRegister, &g_aArgsNotifyPhysRomRegister[0], RT_ELEMENTS(g_aArgsNotifyPhysRomRegister), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, … … 1115 1109 { "PGMGstGetPage", (void *)(uintptr_t)&PGMGstGetPage, &g_aArgsPGMGstGetPage[0], RT_ELEMENTS(g_aArgsPGMGstGetPage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1116 1110 { "PGMInvalidatePage", (void *)(uintptr_t)&PGMInvalidatePage, &g_aArgsPGMInvalidatePage[0], RT_ELEMENTS(g_aArgsPGMInvalidatePage), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1117 #ifndef VBOX_WITH_NEW_PHYS_CODE1118 { "PGM3PhysGrowRange", (void *)(uintptr_t)&PGM3PhysGrowRange, &g_aArgsPGM3PhysGrowRange[0], RT_ELEMENTS(g_aArgsPGM3PhysGrowRange), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL },1119 #endif1120 1111 { "PGMPhysIsGCPhysValid", (void *)(uintptr_t)&PGMPhysIsGCPhysValid, &g_aArgsPGMPhysIsGCPhysValid[0], RT_ELEMENTS(g_aArgsPGMPhysIsGCPhysValid), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, 1121 1112 { "PGMPhysIsA20Enabled", (void *)(uintptr_t)&PGMPhysIsA20Enabled, &g_aArgsVM[0], RT_ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, … … 2163 2154 } 2164 2155 2165 #ifndef VBOX_WITH_NEW_PHYS_CODE2166 REMR3DECL(void) REMR3NotifyPhysRamChunkRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, RTHCUINTPTR pvRam, unsigned fFlags)2167 {2168 #ifndef USE_REM_STUBS2169 Assert(VALID_PTR(pfnREMR3NotifyPhysRamChunkRegister));2170 pfnREMR3NotifyPhysRamChunkRegister(pVM, GCPhys, cb, pvRam, fFlags);2171 #endif2172 }2173 #endif2174 2175 2156 REMR3DECL(void) REMR3NotifyPhysRomRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvCopy, bool fShadow) 2176 2157 { -
trunk/src/recompiler/VBoxRecompiler.c
r18650 r18661 2805 2805 Assert(cb); 2806 2806 Assert(RT_ALIGN_Z(cb, PAGE_SIZE) == cb); 2807 #ifdef VBOX_WITH_NEW_PHYS_CODE2808 2807 AssertMsg(fFlags == REM_NOTIFY_PHYS_RAM_FLAGS_RAM || fFlags == REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2, ("#x\n", fFlags)); 2809 #endif2810 2808 2811 2809 /* 2812 2810 * Base ram? Update GCPhysLastRam. 2813 2811 */ 2814 #ifdef VBOX_WITH_NEW_PHYS_CODE2815 2812 if (fFlags & REM_NOTIFY_PHYS_RAM_FLAGS_RAM) 2816 #else2817 if (!GCPhys)2818 #endif2819 2813 { 2820 2814 if (GCPhys + (cb - 1) > pVM->rem.s.GCPhysLastRam) … … 2831 2825 pVM->rem.s.fIgnoreAll = true; 2832 2826 2833 #ifdef VBOX_WITH_NEW_PHYS_CODE2834 2827 cpu_register_physical_memory(GCPhys, cb, GCPhys); 2835 #else2836 if (!GCPhys)2837 cpu_register_physical_memory(GCPhys, cb, GCPhys | IO_MEM_RAM_MISSING);2838 else2839 {2840 if (fFlags & MM_RAM_FLAGS_RESERVED)2841 cpu_register_physical_memory(GCPhys, cb, IO_MEM_UNASSIGNED);2842 else2843 cpu_register_physical_memory(GCPhys, cb, GCPhys);2844 }2845 #endif2846 2828 Assert(pVM->rem.s.fIgnoreAll); 2847 2829 pVM->rem.s.fIgnoreAll = false; 2848 2830 } 2849 2831 2850 #ifndef VBOX_WITH_NEW_PHYS_CODE2851 2852 /**2853 * Notification about a successful PGMR3PhysRegisterChunk() call.2854 *2855 * @param pVM VM handle.2856 * @param GCPhys The physical address the RAM.2857 * @param cb Size of the memory.2858 * @param pvRam The HC address of the RAM.2859 * @param fFlags Flags of the MM_RAM_FLAGS_* defines.2860 */2861 REMR3DECL(void) REMR3NotifyPhysRamChunkRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, RTHCUINTPTR pvRam, unsigned fFlags)2862 {2863 Log(("REMR3NotifyPhysRamChunkRegister: GCPhys=%RGp cb=%d pvRam=%p fFlags=%d\n", GCPhys, cb, pvRam, fFlags));2864 VM_ASSERT_EMT(pVM);2865 2866 /*2867 * Validate input - we trust the caller.2868 */2869 Assert(pvRam);2870 Assert(RT_ALIGN(pvRam, PAGE_SIZE) == pvRam);2871 Assert(RT_ALIGN_T(GCPhys, PAGE_SIZE, RTGCPHYS) == GCPhys);2872 Assert(cb == PGM_DYNAMIC_CHUNK_SIZE);2873 Assert(fFlags == 0 /* normal RAM */);2874 Assert(!pVM->rem.s.fIgnoreAll);2875 pVM->rem.s.fIgnoreAll = true;2876 2877 cpu_register_physical_memory(GCPhys, cb, GCPhys);2878 2879 Assert(pVM->rem.s.fIgnoreAll);2880 pVM->rem.s.fIgnoreAll = false;2881 }2882 2883 2884 /**2885 * Grows dynamically allocated guest RAM.2886 * Will raise a fatal error if the operation fails.2887 *2888 * @param physaddr The physical address.2889 */2890 void remR3GrowDynRange(unsigned long physaddr)2891 {2892 int rc;2893 PVM pVM = cpu_single_env->pVM;2894 2895 LogFlow(("remR3GrowDynRange %RGp\n", (RTGCPHYS)physaddr));2896 const RTGCPHYS GCPhys = physaddr;2897 rc = PGM3PhysGrowRange(pVM, &GCPhys);2898 if (RT_SUCCESS(rc))2899 return;2900 2901 LogRel(("\nUnable to allocate guest RAM chunk at %RGp\n", (RTGCPHYS)physaddr));2902 cpu_abort(cpu_single_env, "Unable to allocate guest RAM chunk at %RGp\n", (RTGCPHYS)physaddr);2903 AssertFatalFailed();2904 }2905 2906 #endif /* !VBOX_WITH_NEW_PHYS_CODE */2907 2832 2908 2833 /** -
trunk/src/recompiler/cpu-all.h
r13839 r18661 205 205 void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val); 206 206 207 #ifndef VBOX_WITH_NEW_PHYS_CODE208 void remR3GrowDynRange(unsigned long physaddr);209 #endif210 207 #if 0 /*defined(RT_ARCH_AMD64) && defined(VBOX_STRICT)*/ 211 208 # define VBOX_CHECK_ADDR(ptr) do { if ((uintptr_t)(ptr) >= _4G) __asm__("int3"); } while (0) … … 1008 1005 #define IO_MEM_UNASSIGNED (2 << IO_MEM_SHIFT) 1009 1006 #define IO_MEM_NOTDIRTY (4 << IO_MEM_SHIFT) /* used internally, never use directly */ 1010 #if defined(VBOX) && !defined(VBOX_WITH_NEW_PHYS_CODE)1011 #define IO_MEM_RAM_MISSING (5 << IO_MEM_SHIFT) /* used internally, never use directly */1012 #endif1013 1007 /* acts like a ROM when read and like a device when written. As an 1014 1008 exception, the write memory callback gets the ram offset instead of -
trunk/src/recompiler/exec.c
r13185 r18661 292 292 pd[i].phys_offset = IO_MEM_UNASSIGNED; 293 293 } 294 #if defined(VBOX) && !defined(VBOX_WITH_NEW_PHYS_CODE)295 pd = ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1));296 if (RT_UNLIKELY((pd->phys_offset & ~TARGET_PAGE_MASK) == IO_MEM_RAM_MISSING))297 remR3GrowDynRange(pd->phys_offset & TARGET_PAGE_MASK);298 return pd;299 #else300 294 return ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1)); 301 #endif302 295 } 303 296 … … 1972 1965 p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1); 1973 1966 p->phys_offset = phys_offset; 1974 #if !defined(VBOX) || defined(VBOX_WITH_NEW_PHYS_CODE)1975 1967 if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM || 1976 1968 (phys_offset & IO_MEM_ROMD)) 1977 #else1978 if ( (phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM1979 || (phys_offset & IO_MEM_ROMD)1980 || (phys_offset & ~TARGET_PAGE_MASK) == IO_MEM_RAM_MISSING)1981 #endif1982 1983 1969 phys_offset += TARGET_PAGE_SIZE; 1984 1970 } … … 2182 2168 cpu_register_io_memory(IO_MEM_UNASSIGNED >> IO_MEM_SHIFT, unassigned_mem_read, unassigned_mem_write, NULL); 2183 2169 cpu_register_io_memory(IO_MEM_NOTDIRTY >> IO_MEM_SHIFT, error_mem_read, notdirty_mem_write, NULL); 2184 #if defined(VBOX) && !defined(VBOX_WITH_NEW_PHYS_CODE)2185 cpu_register_io_memory(IO_MEM_RAM_MISSING >> IO_MEM_SHIFT, unassigned_mem_read, unassigned_mem_write, NULL);2186 io_mem_nb = 6;2187 #else2188 2170 io_mem_nb = 5; 2189 #endif2190 2171 2191 2172 #ifndef VBOX /* VBOX: we do this later when the RAM is allocated. */
Note:
See TracChangeset
for help on using the changeset viewer.