Changeset 87256 in vbox
- Timestamp:
- Jan 15, 2021 10:27:15 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/iprt/asm-arm.h (modified) (2 diffs)
-
src/VBox/Runtime/testcase/tstRTInlineAsm.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm-arm.h
r87218 r87256 87 87 #endif 88 88 89 #if 0 90 /** 91 * Gets the content of the CPU timestamp counter register. 92 * 93 * @returns TSC. 89 90 /** 91 * Gets the content of the CNTVCT_EL0 (or CNTPCT) register. 92 * 93 * @returns CNTVCT_EL0 value. 94 * @note We call this TSC to better fit in with existing x86/amd64 based code. 94 95 */ 95 96 #if RT_INLINE_ASM_EXTERNAL … … 98 99 DECLINLINE(uint64_t) ASMReadTSC(void) 99 100 { 100 RTUINT64U u; 101 # if RT_INLINE_ASM_GNU_STYLE 102 # else 103 # error "Unsupported compiler" 104 # endif 105 return u.u; 106 } 107 #endif 101 # if RT_INLINE_ASM_GNU_STYLE 102 uint64_t u64; 103 # ifdef RT_ARCH_ARM64 104 __asm__ __volatile__("isb\n\t" 105 "mrs %0, CNTVCT_EL0\n\t" 106 : "=r" (u64)); 107 # else 108 uint32_t u32Spill; 109 uint32_t u32Comp; 110 __asm__ __volatile__("isb\n" 111 "Lagain:\n\t" 112 "mrrc p15, 0, %[uSpill], %H[uRet], c14\n\t" /* CNTPCT high into uRet.hi */ 113 "mrrc p15, 0, %[uRet], %[uSpill], c14\n\t" /* CNTPCT low into uRet.lo */ 114 "mrrc p15, 0, %[uSpill], %[uHiComp], c14\n\t" /* CNTPCT high into uHiComp */ 115 "cmp %H[uRet], %[uHiComp]\n\t" 116 "b.eq Lagain\n\t" /* Redo if high value changed. */ 117 : [uRet] "=r" (u64) 118 , "=r" (uHiComp) 119 , "=r" (uSpill)); 120 # endif 121 return u64; 122 123 # else 124 # error "Unsupported compiler" 125 # endif 126 } 108 127 #endif 109 128 -
trunk/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
r87228 r87256 44 44 # include <iprt/asm-amd64-x86.h> 45 45 # include <iprt/x86.h> 46 #elif defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32) 47 # include <iprt/asm-arm.h> 48 # include <iprt/time.h> 46 49 #else 47 50 # include <iprt/time.h> … … 2676 2679 RTTestSub(g_hTest, "Benchmarking"); 2677 2680 2678 #if 0 && !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) )2681 #if 0 && !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)) 2679 2682 # define BENCH(op, str) \ 2680 2683 do { \ … … 2706 2709 } while (0) 2707 2710 #endif 2708 #if (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) ) && !defined(GCC44_32BIT_PIC)2711 #if (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)) && !defined(GCC44_32BIT_PIC) 2709 2712 # define BENCH_TSC(op, str) \ 2710 2713 do { \ … … 2804 2807 BENCH(s_u32 = ASMGetApicIdExt8000001E(), "ASMGetApicIdExt8000001E"); 2805 2808 #endif 2809 #if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)) 2810 BENCH(s_u64 = ASMReadTSC(), "ASMReadTSC"); 2811 #endif 2806 2812 #if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) 2807 2813 uint32_t uAux; … … 2813 2819 BENCH(s_u64 = ASMReadTscWithAux(&uAux), "ASMReadTscWithAux"); 2814 2820 } 2815 BENCH(s_u64 = ASMReadTSC(), "ASMReadTSC");2816 2821 union 2817 2822 {
Note:
See TracChangeset
for help on using the changeset viewer.

