VirtualBox

Changeset 106623 in vbox


Ignore:
Timestamp:
Oct 23, 2024 3:16:16 PM (5 weeks ago)
Author:
vboxsync
Message:

iprt/asm-arm.h: Added ASMGetThreadIdRoEL0. jiraref:VBP-1253

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm-arm.h

    r106430 r106623  
    5757 * MSVC insists on having these defined using ARM64_SYSREG or it will
    5858 * fail to compile with "error C2284: "_ReadStatusReg": invalid argument for internal function, parameter 1"
    59  * if we use our own definitions from iprt/armv8.h
    60  */
    61 # define ARM64_SYSREG_DAIF       ARM64_SYSREG(3, 3,  4, 2, 1)
    62 # define ARM64_SYSREG_CNTFRQ_EL0 ARM64_SYSREG(3, 3, 14, 0, 0)
    63 # define ARM64_SYSREG_CNTCVT_EL0 ARM64_SYSREG(3, 3, 14, 0, 2)
     59 * if we use our own definitions from iprt/armv8.h
     60 * 
     61 * The reason for this, is that ARM64_SYSREG masks off the top bit (bit 15)
     62 * whereas our macro doesn't.  So the reason is probably the implicitness
     63 * of the top bit in the MRS/MSR encoding.
     64 */
     65# define ARM64_SYSREG_DAIF          ARM64_SYSREG(3, 3,  4, 2, 1)
     66# define ARM64_SYSREG_CNTFRQ_EL0    ARM64_SYSREG(3, 3, 14, 0, 0)
     67# define ARM64_SYSREG_CNTCVT_EL0    ARM64_SYSREG(3, 3, 14, 0, 2)
     68# define ARM64_SYSREG_TPIDRRO_EL0   ARM64_SYSREG(3, 3, 13, 0, 3)
    6469#endif
    6570
     
    429434
    430435
     436/**
     437 * Get the TPIDRRO_EL0 register.
     438 */
     439#if RT_INLINE_ASM_EXTERNAL
     440DECLASM(RTCCUINTREG) ASMGetThreadIdRoEL0(void);
     441#else
     442DECLINLINE(RTCCUINTREG) ASMGetThreadIdRoEL0(void)
     443{
     444# if RT_INLINE_ASM_GNU_STYLE
     445    RTCCUINTREG uRet;
     446#  ifdef RT_ARCH_ARM64
     447    __asm__ __volatile__("Lstart_ASMGetThreadIdEl0_%=:\n\t"
     448                         "mrs %[uRet], TPIDRRO_EL0\n\t"
     449                         : : [uRet] "r" (uRet));
     450#  else
     451    __asm__ __volatile__("Lstart_ASMGetThreadIdEl0_%=:\n\t"
     452                         "mrc p15, 0, %[uRet], c13, c0, 3\n\t" /* TPIDRURO */
     453                         : : [uRet] "r" (uRet));
     454#  endif
     455    return uRet;
     456# elif RT_INLINE_ASM_USES_INTRIN
     457    return _ReadStatusReg(ARM64_SYSREG_TPIDRRO_EL0);
     458# else
     459#  error "Unsupported compiler"
     460# endif
     461}
     462#endif
     463
     464
    431465/** @} */
    432466#endif /* !IPRT_INCLUDED_asm_arm_h */
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