VirtualBox

Ignore:
Timestamp:
Jun 8, 2023 12:42:48 PM (18 months ago)
Author:
vboxsync
Message:

VMM/CPUM: Implement CPUMGetGuestCodeBits() and CPUMGetGuestDisMode(), bugref:10387

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs-armv8.cpp

    r100108 r100119  
    226226VMMDECL(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu)
    227227{
    228     RT_NOREF(pVCpu);
    229     AssertReleaseFailed();
    230     return false;
     228    CPUM_INT_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_PSTATE);
     229    return !RT_BOOL(pVCpu->cpum.s.Guest.fPState & ARMV8_SPSR_EL2_AARCH64_M4);
    231230}
    232231
     
    327326
    328327/**
    329  * Figure whether the CPU is currently executing 16, 32 or 64 bit code.
    330  *
    331  * @returns 16, 32 or 64.
     328 * Figure whether the CPU is currently executing 32 or 64 bit code.
     329 *
     330 * @returns 32 or 64.
    332331 * @param   pVCpu               The cross context virtual CPU structure of the calling EMT.
    333332 */
    334333VMMDECL(uint32_t)       CPUMGetGuestCodeBits(PVMCPU pVCpu)
    335334{
    336     CPUM_INT_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_PC | CPUMCTX_EXTRN_PSTATE);
    337     AssertReleaseFailed();
    338     RT_NOREF(pVCpu);
    339     return 16;
     335    CPUM_INT_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_PSTATE);
     336    if (pVCpu->cpum.s.Guest.fPState & ARMV8_SPSR_EL2_AARCH64_M4)
     337        return 32;
     338
     339    return 64;
    340340}
    341341
     
    343343VMMDECL(DISCPUMODE)     CPUMGetGuestDisMode(PVMCPU pVCpu)
    344344{
    345     CPUM_INT_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_PC | CPUMCTX_EXTRN_PSTATE);
    346     AssertReleaseFailed();
    347     RT_NOREF(pVCpu);
    348     return DISCPUMODE_16BIT;
     345    CPUM_INT_ASSERT_NOT_EXTRN(pVCpu, CPUMCTX_EXTRN_PSTATE);
     346    if (pVCpu->cpum.s.Guest.fPState & ARMV8_SPSR_EL2_AARCH64_M4)
     347    {
     348        if (pVCpu->cpum.s.Guest.fPState & ARMV8_SPSR_EL2_AARCH64_T)
     349            return DISCPUMODE_ARMV8_T32;
     350
     351        return DISCPUMODE_ARMV8_A32;
     352    }
     353
     354    return DISCPUMODE_ARMV8_A64;
    349355}
    350356
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