VirtualBox

Changeset 14277

Show
Ignore:
Timestamp:
11/20/08 19:14:47 (2 months ago)
Author:
vboxsync
Message:

Implemented support for virtual addresses in TLB, improves performance greatly,
but not fully functional as breaks some sync checks, so disabled.
To enable - comment out $(REM_MOD)_DEFS += REM_PHYS_ADDR_IN_TLB
in Makefile.kmk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/recompiler_new/Sun/config.h

    r13968 r14277  
    3838/* Uncomment to see generated code */ 
    3939/* #define DEBUG_DISAS */ 
     40 
     41#if 0 /*defined(RT_ARCH_AMD64) && defined(VBOX_STRICT)*/ 
     42# define VBOX_CHECK_ADDR(ptr) do { if ((uintptr_t)(ptr) >= _4G) __asm__("int3"); } while (0) 
     43#else 
     44# define VBOX_CHECK_ADDR(ptr) do { } while (0) 
     45#endif 
  • trunk/src/recompiler_new/VBoxRecompiler.c

    r14241 r14277  
    2929#include "exec-all.h" 
    3030#include "config.h" 
     31#include "cpu-all.h" 
    3132 
    3233void cpu_exec_init_all(unsigned long tb_size); 
     
    27852786    Assert(!pVM->rem.s.fIgnoreAll); 
    27862787    pVM->rem.s.fIgnoreAll = true; 
    2787 #ifdef REM_PHYS_ADDR_IN_TLB 
    27882788    cpu_register_physical_memory(GCPhys, cb, GCPhys); 
    2789 #else 
    2790     cpu_register_physical_memory(GCPhys, cb, pvRam); 
    2791 #endif 
    2792  
    27932789    Assert(pVM->rem.s.fIgnoreAll); 
    27942790    pVM->rem.s.fIgnoreAll = false; 
     
    30873083    AssertFatalFailed(); 
    30883084} 
    3089  
    3090  
    3091 /** Validate the physical address passed to the read functions. 
    3092  * Useful for finding non-guest-ram reads/writes.  */ 
    3093 #if 0 //1 /* disable if it becomes bothersome... */ 
    3094 # define VBOX_CHECK_ADDR(GCPhys) AssertMsg(PGMPhysIsGCPhysValid(cpu_single_env->pVM, (GCPhys)), ("%RGp\n", (GCPhys))) 
    3095 #else 
    3096 # define VBOX_CHECK_ADDR(GCPhys) do { } while (0) 
    3097 #endif 
    30983085 
    30993086/** 
  • trunk/src/recompiler_new/cpu-all.h

    r13839 r14277  
    247247 *   kernel : kernel mode access using soft MMU 
    248248 */ 
     249 
    249250#ifdef VBOX 
     251#ifndef VBOX_WITH_NEW_PHYS_CODE 
     252void     remR3GrowDynRange(unsigned long physaddr); 
     253#endif 
    250254 
    251255void     remR3PhysRead(RTGCPHYS SrcGCPhys, void *pvDst, unsigned cb); 
     
    264268void     remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val); 
    265269 
    266 #ifndef VBOX_WITH_NEW_PHYS_CODE 
    267 void     remR3GrowDynRange(unsigned long physaddr); 
    268 #endif 
    269 #if 0 /*defined(RT_ARCH_AMD64) && defined(VBOX_STRICT)*/ 
    270 # define VBOX_CHECK_ADDR(ptr) do { if ((uintptr_t)(ptr) >= _4G) __asm__("int3"); } while (0) 
    271 #else 
    272 # define VBOX_CHECK_ADDR(ptr) do { } while (0) 
    273 #endif 
     270#ifndef REM_PHYS_ADDR_IN_TLB 
     271target_ulong remR3HCVirt2GCPhys(CPUState *env1, void *addr); 
     272void* remR3GCPhys2HCVirt(CPUState *env1, target_ulong physAddr); 
     273#endif 
     274 
     275#endif /* VBOX */ 
     276 
     277#if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 
    274278 
    275279DECLINLINE(int) ldub_p(void *ptr) 
     
    373377} 
    374378 
    375 #else  /* !VBOX */ 
     379#else  /* !(VBOX && REM_PHYS_ADDR_IN_TLB) */ 
    376380 
    377381static inline int ldub_p(void *ptr) 
     
    909913#define g2h(x) ((void *)((unsigned long)(x) + GUEST_BASE)) 
    910914#define h2g(x) ((target_ulong)(x - GUEST_BASE)) 
    911  
    912915#define saddr(x) g2h(x) 
    913916#define laddr(x) g2h(x) 
  • trunk/src/recompiler_new/exec.c

    r13731 r14277  
    20692069            tlb_entry->addend - (unsigned long)phys_ram_base; 
    20702070#else 
    2071         ram_addr = remR3HCVirt2GCPhys(first_cpu, (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend); 
     2071        ram_addr = remR3HCVirt2GCPhys(first_cpu, (void*)((tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend)); 
    20722072#endif 
    20732073        if (!cpu_physical_memory_is_dirty(ram_addr)) { 
     
    27012701    unsigned long ram_addr; 
    27022702    int dirty_flags; 
    2703 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 
     2703#if defined(VBOX)  
    27042704    ram_addr = addr; 
    2705 #elif !defined(VBOX) 
     2705#elif 
    27062706    ram_addr = addr - (unsigned long)phys_ram_base; 
    2707 #else 
    2708     ram_addr = remR3HCVirt2GCPhys(first_cpu, (void *)addr); 
    27092707#endif 
    27102708#ifdef VBOX 
     
    27252723#endif 
    27262724    } 
     2725#if defined(VBOX) && !defined(REM_PHYS_ADDR_IN_TLB) 
     2726    remR3PhysWriteU8(addr, val); 
     2727#else 
    27272728    stb_p((uint8_t *)(long)addr, val); 
     2729#endif 
    27282730#ifdef USE_KQEMU 
    27292731    if (cpu_single_env->kqemu_enabled && 
     
    27462748    unsigned long ram_addr; 
    27472749    int dirty_flags; 
    2748 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 
     2750#if defined(VBOX)  
    27492751    ram_addr = addr; 
    2750 #elif !defined(VBOX) 
     2752#else 
    27512753    ram_addr = addr - (unsigned long)phys_ram_base; 
    2752 #else 
    2753     ram_addr = remR3HCVirt2GCPhys(first_cpu, (void *)addr); 
    27542754#endif 
    27552755#ifdef VBOX 
     
    27702770#endif 
    27712771    } 
     2772#if defined(VBOX) && !defined(REM_PHYS_ADDR_IN_TLB) 
     2773    remR3PhysWriteU16(addr, val); 
     2774#else 
    27722775    stw_p((uint8_t *)(long)addr, val); 
     2776#endif 
     2777 
    27732778#ifdef USE_KQEMU 
    27742779    if (cpu_single_env->kqemu_enabled && 
     
    27912796    unsigned long ram_addr; 
    27922797    int dirty_flags; 
    2793 #if defined(VBOX) && defined(REM_PHYS_ADDR_IN_TLB) 
     2798#if defined(VBOX)  
    27942799    ram_addr = addr; 
    2795 #elif !defined(VBOX) 
     2800#else 
    27962801    ram_addr = addr - (unsigned long)phys_ram_base; 
    2797 #else 
    2798     ram_addr = remR3HCVirt2GCPhys(first_cpu, (void *)addr); 
    27992802#endif 
    28002803#ifdef VBOX 
     
    28152818#endif 
    28162819    } 
     2820#if defined(VBOX) && !defined(REM_PHYS_ADDR_IN_TLB) 
     2821    remR3PhysWriteU32(addr, val); 
     2822#else 
    28172823    stl_p((uint8_t *)(long)addr, val); 
     2824#endif 
    28182825#ifdef USE_KQEMU 
    28192826    if (cpu_single_env->kqemu_enabled && 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy