Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[settings] Disable fastmem on Linux systems with non-4kb page sizes (#3669)

crueter07e3a2aa46d1
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index c952567e63..4197c99663 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -27,6 +27,10 @@
#include "common/settings.h"
#include "common/time_zone.h"
+#if defined(__linux__ ) && defined(ARCHITECTURE_arm64)
+#include <unistd.h>
+#endif
+
namespace Settings {
// Clang 14 and earlier have errors when explicitly instantiating these classes
@@ -178,7 +182,11 @@ bool IsFastmemEnabled() {
return bool(values.cpuopt_fastmem);
else if (values.cpu_accuracy.GetValue() == CpuAccuracy::Unsafe)
return bool(values.cpuopt_unsafe_host_mmu);
-#if !defined(__APPLE__) && !defined(__linux__) && !defined(__ANDROID__) && !defined(_WIN32)
+#if defined(__linux__) && defined(ARCHITECTURE_arm64)
+ // Only 4kb systems support host MMU right now
+ // TODO: Support this
+ return getpagesize() == 4096;
+#elif !defined(__APPLE__) && !defined(__ANDROID__) && !defined(_WIN32) && !defined(__linux__)
return false;
#else
return true;