VirtualBox

Changeset 100307 in vbox


Ignore:
Timestamp:
Jun 28, 2023 10:17:34 AM (17 months ago)
Author:
vboxsync
Message:

Runtime,Additions,HostDrivers: Provide API to query the host page size and associated parameters for architectures where the used page size can vary (like on linux.arm64 depending on the kernel config), bugref:10476

Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/mangling.h

    r100171 r100307  
    24342434# define RTSymlinkRead                                  RT_MANGLER(RTSymlinkRead)
    24352435# define RTSymlinkReadA                                 RT_MANGLER(RTSymlinkReadA)
     2436# define RTSystemGetPageSize                            RT_MANGLER(RTSystemGetPageSize)
     2437# define RTSystemGetPageOffsetMask                      RT_MANGLER(RTSystemGetPageOffsetMask)
     2438# define RTSystemGetPageShift                           RT_MANGLER(RTSystemGetPageShift)
     2439# define RTSystemPageAlignSize                          RT_MANGLER(RTSystemPageAlignSize)
    24362440# define RTSystemQueryFirmwareType                      RT_MANGLER(RTSystemQueryFirmwareType)
    24372441# define RTSystemQueryFirmwareBoolean                   RT_MANGLER(RTSystemQueryFirmwareBoolean)
  • trunk/include/iprt/system.h

    r98103 r100307  
    163163 */
    164164RTDECL(int) RTSystemQueryUnavailableRam(uint64_t *pcb);
     165
     166/**
     167 * Returns the page size in bytes of the system.
     168 *
     169 * @returns Page size in bytes.
     170 */
     171RTDECL(uint32_t) RTSystemGetPageSize(void);
     172
     173/**
     174 * Returns the page shift in bits of the system.
     175 *
     176 * @returns Page shift in bits.
     177 */
     178RTDECL(uint32_t) RTSystemGetPageShift(void);
     179
     180/**
     181 * Returns the page offset mask of the system.
     182 *
     183 * @returns Page offset maske.
     184 */
     185RTDECL(uintptr_t) RTSystemGetPageOffsetMask(void);
     186
     187/**
     188 * Aligns the given size to the systems page size.
     189 *
     190 * @returns Byte size aligned to the systems page size.
     191 * @param   cb                  The size in bytes to align.
     192 */
     193RTDECL(size_t) RTSystemPageAlignSize(size_t cb);
    165194
    166195
  • trunk/src/VBox/Additions/common/VBoxGuest/linux/combined-agnostic.c

    r100191 r100307  
    167167#undef LOG_GROUP
    168168#include "generic/mppresent-generic.c"
     169#undef LOG_GROUP
     170#include "generic/system-page-size-generic.c"
    169171#undef LOG_GROUP
    170172#include "VBox/log-vbox.c"
  • trunk/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest

    r100191 r100307  
    7474    ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \
    7575    ${PATH_ROOT}/include/iprt/string.h=>include/iprt/string.h \
     76    ${PATH_ROOT}/include/iprt/system.h=>include/iprt/system.h \
    7677    ${PATH_ROOT}/include/iprt/thread.h=>include/iprt/thread.h \
    7778    ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
     
    198199    ${PATH_ROOT}/src/VBox/Runtime/generic/errvars-generic.cpp=>generic/errvars-generic.c \
    199200    ${PATH_ROOT}/src/VBox/Runtime/generic/mppresent-generic.cpp=>generic/mppresent-generic.c \
     201    ${PATH_ROOT}/src/VBox/Runtime/generic/system-page-size-generic.cpp=>generic/system-page-size-generic.c \
    200202    ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.cpp=>r0drv/alloc-r0drv.c \
    201203    ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.h=>r0drv/alloc-r0drv.h \
  • trunk/src/VBox/HostDrivers/Support/linux/combined-agnostic2.c

    r98103 r100307  
    104104#include "generic/mppresent-generic.c"
    105105#undef LOG_GROUP
     106#include "generic/system-page-size-generic.c"
     107#undef LOG_GROUP
    106108#include "generic/uuid-generic.c"
    107109#undef LOG_GROUP
  • trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv

    r98103 r100307  
    7373    ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \
    7474    ${PATH_ROOT}/include/iprt/string.h=>include/iprt/string.h \
     75    ${PATH_ROOT}/include/iprt/system.h=>include/iprt/system.h \
    7576    ${PATH_ROOT}/include/iprt/thread.h=>include/iprt/thread.h \
    7677    ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
     
    198199    ${PATH_ROOT}/src/VBox/Runtime/generic/errvars-generic.cpp=>generic/errvars-generic.c \
    199200    ${PATH_ROOT}/src/VBox/Runtime/generic/mppresent-generic.cpp=>generic/mppresent-generic.c \
     201    ${PATH_ROOT}/src/VBox/Runtime/generic/system-page-size-generic.cpp=>generic/system-page-size-generic.c \
    200202    ${PATH_ROOT}/src/VBox/Runtime/generic/uuid-generic.cpp=>generic/uuid-generic.c \
    201203    ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.cpp=>r0drv/alloc-r0drv.c \
  • trunk/src/VBox/Runtime/Makefile.kmk

    r100192 r100307  
    834834RuntimeBaseR3_SOURCES.x86 += \
    835835        generic/RTMpGetDescription-generic.cpp \
     836        generic/system-page-size-generic.cpp \
    836837        common/misc/zero.asm \
    837838        common/misc/RTSystemIsInsideVM-amd64-x86.cpp \
     
    840841RuntimeBaseR3_SOURCES.amd64 += \
    841842        generic/RTMpGetDescription-generic.cpp \
     843        generic/system-page-size-generic.cpp \
    842844        common/misc/zero.asm \
    843845        common/misc/RTSystemIsInsideVM-amd64-x86.cpp \
     
    868870RuntimeBaseR3_SOURCES.sparc32 += \
    869871        generic/RTMpGetDescription-generic-stub.cpp \
     872        generic/system-page-size-generic.cpp \
    870873        generic/RTSystemIsInsideVM-generic.cpp \
    871874        common/asm/ASMBitFirstClear-generic.cpp \
     
    883886RuntimeBaseR3_SOURCES.sparc64 += \
    884887        generic/RTMpGetDescription-generic-stub.cpp \
     888        generic/system-page-size-generic.cpp \
    885889        generic/RTSystemIsInsideVM-generic.cpp \
    886890        common/asm/ASMBitFirstClear-generic.cpp \
     
    11951199        r3/linux/semeventmulti-linux.cpp
    11961200 RuntimeBaseR3_SOURCES.linux.arm64 += \
     1201        r3/posix/system-page-size-posix.cpp \
    11971202        r3/linux/semevent-linux.cpp \
    11981203        r3/linux/semeventmulti-linux.cpp
    11991204 RuntimeBaseR3_SOURCES.linux.arm32 += \
     1205        r3/posix/system-page-size-posix.cpp \
    12001206        r3/linux/semevent-linux.cpp \
    12011207        r3/linux/semeventmulti-linux.cpp
     
    13971403        common/string/mempcpy.cpp \
    13981404        common/string/memrchr.cpp \
     1405        generic/system-page-size-generic.cpp \
    13991406        r3/darwin/RTMpGetDescription-generic.cpp
    14001407RuntimeBaseR3_SOURCES.darwin.arm64 += \
    14011408        common/string/mempcpy.cpp \
    14021409        common/string/memrchr.cpp \
     1410        generic/system-page-size-generic.cpp \
    14031411        r3/darwin/RTMpGetDescription-generic.cpp
    14041412
     
    35783586        generic/RTSemEventMultiWait-2-ex-generic.cpp \
    35793587        generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
     3588        generic/system-page-size-generic.cpp \
    35803589        generic/critsect-generic.cpp \
    35813590        generic/critsectrw-generic.cpp \
  • trunk/src/VBox/Runtime/r3/init.cpp

    r98103 r100307  
    8888#include "internal/path.h"
    8989#include "internal/process.h"
     90#include "internal/system.h"
    9091#include "internal/thread.h"
    9192#include "internal/time.h"
     
    407408#endif /* !IN_GUEST && !RT_NO_GIP */
    408409
     410#if defined(RT_ARCH_ARM64) && defined(RT_OS_LINUX)
     411    /*
     412     * Initialize the page size.
     413     */
     414    rc = rtSystemInitPageSize();
     415    AssertMsgRCReturn(rc, ("Failed to initialize the page size, rc=%Rrc!\n", rc), rc);
     416#endif
     417
    409418    /*
    410419     * Thread Thread database and adopt the caller thread as 'main'.
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