VirtualBox

Changeset 99956 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
May 24, 2023 11:39:15 AM (20 months ago)
Author:
vboxsync
Message:

VMM/CPUM-armv8: Implement OSDLR_EL1, OSLAR_EL1 and OSLSR_EL1 accessed by Linux guests, bugref:10387

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM-armv8.cpp

    r99739 r99956  
    7171
    7272/*********************************************************************************************************************************
     73*   Defined Constants And Macros                                                                                                 *
     74*********************************************************************************************************************************/
     75
     76/** Internal form used by the macros. */
     77#ifdef VBOX_WITH_STATISTICS
     78# define RINT(a_uFirst, a_uLast, a_enmRdFn, a_enmWrFn, a_offCpumCpu, a_uInitOrReadValue, a_fWrIgnMask, a_fWrGpMask, a_szName) \
     79    { a_uFirst, a_uLast, a_enmRdFn, a_enmWrFn, a_offCpumCpu, 0, 0, a_uInitOrReadValue, a_fWrIgnMask, a_fWrGpMask, a_szName, \
     80      { 0 }, { 0 }, { 0 }, { 0 } }
     81#else
     82# define RINT(a_uFirst, a_uLast, a_enmRdFn, a_enmWrFn, a_offCpumCpu, a_uInitOrReadValue, a_fWrIgnMask, a_fWrGpMask, a_szName) \
     83    { a_uFirst, a_uLast, a_enmRdFn, a_enmWrFn, a_offCpumCpu, 0, 0, a_uInitOrReadValue, a_fWrIgnMask, a_fWrGpMask, a_szName }
     84#endif
     85
     86/** Function handlers, extended version. */
     87#define MFX(a_uMsr, a_szName, a_enmRdFnSuff, a_enmWrFnSuff, a_uValue, a_fWrIgnMask, a_fWrGpMask) \
     88    RINT(a_uMsr, a_uMsr, kCpumSysRegRdFn_##a_enmRdFnSuff, kCpumSysRegWrFn_##a_enmWrFnSuff, 0, a_uValue, a_fWrIgnMask, a_fWrGpMask, a_szName)
     89/** Function handlers, read-only. */
     90#define MFO(a_uMsr, a_szName, a_enmRdFnSuff) \
     91    RINT(a_uMsr, a_uMsr, kCpumSysRegRdFn_##a_enmRdFnSuff, kCpumSysRegWrFn_ReadOnly, 0, 0, 0, UINT64_MAX, a_szName)
     92/** Read-only fixed value, ignores all writes. */
     93#define MVI(a_uMsr, a_szName, a_uValue) \
     94    RINT(a_uMsr, a_uMsr, kCpumSysRegRdFn_FixedValue, kCpumSysRegWrFn_IgnoreWrite, 0, a_uValue, UINT64_MAX, 0, a_szName)
     95
     96
     97/*********************************************************************************************************************************
    7398*   Structures and Typedefs                                                                                                      *
    7499*********************************************************************************************************************************/
     
    103128*   Global Variables                                                                                                             *
    104129*********************************************************************************************************************************/
     130/**
     131 * System register ranges.
     132 */
     133static CPUMSYSREGRANGE const g_aSysRegRanges[] =
     134{
     135    MFX(ARMV8_AARCH64_SYSREG_OSLAR_EL1, "OSLAR_EL1", WriteOnly, OslarEl1, 0, UINT64_C(0xfffffffffffffffe), UINT64_C(0xfffffffffffffffe)),
     136    MFO(ARMV8_AARCH64_SYSREG_OSLSR_EL1, "OSLSR_EL1", OslsrEl1),
     137    MVI(ARMV8_AARCH64_SYSREG_OSDLR_EL1, "OSDLR_EL1", 0)
     138};
     139
     140
    105141#if 0 /** @todo Will come later. */
    106142/** Saved state field descriptors for CPUMCTX. */
     
    185221
    186222/**
     223 * Initializes the guest system register states.
     224 *
     225 * @returns VBox status code.
     226 * @param   pVM         The cross context VM structure.
     227 */
     228static int cpumR3InitSysRegs(PVM pVM)
     229{
     230    for (uint32_t i = 0; i < RT_ELEMENTS(g_aSysRegRanges); i++)
     231    {
     232        int rc = CPUMR3SysRegRangesInsert(pVM, &g_aSysRegRanges[i]);
     233        AssertLogRelRCReturn(rc, rc);
     234    }
     235
     236    return VINF_SUCCESS;
     237}
     238
     239
     240/**
    187241 * Initializes the CPUM.
    188242 *
     
    228282
    229283    rc = cpumR3DbgInit(pVM);
     284    if (RT_FAILURE(rc))
     285        return rc;
     286
     287    /*
     288     * Initialize the Guest system register states.
     289     */
     290    rc = cpumR3InitSysRegs(pVM);
    230291    if (RT_FAILURE(rc))
    231292        return rc;
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