View | Details | Raw Unified | Return to bug 246982
Collapse All | Expand All

(-)www/chromium/files/patch-third__party_zlib_BUILD.gn (+20 lines)
Line 0 Link Here
1
--- third_party/zlib/BUILD.gn.orig	2020-05-18 20:40:28 UTC
2
+++ third_party/zlib/BUILD.gn
3
@@ -82,6 +82,8 @@ if (use_arm_neon_optimizations) {
4
       defines = [ "CRC32_ARMV8_CRC32" ]
5
       if (is_android) {
6
         defines += [ "ARMV8_OS_ANDROID" ]
7
+      } else if (is_bsd) {
8
+        defines += [ "ARMV8_OS_FREEBSD" ]
9
       } else if (is_linux || is_chromeos) {
10
         defines += [ "ARMV8_OS_LINUX" ]
11
       } else if (is_fuchsia) {
12
@@ -350,7 +352,7 @@ static_library("minizip") {
13
     ]
14
   }
15
 
16
-  if (is_mac || is_ios || is_android || is_nacl) {
17
+  if (is_mac || is_ios || is_android || is_nacl || is_bsd) {
18
     # Mac, Android and the BSDs don't have fopen64, ftello64, or fseeko64. We
19
     # use fopen, ftell, and fseek instead on these systems.
20
     defines = [ "USE_FILE32API" ]
(-)www/chromium/files/patch-third_party_zlib_cpu__features.c (+55 lines)
Line 0 Link Here
1
--- third_party/zlib/cpu_features.c.orig	2020-05-18 20:40:28 UTC
2
+++ third_party/zlib/cpu_features.c
3
@@ -24,11 +24,20 @@ int ZLIB_INTERNAL x86_cpu_enable_simd = 0;
4
 
5
 #ifndef CPU_NO_SIMD
6
 
7
-#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA)
8
+#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) || defined(ARMV8_OS_FREEBSD)
9
 #include <pthread.h>
10
 #endif
11
 
12
-#if defined(ARMV8_OS_ANDROID)
13
+#if defined(ARMV8_OS_FREEBSD)
14
+#include <machine/armreg.h>
15
+#include <sys/types.h>
16
+#ifndef ID_AA64ISAR0_AES_VAL
17
+#define ID_AA64ISAR0_AES_VAL ID_AA64ISAR0_AES
18
+#endif
19
+#ifndef ID_AA64ISAR0_CRC32_VAL
20
+#define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
21
+#endif
22
+#elif defined(ARMV8_OS_ANDROID)
23
 #include <cpu-features.h>
24
 #elif defined(ARMV8_OS_LINUX)
25
 #include <asm/hwcap.h>
26
@@ -49,7 +58,7 @@ int ZLIB_INTERNAL x86_cpu_enable_simd = 0;
27
 static void _cpu_check_features(void);
28
 #endif
29
 
30
-#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) || defined(X86_NOT_WINDOWS)
31
+#if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || defined(ARMV8_OS_FUCHSIA) || defined(X86_NOT_WINDOWS) || defined(ARMV8_OS_FREEBSD)
32
 static pthread_once_t cpu_check_inited_once = PTHREAD_ONCE_INIT;
33
 void ZLIB_INTERNAL cpu_check_features(void)
34
 {
35
@@ -108,6 +117,13 @@ static void _cpu_check_features(void)
36
 #elif defined(ARMV8_OS_WINDOWS)
37
     arm_cpu_enable_crc32 = IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
38
     arm_cpu_enable_pmull = IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
39
+#elif defined(ARMV8_OS_FREEBSD)
40
+    uint64_t id_aa64isar0;
41
+    id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
42
+    if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL)
43
+        arm_cpu_enable_pmull = 1;
44
+    if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE)
45
+        arm_cpu_enable_crc32 = 1;
46
 #endif
47
 }
48
 #endif
49
@@ -145,4 +161,4 @@ static void _cpu_check_features(void)
50
 }
51
 #endif
52
 #endif
53
-#endif
54
\ No newline at end of file
55
+#endif

Return to bug 246982