VirtualBox

Changeset 106430 in vbox


Ignore:
Timestamp:
Oct 17, 2024 11:13:31 AM (7 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165249
Message:

include/iprt/asm-arm.h: Make it build on win.arm64, bugref:10392

File:
1 edited

Legend:

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

    r106061 r106430  
    4343#if !defined(RT_ARCH_ARM64) && !defined(RT_ARCH_ARM32)
    4444# error "Not on ARM64 or ARM32"
     45#endif
     46
     47#if defined(_MSC_VER) && RT_INLINE_ASM_USES_INTRIN
     48/* Emit the intrinsics at all optimization levels. */
     49# include <iprt/sanitized/intrin.h>
     50# pragma intrinsic(_ReadStatusReg)
     51# pragma intrinsic(_WriteStatusReg)
     52# pragma intrinsic(_disable)
     53# pragma intrinsic(_enable)
     54# pragma intrinsic(__hvc)
     55
     56/*
     57 * MSVC insists on having these defined using ARM64_SYSREG or it will
     58 * 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)
    4564#endif
    4665
     
    85104    return u64;
    86105
     106#elif RT_INLINE_ASM_USES_INTRIN
     107    return (uint64_t)_ReadStatusReg(ARM64_SYSREG_CNTCVT_EL0);
    87108# else
    88109#  error "Unsupported compiler"
     
    118139    return u64;
    119140
     141#elif RT_INLINE_ASM_USES_INTRIN
     142    return (uint64_t)_ReadStatusReg(ARM64_SYSREG_CNTFRQ_EL0);
    120143# else
    121144#  error "Unsupported compiler"
     
    145168                         : "=r" (uFlags));
    146169#  endif
     170# elif RT_INLINE_ASM_USES_INTRIN
     171    _enable();
    147172# else
    148173#  error "Unsupported compiler"
     
    172197                         : "=r" (uFlags));
    173198#  endif
     199# elif RT_INLINE_ASM_USES_INTRIN
     200    _disable();
    174201# else
    175202#  error "Unsupported compiler"
     
    203230                         , "=r" (uNewFlags));
    204231#  endif
     232# elif RT_INLINE_ASM_USES_INTRIN
     233    uFlags = _ReadStatusReg(ARM64_SYSREG_DAIF);
     234    _disable();
    205235# else
    206236#  error "Unsupported compiler"
     
    208238    return uFlags;
    209239}
     240#endif
    210241
    211242
     
    229260#   error "Implementation required for arm32"
    230261#  endif
     262# elif RT_INLINE_ASM_USES_INTRIN
     263    uFlags = _ReadStatusReg(ARM64_SYSREG_DAIF);
    231264# else
    232265#  error "Unsupported compiler"
     
    254287#   error "Implementation required for arm32"
    255288#  endif
     289# elif RT_INLINE_ASM_USES_INTRIN
     290    _WriteStatusReg(ARM64_SYSREG_DAIF, uFlags);
    256291# else
    257292#  error "Unsupported compiler"
     
    271306}
    272307
    273 #endif
     308
     309#if 0 /* Later */
     310/**
     311 * Issue HVC call with a single argument.
     312 */
     313#if RT_INLINE_ASM_EXTERNAL
     314DECLASM(void) ASMHvc(uint16_t u16Imm, uint32_t u32Arg0);
     315#else
     316DECLINLINE(void) ASMHvc(uint16_t u16Imm, uint32_t u32Arg0)
     317{
     318# if RT_INLINE_ASM_GNU_STYLE
     319#  error "Later"
     320# elif RT_INLINE_ASM_USES_INTRIN
     321    __hvc(u16Imm, u32Val);
     322# else
     323#  error "Unsupported compiler"
     324# endif
     325}
     326#endif
     327#endif
     328
    274329
    275330/**
    276331 * Halts the CPU until interrupted.
    277332 */
    278 #if RT_INLINE_ASM_EXTERNAL
     333#if RT_INLINE_ASM_EXTERNAL || defined(_MSC_VER)
    279334DECLASM(void) ASMHalt(void);
    280335#else
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