VirtualBox

Ignore:
Timestamp:
Mar 21, 2007 2:58:53 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19699
Message:

Quick hack to only use physical addresses so we can dispense with the unnecessary address translation. It's all enabled by the DEFS += REM_PHYS_ADDR_IN_TLB statement in the Makefile.kmk. (Not tested with PGM_DYNAMIC_RAM_ALLOC yet, will do that tomorrow.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/new/cpu-all.h

    r1589 r1590  
    181181#ifdef VBOX
    182182
    183 #if !defined(REMR3PHYSREADWRITE_DEFINED)
    184 #define REMR3PHYSREADWRITE_DEFINED
    185 /* Header sharing between vbox & qemu is rather ugly. */
     183void     remR3PhysRead(RTGCPHYS SrcGCPhys, void *pvDst, unsigned cb);
     184uint8_t  remR3PhysReadU8(RTGCPHYS SrcGCPhys);
     185int8_t   remR3PhysReadS8(RTGCPHYS SrcGCPhys);
     186uint16_t remR3PhysReadU16(RTGCPHYS SrcGCPhys);
     187int16_t  remR3PhysReadS16(RTGCPHYS SrcGCPhys);
     188uint32_t remR3PhysReadU32(RTGCPHYS SrcGCPhys);
     189int32_t  remR3PhysReadS32(RTGCPHYS SrcGCPhys);
     190uint64_t remR3PhysReadU64(RTGCPHYS SrcGCPhys);
     191int64_t  remR3PhysReadS64(RTGCPHYS SrcGCPhys);
     192void     remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb);
     193void     remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val);
     194void     remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val);
     195void     remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val);
     196void     remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val);
     197
     198#ifndef REM_PHYS_ADDR_IN_TLB
    186199void     remR3PhysReadHCPtr(uint8_t *pbSrcPhys, void *pvDst, unsigned cb);
    187200uint8_t  remR3PhysReadHCPtrU8(uint8_t *pbSrcPhys);
     
    198211void     remR3PhysWriteHCPtrU32(uint8_t *pbDstPhys, uint32_t val);
    199212void     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
    201217void    *remR3GCPhys2HCVirt(void *env, target_ulong addr);
    202218target_ulong remR3HCVirt2GCPhys(void *env, void *addr);
     219# endif
    203220void     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
    206227
    207228static inline int ldub_p(void *ptr)
    208229{
     230#ifdef REM_PHYS_ADDR_IN_TLB
     231    VBOX_CHECK_ADDR(ptr);
     232    return remR3PhysReadU8((uintptr_t)ptr);
     233#else
    209234    return remR3PhysReadHCPtrU8(ptr);
     235#endif
    210236}
    211237
    212238static inline int ldsb_p(void *ptr)
    213239{
     240#ifdef REM_PHYS_ADDR_IN_TLB
     241    VBOX_CHECK_ADDR(ptr);
     242    return remR3PhysReadS8((uintptr_t)ptr);
     243#else
    214244    return remR3PhysReadHCPtrS8(ptr);
     245#endif
    215246}
    216247
    217248static inline void stb_p(void *ptr, int v)
    218249{
     250#ifdef REM_PHYS_ADDR_IN_TLB
     251    VBOX_CHECK_ADDR(ptr);
     252    remR3PhysWriteU8((uintptr_t)ptr, v);
     253#else
    219254    remR3PhysWriteHCPtrU8(ptr, v);
     255#endif
    220256}
    221257
    222258static inline int lduw_le_p(void *ptr)
    223259{
     260#ifdef REM_PHYS_ADDR_IN_TLB
     261    VBOX_CHECK_ADDR(ptr);
     262    return remR3PhysReadU16((uintptr_t)ptr);
     263#else
    224264    return remR3PhysReadHCPtrU16(ptr);
     265#endif
    225266}
    226267
    227268static inline int ldsw_le_p(void *ptr)
    228269{
     270#ifdef REM_PHYS_ADDR_IN_TLB
     271    VBOX_CHECK_ADDR(ptr);
     272    return remR3PhysReadS16((uintptr_t)ptr);
     273#else
    229274    return remR3PhysReadHCPtrS16(ptr);
     275#endif
    230276}
    231277
    232278static inline void stw_le_p(void *ptr, int v)
    233279{
     280#ifdef REM_PHYS_ADDR_IN_TLB
     281    VBOX_CHECK_ADDR(ptr);
     282    remR3PhysWriteU16((uintptr_t)ptr, v);
     283#else
    234284    remR3PhysWriteHCPtrU16(ptr, v);
     285#endif
    235286}
    236287
    237288static inline int ldl_le_p(void *ptr)
    238289{
     290#ifdef REM_PHYS_ADDR_IN_TLB
     291    VBOX_CHECK_ADDR(ptr);
     292    return remR3PhysReadU32((uintptr_t)ptr);
     293#else
    239294    return remR3PhysReadHCPtrU32(ptr);
     295#endif
    240296}
    241297
    242298static inline void stl_le_p(void *ptr, int v)
    243299{
     300#ifdef REM_PHYS_ADDR_IN_TLB
     301    VBOX_CHECK_ADDR(ptr);
     302    remR3PhysWriteU32((uintptr_t)ptr, v);
     303#else
    244304    remR3PhysWriteHCPtrU32(ptr, v);
     305#endif
    245306}
    246307
    247308static inline void stq_le_p(void *ptr, uint64_t v)
    248309{
     310#ifdef REM_PHYS_ADDR_IN_TLB
     311    VBOX_CHECK_ADDR(ptr);
     312    remR3PhysWriteU64((uintptr_t)ptr, v);
     313#else
    249314    remR3PhysWriteHCPtrU64(ptr, v);
     315#endif
    250316}
    251317
    252318static inline uint64_t ldq_le_p(void *ptr)
    253319{
     320#ifdef REM_PHYS_ADDR_IN_TLB
     321    VBOX_CHECK_ADDR(ptr);
     322    return remR3PhysReadU64((uintptr_t)ptr);
     323#else
    254324    return remR3PhysReadHCPtrU64(ptr);
    255 }
     325#endif
     326}
     327
     328#undef VBOX_CHECK_ADDR
    256329
    257330/* float access */
     
    9731046extern uint32_t phys_ram_dirty_size;
    9741047#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))
    9761049extern uint8_t *phys_ram_base;
    9771050#endif
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