Changeset 106430 in vbox
- Timestamp:
- Oct 17, 2024 11:13:31 AM (7 months ago)
- svn:sync-xref-src-repo-rev:
- 165249
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm-arm.h
r106061 r106430 43 43 #if !defined(RT_ARCH_ARM64) && !defined(RT_ARCH_ARM32) 44 44 # 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) 45 64 #endif 46 65 … … 85 104 return u64; 86 105 106 #elif RT_INLINE_ASM_USES_INTRIN 107 return (uint64_t)_ReadStatusReg(ARM64_SYSREG_CNTCVT_EL0); 87 108 # else 88 109 # error "Unsupported compiler" … … 118 139 return u64; 119 140 141 #elif RT_INLINE_ASM_USES_INTRIN 142 return (uint64_t)_ReadStatusReg(ARM64_SYSREG_CNTFRQ_EL0); 120 143 # else 121 144 # error "Unsupported compiler" … … 145 168 : "=r" (uFlags)); 146 169 # endif 170 # elif RT_INLINE_ASM_USES_INTRIN 171 _enable(); 147 172 # else 148 173 # error "Unsupported compiler" … … 172 197 : "=r" (uFlags)); 173 198 # endif 199 # elif RT_INLINE_ASM_USES_INTRIN 200 _disable(); 174 201 # else 175 202 # error "Unsupported compiler" … … 203 230 , "=r" (uNewFlags)); 204 231 # endif 232 # elif RT_INLINE_ASM_USES_INTRIN 233 uFlags = _ReadStatusReg(ARM64_SYSREG_DAIF); 234 _disable(); 205 235 # else 206 236 # error "Unsupported compiler" … … 208 238 return uFlags; 209 239 } 240 #endif 210 241 211 242 … … 229 260 # error "Implementation required for arm32" 230 261 # endif 262 # elif RT_INLINE_ASM_USES_INTRIN 263 uFlags = _ReadStatusReg(ARM64_SYSREG_DAIF); 231 264 # else 232 265 # error "Unsupported compiler" … … 254 287 # error "Implementation required for arm32" 255 288 # endif 289 # elif RT_INLINE_ASM_USES_INTRIN 290 _WriteStatusReg(ARM64_SYSREG_DAIF, uFlags); 256 291 # else 257 292 # error "Unsupported compiler" … … 271 306 } 272 307 273 #endif 308 309 #if 0 /* Later */ 310 /** 311 * Issue HVC call with a single argument. 312 */ 313 #if RT_INLINE_ASM_EXTERNAL 314 DECLASM(void) ASMHvc(uint16_t u16Imm, uint32_t u32Arg0); 315 #else 316 DECLINLINE(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 274 329 275 330 /** 276 331 * Halts the CPU until interrupted. 277 332 */ 278 #if RT_INLINE_ASM_EXTERNAL 333 #if RT_INLINE_ASM_EXTERNAL || defined(_MSC_VER) 279 334 DECLASM(void) ASMHalt(void); 280 335 #else
Note:
See TracChangeset
for help on using the changeset viewer.