VirtualBox

Changeset 92613 in vbox for trunk/include


Ignore:
Timestamp:
Nov 26, 2021 9:53:47 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148505
Message:

SUP,IPRT,++: Adding SUPSECMAIN_FLAGS_DRIVERLESS_IEM_ALLOWED and SUPR3INIT_F_DRIVERLESS_NEM_FALLBACK to SUPLib and RTR3INIT_FLAGS_TRY_SUPLIB to RTR3Init*, the latter probably reflects the actual state there a lot better. Currently only the TRY_SUPLIB option works, the other two aren't really implemented in SUPLib yet. bugref:10138

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/sup.h

    r92556 r92613  
    653653
    654654/** @internal  */
     655SUPDECL(PSUPGIPCPU) SUPGetGipCpuPtrForAsyncMode(PSUPGLOBALINFOPAGE pGip);
    655656SUPDECL(uint64_t) SUPGetCpuHzFromGipForAsyncMode(PSUPGLOBALINFOPAGE pGip);
    656657SUPDECL(bool)     SUPIsTscFreqCompatible(uint64_t uCpuHz, uint64_t *puGipCpuHz, bool fRelax);
    657658SUPDECL(bool)     SUPIsTscFreqCompatibleEx(uint64_t uBaseCpuHz, uint64_t uCpuHz, bool fRelax);
    658659
     660
     661/**
     662 * Gets CPU entry of the calling CPU.
     663 *
     664 * @returns Pointer to the CPU entry on success, NULL on failure.
     665 * @param   pGip        The GIP pointer.
     666 */
     667DECLINLINE(PSUPGIPCPU) SUPGetGipCpuPtr(PSUPGLOBALINFOPAGE pGip)
     668{
     669    if (RT_LIKELY(   pGip
     670                  && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC))
     671    {
     672        switch (pGip->u32Mode)
     673        {
     674            case SUPGIPMODE_INVARIANT_TSC:
     675            case SUPGIPMODE_SYNC_TSC:
     676                return &pGip->aCPUs[0];
     677            case SUPGIPMODE_ASYNC_TSC:
     678                return SUPGetGipCpuPtrForAsyncMode(pGip);
     679            default: break; /* shut up gcc */
     680        }
     681    }
     682    AssertFailed();
     683    return NULL;
     684}
    659685
    660686/**
     
    12021228 * @param   pszProgName     The program name. This will be used to figure out which
    12031229 *                          DLL/SO/DYLIB to load and execute.
    1204  * @param   fFlags          Flags.
     1230 * @param   fFlags          SUPSECMAIN_FLAGS_XXX.
    12051231 * @param   argc            The argument count.
    12061232 * @param   argv            The argument vector.
     
    12091235DECLHIDDEN(int) SUPR3HardenedMain(const char *pszProgName, uint32_t fFlags, int argc, char **argv, char **envp);
    12101236
    1211 /** @name SUPR3HardenedMain flags.
     1237/** @name SUPSECMAIN_FLAGS_XXX - SUPR3HardenedMain flags.
    12121238 * @{ */
    12131239/** Don't open the device. (Intended for VirtualBox without -startvm.) */
    1214 #define SUPSECMAIN_FLAGS_DONT_OPEN_DEV      RT_BIT_32(0)
     1240#define SUPSECMAIN_FLAGS_DONT_OPEN_DEV              RT_BIT_32(0)
    12151241/** The hardened DLL has a "TrustedError" function (see FNSUPTRUSTEDERROR). */
    1216 #define SUPSECMAIN_FLAGS_TRUSTED_ERROR      RT_BIT_32(1)
     1242#define SUPSECMAIN_FLAGS_TRUSTED_ERROR              RT_BIT_32(1)
    12171243/** Hack for making VirtualBoxVM use VirtualBox.dylib on Mac OS X.
    12181244 * @note Not used since 6.0  */
    1219 #define SUPSECMAIN_FLAGS_OSX_VM_APP         RT_BIT_32(2)
     1245#define SUPSECMAIN_FLAGS_OSX_VM_APP                 RT_BIT_32(2)
     1246/** The first process.
     1247 * @internal  */
     1248#define SUPSECMAIN_FLAGS_FIRST_PROCESS              RT_BIT_32(3)
    12201249/** Program binary location mask. */
    1221 #define SUPSECMAIN_FLAGS_LOC_MASK           UINT32_C(0x00000030)
     1250#define SUPSECMAIN_FLAGS_LOC_MASK                   UINT32_C(0x00000030)
    12221251/** Default binary location is the application binary directory.  Does
    12231252 * not need to be given explicitly (it's 0).  */
    1224 #define SUPSECMAIN_FLAGS_LOC_APP_BIN        UINT32_C(0x00000000)
     1253#define SUPSECMAIN_FLAGS_LOC_APP_BIN                UINT32_C(0x00000000)
    12251254/** The binary is located in the testcase directory instead of the
    12261255 * default application binary directory. */
    1227 #define SUPSECMAIN_FLAGS_LOC_TESTCASE       UINT32_C(0x00000010)
     1256#define SUPSECMAIN_FLAGS_LOC_TESTCASE               UINT32_C(0x00000010)
    12281257/** The binary is located in a nested application bundle under Resources/ in the
    12291258 * main Mac OS X application (think Resources/VirtualBoxVM.app).  */
    1230 #define SUPSECMAIN_FLAGS_LOC_OSX_HLP_APP    UINT32_C(0x00000020)
    1231 /** The first process.
    1232  * @internal  */
    1233 #define SUPSECMAIN_FLAGS_FIRST_PROCESS      UINT32_C(0x00000100)
     1259#define SUPSECMAIN_FLAGS_LOC_OSX_HLP_APP            UINT32_C(0x00000020)
     1260/** Driverless IEM-only mode is allowed, so don't fail fatally just because
     1261 * the VBox support driver is unavailable. */
     1262#define SUPSECMAIN_FLAGS_DRIVERLESS_IEM_ALLOWED     RT_BIT_32(8)
     1263#ifdef VBOX_WITH_DRIVERLESS_NEM_FALLBACK
     1264/** Driverless NEM is a fallback posibility, so don't fail fatally just
     1265 * because the VBox support driver is unavailable.
     1266 * This may imply checking NEM requirements, depending on the host.
     1267 * @note Not supported on Windows. */
     1268# define SUPSECMAIN_FLAGS_DRIVERLESS_NEM_FALLBACK   RT_BIT_32(9)
     1269#endif
     1270
    12341271/** @} */
    12351272
     
    12521289 *
    12531290 * @returns VBox status code.
    1254  * @param   fUnrestricted   The desired access.
     1291 * @param   fFlags          SUPR3INIT_F_XXX
    12551292 * @param   ppSession       Where to store the session handle. Defaults to NULL.
    12561293 */
    1257 SUPR3DECL(int) SUPR3InitEx(bool fUnrestricted, PSUPDRVSESSION *ppSession);
     1294SUPR3DECL(int) SUPR3InitEx(uint32_t fFlags, PSUPDRVSESSION *ppSession);
     1295/** @name SUPR3INIT_F_XXX - Flags for SUPR3InitEx
     1296 * @{ */
     1297/** Unrestricted access. */
     1298#define SUPR3INIT_F_UNRESTRICTED                RT_BIT_32(0)
     1299/** Limited access (for Main). */
     1300#define SUPR3INIT_F_LIMITED                     RT_BIT_32(1)
     1301/** Allow driverless IEM mode if the VBox support driver is unavailable.
     1302 * @see SUPSECMAIN_FLAGS_DRIVERLESS_IEM_ALLOWED */
     1303#define SUPR3INIT_F_DRIVERLESS_IEM_ALLOWED      RT_BIT_32(2)
     1304#ifdef VBOX_WITH_DRIVERLESS_NEM_FALLBACK
     1305/** Allow driverless NEM mode as fallback if the VBox support driver is unavailable.
     1306 * @see SUPSECMAIN_FLAGS_DRIVERLESS_NEM_FALLBACK */
     1307# define SUPR3INIT_F_DRIVERLESS_NEM_FALLBACK    RT_BIT_32(3)
     1308#endif
     1309/** @} */
    12581310
    12591311/**
  • trunk/include/iprt/initterm.h

    r92562 r92613  
    5151#ifdef IN_RING3
    5252
    53 /** @name RTR3Init flags (RTR3INIT_XXX).
     53/** @name RTR3INIT_FLAGS_XXX - RTR3Init* flags.
     54 * @see RTR3InitExeNoArguments, RTR3InitExe, RTR3InitDll, RTR3InitEx
    5455 * @{ */
    55 /** Try initialize SUPLib. */
    56 # define RTR3INIT_FLAGS_SUPLIB       RT_BIT(0)
    5756/** Initializing IPRT from a DLL. */
    58 # define RTR3INIT_FLAGS_DLL          RT_BIT(1)
    59 /** We are sharing a process space, so we need to behave. */
    60 # define RTR3INIT_FLAGS_UNOBTRUSIVE  RT_BIT(2)
     57# define RTR3INIT_FLAGS_DLL             RT_BIT(0)
    6158/** The caller ensures that the argument vector is UTF-8. */
    62 # define RTR3INIT_FLAGS_UTF8_ARGV    RT_BIT(3)
     59# define RTR3INIT_FLAGS_UTF8_ARGV       RT_BIT(1)
    6360/** Indicates that this is a standalone application without any additional
    6461 * shared libraries in the application directory. Mainly windows loader mess. */
    65 # define RTR3INIT_FLAGS_STANDALONE_APP RT_BIT(4)
     62# define RTR3INIT_FLAGS_STANDALONE_APP  RT_BIT(2)
     63/** We are sharing a process space, so we need to behave. */
     64# define RTR3INIT_FLAGS_UNOBTRUSIVE     RT_BIT(3)
     65
     66/** Initialize SUPLib (must not fail). */
     67# define RTR3INIT_FLAGS_SUPLIB          RT_BIT(16)
     68/** Try initialize SUPLib and ignore failures. */
     69# define RTR3INIT_FLAGS_TRY_SUPLIB      RT_BIT(17)
     70/** Shift count for passing thru SUPR3INIT_F_XXX flags.   */
     71# define RTR3INIT_FLAGS_SUPLIB_SHIFT    18
     72/** The mask covering the passthru SUPR3INIT_F_XXX flags. */
     73# define RTR3INIT_FLAGS_SUPLIB_MASK     UINT32_C(0xfffc0000)
     74
     75/** Valid flag mask. */
     76# define RTR3INIT_FLAGS_VALID_MASK      UINT32_C(0xffff000f)
    6677/** @} */
    6778
     
    6980 * @{ */
    7081/** Version 1. */
    71 # define RTR3INIT_VER_1              UINT32_C(1)
     82# define RTR3INIT_VER_1                 UINT32_C(1)
     83/** Version 2 - new flags, rearranged a bit. */
     84# define RTR3INIT_VER_2                 UINT32_C(2)
    7285/** The current version. */
    73 # define RTR3INIT_VER_CUR            RTR3INIT_VER_1
     86# define RTR3INIT_VER_CUR               RTR3INIT_VER_2
    7487/** @} */
    7588
     
    7891 *
    7992 * @returns iprt status code.
    80  * @param   fFlags          Flags, see RTR3INIT_XXX.
     93 * @param   fFlags          Flags, see RTR3INIT_FLAGS_XXX.
    8194 */
    8295RTR3DECL(int) RTR3InitExeNoArguments(uint32_t fFlags);
     
    88101 * @param   cArgs           Pointer to the argument count.
    89102 * @param   ppapszArgs      Pointer to the argument vector pointer.
    90  * @param   fFlags          Flags, see RTR3INIT_XXX.
     103 * @param   fFlags          Flags, see RTR3INIT_FLAGS_XXX.
    91104 */
    92105RTR3DECL(int) RTR3InitExe(int cArgs, char ***ppapszArgs, uint32_t fFlags);
     
    96109 *
    97110 * @returns iprt status code.
    98  * @param   fFlags          Flags, see RTR3INIT_XXX.
     111 * @param   fFlags          Flags, see RTR3INIT_FLAGS_XXX.
    99112 */
    100113RTR3DECL(int) RTR3InitDll(uint32_t fFlags);
     
    107120 * @returns IPRT status code.
    108121 * @param   iVersion        The interface version. Must be 0 atm.
    109  * @param   fFlags          Flags, see RTR3INIT_XXX.
     122 * @param   fFlags          Flags, see RTR3INIT_FLAGS_XXX.
    110123 * @param   cArgs           Pointer to the argument count.
    111124 * @param   ppapszArgs      Pointer to the argument vector pointer. NULL
Note: See TracChangeset for help on using the changeset viewer.

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