Changeset 1590 in vbox for trunk/src/recompiler
- Timestamp:
- Mar 21, 2007 2:58:53 AM (18 years ago)
- Location:
- trunk/src/recompiler/new
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/new/Makefile.kmk
r1196 r1590 55 55 $(PATH_$(REM_MOD))/opc.h 56 56 57 # A private hack for gcc 4.1 - no longer required. gcc 4.1.1 works fine for everything. 58 #ifeq ($(USERNAME).$(BUILD_TARGET),bird.linux) 59 # TOOL_GCC3_CC = gcc-3.4.6 60 # TOOL_GCC3_CXX = gcc-3.4.6 61 # TOOL_GCC3_LD = g++-3.4.6 62 # override VBOX_GCC_Wno-variadic-macros= 63 # override VBOX_USING_GCC4= 64 #endif 57 DEFS += REM_PHYS_ADDR_IN_TLB 65 58 66 59 # -
trunk/src/recompiler/new/VBoxREMWrapper.cpp
r1120 r1590 638 638 }; 639 639 static const REMPARMDESC g_aArgsPGM3PhysGrowRange[] = 640 { 641 { REMPARMDESC_FLAGS_INT, sizeof(PVM) }, 642 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS) } 643 }; 644 static const REMPARMDESC g_aArgsPGMPhysIsGCPhysValid[] = 640 645 { 641 646 { REMPARMDESC_FLAGS_INT, sizeof(PVM) }, … … 975 980 { "PGMPhysGCPtr2HCPtrByGstCR3", (void *)(uintptr_t)&PGMPhysGCPtr2HCPtrByGstCR3, &g_aArgsPGMPhysGCPtr2HCPtrByGstCR3[0], ELEMENTS(g_aArgsPGMPhysGCPtr2HCPtrByGstCR3), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 976 981 { "PGM3PhysGrowRange", (void *)(uintptr_t)&PGM3PhysGrowRange, &g_aArgsPGM3PhysGrowRange[0], ELEMENTS(g_aArgsPGM3PhysGrowRange), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 982 { "PGMPhysIsGCPhysValid", (void *)(uintptr_t)&PGMPhysIsGCPhysValid, &g_aArgsPGMPhysIsGCPhysValid[0], ELEMENTS(g_aArgsPGMPhysIsGCPhysValid), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, 977 983 { "PGMPhysIsA20Enabled", (void *)(uintptr_t)&PGMPhysIsA20Enabled, &g_aArgsVM[0], ELEMENTS(g_aArgsVM), REMFNDESC_FLAGS_RET_INT, sizeof(bool), NULL }, 978 984 { "PGMPhysRead", (void *)(uintptr_t)&PGMPhysRead, &g_aArgsPGMPhysRead[0], ELEMENTS(g_aArgsPGMPhysRead), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, -
trunk/src/recompiler/new/VBoxRecompiler.c
r1589 r1590 117 117 static STAMPROFILEADV gStatRawCheck; 118 118 static STAMPROFILEADV gStatMemRead; 119 static STAMPROFILEADV gStatMemReadHCPtr; 119 120 static STAMPROFILEADV gStatMemWrite; 121 static STAMPROFILEADV gStatMemWriteHCPtr; 120 122 static STAMCOUNTER gStatRefuseTFInhibit; 121 123 static STAMCOUNTER gStatRefuseVM86; … … 350 352 STAM_REG(pVM, &gStatRawCheck, STAMTYPE_PROFILE, "/PROF/REM/RawCheck", STAMUNIT_TICKS_PER_CALL, "Profiling timer scheduling."); 351 353 STAM_REG(pVM, &gStatMemRead, STAMTYPE_PROFILE, "/PROF/REM/MemRead", STAMUNIT_TICKS_PER_CALL, "Profiling memory access."); 354 STAM_REG(pVM, &gStatMemReadHCPtr, STAMTYPE_PROFILE, "/PROF/REM/MemReadHCPtr", STAMUNIT_TICKS_PER_CALL, "Profiling memory access."); 352 355 STAM_REG(pVM, &gStatMemWrite, STAMTYPE_PROFILE, "/PROF/REM/MemWrite", STAMUNIT_TICKS_PER_CALL, "Profiling memory access."); 356 STAM_REG(pVM, &gStatMemWriteHCPtr, STAMTYPE_PROFILE, "/PROF/REM/MemWriteHCPtr", STAMUNIT_TICKS_PER_CALL, "Profiling memory access."); 353 357 354 358 STAM_REG(pVM, &gStatRefuseTFInhibit, STAMTYPE_COUNTER, "/REM/Refuse/TFInibit", STAMUNIT_OCCURENCES, "Raw mode refused because of TF or irq inhibit"); … … 1343 1347 * @param env Pointer to cpu environment. 1344 1348 */ 1345 void remR3SetPage(CPUState *env, CPUTLBEntry *pRead, CPUTLBEntry *pWrite, int prot, int is_user) 1346 { 1347 #ifndef PGM_DYNAMIC_RAM_ALLOC 1348 target_ulong phys_addr; 1349 #endif 1350 target_ulong virt_addr, addend; 1349 void remR3SetPage(CPUState *env, CPUTLBEntry *pTLBEntry, CPUTLBEntry *pTLBEntryIgnored, int prot, int is_user) 1350 { 1351 target_ulong virt_addr; 1351 1352 if (env->pVM->rem.s.fIgnoreSetPage || env->pVM->rem.s.fIgnoreAll) 1352 1353 return; … … 1355 1356 #ifndef PGM_DYNAMIC_RAM_ALLOC 1356 1357 if(!is_user && !(env->state & CPU_RAW_RING0)) 1357 { 1358 // We are currently not interested in kernel pages 1359 #ifdef DEBUG 1360 if (prot & PAGE_WRITE) 1361 { 1362 addend = pWrite->addend; 1363 virt_addr = pWrite->addr_write; 1364 } 1365 else if (prot & PAGE_READ) 1366 { 1367 addend = pRead->addend; 1368 virt_addr = pRead->addr_read; 1369 } 1370 else 1371 { 1372 // Should never happen! 1373 AssertMsgFailed(("tlb_set_page_raw unexpected protection flags %x\n", prot)); 1374 return; 1375 } 1376 1377 if (!(addend & IO_MEM_ROM)) 1378 { 1379 phys_addr = virt_addr - (uintptr_t)phys_ram_base + addend; 1380 } 1381 else 1382 { 1383 Log(("memory mapped io memory at %08X\n", addend)); 1384 phys_addr = addend; //@todo: correct?? 1385 } 1386 1387 // Clear IO_* flags (TODO: are they actually useful for us??) 1388 virt_addr &= ~0xFFF; 1389 #if !defined(DEBUG_bird) && !defined(DEBUG_dmik) 1390 //// dprintf(("tlb_set_page_raw Ignoring system page (%x-%x) prot %x is_user %d\n", virt_addr, phys_addr, prot, is_user)); 1391 #endif 1392 #endif 1393 return; 1394 } 1395 1396 Log2(("tlb_set_page_raw read (%x-%x) write (%x-%x) prot %x is_user %d phys base %x\n", 1397 pRead->addr_read, pRead->addend, pWrite->addr_write, pWrite->addend, prot, is_user, phys_ram_base)); 1358 return; /* We are currently not interested in kernel pages */ 1359 #endif 1360 1361 #if !defined(PGM_DYNAMIC_RAM_ALLOC) && !defined(REM_PHYS_ADDR_IN_TLB) 1362 Log2(("tlb_set_page_raw (r=%x|w=%x)-%x prot %x is_user %d phys base %x\n", 1363 pTLBEntry->addr_read, pTLBEntry->addr_write, pTLBEntry->addend, prot, is_user, phys_ram_base)); 1398 1364 #else /* PGM_DYNAMIC_RAM_ALLOC */ 1399 Log2(("tlb_set_page_raw read (%x-%x) write (%x-%x) prot %x is_user %d phys\n",1400 p Read->addr_read, pRead->addend, pWrite->addr_write, pWrite->addend, prot, is_user));1365 Log2(("tlb_set_page_raw (r=%x|w=%x)-%x prot %x is_user %d\n", 1366 pTLBEntry->addr_read, pTLBEntry->addr_write, pTLBEntry->addend, prot, is_user)); 1401 1367 #endif/* PGM_DYNAMIC_RAM_ALLOC */ 1402 1368 1369 /* 1370 * Extract the virtual address. 1371 */ 1403 1372 if (prot & PAGE_WRITE) 1404 { 1405 addend = pWrite->addend; 1406 virt_addr = pWrite->addr_write; 1407 } 1373 virt_addr = pTLBEntry->addr_write; 1408 1374 else if (prot & PAGE_READ) 1409 { 1410 addend = pRead->addend; 1411 virt_addr = pRead->addr_read; 1412 } 1375 virt_addr = pTLBEntry->addr_read; 1413 1376 else 1414 { 1415 // Should never happen! 1416 AssertMsgFailed(("tlb_set_page_raw unexpected protection flags %x\n", prot)); 1417 return; 1418 } 1419 1420 #ifndef PGM_DYNAMIC_RAM_ALLOC 1421 if (!(addend & IO_MEM_ROM)) 1422 { 1423 phys_addr = virt_addr - (uintptr_t)phys_ram_base + addend; 1424 } 1425 else 1426 { 1427 Log(("memory mapped io memory at %08X\n", addend)); 1428 phys_addr = addend; //@todo: correct?? 1429 } 1430 #endif /* !PGM_DYNAMIC_RAM_ALLOC */ 1431 1432 // Clear IO_* flags (TODO: are they actually useful for us??) 1433 virt_addr &= ~0xFFF; 1377 AssertMsgFailedReturnVoid(("tlb_set_page_raw unexpected protection flags %x\n", prot)); 1378 virt_addr &= TARGET_PAGE_MASK; 1434 1379 1435 1380 /* … … 1447 1392 if (VBOX_FAILURE(rc)) 1448 1393 { 1449 #ifdef PGM_DYNAMIC_RAM_ALLOC 1450 AssertMsgFailed(("RAWEx_SetPageEntry %x %x %d failed!!\n", virt_addr, prot, is_user)); 1451 #else 1394 #ifdef VBOX_STRICT 1395 target_ulong addend = pTLBEntry->addend; 1396 target_ulong phys_addr; 1397 1398 if (!(addend & IO_MEM_ROM)) 1399 # ifdef REM_PHYS_ADDR_IN_TLB 1400 phys_addr = virt_addr + addend; 1401 # elif defined(REM_PHYS_ADDR_IN_TLB) 1402 phys_addr = remR3HCVirt2GCPhys(env, (void *)(virt_addr + addend)); 1403 # else 1404 phys_addr = virt_addr - (uintptr_t)phys_ram_base + addend; 1405 # endif 1406 else 1407 phys_addr = addend; 1452 1408 AssertMsgFailed(("RAWEx_SetPageEntry %x %x %x %d failed!!\n", virt_addr, phys_addr, prot, is_user)); 1453 #endif 1409 #endif /* VBOX_STRICT */ 1454 1410 VM_FF_SET(env->pVM, VM_FF_PGM_SYNC_CR3); 1455 1411 } … … 2558 2514 if (!GCPhys) 2559 2515 { 2560 #if ndef PGM_DYNAMIC_RAM_ALLOC2516 #if !defined(PGM_DYNAMIC_RAM_ALLOC) && !defined(REM_PHYS_ADDR_IN_TLB) 2561 2517 AssertRelease(!phys_ram_base); 2562 2518 phys_ram_base = pvRam; … … 2589 2545 else 2590 2546 { 2547 # ifndef REM_PHYS_ADDR_IN_TLB 2591 2548 uint32_t i; 2549 # endif 2592 2550 2593 2551 cpu_register_physical_memory(GCPhys, cb, GCPhys | (fFlags & MM_RAM_FLAGS_RESERVED ? IO_MEM_UNASSIGNED : 0)); 2594 2552 2553 # ifndef REM_PHYS_ADDR_IN_TLB 2595 2554 AssertRelease(pVM->rem.s.cPhysRegistrations < REM_MAX_PHYS_REGISTRATIONS); 2596 2555 for (i = 0; i < pVM->rem.s.cPhysRegistrations; i++) … … 2610 2569 pVM->rem.s.cPhysRegistrations++; 2611 2570 } 2612 } 2571 # endif /* !REM_PHYS_ADDR_IN_TLB */ 2572 } 2573 #elif defined(REM_PHYS_ADDR_IN_TLB) 2574 cpu_register_physical_memory(GCPhys, cb, GCPhys | (fFlags & MM_RAM_FLAGS_RESERVED ? IO_MEM_UNASSIGNED : 0)); 2613 2575 #else 2614 2576 AssertRelease(phys_ram_base); … … 2647 2609 Assert(fFlags == 0 /* normal RAM */); 2648 2610 2611 # ifdef REM_PHYS_ADDR_IN_TLB 2649 2612 if (!pVM->rem.s.paHCVirtToGCPhys) 2650 2613 { … … 2685 2648 } 2686 2649 } 2650 # endif /* REM_PHYS_ADDR_IN_TLB */ 2687 2651 2688 2652 Assert(!pVM->rem.s.fIgnoreAll); … … 2701 2665 2702 2666 #ifdef PGM_DYNAMIC_RAM_ALLOC 2667 # ifndef REM_PHYS_ADDR_IN_TLB 2703 2668 /** 2704 2669 * Convert GC physical address to HC virt … … 2774 2739 return 0; 2775 2740 } 2776 2741 # endif /* !REM_PHYS_ADDR_IN_TLB */ 2777 2742 2778 2743 /** … … 2831 2796 pVM->rem.s.fIgnoreAll = true; 2832 2797 2833 #ifdef PGM_DYNAMIC_RAM_ALLOC 2798 #ifdef REM_PHYS_ADDR_IN_TLB 2799 cpu_register_physical_memory(GCPhys, cb, GCPhys | IO_MEM_ROM); 2800 #elif defined(PGM_DYNAMIC_RAM_ALLOC) 2834 2801 cpu_register_physical_memory(GCPhys, cb, GCPhys | IO_MEM_ROM); 2835 2802 AssertRelease(pVM->rem.s.cPhysRegistrations < REM_MAX_PHYS_REGISTRATIONS); … … 2966 2933 Assert(cb == PAGE_SIZE); 2967 2934 Assert(RT_ALIGN_T(GCPhys, PAGE_SIZE, RTGCPHYS) == GCPhys); 2968 #ifdef PGM_DYNAMIC_RAM_ALLOC 2935 #ifdef REM_PHYS_ADDR_IN_TLB 2936 cpu_register_physical_memory(GCPhys, cb, GCPhys); 2937 #elif defined(PGM_DYNAMIC_RAM_ALLOC) 2969 2938 Assert(remR3HCVirt2GCPhys(cpu_single_env, pvHCPtr) < MMR3PhysGetRamSize(pVM)); 2970 2939 cpu_register_physical_memory(GCPhys, cb, GCPhys); … … 3017 2986 Assert(cb == PAGE_SIZE); 3018 2987 Assert(RT_ALIGN_T(GCPhysOld, PAGE_SIZE, RTGCPHYS) == GCPhysOld); 3019 #ifdef PGM_DYNAMIC_RAM_ALLOC 2988 #ifdef REM_PHYS_ADDR_IN_TLB 2989 cpu_register_physical_memory(GCPhysOld, cb, GCPhysOld); 2990 #elif defined(PGM_DYNAMIC_RAM_ALLOC) 3020 2991 Assert(remR3HCVirt2GCPhys(cpu_single_env, pvHCPtr) < MMR3PhysGetRamSize(pVM)); 3021 2992 cpu_register_physical_memory(GCPhysOld, cb, GCPhysOld); … … 3101 3072 3102 3073 3074 /** Validate the physical address passed to the read functions. 3075 * Useful for finding non-guest-ram reads/writes. */ 3076 #if 1 3077 # define VBOX_CHECK_ADDR(GCPhys) AssertMsg(PGMPhysIsGCPhysValid(cpu_single_env->pVM, (GCPhys)), ("%VGp\n", (GCPhys))) 3078 #else 3079 # define VBOX_CHECK_ADDR(GCPhys) do { } while (0) 3080 #endif 3081 3082 /** 3083 * Read guest RAM and ROM. 3084 * 3085 * @param SrcGCPhys The source address (guest physical). 3086 * @param pvDst The destination address. 3087 * @param cb Number of bytes 3088 */ 3089 void remR3PhysRead(RTGCPHYS SrcGCPhys, void *pvDst, unsigned cb) 3090 { 3091 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3092 VBOX_CHECK_ADDR(SrcGCPhys); 3093 PGMPhysRead(cpu_single_env->pVM, SrcGCPhys, pvDst, cb); 3094 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3095 } 3096 3097 3098 /** 3099 * Read guest RAM and ROM, unsigned 8-bit. 3100 * 3101 * @param SrcGCPhys The source address (guest physical). 3102 */ 3103 uint8_t remR3PhysReadU8(RTGCPHYS SrcGCPhys) 3104 { 3105 uint8_t val; 3106 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3107 VBOX_CHECK_ADDR(SrcGCPhys); 3108 val = PGMR3PhysReadByte(cpu_single_env->pVM, SrcGCPhys); 3109 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3110 return val; 3111 } 3112 3113 3114 /** 3115 * Read guest RAM and ROM, signed 8-bit. 3116 * 3117 * @param SrcGCPhys The source address (guest physical). 3118 */ 3119 int8_t remR3PhysReadS8(RTGCPHYS SrcGCPhys) 3120 { 3121 int8_t val; 3122 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3123 VBOX_CHECK_ADDR(SrcGCPhys); 3124 val = PGMR3PhysReadByte(cpu_single_env->pVM, SrcGCPhys); 3125 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3126 return val; 3127 } 3128 3129 3130 /** 3131 * Read guest RAM and ROM, unsigned 16-bit. 3132 * 3133 * @param SrcGCPhys The source address (guest physical). 3134 */ 3135 uint16_t remR3PhysReadU16(RTGCPHYS SrcGCPhys) 3136 { 3137 uint16_t val; 3138 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3139 VBOX_CHECK_ADDR(SrcGCPhys); 3140 val = PGMR3PhysReadWord(cpu_single_env->pVM, SrcGCPhys); 3141 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3142 return val; 3143 } 3144 3145 3146 /** 3147 * Read guest RAM and ROM, signed 16-bit. 3148 * 3149 * @param SrcGCPhys The source address (guest physical). 3150 */ 3151 int16_t remR3PhysReadS16(RTGCPHYS SrcGCPhys) 3152 { 3153 uint16_t val; 3154 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3155 VBOX_CHECK_ADDR(SrcGCPhys); 3156 val = PGMR3PhysReadWord(cpu_single_env->pVM, SrcGCPhys); 3157 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3158 return val; 3159 } 3160 3161 3162 /** 3163 * Read guest RAM and ROM, unsigned 32-bit. 3164 * 3165 * @param SrcGCPhys The source address (guest physical). 3166 */ 3167 uint32_t remR3PhysReadU32(RTGCPHYS SrcGCPhys) 3168 { 3169 uint32_t val; 3170 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3171 VBOX_CHECK_ADDR(SrcGCPhys); 3172 val = PGMR3PhysReadDword(cpu_single_env->pVM, SrcGCPhys); 3173 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3174 return val; 3175 } 3176 3177 3178 /** 3179 * Read guest RAM and ROM, signed 32-bit. 3180 * 3181 * @param SrcGCPhys The source address (guest physical). 3182 */ 3183 int32_t remR3PhysReadS32(RTGCPHYS SrcGCPhys) 3184 { 3185 int32_t val; 3186 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3187 VBOX_CHECK_ADDR(SrcGCPhys); 3188 val = PGMR3PhysReadDword(cpu_single_env->pVM, SrcGCPhys); 3189 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3190 return val; 3191 } 3192 3193 3194 /** 3195 * Read guest RAM and ROM, unsigned 64-bit. 3196 * 3197 * @param SrcGCPhys The source address (guest physical). 3198 */ 3199 uint64_t remR3PhysReadU64(RTGCPHYS SrcGCPhys) 3200 { 3201 uint64_t val; 3202 STAM_PROFILE_ADV_START(&gStatMemRead, a); 3203 VBOX_CHECK_ADDR(SrcGCPhys); 3204 val = PGMR3PhysReadDword(cpu_single_env->pVM, SrcGCPhys) 3205 | ((uint64_t)PGMR3PhysReadDword(cpu_single_env->pVM, SrcGCPhys + 4) << 32); /** @todo fix me! */ 3206 STAM_PROFILE_ADV_STOP(&gStatMemRead, a); 3207 return val; 3208 } 3209 3210 3211 /** 3212 * Write guest RAM. 3213 * 3214 * @param DstGCPhys The destination address (guest physical). 3215 * @param pvSrc The source address. 3216 * @param cb Number of bytes to write 3217 */ 3218 void remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb) 3219 { 3220 STAM_PROFILE_ADV_START(&gStatMemWrite, a); 3221 VBOX_CHECK_ADDR(DstGCPhys); 3222 PGMPhysWrite(cpu_single_env->pVM, DstGCPhys, pvSrc, cb); 3223 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3224 } 3225 3226 3227 /** 3228 * Write guest RAM, unsigned 8-bit. 3229 * 3230 * @param DstGCPhys The destination address (guest physical). 3231 * @param val Value 3232 */ 3233 void remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val) 3234 { 3235 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3236 VBOX_CHECK_ADDR(DstGCPhys); 3237 PGMR3PhysWriteByte(cpu_single_env->pVM, DstGCPhys, val); 3238 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3239 } 3240 3241 3242 /** 3243 * Write guest RAM, unsigned 8-bit. 3244 * 3245 * @param DstGCPhys The destination address (guest physical). 3246 * @param val Value 3247 */ 3248 void remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val) 3249 { 3250 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3251 VBOX_CHECK_ADDR(DstGCPhys); 3252 PGMR3PhysWriteWord(cpu_single_env->pVM, DstGCPhys, val); 3253 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3254 } 3255 3256 3257 /** 3258 * Write guest RAM, unsigned 32-bit. 3259 * 3260 * @param DstGCPhys The destination address (guest physical). 3261 * @param val Value 3262 */ 3263 void remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val) 3264 { 3265 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3266 VBOX_CHECK_ADDR(DstGCPhys); 3267 PGMR3PhysWriteDword(cpu_single_env->pVM, DstGCPhys, val); 3268 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3269 } 3270 3271 3272 /** 3273 * Write guest RAM, unsigned 64-bit. 3274 * 3275 * @param DstGCPhys The destination address (guest physical). 3276 * @param val Value 3277 */ 3278 void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val) 3279 { 3280 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3281 VBOX_CHECK_ADDR(DstGCPhys); 3282 PGMR3PhysWriteDword(cpu_single_env->pVM, DstGCPhys, (uint32_t)val); /** @todo add U64 interface. */ 3283 PGMR3PhysWriteDword(cpu_single_env->pVM, DstGCPhys + 4, val >> 32); 3284 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3285 } 3286 3287 3288 #ifndef REM_PHYS_ADDR_IN_TLB 3289 3103 3290 /** 3104 3291 * Read guest RAM and ROM. … … 3110 3297 void remR3PhysReadHCPtr(uint8_t *pbSrcPhys, void *pvDst, unsigned cb) 3111 3298 { 3112 STAM_PROFILE_ADV_START(&gStatMemRead , a);3299 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3113 3300 3114 3301 /* … … 3130 3317 memcpy(pvDst, pbSrcPhys, cb); 3131 3318 } 3132 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3319 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3133 3320 } 3134 3321 … … 3143 3330 uint8_t val; 3144 3331 3145 STAM_PROFILE_ADV_START(&gStatMemRead , a);3332 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3146 3333 3147 3334 /* … … 3162 3349 val = *pbSrcPhys; 3163 3350 } 3164 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3351 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3165 3352 return val; 3166 3353 } … … 3176 3363 int8_t val; 3177 3364 3178 STAM_PROFILE_ADV_START(&gStatMemRead , a);3365 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3179 3366 3180 3367 /* … … 3195 3382 val = *(int8_t *)pbSrcPhys; 3196 3383 } 3197 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3384 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3198 3385 return val; 3199 3386 } … … 3209 3396 uint16_t val; 3210 3397 3211 STAM_PROFILE_ADV_START(&gStatMemRead , a);3398 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3212 3399 3213 3400 /* … … 3228 3415 val = *(uint16_t *)pbSrcPhys; 3229 3416 } 3230 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3417 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3231 3418 return val; 3232 3419 } … … 3242 3429 int16_t val; 3243 3430 3244 STAM_PROFILE_ADV_START(&gStatMemRead , a);3431 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3245 3432 3246 3433 /* … … 3262 3449 val = *(int16_t *)pbSrcPhys; 3263 3450 } 3264 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3451 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3265 3452 return val; 3266 3453 } … … 3276 3463 uint32_t val; 3277 3464 3278 STAM_PROFILE_ADV_START(&gStatMemRead , a);3465 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3279 3466 3280 3467 /* … … 3295 3482 val = *(uint32_t *)pbSrcPhys; 3296 3483 } 3297 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3484 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3298 3485 return val; 3299 3486 } … … 3309 3496 int32_t val; 3310 3497 3311 STAM_PROFILE_ADV_START(&gStatMemRead , a);3498 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3312 3499 3313 3500 /* … … 3328 3515 val = *(int32_t *)pbSrcPhys; 3329 3516 } 3330 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3517 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3331 3518 return val; 3332 3519 } … … 3342 3529 uint64_t val; 3343 3530 3344 STAM_PROFILE_ADV_START(&gStatMemRead , a);3531 STAM_PROFILE_ADV_START(&gStatMemReadHCPtr, a); 3345 3532 3346 3533 /* … … 3362 3549 val = *(uint32_t *)pbSrcPhys; 3363 3550 } 3364 STAM_PROFILE_ADV_STOP(&gStatMemRead , a);3551 STAM_PROFILE_ADV_STOP(&gStatMemReadHCPtr, a); 3365 3552 return val; 3366 3553 } … … 3376 3563 void remR3PhysWriteHCPtr(uint8_t *pbDstPhys, const void *pvSrc, unsigned cb) 3377 3564 { 3378 STAM_PROFILE_ADV_START(&gStatMemWrite , a);3565 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3379 3566 /* 3380 3567 * Calc the physical address ('off') and check that it's within the RAM. … … 3389 3576 else 3390 3577 AssertMsgFailed(("pbDstPhys=%p off=%p cb=%d\n", pbDstPhys, off, cb)); 3391 STAM_PROFILE_ADV_STOP(&gStatMemWrite , a);3578 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3392 3579 } 3393 3580 … … 3401 3588 void remR3PhysWriteHCPtrU8(uint8_t *pbDstPhys, uint8_t val) 3402 3589 { 3403 STAM_PROFILE_ADV_START(&gStatMemWrite , a);3590 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3404 3591 /* 3405 3592 * Calc the physical address ('off') and check that it's within the RAM. … … 3414 3601 else 3415 3602 AssertMsgFailed(("pbDstPhys=%p off=%p cb=%d\n", pbDstPhys, off, 1)); 3416 STAM_PROFILE_ADV_STOP(&gStatMemWrite , a);3603 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3417 3604 } 3418 3605 … … 3426 3613 void remR3PhysWriteHCPtrU16(uint8_t *pbDstPhys, uint16_t val) 3427 3614 { 3428 STAM_PROFILE_ADV_START(&gStatMemWrite , a);3615 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3429 3616 /* 3430 3617 * Calc the physical address ('off') and check that it's within the RAM. … … 3439 3626 else 3440 3627 AssertMsgFailed(("pbDstPhys=%p off=%p cb=%d\n", pbDstPhys, off, 2)); 3441 STAM_PROFILE_ADV_STOP(&gStatMemWrite , a);3628 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3442 3629 } 3443 3630 … … 3451 3638 void remR3PhysWriteHCPtrU32(uint8_t *pbDstPhys, uint32_t val) 3452 3639 { 3453 STAM_PROFILE_ADV_START(&gStatMemWrite , a);3640 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3454 3641 /* 3455 3642 * Calc the physical address ('off') and check that it's within the RAM. … … 3464 3651 else 3465 3652 AssertMsgFailed(("pbDstPhys=%p off=%p cb=%d\n", pbDstPhys, off, 4)); 3466 STAM_PROFILE_ADV_STOP(&gStatMemWrite , a);3653 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3467 3654 } 3468 3655 … … 3476 3663 void remR3PhysWriteHCPtrU64(uint8_t *pbDstPhys, uint64_t val) 3477 3664 { 3478 STAM_PROFILE_ADV_START(&gStatMemWrite , a);3665 STAM_PROFILE_ADV_START(&gStatMemWriteHCPtr, a); 3479 3666 /* 3480 3667 * Calc the physical address ('off') and check that it's within the RAM. … … 3492 3679 else 3493 3680 AssertMsgFailed(("pbDstPhys=%p off=%p cb=%d\n", pbDstPhys, off, 4)); 3494 STAM_PROFILE_ADV_STOP(&gStatMemWrite, a); 3495 } 3496 3681 STAM_PROFILE_ADV_STOP(&gStatMemWriteHCPtr, a); 3682 } 3683 3684 #endif /* !REM_PHYS_ADDR_IN_TLB */ 3497 3685 3498 3686 -
trunk/src/recompiler/new/cpu-all.h
r1589 r1590 181 181 #ifdef VBOX 182 182 183 #if !defined(REMR3PHYSREADWRITE_DEFINED) 184 #define REMR3PHYSREADWRITE_DEFINED 185 /* Header sharing between vbox & qemu is rather ugly. */ 183 void remR3PhysRead(RTGCPHYS SrcGCPhys, void *pvDst, unsigned cb); 184 uint8_t remR3PhysReadU8(RTGCPHYS SrcGCPhys); 185 int8_t remR3PhysReadS8(RTGCPHYS SrcGCPhys); 186 uint16_t remR3PhysReadU16(RTGCPHYS SrcGCPhys); 187 int16_t remR3PhysReadS16(RTGCPHYS SrcGCPhys); 188 uint32_t remR3PhysReadU32(RTGCPHYS SrcGCPhys); 189 int32_t remR3PhysReadS32(RTGCPHYS SrcGCPhys); 190 uint64_t remR3PhysReadU64(RTGCPHYS SrcGCPhys); 191 int64_t remR3PhysReadS64(RTGCPHYS SrcGCPhys); 192 void remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb); 193 void remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val); 194 void remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val); 195 void remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val); 196 void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val); 197 198 #ifndef REM_PHYS_ADDR_IN_TLB 186 199 void remR3PhysReadHCPtr(uint8_t *pbSrcPhys, void *pvDst, unsigned cb); 187 200 uint8_t remR3PhysReadHCPtrU8(uint8_t *pbSrcPhys); … … 198 211 void remR3PhysWriteHCPtrU32(uint8_t *pbDstPhys, uint32_t val); 199 212 void remR3PhysWriteHCPtrU64(uint8_t *pbDstPhys, uint64_t val); 200 # ifdef PGM_DYNAMIC_RAM_ALLOC 213 #endif 214 215 #ifdef PGM_DYNAMIC_RAM_ALLOC 216 # ifndef REM_PHYS_ADDR_IN_TLB 201 217 void *remR3GCPhys2HCVirt(void *env, target_ulong addr); 202 218 target_ulong remR3HCVirt2GCPhys(void *env, void *addr); 219 # endif 203 220 void remR3GrowDynRange(unsigned long physaddr); 204 # endif 205 #endif 221 #endif 222 #if defined(__AMD64__) 223 # define VBOX_CHECK_ADDR(ptr) do { if ((uintptr_t)(ptr) >= _4G) __asm__("int3"); } while (0) 224 #else 225 # define VBOX_CHECK_ADDR(ptr) (void) 226 #endif 206 227 207 228 static inline int ldub_p(void *ptr) 208 229 { 230 #ifdef REM_PHYS_ADDR_IN_TLB 231 VBOX_CHECK_ADDR(ptr); 232 return remR3PhysReadU8((uintptr_t)ptr); 233 #else 209 234 return remR3PhysReadHCPtrU8(ptr); 235 #endif 210 236 } 211 237 212 238 static inline int ldsb_p(void *ptr) 213 239 { 240 #ifdef REM_PHYS_ADDR_IN_TLB 241 VBOX_CHECK_ADDR(ptr); 242 return remR3PhysReadS8((uintptr_t)ptr); 243 #else 214 244 return remR3PhysReadHCPtrS8(ptr); 245 #endif 215 246 } 216 247 217 248 static inline void stb_p(void *ptr, int v) 218 249 { 250 #ifdef REM_PHYS_ADDR_IN_TLB 251 VBOX_CHECK_ADDR(ptr); 252 remR3PhysWriteU8((uintptr_t)ptr, v); 253 #else 219 254 remR3PhysWriteHCPtrU8(ptr, v); 255 #endif 220 256 } 221 257 222 258 static inline int lduw_le_p(void *ptr) 223 259 { 260 #ifdef REM_PHYS_ADDR_IN_TLB 261 VBOX_CHECK_ADDR(ptr); 262 return remR3PhysReadU16((uintptr_t)ptr); 263 #else 224 264 return remR3PhysReadHCPtrU16(ptr); 265 #endif 225 266 } 226 267 227 268 static inline int ldsw_le_p(void *ptr) 228 269 { 270 #ifdef REM_PHYS_ADDR_IN_TLB 271 VBOX_CHECK_ADDR(ptr); 272 return remR3PhysReadS16((uintptr_t)ptr); 273 #else 229 274 return remR3PhysReadHCPtrS16(ptr); 275 #endif 230 276 } 231 277 232 278 static inline void stw_le_p(void *ptr, int v) 233 279 { 280 #ifdef REM_PHYS_ADDR_IN_TLB 281 VBOX_CHECK_ADDR(ptr); 282 remR3PhysWriteU16((uintptr_t)ptr, v); 283 #else 234 284 remR3PhysWriteHCPtrU16(ptr, v); 285 #endif 235 286 } 236 287 237 288 static inline int ldl_le_p(void *ptr) 238 289 { 290 #ifdef REM_PHYS_ADDR_IN_TLB 291 VBOX_CHECK_ADDR(ptr); 292 return remR3PhysReadU32((uintptr_t)ptr); 293 #else 239 294 return remR3PhysReadHCPtrU32(ptr); 295 #endif 240 296 } 241 297 242 298 static inline void stl_le_p(void *ptr, int v) 243 299 { 300 #ifdef REM_PHYS_ADDR_IN_TLB 301 VBOX_CHECK_ADDR(ptr); 302 remR3PhysWriteU32((uintptr_t)ptr, v); 303 #else 244 304 remR3PhysWriteHCPtrU32(ptr, v); 305 #endif 245 306 } 246 307 247 308 static inline void stq_le_p(void *ptr, uint64_t v) 248 309 { 310 #ifdef REM_PHYS_ADDR_IN_TLB 311 VBOX_CHECK_ADDR(ptr); 312 remR3PhysWriteU64((uintptr_t)ptr, v); 313 #else 249 314 remR3PhysWriteHCPtrU64(ptr, v); 315 #endif 250 316 } 251 317 252 318 static inline uint64_t ldq_le_p(void *ptr) 253 319 { 320 #ifdef REM_PHYS_ADDR_IN_TLB 321 VBOX_CHECK_ADDR(ptr); 322 return remR3PhysReadU64((uintptr_t)ptr); 323 #else 254 324 return remR3PhysReadHCPtrU64(ptr); 255 } 325 #endif 326 } 327 328 #undef VBOX_CHECK_ADDR 256 329 257 330 /* float access */ … … 973 1046 extern uint32_t phys_ram_dirty_size; 974 1047 #endif /* VBOX */ 975 #if !defined(VBOX) || ! defined(PGM_DYNAMIC_RAM_ALLOC)1048 #if !defined(VBOX) || !(defined(PGM_DYNAMIC_RAM_ALLOC) || defined(REM_PHYS_ADDR_IN_TLB)) 976 1049 extern uint8_t *phys_ram_base; 977 1050 #endif -
trunk/src/recompiler/new/exec-all.h
r1182 r1590 604 604 # ifdef VBOX 605 605 target_ulong remR3PhysGetPhysicalAddressCode(CPUState *env, target_ulong addr, CPUTLBEntry *pTLBEntry); 606 # if def PGM_DYNAMIC_RAM_ALLOC606 # if defined(PGM_DYNAMIC_RAM_ALLOC) && !defined(REM_PHYS_ADDR_IN_TLB) 607 607 target_ulong remR3HCVirt2GCPhys(void *env, void *addr); 608 608 # endif … … 644 644 # endif 645 645 } 646 # if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC) 646 # if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 647 return addr + env->tlb_table[is_user][index].addend; 648 # elif defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC) 647 649 return remR3HCVirt2GCPhys(env, (void *)(addr + env->tlb_table[is_user][index].addend)); 648 650 # else -
trunk/src/recompiler/new/exec.c
r1589 r1590 104 104 uint32_t phys_ram_dirty_size; 105 105 #endif /* VBOX */ 106 #if !defined(VBOX) || ! defined(PGM_DYNAMIC_RAM_ALLOC)106 #if !defined(VBOX) || !(defined(PGM_DYNAMIC_RAM_ALLOC) || defined(REM_PHYS_ADDR_IN_TLB)) 107 107 uint8_t *phys_ram_base; 108 108 #endif … … 1498 1498 /* we modify the TLB cache so that the dirty bit will be set again 1499 1499 when accessing the range */ 1500 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1500 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 1501 start1 = start; 1502 #elif !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1501 1503 start1 = start + (unsigned long)phys_ram_base; 1502 1504 #else … … 1548 1550 if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == IO_MEM_RAM) { 1549 1551 /* RAM case */ 1550 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1552 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 1553 ram_addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend; 1554 #elif !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1551 1555 ram_addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + 1552 1556 tlb_entry->addend - (unsigned long)phys_ram_base; 1553 1557 #else 1554 ram_addr = remR3HCVirt2GCPhys(first_cpu, (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend); /** @todo check if this is right! */1558 ram_addr = remR3HCVirt2GCPhys(first_cpu, (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend); 1555 1559 #endif 1556 1560 if (!cpu_physical_memory_is_dirty(ram_addr)) { … … 1634 1638 /* standard memory */ 1635 1639 address = vaddr; 1636 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1640 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 1641 addend = pd & TARGET_PAGE_MASK; 1642 #elif !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1637 1643 addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK); 1638 1644 #else … … 1753 1759 (unsigned long)addr, vp->prot); 1754 1760 /* set the dirty bit */ 1755 #ifdef VBOX1756 if (RT_LIKELY((vp->phys_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size))1757 #endif1758 1761 phys_ram_dirty[vp->phys_addr >> TARGET_PAGE_BITS] = 0xff; 1759 1762 /* flush the code inside */ … … 2013 2016 unsigned long ram_addr; 2014 2017 int dirty_flags; 2015 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2018 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 2019 ram_addr = addr; 2020 #elif !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2016 2021 ram_addr = addr - (unsigned long)phys_ram_base; 2017 2022 #else … … 2056 2061 unsigned long ram_addr; 2057 2062 int dirty_flags; 2058 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2063 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 2064 ram_addr = addr; 2065 #elif !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2059 2066 ram_addr = addr - (unsigned long)phys_ram_base; 2060 2067 #else … … 2099 2106 unsigned long ram_addr; 2100 2107 int dirty_flags; 2101 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2108 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 2109 ram_addr = addr; 2110 #elif !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2102 2111 ram_addr = addr - (unsigned long)phys_ram_base; 2103 2112 #else … … 2275 2284 if (l >= 4 && ((addr & 3) == 0)) { 2276 2285 /* 32 bit write access */ 2286 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB) 2277 2287 val = ldl_p(buf); 2288 #else 2289 val = *(const uint32_t *)buf; 2290 #endif 2278 2291 io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); 2279 2292 l = 4; 2280 2293 } else if (l >= 2 && ((addr & 1) == 0)) { 2281 2294 /* 16 bit write access */ 2295 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB) 2282 2296 val = lduw_p(buf); 2297 #else 2298 val = *(const uint16_t *)buf; 2299 #endif 2283 2300 io_mem_write[io_index][1](io_mem_opaque[io_index], addr, val); 2284 2301 l = 2; 2285 2302 } else { 2286 2303 /* 8 bit write access */ 2304 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB) 2287 2305 val = ldub_p(buf); 2306 #else 2307 val = *(const uint8_t *)buf; 2308 #endif 2288 2309 io_mem_write[io_index][0](io_mem_opaque[io_index], addr, val); 2289 2310 l = 1; … … 2294 2315 /* RAM case */ 2295 2316 #ifdef VBOX 2296 # ifdef PGM_DYNAMIC_RAM_ALLOC 2297 ptr = remR3GCPhys2HCVirt(cpu_single_env, addr1); 2298 # else 2299 ptr = phys_ram_base + addr1; 2300 # endif 2301 remR3PhysWriteHCPtr(ptr, buf, l); 2317 remR3PhysWrite(addr1, buf, l); NOREF(ptr); 2302 2318 #else 2303 2319 ptr = phys_ram_base + addr1; … … 2323 2339 /* 32 bit read access */ 2324 2340 val = io_mem_read[io_index][2](io_mem_opaque[io_index], addr); 2341 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB) 2325 2342 stl_p(buf, val); 2343 #else 2344 *(uint32_t *)buf = val; 2345 #endif 2326 2346 l = 4; 2327 2347 } else if (l >= 2 && ((addr & 1) == 0)) { 2328 2348 /* 16 bit read access */ 2329 2349 val = io_mem_read[io_index][1](io_mem_opaque[io_index], addr); 2350 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB) 2330 2351 stw_p(buf, val); 2352 #else 2353 *(uint16_t *)buf = val; 2354 #endif 2331 2355 l = 2; 2332 2356 } else { 2333 2357 /* 8 bit read access */ 2334 2358 val = io_mem_read[io_index][0](io_mem_opaque[io_index], addr); 2359 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB) 2335 2360 stb_p(buf, val); 2361 #else 2362 *(uint8_t *)buf = val; 2363 #endif 2336 2364 l = 1; 2337 2365 } … … 2339 2367 /* RAM case */ 2340 2368 #ifdef VBOX 2341 # ifdef PGM_DYNAMIC_RAM_ALLOC 2342 ptr = remR3GCPhys2HCVirt(cpu_single_env, (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK)); 2343 # else 2344 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2345 (addr & ~TARGET_PAGE_MASK); 2346 # endif 2347 remR3PhysReadHCPtr(ptr, buf, l); 2369 remR3PhysRead((pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK), buf, l); NOREF(ptr); 2348 2370 #else 2349 2371 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + … … 2359 2381 } 2360 2382 2383 #ifndef VBOX 2361 2384 /* used for ROM loading : can write in RAM and ROM */ 2362 2385 void cpu_physical_memory_write_rom(target_phys_addr_t addr, … … 2389 2412 addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK); 2390 2413 /* ROM/RAM case */ 2391 /* RAM case */2392 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)2393 2414 ptr = phys_ram_base + addr1; 2394 #else2395 ptr = remR3GCPhys2HCVirt(cpu_single_env, addr1);2396 #endif2397 2415 memcpy(ptr, buf, l); 2398 2416 } … … 2402 2420 } 2403 2421 } 2422 #endif /* !VBOX */ 2404 2423 2405 2424 … … 2427 2446 } else { 2428 2447 /* RAM case */ 2429 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)2448 #ifndef VBOX 2430 2449 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2431 2450 (addr & ~TARGET_PAGE_MASK); 2432 #else2433 ptr = remR3GCPhys2HCVirt(cpu_single_env, (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK));2434 #endif2435 2451 val = ldl_p(ptr); 2452 #else 2453 val = remR3PhysReadU32((pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK)); NOREF(ptr); 2454 #endif 2436 2455 } 2437 2456 return val; … … 2467 2486 } else { 2468 2487 /* RAM case */ 2469 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)2488 #ifndef VBOX 2470 2489 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2471 2490 (addr & ~TARGET_PAGE_MASK); 2472 #else2473 ptr = remR3GCPhys2HCVirt(cpu_single_env, (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK));2474 #endif2475 2491 val = ldq_p(ptr); 2492 #else 2493 val = remR3PhysReadU64((pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK)); NOREF(ptr); 2494 #endif 2476 2495 } 2477 2496 return val; … … 2515 2534 io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); 2516 2535 } else { 2517 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)2536 #ifndef VBOX 2518 2537 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2519 2538 (addr & ~TARGET_PAGE_MASK); 2520 #else2521 ptr = remR3GCPhys2HCVirt(cpu_single_env, (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK));2522 #endif2523 2539 stl_p(ptr, val); 2540 #else 2541 remR3PhysWriteU32((pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK), val); NOREF(ptr); 2542 #endif 2524 2543 } 2525 2544 } … … 2547 2566 addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK); 2548 2567 /* RAM case */ 2549 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)2568 #ifndef VBOX 2550 2569 ptr = phys_ram_base + addr1; 2551 #else2552 ptr = remR3GCPhys2HCVirt(cpu_single_env, addr1);2553 #endif2554 2555 2570 stl_p(ptr, val); 2571 #else 2572 remR3PhysWriteU32((pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK), val); NOREF(ptr); 2573 #endif 2556 2574 if (!cpu_physical_memory_is_dirty(addr1)) { 2557 2575 /* invalidate code */ … … 2590 2608 #endif 2591 2609 2610 #ifndef VBOX 2592 2611 /* virtual memory access for debug */ 2593 2612 int cpu_memory_rw_debug(CPUState *env, target_ulong addr, … … 2615 2634 } 2616 2635 2617 #ifndef VBOX2618 2636 void dump_exec_info(FILE *f, 2619 2637 int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) -
trunk/src/recompiler/new/target-i386/helper2.c
r1182 r1590 585 585 #if defined(DEBUG) && defined(VBOX) 586 586 uint32_t pde; 587 uint8_t *pde_ptr;588 587 589 588 /* page directory entry */ 590 # ifdef PGM_DYNAMIC_RAM_ALLOC 591 pde_ptr = remR3GCPhys2HCVirt(env, (((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & env->a20_mask)); 592 # else 593 pde_ptr = phys_ram_base + 594 (((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & env->a20_mask); 595 # endif 596 pde = ldl_raw(pde_ptr); 589 pde = remR3PhysReadU32(((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & env->a20_mask); 590 597 591 /* if PSE bit is set, then we use a 4MB page */ 598 592 if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) { -
trunk/src/recompiler/new/translate-op.c
r1589 r1590 26 26 #include "config.h" 27 27 28 #if defined(VBOX) && !defined(REMR3PHYSREADWRITE_DEFINED) 29 #define REMR3PHYSREADWRITE_DEFINED 30 /* Header sharing between vbox & qemu is rather ugly. */ 28 #if defined(VBOX) 29 void remR3PhysRead(RTGCPHYS SrcGCPhys, void *pvDst, unsigned cb); 30 uint8_t remR3PhysReadU8(RTGCPHYS SrcGCPhys); 31 int8_t remR3PhysReadS8(RTGCPHYS SrcGCPhys); 32 uint16_t remR3PhysReadU16(RTGCPHYS SrcGCPhys); 33 int16_t remR3PhysReadS16(RTGCPHYS SrcGCPhys); 34 uint32_t remR3PhysReadU32(RTGCPHYS SrcGCPhys); 35 int32_t remR3PhysReadS32(RTGCPHYS SrcGCPhys); 36 uint64_t remR3PhysReadU64(RTGCPHYS SrcGCPhys); 37 int64_t remR3PhysReadS64(RTGCPHYS SrcGCPhys); 38 void remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb); 39 void remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val); 40 void remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val); 41 void remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val); 42 void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val); 43 44 # ifndef REM_PHYS_ADDR_IN_TLB 31 45 void remR3PhysReadHCPtr(uint8_t *pbSrcPhys, void *pvDst, unsigned cb); 32 46 uint8_t remR3PhysReadHCPtrU8(uint8_t *pbSrcPhys); … … 43 57 void remR3PhysWriteHCPtrU32(uint8_t *pbDstPhys, uint32_t val); 44 58 void remR3PhysWriteHCPtrU64(uint8_t *pbDstPhys, uint64_t val); 59 # endif 45 60 #endif /* VBOX */ 46 61
Note:
See TracChangeset
for help on using the changeset viewer.