Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37493451
en ru br
Репозитории ALT

Группа :: Эмуляторы
Пакет: desmume

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: desmume-0.9.13-arm.patch
Скачать


From d4afd4977ce8b7ba6293946c74914afe79536059 Mon Sep 17 00:00:00 2001
From: rogerman <rogerman@users.noreply.github.com>
Date: Mon, 20 Jun 2022 11:22:26 -0700
Subject: [PATCH] libretro-common: Compiling tune-up for ARM architectures. -
 Fixes a mismatched register warning in arm_enable_runfast_mode() when
 compiling for AArch64. - Fix compiling check_arm_cpu_feature() on non-ARM
 architectures by being super explicit and pedantic about checking for
 __ARM_ARCH; none of this compiler-assumes-a-macro-equals-zero-if-undefined
 stuff.
---
 desmume/src/libretro-common/features/features_cpu.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/desmume/src/libretro-common/features/features_cpu.c b/desmume/src/libretro-common/features/features_cpu.c
index 0980821f9..2c41d5732 100644
--- a/desmume/src/libretro-common/features/features_cpu.c
+++ b/desmume/src/libretro-common/features/features_cpu.c
@@ -300,10 +300,17 @@ static void arm_enable_runfast_mode(void)
    static const unsigned y = 0x03000000;
    int r;
    __asm__ volatile(
+#if defined(__aarch64__) || defined(_M_ARM64)
+         "fmrx	%w0, fpscr   \n\t" /* w0 = FPSCR */
+         "and	%w0, %w0, %w1  \n\t" /* w0 = w0 & 0x04086060 */
+         "orr	%w0, %w0, %w2  \n\t" /* w0 = w0 | 0x03000000 */
+         "fmxr	fpscr, %w0   \n\t" /* FPSCR = w0 */
+#else
          "fmrx	%0, fpscr   \n\t" /* r0 = FPSCR */
          "and	%0, %0, %1  \n\t" /* r0 = r0 & 0x04086060 */
          "orr	%0, %0, %2  \n\t" /* r0 = r0 | 0x03000000 */
          "fmxr	fpscr, %0   \n\t" /* FPSCR = r0 */
+#endif
          : "=r"(r)
          : "r"(x), "r"(y)
         );
@@ -311,13 +318,13 @@ static void arm_enable_runfast_mode(void)
 #endif
 
 #if defined(__linux__) && !defined(CPU_X86)
-#if __ARM_ARCH
+#if defined(__ARM_ARCH) && (__ARM_ARCH > 0)
 #include <sys/auxv.h>
 #endif
 
 static unsigned char check_arm_cpu_feature(const char* feature)
 {
-#if __ARM_ARCH < 8
+#if defined(__ARM_ARCH) && (__ARM_ARCH < 8)
    uint64_t hwcap = getauxval(AT_HWCAP);
    if (!strcmp(feature, "neon"))
       return (hwcap & HWCAP_ARM_NEON) != 0;
@@ -326,7 +333,7 @@ static unsigned char check_arm_cpu_feature(const char* feature)
    if (!strcmp(feature, "vfpv4"))
       return (hwcap & HWCAP_ARM_VFPv4) != 0;
    return 0;
-#elif __ARM_ARCH == 8
+#elif defined(__ARM_ARCH) && (__ARM_ARCH == 8)
    uint64_t hwcap = getauxval(AT_HWCAP);
    if (!strcmp(feature, "asimd"))
       return (hwcap & HWCAP_ASIMD) != 0;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin