VirtualBox

Changeset 103014 in vbox for trunk


Ignore:
Timestamp:
Jan 24, 2024 12:58:12 AM (8 months ago)
Author:
vboxsync
Message:

iprt/asm-mem.h: Eliminated the ASMMemZeroPage function, replaced the three actual uses in PGMPool with RT_BZERO/PAGE_SIZE.

Location:
trunk
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm-mem-watcom-x86-16.h

    r103005 r103014  
    5252 *       the watcom header at both the top and the bottom of asm.h file.
    5353 */
    54 
    55 #undef      ASMMemZeroPage
    56 #ifdef IPRT_ASM_WATCOM_X86_16_WITH_PRAGMAS
    57 # if defined(__SW_0) || defined(__SW_1) || defined(__SW_2)
    58 #  pragma aux ASMMemZeroPage = \
    59     "mov cx, 2048" \
    60     "xor ax, ax" \
    61     "rep stosw"  \
    62     parm [es di] \
    63     modify exact [ax cx di];
    64 # else
    65 #  pragma aux ASMMemZeroPage = \
    66     "mov ecx, 1024" \
    67     "xor eax, eax" \
    68     "rep stosd"  \
    69     parm [es di] \
    70     modify exact [ax cx di];
    71 # endif
    72 #endif
    7354
    7455#undef      ASMMemZero32
  • trunk/include/iprt/asm-mem-watcom-x86-32.h

    r103005 r103014  
    5353 */
    5454
    55 #undef      ASMMemZeroPage
    56 #ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
    57 #pragma aux ASMMemZeroPage = \
    58     "mov ecx, 1024" \
    59     "xor eax, eax" \
    60     "rep stosd"  \
    61     parm [edi] \
    62     modify exact [eax ecx edi];
    63 #endif
    64 
    6555#undef      ASMMemZero32
    6656#ifdef IPRT_ASM_WATCOM_X86_32_WITH_PRAGMAS
  • trunk/include/iprt/asm-mem.h

    r103013 r103014  
    101101# endif
    102102#endif
    103 
    104 
    105 #ifdef RT_ASM_PAGE_SIZE
    106 /**
    107  * Zeros a 4K memory page.
    108  *
    109  * @param   pv  Pointer to the memory block. This must be page aligned.
    110  */
    111 # if (RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN) || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
    112 RT_ASM_DECL_PRAGMA_WATCOM(void) ASMMemZeroPage(volatile void RT_FAR *pv) RT_NOTHROW_PROTO;
    113 #  else
    114 DECLINLINE(void) ASMMemZeroPage(volatile void RT_FAR *pv) RT_NOTHROW_DEF
    115 {
    116 #   if RT_INLINE_ASM_USES_INTRIN
    117 #    ifdef RT_ARCH_AMD64
    118     __stosq((unsigned __int64 *)pv, 0, RT_ASM_PAGE_SIZE / 8);
    119 #    else
    120     __stosd((unsigned long *)pv, 0, RT_ASM_PAGE_SIZE / 4);
    121 #    endif
    122 
    123 #   elif RT_INLINE_ASM_GNU_STYLE
    124     RTCCUINTREG uDummy;
    125 #    ifdef RT_ARCH_AMD64
    126     __asm__ __volatile__("rep stosq"
    127                          : "=D" (pv),
    128                            "=c" (uDummy)
    129                          : "0" (pv),
    130                            "c" (RT_ASM_PAGE_SIZE >> 3),
    131                            "a" (0)
    132                          : "memory");
    133 #    else
    134     __asm__ __volatile__("rep stosl"
    135                          : "=D" (pv),
    136                            "=c" (uDummy)
    137                          : "0" (pv),
    138                            "c" (RT_ASM_PAGE_SIZE >> 2),
    139                            "a" (0)
    140                          : "memory");
    141 #    endif
    142 #   else
    143     __asm
    144     {
    145 #    ifdef RT_ARCH_AMD64
    146         xor     rax, rax
    147         mov     ecx, 0200h
    148         mov     rdi, [pv]
    149         rep     stosq
    150 #    else
    151         xor     eax, eax
    152         mov     ecx, 0400h
    153         mov     edi, [pv]
    154         rep     stosd
    155 #    endif
    156     }
    157 #   endif
    158 }
    159 # endif
    160 #endif /* RT_ASM_PAGE_SIZE */
    161103
    162104
  • trunk/include/iprt/mangling.h

    r102647 r103014  
    291291# define ASMMemZero32                                   RT_MANGLER(ASMMemZero32)
    292292# define ASMMemZero32_EndProc                           RT_MANGLER(ASMMemZero32_EndProc)
    293 # define ASMMemZeroPage                                 RT_MANGLER(ASMMemZeroPage)
    294 # define ASMMemZeroPage_EndProc                         RT_MANGLER(ASMMemZeroPage_EndProc)
    295293# define ASMMultU64ByU32DivByU32                        RT_MANGLER(ASMMultU64ByU32DivByU32)
    296294# define ASMMultU64ByU32DivByU32_EndProc                RT_MANGLER(ASMMultU64ByU32DivByU32_EndProc)
  • trunk/src/VBox/Runtime/Makefile.kmk

    r102648 r103014  
    879879        common/asm/ASMBitFirstSet-generic.cpp \
    880880        common/asm/ASMBitNextSet-generic.cpp \
    881         common/asm/ASMMemZeroPage-generic.cpp \
    882881        common/asm/ASMMemZero32-generic.cpp \
    883882        common/asm/ASMMemFill32-generic.cpp \
     
    893892        common/asm/ASMBitFirstSet-generic.cpp \
    894893        common/asm/ASMBitNextSet-generic.cpp \
    895         common/asm/ASMMemZeroPage-generic.cpp \
    896894        common/asm/ASMMemZero32-generic.cpp \
    897895        common/asm/ASMMemFill32-generic.cpp \
  • trunk/src/VBox/Runtime/VBox/VBoxRTImp.def

    r101349 r103014  
    8181    ASMBitFirstSet              ; not-amd64 not-x86
    8282    ASMBitNextSet               ; not-amd64 not-x86
    83     ASMMemZeroPage              ; not-amd64 not-x86
    8483    ASMMemZero32                ; not-amd64 not-x86
    8584    ASMMemFill32                ; not-amd64 not-x86
  • trunk/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp

    r103013 r103014  
    23802380    DO_SIMPLE_TEST(ASMAtomicUoAndOrXorU64, uint64_t);
    23812381    //DO_SIMPLE_TEST(ASMAtomicAndOrXorExU64, uint64_t);
    2382 }
    2383 
    2384 
    2385 typedef struct
    2386 {
    2387     uint8_t ab[PAGE_SIZE];
    2388 } TSTPAGE;
    2389 
    2390 
    2391 DECLINLINE(void) tstASMMemZeroPageWorker(TSTPAGE *pPage)
    2392 {
    2393     for (unsigned j = 0; j < 16; j++)
    2394     {
    2395         memset(pPage, 0x11 * j, sizeof(*pPage));
    2396         ASMMemZeroPage(pPage);
    2397         for (unsigned i = 0; i < sizeof(pPage->ab); i++)
    2398             if (pPage->ab[i])
    2399                 RTTestFailed(g_hTest, "ASMMemZeroPage didn't clear byte at offset %#x!\n", i);
    2400         if (ASMMemIsZero(pPage, RT_ASM_PAGE_SIZE) != true)
    2401             RTTestFailed(g_hTest, "ASMMemIsZero/RT_ASM_PAGE_SIZE returns false after ASMMemZeroPage!\n");
    2402         if (ASMMemFirstMismatchingU32(pPage, sizeof(pPage), 0) != NULL)
    2403             RTTestFailed(g_hTest, "ASMMemFirstMismatchingU32(,,0) returns non-NULL after ASMMemZeroPage!\n");
    2404     }
    2405 }
    2406 
    2407 
    2408 static void tstASMMemZeroPage(void)
    2409 {
    2410     RTTestISub("ASMMemZeroPage");
    2411     DO_SIMPLE_TEST_NO_SUB_NO_STACK(tstASMMemZeroPageWorker, TSTPAGE);
    24122382}
    24132383
     
    32973267    tstASMAtomicAndOrXor();
    32983268
    3299     tstASMMemZeroPage();
    33003269    tstASMMemFirstMismatchingU8(g_hTest);
    33013270    tstASMMemZero32();
  • trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp

    r103005 r103014  
    51445144    /* paranoia, clear the shadow page. Remove this laser (i.e. let Alloc and ClearAll do it). */
    51455145    STAM_PROFILE_START(&pPool->StatZeroPage, z);
    5146     ASMMemZeroPage(pvShw);
     5146    RT_BZERO(pvShw, PAGE_SIZE);
    51475147    STAM_PROFILE_STOP(&pPool->StatZeroPage, z);
    51485148    pPage->fZeroed = true;
     
    54805480        STAM_PROFILE_START(&pPool->StatZeroPage, z);
    54815481        void *pv = PGMPOOL_PAGE_2_PTR(pVM, pPage);
    5482         ASMMemZeroPage(pv);
     5482        RT_BZERO(pv, PAGE_SIZE);
    54835483        STAM_PROFILE_STOP(&pPool->StatZeroPage, z);
    54845484    }
  • trunk/src/VBox/VMM/VMMR3/PGMPool.cpp

    r103005 r103014  
    682682                        }
    683683#endif
    684                         ASMMemZeroPage(pvShw);
     684                        RT_BZERO(pvShw, PAGE_SIZE);
    685685                        STAM_PROFILE_STOP(&pPool->StatZeroPage, z);
    686686                        pPage->cPresent = 0;
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