VirtualBox

Changeset 1182 in vbox for trunk/src/recompiler


Ignore:
Timestamp:
Mar 4, 2007 7:34:24 PM (18 years ago)
Author:
vboxsync
Message:

Restore the PGM_DYNAMIC_RAM_ALLOC tests and #include <VBox/pgm.h> to make sure it's defined.

Location:
trunk/src/recompiler/new
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/new/VBoxRecompiler.c

    r1112 r1182  
    13611361#ifndef PGM_DYNAMIC_RAM_ALLOC
    13621362    target_ulong phys_addr;
    1363 #endif 
     1363#endif
    13641364    target_ulong virt_addr, addend;
    13651365    if (env->pVM->rem.s.fIgnoreSetPage || env->pVM->rem.s.fIgnoreAll)
     
    14131413    Log2(("tlb_set_page_raw read (%x-%x) write (%x-%x) prot %x is_user %d phys\n",
    14141414          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 */
    14161416
    14171417    if (prot & PAGE_WRITE)
     
    14651465#else
    14661466        AssertMsgFailed(("RAWEx_SetPageEntry %x %x %x %d failed!!\n", virt_addr, phys_addr, prot, is_user));
    1467 #endif 
     1467#endif
    14681468        VM_FF_SET(env->pVM, VM_FF_PGM_SYNC_CR3);
    14691469    }
     
    26312631    cpu_register_physical_memory(GCPhys, cb, ((uintptr_t)pvRam - (uintptr_t)phys_ram_base)
    26322632                                             | (fFlags & MM_RAM_FLAGS_RESERVED ? IO_MEM_UNASSIGNED : 0));
    2633 #endif 
     2633#endif
    26342634    Assert(pVM->rem.s.fIgnoreAll);
    26352635    pVM->rem.s.fIgnoreAll = false;
     
    27122712#else
    27132713    AssertReleaseFailed();
    2714 #endif
    2715 }
    2716 
    2717 
     2714#endif
     2715}
     2716
     2717
     2718#ifdef PGM_DYNAMIC_RAM_ALLOC
    27182719/**
    27192720 *  Convert GC physical address to HC virt
     
    27252726void *remR3GCPhys2HCVirt(void *env, target_ulong addr)
    27262727{
    2727 #ifdef PGM_DYNAMIC_RAM_ALLOC
    27282728    PVM      pVM = ((CPUState *)env)->pVM;
    27292729    uint32_t i;
     
    27422742    Log(("remR3GCPhys2HCVirt: %x -> %x\n", addr, pVM->rem.s.paGCPhysToHCVirt[addr >> PGM_DYNAMIC_CHUNK_SHIFT] + (addr & PGM_DYNAMIC_CHUNK_OFFSET_MASK)));
    27432743    return (void *)(pVM->rem.s.paGCPhysToHCVirt[addr >> PGM_DYNAMIC_CHUNK_SHIFT] + (addr & PGM_DYNAMIC_CHUNK_OFFSET_MASK));
    2744 #else
    2745     return (target_ulong)addr - (target_ulong)phys_ram_base;
    2746 #endif
    27472744}
    27482745
     
    27572754target_ulong remR3HCVirt2GCPhys(void *env, void *addr)
    27582755{
    2759 #ifdef PGM_DYNAMIC_RAM_ALLOC
    27602756    PVM         pVM    = ((CPUState *)env)->pVM;
    27612757    RTHCUINTPTR HCVirt = (RTHCUINTPTR)addr;
     
    27662762    off = HCVirt - pVM->rem.s.paHCVirtToGCPhys[idx].pChunk1;
    27672763
    2768     if (    pVM->rem.s.paHCVirtToGCPhys[idx].pChunk1 
     2764    if (    pVM->rem.s.paHCVirtToGCPhys[idx].pChunk1
    27692765        &&  off < PGM_DYNAMIC_CHUNK_SIZE)
    27702766    {
     
    27722768        return pVM->rem.s.paHCVirtToGCPhys[idx].GCPhys1 + off;
    27732769    }
    2774    
     2770
    27752771    off = HCVirt - pVM->rem.s.paHCVirtToGCPhys[idx].pChunk2;
    2776     if (    pVM->rem.s.paHCVirtToGCPhys[idx].pChunk2 
     2772    if (    pVM->rem.s.paHCVirtToGCPhys[idx].pChunk2
    27772773        &&  off < PGM_DYNAMIC_CHUNK_SIZE)
    27782774    {
     
    27932789    AssertReleaseMsgFailed(("No translation for physical address %VHv???\n", addr));
    27942790    return 0;
    2795 #else
    2796     return (target_ulong)addr - (target_ulong)phys_ram_base;
    2797 #endif
    27982791}
    27992792
     
    28202813}
    28212814
     2815#endif /* PGM_DYNAMIC_RAM_ALLOC */
    28222816
    28232817
     
    28752869    AssertRelease(phys_ram_base);
    28762870    cpu_register_physical_memory(GCPhys, cb, ((uintptr_t)pvCopy - (uintptr_t)phys_ram_base) | IO_MEM_ROM);
    2877 #endif 
     2871#endif
    28782872
    28792873    Log2(("%.64Vhxd\n", (char *)pvCopy + cb - 64));
     
    31433137#else
    31443138    uintptr_t off = pbSrcPhys - phys_ram_base;
    3145 #endif 
     3139#endif
    31463140    if (off < (uintptr_t)phys_ram_size)
    31473141        PGMPhysRead(cpu_single_env->pVM, (RTGCPHYS)off, pvDst, cb);
  • trunk/src/recompiler/new/cpu-all.h

    r1113 r1182  
    2525#  include <VBox/log.h>
    2626#  define LOG_GROUP LOG_GROUP_REM
    27 # endif
    28 #endif
     27# endif
     28# include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */
     29#endif
    2930
    3031#if defined(__arm__) || defined(__sparc__)
     
    197198void     remR3PhysWriteU32(uint8_t *pbDstPhys, uint32_t val);
    198199void     remR3PhysWriteU64(uint8_t *pbDstPhys, uint64_t val);
     200# ifdef PGM_DYNAMIC_RAM_ALLOC
    199201void    *remR3GCPhys2HCVirt(void *env, target_ulong addr);
    200202target_ulong remR3HCVirt2GCPhys(void *env, void *addr);
    201203void     remR3GrowDynRange(unsigned long physaddr);
     204# endif
    202205#endif
    203206
     
    984987#define IO_MEM_UNASSIGNED  (2 << IO_MEM_SHIFT)
    985988#define IO_MEM_NOTDIRTY    (4 << IO_MEM_SHIFT) /* used internally, never use directly */
    986 #ifdef VBOX
     989#if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC)
    987990#define IO_MEM_RAM_MISSING (5 << IO_MEM_SHIFT) /* used internally, never use directly */
    988991#endif
     
    10731076        return;
    10741077    }
    1075 #endif 
     1078#endif
    10761079    phys_ram_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
    10771080}
  • trunk/src/recompiler/new/exec-all.h

    r1113 r1182  
    2626#ifdef VBOX
    2727# include <VBox/tm.h>
     28# include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */
    2829# ifndef LOG_GROUP
    2930#  define LOG_GROUP LOG_GROUP_REM
    30 # endif 
     31# endif
    3132# include <VBox/log.h>
    3233# include "REMInternal.h"
     
    603604# ifdef VBOX
    604605target_ulong remR3PhysGetPhysicalAddressCode(CPUState *env, target_ulong addr, CPUTLBEntry *pTLBEntry);
     606#  ifdef PGM_DYNAMIC_RAM_ALLOC
    605607target_ulong remR3HCVirt2GCPhys(void *env, void *addr);
    606 # endif
     608#  endif
     609# endif
    607610/* NOTE: this function can trigger an exception */
    608611/* NOTE2: the returned address is not exactly the physical address: it
     
    636639# ifdef VBOX
    637640        /* 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]);
    639642# else
    640643        cpu_abort(env, "Trying to execute code outside RAM or ROM at 0x%08lx\n", addr);
    641644# endif
    642645    }
    643 # ifdef VBOX
     646# if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC)
    644647    return remR3HCVirt2GCPhys(env, (void *)(addr + env->tlb_table[is_user][index].addend));
    645648# else
    646649    return addr + env->tlb_table[is_user][index].addend - (unsigned long)phys_ram_base;
    647 # endif 
     650# endif
    648651}
    649652#endif
  • trunk/src/recompiler/new/exec.c

    r1123 r1182  
    4040# include <iprt/string.h>
    4141# include <iprt/param.h>
     42# include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */
    4243#endif /* VBOX */
    4344
     
    172173       TARGET_PAGE_SIZE */
    173174#ifdef VBOX
    174     RTMemProtect(code_gen_buffer, sizeof(code_gen_buffer), 
     175    RTMemProtect(code_gen_buffer, sizeof(code_gen_buffer),
    175176                 RTMEM_PROT_EXEC | RTMEM_PROT_READ | RTMEM_PROT_WRITE);
    176177    qemu_real_host_page_size = PAGE_SIZE;
     
    276277          pd[i].phys_offset = IO_MEM_UNASSIGNED;
    277278    }
    278 #ifdef VBOX
     279#if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC)
    279280    pd = ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1));
    280281    if (RT_UNLIKELY((pd->phys_offset & ~TARGET_PAGE_MASK) == IO_MEM_RAM_MISSING))
     
    14311432                                    ram_addr + TARGET_PAGE_SIZE,
    14321433                                    CODE_DIRTY_FLAG);
    1433 #ifdef VBOX && defined(REM_MONITOR_CODE_PAGES)
     1434#if defined(VBOX) && defined(REM_MONITOR_CODE_PAGES)
    14341435    /** @todo Retest this? This function has changed... */
    14351436    remR3ProtectCode(cpu_single_env, ram_addr);
     
    14971498    /* we modify the TLB cache so that the dirty bit will be set again
    14981499       when accessing the range */
    1499 #ifndef VBOX
     1500#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    15001501    start1 = start + (unsigned long)phys_ram_base;
    15011502#else
     
    15111512#if !defined(CONFIG_SOFTMMU)
    15121513#ifdef VBOX /**@todo remove this check */
    1513 # error "We shouldn't get here..." 
    1514 #endif 
     1514# error "We shouldn't get here..."
     1515#endif
    15151516    /* XXX: this is expensive */
    15161517    {
     
    15471548    if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == IO_MEM_RAM) {
    15481549        /* RAM case */
    1549 #ifndef VBOX
     1550#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    15501551        ram_addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) +
    15511552            tlb_entry->addend - (unsigned long)phys_ram_base;
     
    16331634            /* standard memory */
    16341635            address = vaddr;
    1635 #ifndef VBOX
     1636#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    16361637            addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK);
    16371638#else
     
    17541755#ifdef VBOX
    17551756    if (RT_LIKELY((vp->phys_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size))
    1756 #endif 
     1757#endif
    17571758    phys_ram_dirty[vp->phys_addr >> TARGET_PAGE_BITS] = 0xff;
    17581759    /* flush the code inside */
     
    19501951        p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
    19511952        p->phys_offset = phys_offset;
    1952 #ifndef VBOX
     1953#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    19531954        if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM ||
    19541955            (phys_offset & IO_MEM_ROMD))
     
    20122013    unsigned long ram_addr;
    20132014    int dirty_flags;
    2014 #ifndef VBOX
     2015#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    20152016    ram_addr = addr - (unsigned long)phys_ram_base;
    20162017#else
     
    20552056    unsigned long ram_addr;
    20562057    int dirty_flags;
    2057 #ifndef VBOX
     2058#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    20582059    ram_addr = addr - (unsigned long)phys_ram_base;
    20592060#else
     
    20862087#ifdef VBOX
    20872088    if (RT_LIKELY((ram_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size))
    2088 #endif 
     2089#endif
    20892090    phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
    20902091    /* we remove the notdirty callback only if the code has been
     
    20982099    unsigned long ram_addr;
    20992100    int dirty_flags;
    2100 #ifndef VBOX
     2101#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    21012102    ram_addr = addr - (unsigned long)phys_ram_base;
    21022103#else
     
    21042105#endif
    21052106#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))
    21072108        dirty_flags = 0xff;
    21082109    else
     
    21132114        tb_invalidate_phys_page_fast(ram_addr, 4);
    21142115# 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))
    21162117            dirty_flags = 0xff;
    21172118        else
     
    21292130#ifdef VBOX
    21302131    if (RT_LIKELY((ram_addr >> TARGET_PAGE_BITS) < phys_ram_dirty_size))
    2131 #endif 
     2132#endif
    21322133    phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;
    21332134    /* we remove the notdirty callback only if the code has been
     
    21542155    cpu_register_io_memory(IO_MEM_UNASSIGNED >> IO_MEM_SHIFT, unassigned_mem_read, unassigned_mem_write, NULL);
    21552156    cpu_register_io_memory(IO_MEM_NOTDIRTY >> IO_MEM_SHIFT, error_mem_read, notdirty_mem_write, NULL);
    2156 #ifdef VBOX
     2157#if defined(VBOX) && defined(PGM_DYNAMIC_RAM_ALLOC)
    21572158    cpu_register_io_memory(IO_MEM_RAM_MISSING >> IO_MEM_SHIFT, unassigned_mem_read, unassigned_mem_write, NULL);
    21582159    io_mem_nb = 6;
     
    22932294                /* RAM case */
    22942295#ifdef VBOX
     2296# ifdef PGM_DYNAMIC_RAM_ALLOC
    22952297                ptr = remR3GCPhys2HCVirt(cpu_single_env, addr1);
     2298# else
     2299                ptr = phys_ram_base + addr1;
     2300# endif
    22962301                remR3PhysWrite(ptr, buf, l);
    22972302#else
     
    23052310#ifdef VBOX
    23062311                    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] |=
    23092314                        (0xff & ~CODE_DIRTY_FLAG);
    23102315                }
     
    23342339                /* RAM case */
    23352340#ifdef VBOX
     2341# ifdef PGM_DYNAMIC_RAM_ALLOC
    23362342                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
    23372347                remR3PhysRead(ptr, buf, l);
    23382348#else
     
    23802390            /* ROM/RAM case */
    23812391        /* RAM case */
    2382 #ifndef VBOX
     2392#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    23832393            ptr = phys_ram_base + addr1;
    23842394#else
     
    24172427    } else {
    24182428        /* RAM case */
    2419 #ifndef VBOX
     2429#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    24202430        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
    24212431            (addr & ~TARGET_PAGE_MASK);
     
    24572467    } else {
    24582468        /* RAM case */
    2459 #ifndef VBOX
     2469#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    24602470        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
    24612471            (addr & ~TARGET_PAGE_MASK);
     
    25052515        io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
    25062516    } else {
    2507 #ifndef VBOX
     2517#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    25082518        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
    25092519            (addr & ~TARGET_PAGE_MASK);
     
    25372547        addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
    25382548        /* RAM case */
    2539 #ifndef VBOX
     2549#if !defined(VBOX) || !defined(PGM_DYNAMIC_RAM_ALLOC)
    25402550        ptr = phys_ram_base + addr1;
    25412551#else
     
    25502560#ifdef VBOX
    25512561            if (RT_LIKELY((addr1 >> TARGET_PAGE_BITS) < phys_ram_dirty_size))
    2552 #endif 
     2562#endif
    25532563            phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |=
    25542564                (0xff & ~CODE_DIRTY_FLAG);
  • trunk/src/recompiler/new/target-i386/helper2.c

    r1111 r1182  
    2626#include <signal.h>
    2727#include <assert.h>
    28 #endif
     28#else
     29# include <VBox/pgm.h> /* PGM_DYNAMIC_RAM_ALLOC */
     30#endif
    2931
    3032#include "cpu.h"
     
    539541#ifdef VBOX
    540542    remR3ChangeCpuMode(env);
    541 #endif 
     543#endif
    542544}
    543545
     
    575577#ifdef VBOX
    576578    remR3ChangeCpuMode(env);
    577 #endif 
     579#endif
    578580}
    579581
     
    586588
    587589    /* page directory entry */
     590# ifdef PGM_DYNAMIC_RAM_ALLOC
    588591    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
    589596    pde = ldl_raw(pde_ptr);
    590597    /* if PSE bit is set, then we use a 4MB page */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette