VirtualBox

Changeset 27575 in vbox


Ignore:
Timestamp:
Mar 22, 2010 9:37:43 AM (15 years ago)
Author:
vboxsync
Message:

alloc-ef.cpp: sensible variable names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/alloc-ef.cpp

    r27404 r27575  
    296296     * counteracted by filling and checking the alignment padding. When the
    297297     * fence is in front then then no extra alignment is needed. */
    298     size_t cbAlign = RT_ALIGN_Z(cb, RTALLOC_EFENCE_ALIGNMENT);
     298    size_t cbAligned = RT_ALIGN_Z(cb, RTALLOC_EFENCE_ALIGNMENT);
    299299#endif
    300300
     
    325325        void *pvEFence = pvBlock;
    326326        void *pv = (char *)pvEFence + RTALLOC_EFENCE_SIZE;
    327 #ifdef RTALLOC_EFENCE_NOMAN_FILLER
     327# ifdef RTALLOC_EFENCE_NOMAN_FILLER
    328328        memset((char *)pv + cb, RTALLOC_EFENCE_NOMAN_FILLER, cbBlock - RTALLOC_EFENCE_SIZE - cb);
    329 #endif
     329# endif
    330330        #else
    331331        void *pvEFence = (char *)pvBlock + (cbBlock - RTALLOC_EFENCE_SIZE);
    332         void *pv = (char *)pvEFence - cbAlign;
    333 #ifdef RTALLOC_EFENCE_NOMAN_FILLER
    334         memset(pvBlock, RTALLOC_EFENCE_NOMAN_FILLER, cbBlock - RTALLOC_EFENCE_SIZE - cbAlign);
    335         memset((char *)pv + cb, RTALLOC_EFENCE_NOMAN_FILLER, cbAlign - cb);
    336 #endif
     332        void *pv = (char *)pvEFence - cbAligned;
     333# ifdef RTALLOC_EFENCE_NOMAN_FILLER
     334        memset(pvBlock, RTALLOC_EFENCE_NOMAN_FILLER, cbBlock - RTALLOC_EFENCE_SIZE - cbAligned);
     335        memset((char *)pv + cb, RTALLOC_EFENCE_NOMAN_FILLER, cbAligned - cb);
     336# endif
    337337        #endif
    338338
     
    402402         */
    403403# ifdef RTALLOC_EFENCE_IN_FRONT
    404         void *p = ASMMemIsAll8((char *)pv + pBlock->cb,
    405                                RT_ALIGN_Z(pBlock->cb, PAGE_SIZE) - pBlock->cb,
    406                                RTALLOC_EFENCE_NOMAN_FILLER);
     404        void *pvWrong = ASMMemIsAll8((char *)pv + pBlock->cb,
     405                                     RT_ALIGN_Z(pBlock->cb, PAGE_SIZE) - pBlock->cb,
     406                                     RTALLOC_EFENCE_NOMAN_FILLER);
    407407# else
    408408        /* Alignment must match allocation alignment in rtMemAlloc(). */
    409         size_t cbAlign = RT_ALIGN_Z(pBlock->cb, RTALLOC_EFENCE_ALIGNMENT);
    410         void *p = ASMMemIsAll8((char *)pv + pBlock->cb,
    411                                cbAlign - pBlock->cb,
     409        size_t cbAligned = RT_ALIGN_Z(pBlock->cb, RTALLOC_EFENCE_ALIGNMENT);
     410        void  *pvWrong   = ASMMemIsAll8((char *)pv + pBlock->cb,
     411                                        cbAligned - pBlock->cb,
     412                                        RTALLOC_EFENCE_NOMAN_FILLER);
     413        if (pvWrong)
     414            RTAssertDoPanic();
     415        pvWrong = ASMMemIsAll8((void *)((uintptr_t)pv & ~PAGE_OFFSET_MASK),
     416                               RT_ALIGN_Z(cbAligned, PAGE_SIZE) - cbAligned,
    412417                               RTALLOC_EFENCE_NOMAN_FILLER);
    413         if (p)
    414             RTAssertDoPanic();
    415         p = ASMMemIsAll8((void *)((uintptr_t)pv & ~PAGE_OFFSET_MASK),
    416                          RT_ALIGN_Z(cbAlign, PAGE_SIZE) - cbAlign,
    417                          RTALLOC_EFENCE_NOMAN_FILLER);
    418418# endif
    419         if (p)
     419        if (pvWrong)
    420420            RTAssertDoPanic();
    421421#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