From: Philippe D. <phi...@la...> - 2025-06-19 06:36:07
|
Le 18/06/2025 à 12:25, Christian Schoenebeck a écrit : > On Tuesday, June 17, 2025 2:16:19 AM CEST Philippe DIDIER wrote: >> Hi > Hi Philippe, > >> We use to create rpms of gig linuxsampler gigedit and qsampler for i686 >> , x86_64 , aarch64 and armv7hl... >> >> There's something wrong when we try to build linuxsampler 2.4.0 for >> armv7hl : >> >> This concerns RTMath.cpp ... We get a build failure with this message : >> >> RTMath.cpp:79:19: error: invalid operand for instruction >> 79 | asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); >> >> >> This is linked to the instructions from line 77 to 80 #elif >> defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) uint32_t t; asm >> volatile ("mrs %0, cntvct_el0" : "=r"(t)); return t; >> >> Maybe we should use for ARM_ARCH_75 > Yeah, looks like that's an ARMv8 (a.k.a. ARM64) feature. > >> the same instruction as for ARMv6 ... that is : >> uint32_t t; >> asm volatile ("mrc p15, 0, %0, c15, c12, 1" : "=r" (t)); >> return t; > I think that also needs some correction. Can you test the following patch? > > Index: src/common/RTMath.cpp > =================================================================== > --- src/common/RTMath.cpp (revision 4334) > +++ src/common/RTMath.cpp (working copy) > @@ -74,16 +74,12 @@ > uint64_t t; > asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); > return (time_stamp_t) t; > - #elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) > - uint32_t t; > - asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); > - return t; > #elif defined(__APPLE__) > return (time_stamp_t) mach_absolute_time(); > #elif defined(__arm__) /* ARMv6 and older */ > # warning ARM 'mrc' instruction requires special runtime privileges! > uint32_t t; > - asm volatile ("mrc p15, 0, %0, c15, c12, 1" : "=r" (t)); > + asm volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r" (t)); > return t; > #else // we don't want to use a slow generic solution > # error "Sorry, LinuxSampler lacks time stamp code for your system." > > Would be good to know not only if it compiles, but whether it works at > runtime. Because as you can see from the warning, special privileges or > preceding system configuration steps might be required for this to work at > all. > > If not, it's getting pretty ugly for the user. Since the sampler would first > start without complaint and eventually after loading a sound the app would die > with illegal instruction exception. > > /Christian > > > > > _______________________________________________ > Linuxsampler-devel mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel Hi Christian We have tested 2 patches (the first from me the second from an other packager) : --- src/common/RTMath.cpp +++ src/common/RTMath.cpp @@ -75,9 +75,9 @@ asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); return (time_stamp_t) t; #elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) - uint32_t t; - asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); - return t; + uint32_t t; + asm volatile ("mrc p15, 0, %0, c15, c12, 1" : "=r" (t)); + return t; #elif defined(__APPLE__) return (time_stamp_t) mach_absolute_time(); #elif defined(__arm__) /* ARMv6 and older */ --- src/common/RTMath.cpp +++ src/common/RTMath.cpp @@ -75,9 +75,9 @@ asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); return (time_stamp_t) t; #elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) - uint32_t t; - asm volatile ("mrs %0, cntvct_el0" : "=r"(t)); - return t; + uint32_t hi, lo; + asm volatile ("mrrc p15, 1, %0, %1, c14" : "=r"(lo), "=r" (hi)); + return lo; #elif defined(__APPLE__) return (time_stamp_t) mach_absolute_time(); #elif defined(__arm__) /* ARMv6 and older */ Both of them allow to compile for armv7hl on our BuildSystem Nevertheless I choosed to apply the first one with return t and not return lo for coherency with the other arches I'm gonna test to compile with asm volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r" (t)); Unfortunately we can't test the use on a real armv7hl system (using a virtual system is not enough) |