VirtualBox

儲存庫 vbox 的更動 100312


忽略:
時間撮記:
2023-6-28 上午10:28:59 (21 月 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
158027
訊息:

Runtime/r3/test.cpp: Replace occurences of PAGE_SIZE/PAGE_OFFSET_MASK with RTSystemGetPageSize()/RTSystemGetPageOffsetMask() in code which is used by the linux.arm64 guest additions / validationkit, bugref:10476

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/r3/test.cpp

    r99758 r100312  
    5353#include <iprt/string.h>
    5454#include <iprt/stream.h>
     55#include <iprt/system.h>
    5556
    5657#include "internal/magics.h"
     
    9899    /** The length of the test name.  */
    99100    size_t              cchTest;
    100     /** The size of a guard. Multiple of PAGE_SIZE. */
     101    /** The size of a guard. Multiple of system page size. */
    101102    uint32_t            cbGuard;
    102103    /** The verbosity level. */
     
    266267    pTest->pszTest          = RTStrDup(pszTest);
    267268    pTest->cchTest          = strlen(pszTest);
    268     pTest->cbGuard          = PAGE_SIZE * 7;
     269    pTest->cbGuard          = RTSystemGetPageSize() * 7;
    269270    pTest->enmMaxLevel      = enmMaxLevel == RTTESTLVL_INVALID ? RTTESTLVL_INFO : enmMaxLevel;
    270271    pTest->fFlags           = fFlags;
     
    576577    if (cbAlign == 0)
    577578        cbAlign = 1;
    578     AssertReturn(cbAlign <= PAGE_SIZE, VERR_INVALID_PARAMETER);
     579    uint32_t const cbPage = RTSystemGetPageSize();
     580    AssertReturn(cbAlign <= cbPage, VERR_INVALID_PARAMETER);
    579581    AssertReturn(cbAlign == (UINT32_C(1) << (ASMBitFirstSetU32(cbAlign) - 1)), VERR_INVALID_PARAMETER);
    580582
     
    586588    if (RT_LIKELY(pMem))
    587589    {
    588         size_t const    cbAligned = RT_ALIGN_Z(cb, PAGE_SIZE);
     590        size_t const    cbAligned = RT_ALIGN_Z(cb, cbPage);
    589591        pMem->aGuards[0].cb = pMem->aGuards[1].cb = pTest->cbGuard;
    590592        pMem->cbAlloc       = pMem->aGuards[0].cb + pMem->aGuards[1].cb + cbAligned;
     
    597599            if (!fHead)
    598600            {
    599                 size_t off = cb & PAGE_OFFSET_MASK;
     601                size_t off = cb & RTSystemGetPageOffsetMask();
    600602                if (off)
    601603                {
    602                     off = PAGE_SIZE - RT_ALIGN_Z(off, cbAlign);
     604                    off = cbPage - RT_ALIGN_Z(off, cbAlign);
    603605                    pMem->pvUser = (uint8_t *)pMem->pvUser + off;
    604606                }
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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