VirtualBox

Changeset 99196 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Mar 28, 2023 1:06:05 PM (20 months ago)
Author:
vboxsync
Message:

VMM: Start on system register handling for ARMv8 (which is ver similar to how we handle MSR accesses on x86), bugref:10385

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpum-armv8.h

    r99051 r99196  
    4848 * @{
    4949 */
     50
     51
     52/**
     53 * System register read functions.
     54 */
     55typedef enum CPUMSYSREGRDFN
     56{
     57    /** Invalid zero value. */
     58    kCpumSysRegRdFn_Invalid = 0,
     59    /** Return the CPUMMSRRANGE::uValue. */
     60    kCpumSysRegRdFn_FixedValue,
     61    /** Alias to the system register range starting at the system register given by
     62     * CPUMSYSREGRANGE::uValue.  Must be used in pair with
     63     * kCpumSysRegWrFn_Alias. */
     64    kCpumSysRegRdFn_Alias,
     65    /** Write only register, all read attempts cause an exception. */
     66    kCpumSysRegRdFn_WriteOnly,
     67
     68    /** End of valid system register read function indexes. */
     69    kCpumSysRegRdFn_End
     70} CPUMSYSREGRDFN;
     71
     72
     73/**
     74 * System register write functions.
     75 */
     76typedef enum CPUMSYSREGWRFN
     77{
     78    /** Invalid zero value. */
     79    kCpumSysRegWrFn_Invalid = 0,
     80    /** Writes are ignored. */
     81    kCpumSysRegWrFn_IgnoreWrite,
     82    /** Writes cause an exception. */
     83    kCpumSysRegWrFn_ReadOnly,
     84    /** Alias to the system register range starting at the system register given by
     85     * CPUMSYSREGRANGE::uValue.  Must be used in pair with
     86     * kCpumSysRegRdFn_Alias. */
     87    kCpumSysRegWrFn_Alias,
     88
     89    /** End of valid system register write function indexes. */
     90    kCpumSysRegWrFn_End
     91} CPUMSYSREGWRFN;
     92
     93
     94/**
     95 * System register range.
     96 *
     97 * @note This is very similar to how x86/amd64 MSRs are handled.
     98 */
     99typedef struct CPUMSYSREGRANGE
     100{
     101    /** The first system register. [0] */
     102    uint16_t    uFirst;
     103    /** The last system register. [2] */
     104    uint16_t    uLast;
     105    /** The read function (CPUMMSRRDFN). [4] */
     106    uint16_t    enmRdFn;
     107    /** The write function (CPUMMSRWRFN). [6] */
     108    uint16_t    enmWrFn;
     109    /** The offset of the 64-bit system register value relative to the start of CPUMCPU.
     110     * UINT16_MAX if not used by the read and write functions.  [8] */
     111    uint32_t    offCpumCpu : 24;
     112    /** Reserved for future hacks. [11] */
     113    uint32_t    fReserved : 8;
     114    /** Padding/Reserved. [12] */
     115    uint32_t    u32Padding;
     116    /** The init/read value. [16]
     117     * When enmRdFn is kCpumMsrRdFn_INIT_VALUE, this is the value returned on RDMSR.
     118     * offCpumCpu must be UINT16_MAX in that case, otherwise it must be a valid
     119     * offset into CPUM. */
     120    uint64_t    uValue;
     121    /** The bits to ignore when writing. [24]   */
     122    uint64_t    fWrIgnMask;
     123    /** The bits that will cause an exception when writing. [32]
     124     * This is always checked prior to calling the write function.  Using
     125     * UINT64_MAX effectively marks the MSR as read-only. */
     126    uint64_t    fWrExcpMask;
     127    /** The register name, if applicable. [32] */
     128    char        szName[56];
     129
     130    /** The number of reads. */
     131    STAMCOUNTER cReads;
     132    /** The number of writes. */
     133    STAMCOUNTER cWrites;
     134    /** The number of times ignored bits were written. */
     135    STAMCOUNTER cIgnoredBits;
     136    /** The number of exceptions generated. */
     137    STAMCOUNTER cExcp;
     138} CPUMSYSREGRANGE;
     139#ifndef VBOX_FOR_DTRACE_LIB
     140AssertCompileSize(CPUMSYSREGRANGE, 128);
     141#endif
     142/** Pointer to an system register range. */
     143typedef CPUMSYSREGRANGE *PCPUMSYSREGRANGE;
     144/** Pointer to a const system register range. */
     145typedef CPUMSYSREGRANGE const *PCCPUMSYSREGRANGE;
     146
    50147
    51148/**
     
    155252/** @} */
    156253
     254
     255#ifndef VBOX_FOR_DTRACE_LIB
     256
     257/** @name Guest Register Getters.
     258 * @{ */
     259VMMDECL(VBOXSTRICTRC)   CPUMQueryGuestSysReg(PVMCPUCC pVCpu, uint32_t idSysReg, uint64_t *puValue);
     260VMMDECL(VBOXSTRICTRC)   CPUMSetGuestSysReg(PVMCPUCC pVCpu, uint32_t idSysReg, uint64_t uValue);
     261/** @} */
     262
     263#endif
     264
    157265/** @} */
    158266RT_C_DECLS_END
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