Changeset 15284 in vbox
- Timestamp:
- Dec 11, 2008 3:23:40 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r14806 r15284 423 423 /** The expanding of the dynamic mapping cache failed. */ 424 424 #define VERR_PGM_DYNMAP_EXPAND_ERROR (-1632) 425 /** The page is unassigned (akin to VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS). */ 426 #define VERR_PGM_PHYS_TLB_UNASSIGNED (-1633) 427 /** Catch any access and route it thru PGM. */ 428 #define VERR_PGM_PHYS_TLB_CATCH_ALL (-1634) 429 /** Catch write access and route it thru PGM. */ 430 #define VINF_PGM_PHYS_TLB_CATCH_WRITE 1635 425 431 426 432 /** @} */ -
trunk/include/VBox/pgm.h
r15226 r15284 352 352 R3PTRTYPE(const char *) pszDesc); 353 353 VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast); 354 VMMDECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr);355 354 VMMDECL(int) PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys); 356 355 VMMDECL(int) PGMHandlerPhysicalChangeCallbacks(PVM pVM, RTGCPHYS GCPhys, … … 366 365 VMMDECL(int) PGMHandlerPhysicalPageReset(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage); 367 366 VMMDECL(bool) PGMHandlerPhysicalIsRegistered(PVM pVM, RTGCPHYS GCPhys); 367 VMMDECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr); 368 368 VMMDECL(bool) PGMPhysIsA20Enabled(PVM pVM); 369 369 VMMDECL(bool) PGMPhysIsGCPhysValid(PVM pVM, RTGCPHYS GCPhys); … … 422 422 VMMDECL(int) PGMPhysGCPhys2R3Ptr(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange, PRTR3PTR pR3Ptr); 423 423 VMMDECL(RTR3PTR) PGMPhysGCPhys2R3PtrAssert(PVM pVM, RTGCPHYS GCPhys, RTUINT cbRange); 424 /** @PGMPhysGCPhys2R3PtrEx flags.425 * @{ */426 /** Default value of the flag, behaves the same way as PGMPhysGCPhys2R3Ptr. */427 #define PGMPHYS_TRANSLATION_FLAG_DEFAULT 0428 /** Indicates that for monitored pages with physical handlers429 * VERR_PGM_PHYS_PAGE_RESERVED error code should be returned,430 * so address translation routines must fallback to PGM functions for431 * access memory. */432 #define PGMPHYS_TRANSLATION_FLAG_CHECK_PHYS_MONITORED RT_BIT_32(0)433 /** Indicates that for monitored pages with virtual handlers434 * VERR_PGM_PHYS_PAGE_RESERVED error code should be returned,435 * so address translation routines must fallback to PGM functions for436 * access memory. */437 #define PGMPHYS_TRANSLATION_FLAG_CHECK_VIRT_MONITORED RT_BIT_32(1)438 /** @} */439 VMMDECL(int) PGMPhysGCPhys2R3PtrEx(PVM pVM, RTGCPHYS GCPhys, RTGCPTR GCPtr, uint32_t flags, PRTR3PTR pR3Ptr);440 424 VMMDECL(int) PGMPhysGCPtr2R3Ptr(PVM pVM, RTGCPTR GCPtr, PRTR3PTR pR3Ptr); 441 425 VMMDECL(int) PGMPhysGCPtr2R3PtrByGstCR3(PVM pVM, RTGCPTR GCPtr, uint64_t cr3, unsigned fFlags, PRTR3PTR pR3Ptr); … … 601 585 VMMR3DECL(int) PGMR3DumpHierarchyGC(PVM pVM, uint64_t cr3, uint64_t cr4, RTGCPHYS PhysSearch); 602 586 587 VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **pvPtr); 603 588 VMMR3DECL(uint8_t) PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys); 604 589 VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys); -
trunk/src/VBox/VMM/PGMPhys.cpp
r14826 r15284 2424 2424 } 2425 2425 2426 2427 /** 2428 * Converts a GC physical address to a HC ring-3 pointer, with some 2429 * additional checks. 2430 * 2431 * @returns VBox status code. 2432 * @retval VINF_SUCCESS on success. 2433 * @retval VINF_PGM_PHYS_TLB_CATCH_WRITE and *pvPtr set if the page has a write 2434 * access handler of some kind. 2435 * @retval VERR_PGM_PHYS_TLB_CATCH_ALL if the page has a handler catching all 2436 * accesses or is odd in any way. 2437 * @retval VERR_PGM_PHYS_TLB_UNASSIGNED if the page doesn't exist. 2438 * 2439 * @param pVM The VM handle. 2440 * @param GCPhys The GC physical address to convert. 2441 * @param fWritable Whether write access is required. 2442 * @param pR3Ptr Where to store the R3 pointer on success. 2443 */ 2444 VMMR3DECL(int) PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **pvPtr) 2445 { 2446 pgmLock(pVM); 2447 2448 PPGMRAMRANGE pRam; 2449 PPGMPAGE pPage; 2450 int rc = pgmPhysGetPageAndRangeEx(&pVM->pgm.s, GCPhys, &pPage, &pRam); 2451 if (RT_SUCCESS(rc)) 2452 { 2453 #if 0 /** @todo ifndef PGM_IGNORE_RAM_FLAGS_RESERVED */ 2454 if (RT_UNLIKELY(PGM_PAGE_IS_RESERVED(pPage))) 2455 rc = VERR_PGM_PHYS_TLB_UNASSIGNED; 2456 #endif 2457 { 2458 #if 0 /** @todo looks like the system ROM is registered incorrectly, 0xfe000 claims to be a zero page. */ 2459 if (fWritable && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED) 2460 rc = VERR_PGM_PHYS_TLB_UNASSIGNED; /** @todo VBOX_WITH_NEW_PHYS_CODE: remap it to a writeable page. */ 2461 #else 2462 if (0) 2463 /* nothing */; 2464 #endif 2465 else if (PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)) /* catches MMIO */ 2466 rc = VERR_PGM_PHYS_TLB_CATCH_ALL; 2467 else if (fWritable && PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)) 2468 rc = VINF_PGM_PHYS_TLB_CATCH_WRITE; 2469 else 2470 rc = VINF_SUCCESS; 2471 if (RT_SUCCESS(rc)) 2472 { 2473 if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC) 2474 { 2475 Assert(PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM); 2476 RTGCPHYS off = GCPhys - pRam->GCPhys; 2477 unsigned iChunk = (off >> PGM_DYNAMIC_CHUNK_SHIFT); 2478 *pvPtr = (void *)(pRam->paChunkR3Ptrs[iChunk] + (off & PGM_DYNAMIC_CHUNK_OFFSET_MASK)); 2479 } 2480 else if (RT_LIKELY(pRam->pvR3)) 2481 { 2482 Assert(PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM); 2483 RTGCPHYS off = GCPhys - pRam->GCPhys; 2484 *pvPtr = (uint8_t *)pRam->pvR3 + off; 2485 } 2486 else 2487 rc = VERR_PGM_PHYS_TLB_UNASSIGNED; 2488 } 2489 } 2490 } 2491 else 2492 rc = VERR_PGM_PHYS_TLB_UNASSIGNED; 2493 2494 pgmUnlock(pVM); 2495 return rc; 2496 } 2497 2498 2499 -
trunk/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
r14969 r15284 1032 1032 * @param pVM VM Handle. 1033 1033 * @param GCPhys Start physical address earlier passed to PGMR3HandlerPhysicalRegister(). 1034 * @remarks Caller must take the PGM lock... 1035 * @threads EMT. 1034 1036 */ 1035 1037 VMMDECL(bool) PGMHandlerPhysicalIsRegistered(PVM pVM, RTGCPHYS GCPhys) … … 1054 1056 } 1055 1057 1058 1056 1059 /** 1057 1060 * Check if particular guest's VA is being monitored. … … 1060 1063 * @param pVM VM handle. 1061 1064 * @param GCPtr Virtual address. 1065 * @remarks Will acquire the PGM lock. 1066 * @threads Any. 1062 1067 */ 1063 1068 VMMDECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr) … … 1067 1072 pgmUnlock(pVM); 1068 1073 1069 return pCur != 0; 1070 } 1074 return pCur != NULL; 1075 } 1076 1071 1077 1072 1078 /** -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r14974 r15284 913 913 } 914 914 915 /** 916 * Converts a GC physical address to a HC ring-3 pointer, with some 917 * additional checks. 918 * 919 * @returns VINF_SUCCESS on success. 920 * @returns VERR_PGM_PHYS_PAGE_RESERVED it it's a valid GC physical 921 * page but has no physical backing, or if partuclar 922 * memory access must always go via PGM, because of handlers. 923 * @returns VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid 924 * GC physical address. 925 * 926 * @param pVM The VM handle. 927 * @param GCPhys The GC physical address to convert. 928 * @param GCPtr The guest VA, to check virtual handler on. 929 * @param flags Flags controlling additional checks. 930 * @param pR3Ptr Where to store the R3 pointer on success. 931 */ 932 VMMDECL(int) PGMPhysGCPhys2R3PtrEx(PVM pVM, RTGCPHYS GCPhys, RTGCPTR GCPtr, uint32_t flags, PRTR3PTR pR3Ptr) 933 { 934 int rc; 935 936 rc = PGMPhysGCPhys2R3Ptr(pVM, GCPhys, 1, pR3Ptr); 937 938 if (RT_SUCCESS(rc) && (flags & PGMPHYS_TRANSLATION_FLAG_CHECK_PHYS_MONITORED)) 939 { 940 /* Check if there's a physical handler for PA */ 941 if (PGMHandlerPhysicalIsRegistered(pVM, GCPhys)) 942 rc = VERR_PGM_PHYS_PAGE_RESERVED; 943 } 944 945 if (RT_SUCCESS(rc) && (flags & PGMPHYS_TRANSLATION_FLAG_CHECK_VIRT_MONITORED)) 946 { 947 /* Check if there's a virtual handler for VA */ 948 if (PGMHandlerVirtualIsRegistered(pVM, GCPtr)) 949 rc = VERR_PGM_PHYS_PAGE_RESERVED; 950 } 951 952 return rc; 953 } 915 954 916 /** 955 917 * PGMPhysGCPhys2R3Ptr convenience for use with assertions. -
trunk/src/recompiler_new/VBoxREMWrapper.cpp
r14969 r15284 718 718 { REMPARMDESC_FLAGS_INT, sizeof(PRTR3PTR), NULL } 719 719 }; 720 static const REMPARMDESC g_aArgsPGM PhysGCPhys2R3PtrEx[] =720 static const REMPARMDESC g_aArgsPGMR3PhysTlbGCPhys2Ptr[] = 721 721 { 722 722 { REMPARMDESC_FLAGS_INT, sizeof(PVM), NULL }, 723 723 { REMPARMDESC_FLAGS_GCPHYS, sizeof(RTGCPHYS), NULL }, 724 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCPHYS), NULL }, 725 { REMPARMDESC_FLAGS_INT, sizeof(uint32_t), NULL }, 726 { REMPARMDESC_FLAGS_INT, sizeof(PRTR3PTR), NULL } 724 { REMPARMDESC_FLAGS_INT, sizeof(bool), NULL }, 725 { REMPARMDESC_FLAGS_INT, sizeof(void *), NULL } 727 726 }; 728 727 static const REMPARMDESC g_aArgsPGMPhysGCPtr2R3PtrByGstCR3[] = … … 1151 1150 { "PGMR3PhysWriteU32", (void *)(uintptr_t)&PGMR3PhysWriteU32, &g_aArgsPGMR3PhysWriteU32[0], RT_ELEMENTS(g_aArgsPGMR3PhysWriteU32), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1152 1151 { "PGMR3PhysWriteU64", (void *)(uintptr_t)&PGMR3PhysWriteU64, &g_aArgsPGMR3PhysWriteU64[0], RT_ELEMENTS(g_aArgsPGMR3PhysWriteU32), REMFNDESC_FLAGS_RET_VOID, 0, NULL }, 1153 { "PGMR3DbgR3Ptr2GCPhys", (void *)(uintptr_t)&PGMR3DbgR3Ptr2GCPhys, &g_aArgsPGMR3DbgR3Ptr2GCPhys[0], RT_ELEMENTS(g_aArgsPGMR3DbgR3Ptr2GCPhys), REMFNDESC_FLAGS_RET_INT, sizeof(uint64_t),NULL },1154 { "PGM PhysGCPhys2R3PtrEx", (void *)(uintptr_t)&PGMPhysGCPhys2R3PtrEx, &g_aArgsPGMPhysGCPhys2R3PtrEx[0], RT_ELEMENTS(g_aArgsPGMPhysGCPhys2R3PtrEx), REMFNDESC_FLAGS_RET_INT, sizeof(int),NULL },1152 { "PGMR3DbgR3Ptr2GCPhys", (void *)(uintptr_t)&PGMR3DbgR3Ptr2GCPhys, &g_aArgsPGMR3DbgR3Ptr2GCPhys[0], RT_ELEMENTS(g_aArgsPGMR3DbgR3Ptr2GCPhys), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1153 { "PGMR3PhysGCPhys2Ptr", (void *)(uintptr_t)&PGMR3PhysTlbGCPhys2Ptr, &g_aArgsPGMR3PhysTlbGCPhys2Ptr[0], RT_ELEMENTS(g_aArgsPGMR3PhysTlbGCPhys2Ptr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1155 1154 { "SSMR3GetGCPtr", (void *)(uintptr_t)&SSMR3GetGCPtr, &g_aArgsSSMR3GetGCPtr[0], RT_ELEMENTS(g_aArgsSSMR3GetGCPtr), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, 1156 1155 { "SSMR3GetMem", (void *)(uintptr_t)&SSMR3GetMem, &g_aArgsSSMR3GetMem[0], RT_ELEMENTS(g_aArgsSSMR3GetMem), REMFNDESC_FLAGS_RET_INT, sizeof(int), NULL }, -
trunk/src/recompiler_new/VBoxRecompiler.c
r15272 r15284 637 637 } 638 638 else 639 { 639 { 640 640 switch (rc) 641 641 { … … 1283 1283 1284 1284 #ifndef REM_PHYS_ADDR_IN_TLB 1285 void* remR3GCPhys2HCVirt(CPUState *env1, target_ulong physAddr, target_ulong virtAddr) 1286 { 1287 void* rv = NULL; 1288 int rc; 1289 uint32_t flags = PGMPHYS_TRANSLATION_FLAG_CHECK_PHYS_MONITORED; 1290 1291 if (virtAddr != (target_ulong)-1) 1292 flags |= PGMPHYS_TRANSLATION_FLAG_CHECK_VIRT_MONITORED; 1293 1294 rc = PGMPhysGCPhys2R3PtrEx(env1->pVM, (RTGCPHYS)physAddr, (RTGCPTR)virtAddr, 1295 flags, &rv); 1296 1297 if (rc == VERR_PGM_PHYS_PAGE_RESERVED) 1298 { 1299 rv = (void*)((uintptr_t)rv | 1); 1300 rc = 0; 1301 } 1302 Assert (RT_SUCCESS(rc)); 1303 1304 return rv; 1285 void *remR3TlbGCPhys2Ptr(CPUState *env1, target_ulong physAddr, int fWritable) 1286 { 1287 void *pv; 1288 int rc = PGMR3PhysTlbGCPhys2Ptr(env1->pVM, physAddr, true /*fWritable*/, &pv); 1289 Assert( rc == VINF_SUCCESS 1290 || rc == VINF_PGM_PHYS_TLB_CATCH_WRITE 1291 || rc == VERR_PGM_PHYS_TLB_CATCH_ALL 1292 || rc == VERR_PGM_PHYS_TLB_UNASSIGNED); 1293 if (RT_FAILURE(rc)) 1294 return (void *)1; 1295 if (rc == VINF_PGM_PHYS_TLB_CATCH_WRITE) 1296 return (void *)((uintptr_t)pv | 2); 1297 return pv; 1305 1298 } 1306 1299 -
trunk/src/recompiler_new/cpu-all.h
r15278 r15284 264 264 uint64_t remR3PhysReadU64(RTGCPHYS SrcGCPhys); 265 265 int64_t remR3PhysReadS64(RTGCPHYS SrcGCPhys); 266 void remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb);267 void remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val);268 void remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val);269 void remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val);270 void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val);266 void remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb); 267 void remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val); 268 void remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val); 269 void remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val); 270 void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val); 271 271 272 272 #ifndef REM_PHYS_ADDR_IN_TLB 273 void *remR3TlbGCPhys2Ptr(CPUState *env1, target_ulong physAddr, int fWritable); 273 274 target_ulong remR3HCVirt2GCPhys(CPUState *env1, void *addr); 274 void* remR3GCPhys2HCVirt(CPUState *env1, target_ulong physAddr, target_ulong virtAddr);275 275 #endif 276 276 -
trunk/src/recompiler_new/exec.c
r14974 r15284 243 243 VirtualProtect(addr, size, 244 244 PAGE_EXECUTE_READWRITE, &old_protect); 245 245 246 246 } 247 247 #else … … 249 249 { 250 250 unsigned long start, end, page_size; 251 251 252 252 page_size = getpagesize(); 253 253 start = (unsigned long)addr; 254 254 start &= ~(page_size - 1); 255 255 256 256 end = (unsigned long)addr + size; 257 257 end += page_size - 1; 258 258 end &= ~(page_size - 1); 259 259 260 260 mprotect((void *)start, end - start, 261 261 PROT_READ | PROT_WRITE | PROT_EXEC); … … 308 308 #ifdef VBOX 309 309 /* We use other means to set reserved bit on our pages */ 310 #else 310 #else 311 311 #if !defined(_WIN32) && defined(CONFIG_USER_ONLY) 312 312 { … … 328 328 page_set_flags(startaddr & TARGET_PAGE_MASK, 329 329 TARGET_PAGE_ALIGN(endaddr), 330 PAGE_RESERVED); 330 PAGE_RESERVED); 331 331 } 332 332 } while (!feof(f)); … … 379 379 page_set_flags(addr & TARGET_PAGE_MASK, 380 380 TARGET_PAGE_ALIGN(addr + len), 381 PAGE_RESERVED); 381 PAGE_RESERVED); 382 382 } 383 383 #else … … 478 478 #endif 479 479 480 /* VBox allocates codegen buffer dynamically */ 480 /* VBox allocates codegen buffer dynamically */ 481 481 #ifndef VBOX 482 482 #ifdef USE_STATIC_CODE_GEN_BUFFER … … 508 508 #ifdef VBOX 509 509 code_gen_buffer = RTMemExecAlloc(code_gen_buffer_size); 510 510 511 511 if (!code_gen_buffer) { 512 LogRel(("REM: failed allocate codegen buffer %lld\n", 512 LogRel(("REM: failed allocate codegen buffer %lld\n", 513 513 code_gen_buffer_size)); 514 514 return; 515 515 } 516 516 #else //!VBOX 517 #if defined(__linux__) 517 #if defined(__linux__) 518 518 { 519 519 int flags; … … 556 556 #endif 557 557 code_gen_buffer = mmap(addr, code_gen_buffer_size, 558 PROT_WRITE | PROT_READ | PROT_EXEC, 558 PROT_WRITE | PROT_READ | PROT_EXEC, 559 559 flags, -1, 0); 560 560 if (code_gen_buffer == MAP_FAILED) { … … 580 580 #endif 581 581 582 code_gen_buffer_max_size = code_gen_buffer_size - 582 code_gen_buffer_max_size = code_gen_buffer_size - 583 583 code_gen_max_block_size(); 584 584 code_gen_max_blocks = code_gen_buffer_size / CODE_GEN_AVG_BLOCK_SIZE; … … 1282 1282 #else 1283 1283 DECLINLINE(void) tb_alloc_page(TranslationBlock *tb, 1284 unsigned int n, target_ulong page_addr) 1284 unsigned int n, target_ulong page_addr) 1285 1285 #endif 1286 1286 { … … 1346 1346 (code_gen_ptr - code_gen_buffer) >= code_gen_buffer_max_size) 1347 1347 #else 1348 (code_gen_ptr - code_gen_buffer) >= (int)code_gen_buffer_max_size) 1348 (code_gen_ptr - code_gen_buffer) >= (int)code_gen_buffer_max_size) 1349 1349 #endif 1350 1350 return NULL; … … 1831 1831 overlap the flushed page. */ 1832 1832 i = tb_jmp_cache_hash_page(addr - TARGET_PAGE_SIZE); 1833 memset (&env->tb_jmp_cache[i], 0, 1833 memset (&env->tb_jmp_cache[i], 0, 1834 1834 TB_JMP_PAGE_SIZE * sizeof(TranslationBlock *)); 1835 1835 1836 1836 i = tb_jmp_cache_hash_page(addr); 1837 memset (&env->tb_jmp_cache[i], 0, 1837 memset (&env->tb_jmp_cache[i], 0, 1838 1838 TB_JMP_PAGE_SIZE * sizeof(TranslationBlock *)); 1839 1839 … … 1929 1929 #endif 1930 1930 #endif 1931 1931 1932 1932 tlb_flush_jmp_cache(env, addr); 1933 1933 … … 1974 1974 1975 1975 #ifdef VBOX 1976 if (start & 1)1976 if (start & 3) 1977 1977 return; 1978 1978 #endif … … 2027 2027 start1 = start + (unsigned long)phys_ram_base; 2028 2028 #else 2029 start1 = (unsigned long)remR3 GCPhys2HCVirt(first_cpu, start, -1);2029 start1 = (unsigned long)remR3TlbGCPhys2Ptr(first_cpu, start, 1 /*fWritable*/); /** @todo this can be harmful with VBOX_WITH_NEW_PHYS_CODE, fix interface/whatever. */ 2030 2030 #endif 2031 2031 for(env = first_cpu; env != NULL; env = env->next_cpu) { … … 2176 2176 addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK); 2177 2177 #else 2178 addend = (unsigned long)remR3GCPhys2HCVirt(env, 2178 /** @todo this is racing the phys_page_find call above since it may register 2179 * a new chunk of memory... */ 2180 addend = (unsigned long)remR3TlbGCPhys2Ptr(env, 2179 2181 pd & TARGET_PAGE_MASK, 2180 vaddr & TARGET_PAGE_MASK);2182 !!(prot & PAGE_WRITE)); 2181 2183 #endif 2182 2184 if ((pd & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) { … … 2201 2203 #ifdef VBOX 2202 2204 # if !defined(REM_PHYS_ADDR_IN_TLB) 2203 if (addend & 0x 1)2205 if (addend & 0x2) 2204 2206 { 2205 addend &= ~(target_ulong)0x1; 2206 if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM) 2207 /* catch write */ 2208 addend &= ~(target_ulong)0x3; 2209 if ((pd & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) 2210 { 2211 /** @todo improve this, it's only avoid code reads right now! */ 2212 address |= TLB_MMIO; 2213 iotlb = env->pVM->rem.s.iHandlerMemType + paddr; 2214 } 2215 } 2216 else if (addend & 0x1) 2217 { 2218 /* catch all */ 2219 addend &= ~(target_ulong)0x3; 2220 if ((pd & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) 2207 2221 { 2208 2222 address |= TLB_MMIO; 2209 iotlb = (pd & ~TARGET_PAGE_MASK) + paddr +env->pVM->rem.s.iHandlerMemType; 2223 code_address |= TLB_MMIO; 2224 iotlb = env->pVM->rem.s.iHandlerMemType + paddr; 2210 2225 } 2211 2226 } … … 2723 2738 unsigned long ram_addr; 2724 2739 int dirty_flags; 2725 #if defined(VBOX) 2740 #if defined(VBOX) 2726 2741 ram_addr = addr; 2727 2742 #elif … … 2770 2785 unsigned long ram_addr; 2771 2786 int dirty_flags; 2772 #if defined(VBOX) 2787 #if defined(VBOX) 2773 2788 ram_addr = addr; 2774 2789 #else … … 2818 2833 unsigned long ram_addr; 2819 2834 int dirty_flags; 2820 #if defined(VBOX) 2835 #if defined(VBOX) 2821 2836 ram_addr = addr; 2822 2837 #else … … 3104 3119 io_mem_nb = 5; 3105 3120 #endif 3106 3121 3107 3122 io_mem_watch = cpu_register_io_memory(0, watch_mem_read, 3108 3123 watch_mem_write, NULL); 3109 3124 3110 3125 #ifndef VBOX /* VBOX: we do this later when the RAM is allocated. */ 3111 3126 /* alloc dirty bits array */ … … 3637 3652 tb = tb_find_pc((unsigned long)retaddr); 3638 3653 if (!tb) { 3639 cpu_abort(env, "cpu_io_recompile: could not find TB for pc=%p", 3654 cpu_abort(env, "cpu_io_recompile: could not find TB for pc=%p", 3640 3655 retaddr); 3641 3656 } … … 3716 3731 cpu_fprintf(f, "gen code size %ld/%ld\n", 3717 3732 code_gen_ptr - code_gen_buffer, code_gen_buffer_max_size); 3718 cpu_fprintf(f, "TB count %d/%d\n", 3733 cpu_fprintf(f, "TB count %d/%d\n", 3719 3734 nb_tbs, code_gen_max_blocks); 3720 3735 cpu_fprintf(f, "TB avg target size %d max=%d bytes\n",
Note:
See TracChangeset
for help on using the changeset viewer.