Explorar el Código

Experimental linux armv7a support (#500)

Jorrit Rouwe hace 2 años
padre
commit
4e457165ee
Se han modificado 3 ficheros con 36 adiciones y 3 borrados
  1. 1 1
      Build/Android/build.gradle
  2. 32 1
      Jolt/Core/FPControlWord.h
  3. 3 1
      Jolt/Core/TickCounter.h

+ 1 - 1
Build/Android/build.gradle

@@ -5,7 +5,7 @@ buildscript {
         mavenCentral()
         mavenCentral()
     }
     }
     dependencies {
     dependencies {
-        classpath 'com.android.tools.build:gradle:7.4.1'
+        classpath 'com.android.tools.build:gradle:7.4.2'
 
 
         // NOTE: Do not place your application dependencies here; they belong
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
         // in the individual module build.gradle files

+ 32 - 1
Jolt/Core/FPControlWord.h

@@ -60,7 +60,7 @@ private:
 	unsigned int mPrevState;
 	unsigned int mPrevState;
 };
 };
 
 
-#elif defined(JPH_CPU_ARM)
+#elif defined(JPH_CPU_ARM) && defined(JPH_USE_NEON)
 
 
 /// Helper class that needs to be put on the stack to update the state of the floating point control word.
 /// Helper class that needs to be put on the stack to update the state of the floating point control word.
 /// This state is kept per thread.
 /// This state is kept per thread.
@@ -91,6 +91,37 @@ private:
 	uint64		mPrevState;
 	uint64		mPrevState;
 };
 };
 
 
+#elif defined(JPH_CPU_ARM)
+
+/// Helper class that needs to be put on the stack to update the state of the floating point control word.
+/// This state is kept per thread.
+template <uint32 Value, uint32 Mask>
+class FPControlWord : public NonCopyable
+{
+public:
+	FPControlWord()
+	{
+		uint32 val;
+		asm volatile("vmrs %0, fpscr" : "=r" (val));
+		mPrevState = val;
+		val &= ~Mask;
+		val |= Value;
+		asm volatile("vmsr fpscr, %0" : /* no output */ : "r" (val));
+	}
+
+	~FPControlWord()
+	{
+		uint32 val;
+		asm volatile("vmrs %0, fpscr" : "=r" (val));
+		val &= ~Mask;
+		val |= mPrevState & Mask;
+		asm volatile("vmsr fpscr, %0" : /* no output */ : "r" (val));
+	}
+
+private:
+	uint32		mPrevState;
+};
+
 #elif defined(JPH_CPU_WASM)
 #elif defined(JPH_CPU_WASM)
 
 
 // Not supported
 // Not supported

+ 3 - 1
Jolt/Core/TickCounter.h

@@ -27,10 +27,12 @@ JPH_INLINE uint64 GetProcessorTickCount()
 	return JPH_PLATFORM_BLUE_GET_TICKS();
 	return JPH_PLATFORM_BLUE_GET_TICKS();
 #elif defined(JPH_CPU_X86)
 #elif defined(JPH_CPU_X86)
 	return __rdtsc();
 	return __rdtsc();
-#elif defined(JPH_CPU_ARM)
+#elif defined(JPH_CPU_ARM) && defined(JPH_USE_NEON)
 	uint64 val;
 	uint64 val;
 	asm volatile("mrs %0, cntvct_el0" : "=r" (val));
 	asm volatile("mrs %0, cntvct_el0" : "=r" (val));
 	return val;
 	return val;
+#elif defined(JPH_CPU_ARM)
+	return 0; // Not supported
 #elif defined(JPH_CPU_WASM)
 #elif defined(JPH_CPU_WASM)
 	return 0; // Not supported
 	return 0; // Not supported
 #else
 #else