Changeset 1182 in vbox for trunk/src/recompiler
- Timestamp:
- Mar 4, 2007 7:34:24 PM (18 years ago)
- Location:
- trunk/src/recompiler/new
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/new/VBoxRecompiler.c
r1112 r1182 1361 1361 #ifndef PGM_DYNAMIC_RAM_ALLOC 1362 1362 target_ulong phys_addr; 1363 #endif 1363 #endif 1364 1364 target_ulong virt_addr, addend; 1365 1365 if (env->pVM->rem.s.fIgnoreSetPage || env->pVM->rem.s.fIgnoreAll) … … 1413 1413 Log2(("tlb_set_page_raw read (%x-%x) write (%x-%x) prot %x is_user %d phys\n", 1414 1414 pRead->addr_read, pRead->addend, pWrite->addr_write, pWrite->addend, prot, is_user)); 1415 #endif/* PGM_DYNAMIC_RAM_ALLOC */ 1415 #endif/* PGM_DYNAMIC_RAM_ALLOC */ 1416 1416 1417 1417 if (prot & PAGE_WRITE) … … 1465 1465 #else 1466 1466 AssertMsgFailed(("RAWEx_SetPageEntry %x %x %x %d failed!!\n", virt_addr, phys_addr, prot, is_user)); 1467 #endif 1467 #endif 1468 1468 VM_FF_SET(env->pVM, VM_FF_PGM_SYNC_CR3); 1469 1469 } … … 2631 2631 cpu_register_physical_memory(GCPhys, cb, ((uintptr_t)pvRam - (uintptr_t)phys_ram_base) 2632 2632 | (fFlags & MM_RAM_FLAGS_RESERVED ? IO_MEM_UNASSIGNED : 0)); 2633 #endif 2633 #endif 2634 2634 Assert(pVM->rem.s.fIgnoreAll); 2635 2635 pVM->rem.s.fIgnoreAll = false; … … 2712 2712 #else 2713 2713 AssertReleaseFailed(); 2714 #endif 2715 } 2716 2717 2714 #endif 2715 } 2716 2717 2718 #ifdef PGM_DYNAMIC_RAM_ALLOC 2718 2719 /** 2719 2720 * Convert GC physical address to HC virt … … 2725 2726 void *remR3GCPhys2HCVirt(void *env, target_ulong addr) 2726 2727 { 2727 #ifdef PGM_DYNAMIC_RAM_ALLOC2728 2728 PVM pVM = ((CPUState *)env)->pVM; 2729 2729 uint32_t i; … … 2742 2742 Log(("remR3GCPhys2HCVirt: %x -> %x\n", addr, pVM->rem.s.paGCPhysToHCVirt[addr >> PGM_DYNAMIC_CHUNK_SHIFT] + (addr & PGM_DYNAMIC_CHUNK_OFFSET_MASK))); 2743 2743 return (void *)(pVM->rem.s.paGCPhysToHCVirt[addr >> PGM_DYNAMIC_CHUNK_SHIFT] + (addr & PGM_DYNAMIC_CHUNK_OFFSET_MASK)); 2744 #else2745 return (target_ulong)addr - (target_ulong)phys_ram_base;2746 #endif2747 2744 } 2748 2745 … … 2757 2754 target_ulong remR3HCVirt2GCPhys(void *env, void *addr) 2758 2755 { 2759 #ifdef PGM_DYNAMIC_RAM_ALLOC2760 2756 PVM pVM = ((CPUState *)env)->pVM; 2761 2757 RTHCUINTPTR HCVirt = (RTHCUINTPTR)addr; … … 2766 2762 off = HCVirt - pVM->rem.s.paHCVirtToGCPhys[idx].pChunk1; 2767 2763 2768 if ( pVM->rem.s.paHCVirtToGCPhys[idx].pChunk1 2764 if ( pVM->rem.s.paHCVirtToGCPhys[idx].pChunk1 2769 2765 && off < PGM_DYNAMIC_CHUNK_SIZE) 2770 2766 { … … 2772 2768 return pVM->rem.s.paHCVirtToGCPhys[idx].GCPhys1 + off; 2773 2769 } 2774 2770 2775 2771 off = HCVirt - pVM->rem.s.paHCVirtToGCPhys[idx].pChunk2; 2776 if ( pVM->rem.s.paHCVirtToGCPhys[idx].pChunk2 2772 if ( pVM->rem.s.paHCVirtToGCPhys[idx].pChunk2 2777 2773 && off < PGM_DYNAMIC_CHUNK_SIZE) 2778 2774 { … … 2793 2789 AssertReleaseMsgFailed(("No translation for physical address %VHv???\n", addr)); 2794 2790 return 0; 2795 #else2796 return (target_ulong)addr - (target_ulong)phys_ram_base;2797 #endif2798 2791 } 2799 2792 … … 2820 2813 } 2821 2814 2815 #endif /* PGM_DYNAMIC_RAM_ALLOC */ 2822 2816 2823 2817 … … 2875 2869 AssertRelease(phys_ram_base); 2876 2870 cpu_register_physical_memory(GCPhys, cb, ((uintptr_t)pvCopy - (uintptr_t)phys_ram_base) | IO_MEM_ROM); 2877 #endif 2871 #endif 2878 2872 2879 2873 Log2(("%.64Vhxd\n", (char *)pvCopy + cb - 64)); … … 3143 3137 #else 3144 3138 uintptr_t off = pbSrcPhys - phys_ram_base; 3145 #endif 3139 #endif 3146 3140 if (off < (uintptr_t)phys_ram_size) 3147 3141 PGMPhysRead(cpu_single_env->pVM, (RTGCPHYS)off, pvDst, cb); -
trunk/src/recompiler/new/cpu-all.h
r1113 r1182 25 25 # include <VBox/log.h> 26 26 # define LOG_GROUP LOG_GROUP_REM 27 # endif 28 #endif 27 # endif 28 # include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */ 29 #endif 29 30 30 31 #if defined(__arm__) || defined(__sparc__) … … 197 198 void remR3PhysWriteU32(uint8_t *pbDstPhys, uint32_t val); 198 199 void remR3PhysWriteU64(uint8_t *pbDstPhys, uint64_t val); 200 # ifdef PGM_DYNAMIC_RAM_ALLOC 199 201 void *remR3GCPhys2HCVirt(void *env, target_ulong addr); 200 202 target_ulong remR3HCVirt2GCPhys(void *env, void *addr); 201 203 void remR3GrowDynRange(unsigned long physaddr); 204 # endif 202 205 #endif 203 206 … … 984 987 #define IO_MEM_UNASSIGNED (2 << IO_MEM_SHIFT) 985 988 #define IO_MEM_NOTDIRTY (4 << IO_MEM_SHIFT) /* used internally, never use directly */ 986 #if def VBOX989 #if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC) 987 990 #define IO_MEM_RAM_MISSING (5 << IO_MEM_SHIFT) /* used internally, never use directly */ 988 991 #endif … … 1073 1076 return; 1074 1077 } 1075 #endif 1078 #endif 1076 1079 phys_ram_dirty[addr >> TARGET_PAGE_BITS] = 0xff; 1077 1080 } -
trunk/src/recompiler/new/exec-all.h
r1113 r1182 26 26 #ifdef VBOX 27 27 # include <VBox/tm.h> 28 # include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */ 28 29 # ifndef LOG_GROUP 29 30 # define LOG_GROUP LOG_GROUP_REM 30 # endif 31 # endif 31 32 # include <VBox/log.h> 32 33 # include "REMInternal.h" … … 603 604 # ifdef VBOX 604 605 target_ulong remR3PhysGetPhysicalAddressCode(CPUState *env, target_ulong addr, CPUTLBEntry *pTLBEntry); 606 # ifdef PGM_DYNAMIC_RAM_ALLOC 605 607 target_ulong remR3HCVirt2GCPhys(void *env, void *addr); 606 # endif 608 # endif 609 # endif 607 610 /* NOTE: this function can trigger an exception */ 608 611 /* NOTE2: the returned address is not exactly the physical address: it … … 636 639 # ifdef VBOX 637 640 /* deal with non-MMIO access handlers. */ 638 return remR3PhysGetPhysicalAddressCode(env, addr, &env->tlb_table[is_user][index]); 641 return remR3PhysGetPhysicalAddressCode(env, addr, &env->tlb_table[is_user][index]); 639 642 # else 640 643 cpu_abort(env, "Trying to execute code outside RAM or ROM at 0x%08lx\n", addr); 641 644 # endif 642 645 } 643 # if def VBOX646 # if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC) 644 647 return remR3HCVirt2GCPhys(env, (void *)(addr + env->tlb_table[is_user][index].addend)); 645 648 # else 646 649 return addr + env->tlb_table[is_user][index].addend - (unsigned long)phys_ram_base; 647 # endif 650 # endif 648 651 } 649 652 #endif -
trunk/src/recompiler/new/exec.c
r1123 r1182 40 40 # include <iprt/string.h> 41 41 # include <iprt/param.h> 42 # include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */ 42 43 #endif /* VBOX */ 43 44 … … 172 173 TARGET_PAGE_SIZE */ 173 174 #ifdef VBOX 174 RTMemProtect(code_gen_buffer, sizeof(code_gen_buffer), 175 RTMemProtect(code_gen_buffer, sizeof(code_gen_buffer), 175 176 RTMEM_PROT_EXEC | RTMEM_PROT_READ | RTMEM_PROT_WRITE); 176 177 qemu_real_host_page_size = PAGE_SIZE; … … 276 277 pd[i].phys_offset = IO_MEM_UNASSIGNED; 277 278 } 278 #if def VBOX279 #if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC) 279 280 pd = ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1)); 280 281 if (RT_UNLIKELY((pd->phys_offset & ~TARGET_PAGE_MASK) == IO_MEM_RAM_MISSING)) … … 1431 1432 ram_addr + TARGET_PAGE_SIZE, 1432 1433 CODE_DIRTY_FLAG); 1433 #if def VBOX&& defined(REM_MONITOR_CODE_PAGES)1434 #if defined(VBOX) && defined(REM_MONITOR_CODE_PAGES) 1434 1435 /** @todo Retest this? This function has changed... */ 1435 1436 remR3ProtectCode(cpu_single_env, ram_addr); … … 1497 1498 /* we modify the TLB cache so that the dirty bit will be set again 1498 1499 when accessing the range */ 1499 #if ndef VBOX1500 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1500 1501 start1 = start + (unsigned long)phys_ram_base; 1501 1502 #else … … 1511 1512 #if !defined(CONFIG_SOFTMMU) 1512 1513 #ifdef VBOX /**@todo remove this check */ 1513 # error "We shouldn't get here..." 1514 #endif 1514 # error "We shouldn't get here..." 1515 #endif 1515 1516 /* XXX: this is expensive */ 1516 1517 { … … 1547 1548 if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == IO_MEM_RAM) { 1548 1549 /* RAM case */ 1549 #if ndef VBOX1550 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1550 1551 ram_addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + 1551 1552 tlb_entry->addend - (unsigned long)phys_ram_base; … … 1633 1634 /* standard memory */ 1634 1635 address = vaddr; 1635 #if ndef VBOX1636 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1636 1637 addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK); 1637 1638 #else … … 1754 1755 #ifdef VBOX 1755 1756 if (RT_LIKELY((vp->phys_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size)) 1756 #endif 1757 #endif 1757 1758 phys_ram_dirty[vp->phys_addr >> TARGET_PAGE_BITS] = 0xff; 1758 1759 /* flush the code inside */ … … 1950 1951 p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1); 1951 1952 p->phys_offset = phys_offset; 1952 #if ndef VBOX1953 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 1953 1954 if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM || 1954 1955 (phys_offset & IO_MEM_ROMD)) … … 2012 2013 unsigned long ram_addr; 2013 2014 int dirty_flags; 2014 #if ndef VBOX2015 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2015 2016 ram_addr = addr - (unsigned long)phys_ram_base; 2016 2017 #else … … 2055 2056 unsigned long ram_addr; 2056 2057 int dirty_flags; 2057 #if ndef VBOX2058 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2058 2059 ram_addr = addr - (unsigned long)phys_ram_base; 2059 2060 #else … … 2086 2087 #ifdef VBOX 2087 2088 if (RT_LIKELY((ram_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size)) 2088 #endif 2089 #endif 2089 2090 phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; 2090 2091 /* we remove the notdirty callback only if the code has been … … 2098 2099 unsigned long ram_addr; 2099 2100 int dirty_flags; 2100 #if ndef VBOX2101 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2101 2102 ram_addr = addr - (unsigned long)phys_ram_base; 2102 2103 #else … … 2104 2105 #endif 2105 2106 #ifdef VBOX 2106 if (RT_UNLIKELY((ram_addr >> TARGET_PAGE_BITS) >= phys_ram_dirty_size)) 2107 if (RT_UNLIKELY((ram_addr >> TARGET_PAGE_BITS) >= phys_ram_dirty_size)) 2107 2108 dirty_flags = 0xff; 2108 2109 else … … 2113 2114 tb_invalidate_phys_page_fast(ram_addr, 4); 2114 2115 # ifdef VBOX 2115 if (RT_UNLIKELY((ram_addr >> TARGET_PAGE_BITS) >= phys_ram_dirty_size)) 2116 if (RT_UNLIKELY((ram_addr >> TARGET_PAGE_BITS) >= phys_ram_dirty_size)) 2116 2117 dirty_flags = 0xff; 2117 2118 else … … 2129 2130 #ifdef VBOX 2130 2131 if (RT_LIKELY((ram_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size)) 2131 #endif 2132 #endif 2132 2133 phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; 2133 2134 /* we remove the notdirty callback only if the code has been … … 2154 2155 cpu_register_io_memory(IO_MEM_UNASSIGNED >> IO_MEM_SHIFT, unassigned_mem_read, unassigned_mem_write, NULL); 2155 2156 cpu_register_io_memory(IO_MEM_NOTDIRTY >> IO_MEM_SHIFT, error_mem_read, notdirty_mem_write, NULL); 2156 #if def VBOX2157 #if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC) 2157 2158 cpu_register_io_memory(IO_MEM_RAM_MISSING >> IO_MEM_SHIFT, unassigned_mem_read, unassigned_mem_write, NULL); 2158 2159 io_mem_nb = 6; … … 2293 2294 /* RAM case */ 2294 2295 #ifdef VBOX 2296 # ifdef PGM_DYNAMIC_RAM_ALLOC 2295 2297 ptr = remR3GCPhys2HCVirt(cpu_single_env, addr1); 2298 # else 2299 ptr = phys_ram_base + addr1; 2300 # endif 2296 2301 remR3PhysWrite(ptr, buf, l); 2297 2302 #else … … 2305 2310 #ifdef VBOX 2306 2311 if (RT_LIKELY((addr1 >> TARGET_PAGE_BITS) < phys_ram_dirty_size)) 2307 #endif 2308 phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |= 2312 #endif 2313 phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |= 2309 2314 (0xff & ~CODE_DIRTY_FLAG); 2310 2315 } … … 2334 2339 /* RAM case */ 2335 2340 #ifdef VBOX 2341 # ifdef PGM_DYNAMIC_RAM_ALLOC 2336 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 2337 2347 remR3PhysRead(ptr, buf, l); 2338 2348 #else … … 2380 2390 /* ROM/RAM case */ 2381 2391 /* RAM case */ 2382 #if ndef VBOX2392 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2383 2393 ptr = phys_ram_base + addr1; 2384 2394 #else … … 2417 2427 } else { 2418 2428 /* RAM case */ 2419 #if ndef VBOX2429 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2420 2430 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2421 2431 (addr & ~TARGET_PAGE_MASK); … … 2457 2467 } else { 2458 2468 /* RAM case */ 2459 #if ndef VBOX2469 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2460 2470 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2461 2471 (addr & ~TARGET_PAGE_MASK); … … 2505 2515 io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); 2506 2516 } else { 2507 #if ndef VBOX2517 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2508 2518 ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 2509 2519 (addr & ~TARGET_PAGE_MASK); … … 2537 2547 addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK); 2538 2548 /* RAM case */ 2539 #if ndef VBOX2549 #if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC) 2540 2550 ptr = phys_ram_base + addr1; 2541 2551 #else … … 2550 2560 #ifdef VBOX 2551 2561 if (RT_LIKELY((addr1 >> TARGET_PAGE_BITS) < phys_ram_dirty_size)) 2552 #endif 2562 #endif 2553 2563 phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |= 2554 2564 (0xff & ~CODE_DIRTY_FLAG); -
trunk/src/recompiler/new/target-i386/helper2.c
r1111 r1182 26 26 #include <signal.h> 27 27 #include <assert.h> 28 #endif 28 #else 29 # include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */ 30 #endif 29 31 30 32 #include "cpu.h" … … 539 541 #ifdef VBOX 540 542 remR3ChangeCpuMode(env); 541 #endif 543 #endif 542 544 } 543 545 … … 575 577 #ifdef VBOX 576 578 remR3ChangeCpuMode(env); 577 #endif 579 #endif 578 580 } 579 581 … … 586 588 587 589 /* page directory entry */ 590 # ifdef PGM_DYNAMIC_RAM_ALLOC 588 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 589 596 pde = ldl_raw(pde_ptr); 590 597 /* if PSE bit is set, then we use a 4MB page */
Note:
See TracChangeset
for help on using the changeset viewer.